gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r33476 - in gnunet-gtk: contrib src/conversation


From: gnunet
Subject: [GNUnet-SVN] r33476 - in gnunet-gtk: contrib src/conversation
Date: Mon, 2 Jun 2014 20:06:26 +0200

Author: grothoff
Date: 2014-06-02 20:06:26 +0200 (Mon, 02 Jun 2014)
New Revision: 33476

Modified:
   gnunet-gtk/contrib/gnunet_conversation_gtk_main_window.glade
   gnunet-gtk/src/conversation/gnunet-conversation-gtk.c
   gnunet-gtk/src/conversation/gnunet-conversation-gtk_about.c
   gnunet-gtk/src/conversation/gnunet-conversation-gtk_contacts.c
   gnunet-gtk/src/conversation/gnunet-conversation-gtk_log.c
   gnunet-gtk/src/conversation/gnunet-conversation-gtk_phone.c
   gnunet-gtk/src/conversation/gnunet-conversation-gtk_zones.c
   gnunet-gtk/src/conversation/gnunet-conversation-gtk_zones.h
Log:
-misc minor fixes

Modified: gnunet-gtk/contrib/gnunet_conversation_gtk_main_window.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_conversation_gtk_main_window.glade        
2014-06-02 17:47:31 UTC (rev 33475)
+++ gnunet-gtk/contrib/gnunet_conversation_gtk_main_window.glade        
2014-06-02 18:06:26 UTC (rev 33476)
@@ -69,7 +69,7 @@
     <property name="default_width">700</property>
     <property name="default_height">500</property>
     <property name="icon_name">contact-new</property>
-    <signal name="delete-event" handler="GNUNET_GTK_conversation_quit_cb" 
swapped="no"/>
+    <signal name="delete-event" handler="gnunet_conversation_gtk_quit_cb" 
swapped="no"/>
     <child>
       <object class="GtkBox" id="gnunet_conversation_gtk_main_vbox">
         <property name="visible">True</property>
@@ -80,25 +80,25 @@
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <child>
-              <object class="GtkMenuItem" 
id="GNUNET_GTK_conversation_file_menuitem">
+              <object class="GtkMenuItem" 
id="gnunet_conversation_gtk_file_menuitem">
                 <property name="use_action_appearance">False</property>
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="label" translatable="yes">_File</property>
                 <property name="use_underline">True</property>
                 <child type="submenu">
-                  <object class="GtkMenu" 
id="GNUNET_GTK_conversation_file_menu">
+                  <object class="GtkMenu" 
id="gnunet_conversation_gtk_file_menu">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <child>
-                      <object class="GtkImageMenuItem" 
id="GNUNET_GTK_conversation_quit_imagemenuitem">
+                      <object class="GtkImageMenuItem" 
id="gnunet_conversation_conversation_quit_imagemenuitem">
                         <property name="label">gtk-quit</property>
                         <property name="use_action_appearance">False</property>
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="use_underline">True</property>
                         <property name="use_stock">True</property>
-                        <signal name="activate" 
handler="GNUNET_GTK_conversation_quit_cb" swapped="no"/>
+                        <signal name="activate" 
handler="gnunet_conversation_gtk_quit_cb" swapped="no"/>
                       </object>
                     </child>
                   </object>
@@ -162,25 +162,25 @@
               </object>
             </child>
             <child>
-              <object class="GtkMenuItem" 
id="GNUNET_GTK_conversation_help_menuitem">
+              <object class="GtkMenuItem" 
id="gnunet_conversation_gtk_help_menuitem">
                 <property name="use_action_appearance">False</property>
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="label" translatable="yes">_Help</property>
                 <property name="use_underline">True</property>
                 <child type="submenu">
-                  <object class="GtkMenu" 
id="GNUNET_GTK_conversation_help_menu">
+                  <object class="GtkMenu" 
id="gnunet_conversation_gtk_help_menu">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <child>
-                      <object class="GtkImageMenuItem" 
id="GNUNET_GTK_conversation_about_imagemenuitem">
+                      <object class="GtkImageMenuItem" 
id="gnunet_conversation_gtk_about_imagemenuitem">
                         <property name="label">gtk-about</property>
                         <property name="use_action_appearance">False</property>
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="use_underline">True</property>
                         <property name="use_stock">True</property>
-                        <signal name="activate" 
handler="GNUNET_GTK_conversation_about_imagemenuitem_activate_cb" swapped="no"/>
+                        <signal name="activate" 
handler="gnunet_conversation_gtk_about_imagemenuitem_activate_cb" swapped="no"/>
                       </object>
                     </child>
                   </object>
@@ -404,7 +404,7 @@
                                       </packing>
                                     </child>
                                     <child>
-                                      <object class="GtkButton" 
id="GNUNET_GTK_conversation_suspend_button">
+                                      <object class="GtkButton" 
id="gnunet_conversation_gtk_suspend_button">
                                         <property 
name="label">gtk-media-pause</property>
                                         <property 
name="use_action_appearance">False</property>
                                         <property 
name="sensitive">False</property>
@@ -412,7 +412,7 @@
                                         <property 
name="receives_default">True</property>
                                         <property 
name="use_stock">True</property>
                                         <property 
name="image_position">top</property>
-                                        <signal name="clicked" 
handler="GNUNET_CONVERSATION_GTK_on_pause_clicked" swapped="no"/>
+                                        <signal name="clicked" 
handler="gnunet_conversation_gtk_on_pause_clicked" swapped="no"/>
                                       </object>
                                       <packing>
                                         <property 
name="expand">False</property>
@@ -430,7 +430,7 @@
                                         <property 
name="receives_default">True</property>
                                         <property 
name="use_stock">True</property>
                                         <property 
name="image_position">top</property>
-                                        <signal name="clicked" 
handler="GNUNET_CONVERSATION_GTK_on_hangup_clicked" swapped="no"/>
+                                        <signal name="clicked" 
handler="gnunet_conversation_gtk_on_hangup_clicked" swapped="no"/>
                                       </object>
                                       <packing>
                                         <property 
name="expand">False</property>
@@ -465,7 +465,9 @@
                                             <property 
name="enable_search">False</property>
                                             <property 
name="search_column">0</property>
                                             <child internal-child="selection">
-                                              <object class="GtkTreeSelection" 
id="gnunet_conversation_gtk_active_calls_treeview_selection"/>
+                                              <object class="GtkTreeSelection" 
id="gnunet_conversation_gtk_active_calls_treeview_selection">
+                                                <signal name="changed" 
handler="gnunet_conversation_gtk_active_calls_treeview_selection_changed_cb" 
swapped="no"/>
+                                              </object>
                                             </child>
                                             <child>
                                               <object 
class="GtkTreeViewColumn" id="caller_numColumn">
@@ -536,7 +538,7 @@
                                         <property name="spacing">5</property>
                                         <property 
name="layout_style">start</property>
                                         <child>
-                                          <object class="GtkImage" 
id="GNUNET_GTK_status_icon">
+                                          <object class="GtkImage" 
id="gnunet_conversation_gtk_status_icon">
                                             <property 
name="width_request">75</property>
                                             <property 
name="height_request">75</property>
                                             <property 
name="visible">True</property>
@@ -560,7 +562,7 @@
                                             <property 
name="can_focus">True</property>
                                             <property 
name="receives_default">True</property>
                                             <property 
name="xalign">0.4699999988079071</property>
-                                            <signal name="clicked" 
handler="GNUNET_CONVERSATION_GTK_use_current_button_clicked" swapped="no"/>
+                                            <signal name="clicked" 
handler="gnunet_conversation_gtk_use_current_button_clicked" swapped="no"/>
                                           </object>
                                           <packing>
                                             <property 
name="expand">False</property>
@@ -594,7 +596,7 @@
                                             <property 
name="sensitive">False</property>
                                             <property 
name="can_focus">True</property>
                                             <property 
name="receives_default">True</property>
-                                            <signal name="clicked" 
handler="GNUNET_CONVERSATION_GTK_on_resume_clicked" swapped="no"/>
+                                            <signal name="clicked" 
handler="gnunet_conversation_gtk_on_resume_clicked" swapped="no"/>
                                           </object>
                                           <packing>
                                             <property 
name="expand">False</property>
@@ -913,12 +915,12 @@
                             <property name="can_focus">False</property>
                             <property name="left_padding">12</property>
                             <child>
-                              <object class="GtkScrolledWindow" 
id="GNUNET_GTK_conversation_log_scroll">
+                              <object class="GtkScrolledWindow" 
id="gnunet_conversation_gtk_log_scroll">
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="shadow_type">in</property>
                                 <child>
-                                  <object class="GtkTextView" 
id="GNUNET_GTK_conversation_log">
+                                  <object class="GtkTextView" 
id="gnunet_conversation_gtk_log">
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="editable">False</property>
@@ -959,7 +961,7 @@
           </packing>
         </child>
         <child>
-          <object class="GtkStatusbar" id="GNUNET_GTK_conversation_statusbar">
+          <object class="GtkStatusbar" id="gnunet_conversation_gtk_statusbar">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="orientation">vertical</property>

Modified: gnunet-gtk/src/conversation/gnunet-conversation-gtk.c
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk.c       2014-06-02 
17:47:31 UTC (rev 33475)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk.c       2014-06-02 
18:06:26 UTC (rev 33476)
@@ -92,7 +92,7 @@
   GtkImage *status_icon;
 
   status_icon = GTK_IMAGE (GCG_get_main_window_object
-                           ("GNUNET_GTK_status_icon"));
+                           ("gnunet_conversation_gtk_status_icon"));
   gtk_image_set_from_icon_name (status_icon,
                                 icon_name,
                                 GTK_ICON_SIZE_BUTTON);
@@ -123,11 +123,11 @@
 shutdown_task (void *cls,
                const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
+  GCG_EGOS_shutdown ();
+  GCG_ZONES_shutdown ();
   GCG_PHONE_shutdown ();
   GCG_CONTACTS_shutdown ();
   GCG_IMPORT_shutdown ();
-  GCG_EGOS_shutdown ();
-  GCG_ZONES_shutdown ();
   GNUNET_GTK_tray_icon_destroy ();
   GNUNET_GTK_main_loop_quit (ml);
   ml = NULL;
@@ -141,7 +141,7 @@
  * @param user_data unused
  */
 void
-GNUNET_GTK_conversation_quit_cb (GObject *object,
+gnunet_conversation_gtk_quit_cb (GObject *object,
                                  gpointer user_data)
 {
   GNUNET_SCHEDULER_shutdown ();

Modified: gnunet-gtk/src/conversation/gnunet-conversation-gtk_about.c
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk_about.c 2014-06-02 
17:47:31 UTC (rev 33475)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk_about.c 2014-06-02 
18:06:26 UTC (rev 33476)
@@ -31,7 +31,7 @@
  * This displays an about window
  */
 void
-GNUNET_GTK_conversation_about_imagemenuitem_activate_cb (GtkWidget * dummy,
+gnunet_conversation_gtk_about_imagemenuitem_activate_cb (GtkWidget * dummy,
                                                          gpointer data)
 {
   GNUNET_GTK_display_about ("gnunet_conversation_gtk_about_window.glade");

Modified: gnunet-gtk/src/conversation/gnunet-conversation-gtk_contacts.c
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk_contacts.c      
2014-06-02 17:47:31 UTC (rev 33475)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk_contacts.c      
2014-06-02 18:06:26 UTC (rev 33476)
@@ -28,8 +28,8 @@
  */
 #include "gnunet-conversation-gtk.h"
 #include "gnunet-conversation-gtk_contacts.h"
-#include "gnunet-conversation-gtk_egos.h"
 #include "gnunet-conversation-gtk_phone.h"
+#include "gnunet-conversation-gtk_zones.h"
 
 
 /**
@@ -252,15 +252,20 @@
   struct GNUNET_IDENTITY_Ego *ego;
   const struct GNUNET_CRYPTO_EcdsaPrivateKey *temp_zone_pkey;
 
-  ego = GCG_EGOS_get_selected_ego ();
-  temp_zone_pkey = GNUNET_IDENTITY_ego_get_private_key (ego);
   if (NULL != zone_mon)
   {
     GNUNET_NAMESTORE_zone_monitor_stop (zone_mon);
     zone_mon = NULL;
   }
   gtk_list_store_clear (contacts_liststore);
+  ego = GCG_ZONES_get_selected_zone ();
+  if (NULL == ego)
+  {
+    /* ego deselected (likely shutdown) */
+    return;
+  }
   gtk_widget_hide (contacts_treeview);
+  temp_zone_pkey = GNUNET_IDENTITY_ego_get_private_key (ego);
   zone_mon = GNUNET_NAMESTORE_zone_monitor_start (GCG_get_configuration (),
                                                   temp_zone_pkey,
                                                   GNUNET_YES,

Modified: gnunet-gtk/src/conversation/gnunet-conversation-gtk_log.c
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk_log.c   2014-06-02 
17:47:31 UTC (rev 33475)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk_log.c   2014-06-02 
18:06:26 UTC (rev 33476)
@@ -46,7 +46,7 @@
   va_list ap;
 
   log_view = GTK_TEXT_VIEW (GCG_get_main_window_object
-                            ("GNUNET_GTK_conversation_log"));
+                            ("gnunet_conversation_gtk_log"));
   logbuff = GTK_TEXT_BUFFER (gtk_text_view_get_buffer (log_view));
   va_start (ap, message);
   fmsg = g_strdup_vprintf (message,
@@ -78,7 +78,7 @@
   va_list ap;
 
   status_bar = GTK_STATUSBAR (GCG_get_main_window_object
-                              ("GNUNET_GTK_conversation_statusbar"));
+                              ("gnunet_conversation_gtk_statusbar"));
   status_bar_context = gtk_statusbar_get_context_id (status_bar,
                                                      "blaat"); // blaat!?
   va_start (ap, message);

Modified: gnunet-gtk/src/conversation/gnunet-conversation-gtk_phone.c
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk_phone.c 2014-06-02 
17:47:31 UTC (rev 33475)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk_phone.c 2014-06-02 
18:06:26 UTC (rev 33476)
@@ -417,7 +417,8 @@
     ic->caller = NULL;
   }
   GNUNET_free (ic->caller_id);
-  gtk_tree_row_reference_free (ic->rr);
+  if (NULL != ic->rr)
+    gtk_tree_row_reference_free (ic->rr);
   GNUNET_free (ic);
 }
 
@@ -436,7 +437,8 @@
     oc->call = NULL;
   }
   GNUNET_free (oc->caller_id);
-  gtk_tree_row_reference_free (oc->rr);
+  if (NULL != oc->rr)
+    gtk_tree_row_reference_free (oc->rr);
   GNUNET_free (oc);
 }
 
@@ -566,6 +568,8 @@
   sens = (NULL == active_in) && (NULL == active_out);
   if (0 == strlen (gtk_entry_get_text (address_entry)))
     sens = FALSE;
+  if (NULL == phone)
+    sens = FALSE;
   gtk_widget_set_sensitive (b_call, sens);
 }
 
@@ -1102,11 +1106,11 @@
  * @param user_data builder (unused)
  */
 void
-GNUNET_CONVERSATION_GTK_use_current_button_clicked (GtkButton *button,
+gnunet_conversation_gtk_use_current_button_clicked (GtkButton *button,
                                                     gpointer *user_data)
 {
-  // FIXME: implement, use "GSC_add_contact"
-  // FIXME: need to determine desired label for the contact!
+  GNUNET_break (0); // FIXME: implement!
+  // need to determine desired label for the contact!
   // => prompt user!?
 #if 0
   const gchar *target;
@@ -1124,7 +1128,7 @@
  * @param user_data builder (unused)
  */
 void
-GNUNET_CONVERSATION_GTK_on_resume_clicked (GtkButton *button,
+gnunet_conversation_gtk_on_resume_clicked (GtkButton *button,
                                            gpointer user_data)
 {
   struct IncomingCall *ic;
@@ -1193,7 +1197,7 @@
  * @param user_data builder (unused)
  */
 void
-GNUNET_CONVERSATION_GTK_on_pause_clicked (GtkButton *button,
+gnunet_conversation_gtk_on_pause_clicked (GtkButton *button,
                                           gpointer user_data)
 {
   enum OutCallState os;
@@ -1301,7 +1305,7 @@
  * @param user_data builder (unused)
  */
 void
-GNUNET_CONVERSATION_GTK_on_hangup_clicked (GtkButton *button,
+gnunet_conversation_gtk_on_hangup_clicked (GtkButton *button,
                                            gpointer user_data)
 {
   if ( (NULL == active_in) &&
@@ -1561,6 +1565,15 @@
                                     arg,
                                     speaker, mic,
                                     &call_event_handler, oc);
+  if (NULL == oc->call)
+  {
+    GCG_HISTORY_add (GCG_HISTORY_TYPE_FAILED,
+                     oc->caller_id,
+                     oc->caller_num);
+    destroy_out (oc);
+    return;
+  }
+  active_out = oc;
   gtk_list_store_insert_with_values (active_liststore,
                                      &iter,
                                      -1,
@@ -1607,6 +1620,25 @@
 
 
 /**
+ * Update sensitivity of the "copy" button.
+ */
+static void
+update_copy_sensitivity ()
+{
+  const gchar *label;
+
+  label = gtk_entry_get_text (GTK_ENTRY
+                              (GCG_get_main_window_object
+                               ("gnunet_conversation_gtk_ego_label_entry")));
+  if ( (NULL == label) ||
+       (0 == strlen (label)) )
+    gtk_widget_set_sensitive (b_copy, FALSE);
+  else
+    gtk_widget_set_sensitive (b_copy, TRUE);
+}
+
+
+/**
  * Our phone record has changed, update the information
  * published in the GNU Name System.
  */
@@ -1622,11 +1654,9 @@
   if ( (NULL == label) ||
        (0 == strlen (label)) )
   {
-    gtk_widget_set_sensitive (b_copy, FALSE);
     GSC_remove_phone ();
     return;
   }
-  gtk_widget_set_sensitive (b_copy, TRUE);
   GNUNET_CONVERSATION_phone_get_record (phone,
                                         &rd);
   GSC_add_phone (label, &rd);
@@ -1663,6 +1693,7 @@
                              -1,
                              NULL,
                              preedit);
+  update_copy_sensitivity ();
   update_phone_record ();
 }
 
@@ -1678,6 +1709,7 @@
 gnunet_conversation_gtk_ego_label_comboboxtext_changed_cb (GtkComboBox *widget,
                                                            gpointer user_data)
 {
+  update_copy_sensitivity ();
   update_phone_record ();
 }
 
@@ -1719,6 +1751,7 @@
     return;
   }
   update_phone_record ();
+  update_copy_sensitivity ();
   check_call_sensitivity ();
   do_status ();
 }
@@ -1735,7 +1768,6 @@
   cfg = GCG_get_configuration ();
   speaker = GNUNET_SPEAKER_create_from_hardware (cfg);
   mic = GNUNET_MICROPHONE_create_from_hardware (cfg);
-
   b_add_contact = GTK_WIDGET (GCG_get_main_window_object
                               ("gnunet_conversation_gtk_add_contact_button"));
   b_accept  = GTK_WIDGET (GCG_get_main_window_object

Modified: gnunet-gtk/src/conversation/gnunet-conversation-gtk_zones.c
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk_zones.c 2014-06-02 
17:47:31 UTC (rev 33475)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk_zones.c 2014-06-02 
18:06:26 UTC (rev 33476)
@@ -64,6 +64,31 @@
 
 
 /**
+ * Obtain the currently selected zone.
+ *
+ * @return NULL if no ego is selected
+ */
+struct GNUNET_IDENTITY_Ego *
+GCG_ZONES_get_selected_zone ()
+{
+  struct GNUNET_IDENTITY_Ego *ego;
+  GtkTreeIter iter;
+  GtkComboBox *cb;
+
+  cb = GTK_COMBO_BOX (GCG_get_main_window_object
+                      ("gnunet_conversation_gtk_contacts_zone_combobox"));
+  if (! gtk_combo_box_get_active_iter (cb,
+                                       &iter))
+    return NULL;
+  gtk_tree_model_get (GTK_TREE_MODEL (zone_liststore),
+                      &iter,
+                      ZONE_LS_EGO, &ego,
+                      -1);
+  return ego;
+}
+
+
+/**
  * Function called by identity service with information about zones.
  *
  * @param cls NULL

Modified: gnunet-gtk/src/conversation/gnunet-conversation-gtk_zones.h
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk_zones.h 2014-06-02 
17:47:31 UTC (rev 33475)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk_zones.h 2014-06-02 
18:06:26 UTC (rev 33476)
@@ -31,6 +31,15 @@
 
 
 /**
+ * Obtain the currently selected zone.
+ *
+ * @return NULL if no ego is selected
+ */
+struct GNUNET_IDENTITY_Ego *
+GCG_ZONES_get_selected_zone (void);
+
+
+/**
  * Initialize the contact list
  *
  * @param ego_name default ego to pre-select




reply via email to

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