gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r33472 - gnunet-gtk/src/conversation
Date: Mon, 2 Jun 2014 19:31:06 +0200

Author: grothoff
Date: 2014-06-02 19:31:06 +0200 (Mon, 02 Jun 2014)
New Revision: 33472

Modified:
   gnunet-gtk/src/conversation/gnunet-conversation-gtk.c
   gnunet-gtk/src/conversation/gnunet-conversation-gtk_zones.c
Log:
-initialize zones

Modified: gnunet-gtk/src/conversation/gnunet-conversation-gtk.c
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk.c       2014-06-02 
16:38:46 UTC (rev 33471)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk.c       2014-06-02 
17:31:06 UTC (rev 33472)
@@ -127,6 +127,7 @@
   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;
@@ -196,6 +197,7 @@
   if (NULL == ego_name)
     ego_name = GNUNET_strdup ("phone-ego");
   GCG_HISTORY_init ();
+  GCG_ZONES_init (ego_name);
   GCG_EGOS_init (ego_name);
   GCG_IMPORT_init ();
   GCG_CONTACTS_init ();

Modified: gnunet-gtk/src/conversation/gnunet-conversation-gtk_zones.c
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk_zones.c 2014-06-02 
16:38:46 UTC (rev 33471)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk_zones.c 2014-06-02 
17:31:06 UTC (rev 33472)
@@ -57,7 +57,12 @@
  */
 static GtkListStore *zone_liststore;
 
+/**
+ * Ego to select by default.
+ */
+static char *default_ego;
 
+
 /**
  * Function called by identity service with information about zones.
  *
@@ -75,6 +80,7 @@
   GtkTreeIter iter;
   GtkTreeRowReference *rr;
   GtkTreePath *path;
+  GtkComboBox *cb;
 
   rr = *ctx;
   if (NULL == rr)
@@ -86,6 +92,18 @@
                                        ZONE_LS_NAME, name,
                                        ZONE_LS_EGO, ego,
                                        -1);
+    if ( (NULL != default_ego) &&
+         (0 == strcmp (name,
+                       default_ego)) )
+    {
+      /* found the ego that we were supposed to use by default, select
+         it! */
+      GNUNET_free (default_ego);
+      default_ego = NULL;
+      cb = GTK_COMBO_BOX (GCG_get_main_window_object
+                          ("gnunet_conversation_gtk_contacts_zone_combobox"));
+      gtk_combo_box_set_active_iter (cb, &iter);
+    }
     path = gtk_tree_model_get_path (GTK_TREE_MODEL (zone_liststore),
                                     &iter);
     rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (zone_liststore),
@@ -119,10 +137,13 @@
 
 /**
  * Initialize the zones list
+ *
+ * @param ego_name default ego to pre-select
  */
 void
-GCG_ZONES_init ()
+GCG_ZONES_init (const char *ego_name)
 {
+  default_ego = GNUNET_strdup (ego_name);
   zone_liststore
     =  GTK_LIST_STORE (GCG_get_main_window_object
                        ("gnunet_conversation_gtk_contacts_zone_liststore"));
@@ -143,6 +164,11 @@
     GNUNET_IDENTITY_disconnect (id);
     id = NULL;
   }
+  if (NULL != default_ego)
+  {
+    GNUNET_free (default_ego);
+    default_ego = NULL;
+  }
 }
 
 /* end of gnunet-conversation-gtk_zones.c */




reply via email to

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