gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r32004 - gnunet-gtk/src/conversation


From: gnunet
Subject: [GNUnet-SVN] r32004 - gnunet-gtk/src/conversation
Date: Wed, 22 Jan 2014 14:03:55 +0100

Author: hark
Date: 2014-01-22 14:03:55 +0100 (Wed, 22 Jan 2014)
New Revision: 32004

Modified:
   gnunet-gtk/src/conversation/gnunet-conversation-gtk.c
   gnunet-gtk/src/conversation/gnunet-conversation-gtk.h
Log:
fix some compiler warnings about gtk


Modified: gnunet-gtk/src/conversation/gnunet-conversation-gtk.c
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk.c       2014-01-22 
12:59:52 UTC (rev 32003)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk.c       2014-01-22 
13:03:55 UTC (rev 32004)
@@ -45,7 +45,7 @@
 
 #define UPDATE_STATUS(format, ...) update_status(g_strdup_printf (format, ## 
__VA_ARGS__))
 
-#define UPDATE_INFOBAR(format, ...) set_infobar_text(g_strdup_printf (format, 
## __VA_ARGS__))
+//#define UPDATE_INFOBAR(format, ...) set_infobar_text(g_strdup_printf 
(format, ## __VA_ARGS__))
 
 #define LOG(format, ...) log_message(g_strdup_printf (format, ## __VA_ARGS__))
 
@@ -55,6 +55,7 @@
  * @param name name of the object
  * @return NULL on error
  */
+
 static GObject *
 get_object (const char *name)
 {
@@ -62,7 +63,8 @@
 }
 
 /*
- * log a message to gtk thing
+ * log a message to gtk log textbuffer
+ * @param Message to be logged
  */
 
 void
@@ -76,14 +78,10 @@
   GtkTextIter iter;
   gchar *fmsg;
 
-//    update_status(message);
-  //UPDATE_STATUS("status update testje: %s", message);
-  //FPRINTF(stderr,"now logging: %s",message);
+  log_view = GTK_TEXT_VIEW(get_object ("GNUNET_GTK_conversation_log"));
 
-  log_view = get_object ("GNUNET_GTK_conversation_log");
+  logbuff = GTK_TEXT_BUFFER(gtk_text_view_get_buffer (log_view));
 
-  logbuff = gtk_text_view_get_buffer (log_view);
-
   fmsg = g_strdup_printf (" %s \n", message);
 
   gtk_text_buffer_get_start_iter (logbuff, &iter);
@@ -94,12 +92,22 @@
 
 }
 
+/*
+ * does nothing
+ */
+
 void
 update_state ()
 {
 //    LOG('update_state called',NULL);
 }
 
+/*
+ * update status
+ *
+ * @param message Message to put in statusbar
+ */
+
 void
 update_status (const gchar * message)
 {
@@ -107,10 +115,9 @@
   GtkStatusbar *status_bar;
   guint status_bar_context;
 
-  //static int count = 1;
   gchar *buff;
 
-  status_bar = get_object ("GNUNET_GTK_conversation_statusbar");
+  status_bar = GTK_STATUSBAR(get_object ("GNUNET_GTK_conversation_statusbar"));
   status_bar_context = gtk_statusbar_get_context_id (status_bar, "blaat");
 
 
@@ -124,11 +131,11 @@
 }
 
 /*
-* adds a item to the call history 
-  types:
-  1: accepted
-  2: rejected 
-*/
+ * adds a item to the call history 
+ * 
+ * @param type type of call: 1: accepted 2: rejected
+ * @return void 
+ */
 
 void
 history_add (int type, char *contactName)
@@ -142,72 +149,95 @@
                       contactName, -1);
 }
 
+/*
+ * set button text
+ * @param button_name name of button
+ * @param label label on the button
+ */
+
 void
 set_button_text (const char *button_name, const char *label)
 {
   //GtkButton *button;
   GtkWidget *button;
 
-  button = get_object (button_name);
+  button = GTK_WIDGET(get_object (button_name));
   gtk_widget_hide (button);
 }
 
-void
-set_infobar_text (const gchar * text)
-{
-  GtkLabel *infolabel;
+/*
+ * set infobar text
+ */
+//
+//void
+//set_infobar_text (const gchar * text)
+//{
+//  GtkLabel *infolabel;
+//
+//  infolabel = GTK_LABEL(get_object ("GNUNET_GTK_new_call_label"));
+//  log_message ("setting infobar text");
+//  gtk_label_set_text (infolabel, text);
+//}
+//
+/*
+ * disable button
+ */
 
-  infolabel = get_object ("GNUNET_GTK_new_call_label");
-  log_message ("setting infobar text");
-  gtk_label_set_text (infolabel, text);
-}
-
-
-
 void
 disable_button (const char *button_name)
 {
   //GtkButton *button;
   GtkWidget *button;
 
-  button = get_object (button_name);
+  button = GTK_WIDGET(get_object (button_name));
   gtk_widget_hide (button);
 }
 
+/*
+ * enable button
+ */
+
 void
 enable_button (const char *button_name)
 {
   //GtkButton *button;
   GtkWidget *button;
 
-  button = get_object (button_name);
+  button = GTK_WIDGET(get_object (button_name));
   gtk_widget_show (button);
 }
 
-void
-show_infobar ()
-{
-//   GtkInfoBar *infobar;
-  GtkWidget *infobar;
+/*
+ * show infobar
+ */
+//
+//void
+//show_infobar ()
+//{
+//  GtkWidget *infobar;
+//
+//  infobar = GTK_WIDGET(get_object ("GNUNET_GTK_conversation_infobar"));
+//
+//  gtk_widget_show (infobar);
+//}
+//
+/*
+ * hide infobar
+ */
+//
+//void
+//hide_infobar ()
+//{
+//  //GtkInfoBar *infobar;
+//  GtkWidget *infobar;
+//
+//  infobar = GTK_WIDGET(get_object ("GNUNET_GTK_conversation_infobar"));
+//
+//  gtk_widget_hide (infobar);
+//}
+//
 
-  infobar = get_object ("GNUNET_GTK_conversation_infobar");
 
-  gtk_widget_show (infobar);
-}
-
-void
-hide_infobar ()
-{
-  //GtkInfoBar *infobar;
-  GtkWidget *infobar;
-
-  infobar = get_object ("GNUNET_GTK_conversation_infobar");
-
-  gtk_widget_hide (infobar);
-}
-
-
-
 /**
  * Function called with an event emitted by a phone.
  *
@@ -231,10 +261,10 @@
          caller_num_gen);
 
 
-    UPDATE_INFOBAR (_("Incoming call from `%s' on line %u\n"), caller_id,
-                    caller_num_gen);
+    //UPDATE_INFOBAR (_("Incoming call from `%s' on line %u\n"), caller_id,
+    //                caller_num_gen);
 
-    show_infobar ();
+    //show_infobar ();
     // TODO: make sound
 
     cl = GNUNET_new (struct CallList);
@@ -268,7 +298,7 @@
       phone_state = PS_LISTEN;
     }
     GNUNET_free (cl);
-    gtk_widget_destroy (dialog);
+    gtk_widget_destroy (GTK_WIDGET(dialog));
     break;
 
   }
@@ -381,6 +411,8 @@
     GNUNET_break (CS_CONNECTED == call_state);
     LOG (_("Connection to `%s' resumed (by other user)\n"), peer_name);
     break;
+  case GNUNET_CONVERSATION_EC_CALL_ERROR:
+    LOG ("GNUNET_CONVERSATION_EC_CALL_ERROR %s", peer_name);
   }
 }
 
@@ -844,8 +876,9 @@
 static void
 add_continuation (void *cls, int32_t success, const char *emsg)
 {
-  struct GNUNET_NAMESTORE_QueueEntry **qe = cls;
 
+    struct GNUNET_NAMESTORE_QueueEntry **qe = cls;
+
   *qe = NULL;
   if (GNUNET_YES != success)
   {
@@ -871,8 +904,8 @@
              const char *name)
 {
 
-  FPRINTF (stderr, _("identity_cb name: `%s'  caller_id: `%s' \n"), name,
-           caller_id);
+//  FPRINTF (stderr, _("identity_cb name: `%s'  caller_id: `%s' \n"), name,
+//           caller_id);
 
   if (NULL == name)
     return;
@@ -930,7 +963,9 @@
 static void
 shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
-  struct OperationContext *oc;
+ 
+//TODO: make this work
+    //struct OperationContext *oc;
 
 /*
   GIG_advertise_shutdown_ ();
@@ -1001,7 +1036,7 @@
 
 
   GNUNET_CRYPTO_ecdsa_key_clear (&zone_pkey);
-  return 0;
+  //return 0;
 
 }
 
@@ -1016,8 +1051,8 @@
 static void
 run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
-  GtkTreeIter iter;
-  GtkWidget *main_window;
+  //GtkTreeIter iter;
+  GtkWindow *main_window;
 
   //line = 0;
 
@@ -1029,7 +1064,7 @@
   /* setup main window */
   main_window = GTK_WIDGET (get_object ("GNUNET_GTK_conversation_window"));
   main_window =
-      GNUNET_GTK_plug_me ("GNUNET_CONVERSATION_GTK_PLUG", main_window);
+      GNUNET_GTK_plug_me ("GNUNET_CONVERSATION_GTK_PLUG", 
GTK_WIDGET(main_window));
   gtk_window_set_default_size (main_window, 300, 700);
   contacts_liststore =
       GTK_LIST_STORE (get_object
@@ -1063,7 +1098,7 @@
   /* make GUI visible */
   if (!tray_only)
   {
-    gtk_widget_show (main_window);
+    gtk_widget_show (GTK_WIDGET(main_window));
     gtk_window_present (GTK_WINDOW (main_window));
   }
 
@@ -1133,9 +1168,68 @@
 
 /* gui stuff start */
 
+/* 
+ * Function to open a dialog box displaying the message provided. 
+ *
+ * @param message message in the dialogbox
+ * @param caller_id
+ */
 
+void
+quick_message (gchar * message, const char *caller_id)
+{
+    GtkWidget *caller_name, *notification, *content_area;
+    GtkDialog *dialog;
+    GtkWindow *main_window;
+    main_window = GTK_WINDOW(get_object("GNUNET_GTK_conversation_window"));
+    // Create the widgets 
 
+    
+    dialog = gtk_dialog_new_with_buttons ("Incoming call!",
+                                         main_window,
+                                         GTK_DIALOG_DESTROY_WITH_PARENT,
+                                         _("Accept call"),
+                                         GTK_RESPONSE_ACCEPT,
+                                         _("Reject call"),
+                                         GTK_RESPONSE_REJECT,
+                                        _("Decide later"),
+                                         GTK_RESPONSE_CANCEL,
 
+                                         NULL);
+    content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+
+    
+    notification = gtk_label_new ("Incoming call from:");
+    caller_name = gtk_label_new (caller_id);
+     
+    // Add the labels, and show everything we've added to the dialog 
+    gtk_container_add (GTK_CONTAINER (content_area), notification);
+    gtk_container_add (GTK_CONTAINER (content_area), caller_name);
+    gtk_widget_show_all (GTK_WIDGET(dialog));
+
+    switch(gtk_dialog_run(dialog)){
+       case GTK_RESPONSE_ACCEPT :
+                do_status("");
+               gtk_widget_destroy(GTK_WIDGET(dialog));
+               do_accept("0");       
+               break;
+       case GTK_RESPONSE_REJECT :
+                do_reject(NULL);
+               do_status(""); 
+                gtk_widget_destroy(GTK_WIDGET(dialog));
+               break;
+       case GTK_RESPONSE_CANCEL :
+                do_status("");
+                gtk_widget_destroy(GTK_WIDGET(dialog));
+                break;
+        }       
+
+
+}
+
+
+
+
 /**
  * call clicked
  */
@@ -1143,14 +1237,9 @@
 GNUNET_CONVERSATION_GTK_on_call_clicked ()
 {
   char *to_addr;
-
-  // /og_message ("call clicked");
-  //update_status();
-  //address dingetje
-
   GtkEntry *address_entry;
 
-  address_entry = GTK_ENTRY ((get_object ("GNUNET_GTK_conversation_address")));
+  address_entry = GTK_ENTRY (get_object ("GNUNET_GTK_conversation_address"));
   to_addr = gtk_entry_get_text (address_entry);
 
 //    FPRINTF (stderr, _("calling: %s \n"), to_addr ); 
@@ -1184,7 +1273,7 @@
 {
   FPRINTF (stderr, "accept clicked \n");
   do_accept (0);
-  hide_infobar ();
+ // hide_infobar ();
 }
 
 
@@ -1205,13 +1294,13 @@
 GNUNET_CONVERSATION_GTK_on_pause_clicked ()
 {
 //    GtkEntry *entry; 
-
+do_suspend("0");
   //FPRINTF (stderr, "pause clicked \n");
   //do_pause("");
   //  entry = GTK_ENTRY((get_object ("GNUNET_GTK_conversation_address")));
   //FPRINTF (stderr, gtk_entry_get_text (entry));
 //    gtk_entry_set_text (entry, "testtextje");
-  show_infobar ();
+//  show_infobar ();
 }
 
 /**
@@ -1238,6 +1327,13 @@
   //quick_message('hee blaaat you have a call from blaat');
 }
 
+/*
+void
+GNUNET_contact_test ()
+{
+FPRINTF (stderr, "gnunet contact test"
+}
+*/
 
 void
 use_current_incoming_address ()
@@ -1292,11 +1388,15 @@
 GNUNET_CONVERSATION_GTK_on_add_clicked (GtkButton * button,
                                         gpointer * user_data)
 {
-  gint response_id;
+//  gint response_id;
 
   FPRINTF (stderr, "add clicked \n");
-  GtkWidget *caller_name, *notification, *content_area, *currentCheckButton,
-      *nameEntry, *addressEntry, *anotherArea, *labelName, *labelAddres;
+  //unused:  *anotherArea, *labelName, *labelAddres *caller_name
+
+  GtkLabel *notification; 
+  GtkHBox *content_area;
+  GtkButton  *currentCheckButton;
+  GtkEntry *nameEntry, *addressEntry;
   GtkDialog *dialog;
   GtkWindow *main_window;
 
@@ -1315,14 +1415,14 @@
                                    GTK_DIALOG_DESTROY_WITH_PARENT,
                                    _("Add contact"), GTK_RESPONSE_ACCEPT,
                                    _("Cancel"), GTK_RESPONSE_CANCEL, NULL);
-  gtk_dialog_add_action_widget (dialog, currentCheckButton, GTK_RESPONSE_OK);
-  FPRINTF (stderr, "response id : %u", response_id);
+  gtk_dialog_add_action_widget (dialog, GTK_WIDGET(currentCheckButton), 
GTK_RESPONSE_OK);
+//  FPRINTF (stderr, "response id : %u", response_id);
   g_signal_connect (GTK_BUTTON (currentCheckButton), "clicked",
                     G_CALLBACK (use_current_incoming_address), NULL);
 
 
-  gtk_dialog_add_action_widget (dialog, nameEntry, 2);
-  gtk_dialog_add_action_widget (dialog, addressEntry, 3);
+  gtk_dialog_add_action_widget (dialog, GTK_WIDGET(nameEntry), 2);
+  gtk_dialog_add_action_widget (dialog, GTK_WIDGET(addressEntry), 3);
 
   content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
 
@@ -1331,9 +1431,9 @@
 //    caller_name = gtk_label_new (caller_id);
 
   // Add the labels, and show everything we've added to the dialog 
-  gtk_container_add (GTK_CONTAINER (content_area), notification);
+  gtk_container_add (GTK_CONTAINER (content_area), GTK_WIDGET(notification));
 //    gtk_container_add (GTK_CONTAINER (content_area), caller_name);
-  gtk_widget_show_all (dialog);
+  gtk_widget_show_all (GTK_WIDGET(dialog));
 
   switch (gtk_dialog_run (dialog))
   {
@@ -1342,19 +1442,19 @@
     do_status ("");
     add_contact (gtk_entry_get_text (nameEntry),
                  gtk_entry_get_text (addressEntry));
-    gtk_widget_destroy (dialog);
+    gtk_widget_destroy (GTK_WIDGET(dialog));
     break;
   case GTK_RESPONSE_CANCEL:
     FPRINTF (stderr, "cancel clicked");
     do_status ("");
-    gtk_widget_destroy (dialog);
+    gtk_widget_destroy (GTK_WIDGET(dialog));
     break;
   case GTK_RESPONSE_OK:
     //use_current_incoming_address();
-    gtk_entry_set_text (addressEntry, callerName);
+    gtk_entry_set_text (GTK_ENTRY(addressEntry), callerName);
     add_contact (gtk_entry_get_text (nameEntry), callerName);
 //              
add_contact(gtk_entry_get_text(nameEntry),memmove(&callerName,&callerName+52,1));
-    gtk_widget_destroy (dialog);
+    gtk_widget_destroy (GTK_WIDGET(dialog));
 
 //              memmove(&address+1,&address+51,1);
     break;
@@ -1372,65 +1472,6 @@
 }
 
 
-/* 
- * Function to open a dialog box displaying the message provided. 
- *
- * @param message message in the dialogbox
- * @param caller_id
- */
-
-void
-quick_message (gchar * message, const char *caller_id)
-{
-    GtkWidget *caller_name, *notification, *content_area;
-    GtkDialog *dialog;
-    GtkWindow *main_window;
-    main_window = get_object("GNUNET_GTK_conversation_window");
-    // Create the widgets 
-
-    
-    dialog = gtk_dialog_new_with_buttons ("Incoming call!",
-                                         main_window,
-                                         GTK_DIALOG_DESTROY_WITH_PARENT,
-                                         _("Accept call"),
-                                         GTK_RESPONSE_ACCEPT,
-                                         _("Reject call"),
-                                         GTK_RESPONSE_REJECT,
-                                        _("Decide later"),
-                                         GTK_RESPONSE_CANCEL,
-
-                                         NULL);
-    content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
-
-    
-    notification = gtk_label_new ("Incoming call from:");
-    caller_name = gtk_label_new (caller_id);
-     
-    // Add the labels, and show everything we've added to the dialog 
-    gtk_container_add (GTK_CONTAINER (content_area), notification);
-    gtk_container_add (GTK_CONTAINER (content_area), caller_name);
-    gtk_widget_show_all (dialog);
-
-    switch(gtk_dialog_run(dialog)){
-       case GTK_RESPONSE_ACCEPT :
-                do_status("");
-               gtk_widget_destroy(dialog);
-               do_accept("0");       
-               break;
-       case GTK_RESPONSE_REJECT :
-                do_reject(NULL);
-               do_status(""); 
-                gtk_widget_destroy(dialog);
-               break;
-       case GTK_RESPONSE_CANCEL :
-                do_status("");
-                gtk_widget_destroy(dialog);
-                break;
-        }       
-
-
-}
-
 /*
  * row activated
  * @return void
@@ -1439,8 +1480,8 @@
 void
 GNUNET_CONVERSATION_GTK_row_activated ()
 {
-  char *callAddress;
-  char *type;
+  gchar *callAddress;
+  gchar *type;
 
   FPRINTF (stderr, "row activated \n");
 

Modified: gnunet-gtk/src/conversation/gnunet-conversation-gtk.h
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk.h       2014-01-22 
12:59:52 UTC (rev 32003)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk.h       2014-01-22 
13:03:55 UTC (rev 32004)
@@ -63,12 +63,12 @@
 /**
  * Head of operations.
  */
-static struct OperationContext *oc_head;
+//static struct OperationContext *oc_head;
 
 /**
  * Tail of operations.
  */
-static struct OperationContext *oc_tail;
+//static struct OperationContext *oc_tail;
 
 /**
  * Possible states of the phone.
@@ -188,7 +188,7 @@
  * Desired phone line.
  */
 static unsigned int line;
-static unsigned int line1;
+//static unsigned int line1;
 
 /**
  * Our speaker.
@@ -204,8 +204,8 @@
  * Our configurations.
  */
 static struct GNUNET_CONFIGURATION_Handle *cfg;
-static struct GNUNET_CONFIGURATION_Handle *cfg1;
-static struct GNUNET_CONFIGURATION_Handle *cfg2;
+//static struct GNUNET_CONFIGURATION_Handle *cfg1;
+//static struct GNUNET_CONFIGURATION_Handle *cfg2;
 
 
 /**




reply via email to

[Prev in Thread] Current Thread [Next in Thread]