gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r32217 - in gnunet-gtk: contrib src/conversation
Date: Tue, 4 Feb 2014 18:22:05 +0100

Author: yids
Date: 2014-02-04 18:22:05 +0100 (Tue, 04 Feb 2014)
New Revision: 32217

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.h
Log:
- various fixes
- some work on contacts zone selection (no working yet)



Modified: gnunet-gtk/contrib/gnunet_conversation_gtk_main_window.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_conversation_gtk_main_window.glade        
2014-02-04 16:35:19 UTC (rev 32216)
+++ gnunet-gtk/contrib/gnunet_conversation_gtk_main_window.glade        
2014-02-04 17:22:05 UTC (rev 32217)
@@ -588,6 +588,7 @@
                             <property name="can_focus">False</property>
                             <property 
name="model">gnunet_conversation_gtk_contacts_zone_liststore</property>
                             <property 
name="tearoff_title">Phonebook:</property>
+                            <signal name="changed" 
handler="gnunet_conversation_gtk_zone_combobox_changed_cb" swapped="no"/>
                             <child>
                               <object class="GtkCellRendererText" 
id="gnunet_conversation_gtk_contacts_zone_ego_name_cellrenderertext"/>
                               <attributes>
@@ -605,21 +606,6 @@
                         <child>
                           <placeholder/>
                         </child>
-                        <child>
-                          <placeholder/>
-                        </child>
-                        <child>
-                          <placeholder/>
-                        </child>
-                        <child>
-                          <placeholder/>
-                        </child>
-                        <child>
-                          <placeholder/>
-                        </child>
-                        <child>
-                          <placeholder/>
-                        </child>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -769,6 +755,20 @@
             <property name="position">1</property>
           </packing>
         </child>
+        <child>
+          <object class="GtkStatusbar" id="GNUNET_GTK_conversation_statusbar">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">8</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
       </object>
     </child>
   </object>
@@ -833,36 +833,10 @@
       </row>
     </data>
   </object>
-  <object class="GtkWindow" id="window1">
-    <property name="can_focus">False</property>
-    <child>
-      <object class="GtkVBox" id="GNUNET_GTK_conversationvbox">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <child>
-          <placeholder/>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
-        <child>
-          <object class="GtkStatusbar" id="GNUNET_GTK_conversation_statusbar">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="orientation">vertical</property>
-            <property name="spacing">8</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="pack_type">end</property>
-            <property name="position">3</property>
-          </packing>
-        </child>
-      </object>
-    </child>
+  <object class="GtkTreeStore" id="gnunet_conversation_gtk_zone_treestore">
+    <columns>
+      <!-- column-name zone -->
+      <column type="gchararray"/>
+    </columns>
   </object>
 </interface>

Modified: gnunet-gtk/src/conversation/gnunet-conversation-gtk.c
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk.c       2014-02-04 
16:35:19 UTC (rev 32216)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk.c       2014-02-04 
17:22:05 UTC (rev 32217)
@@ -891,7 +891,7 @@
       type = "PHONE";
     }
 //    FPRINTF (stdout, "%s", rname);
-    if (rd[i].record_type == 65536 || rd[i].record_type == 65536)
+    if (rd[i].record_type == 65536 || rd[i].record_type == 65542)
     {
       gtk_list_store_append (contacts_liststore, &iter);
       gtk_list_store_set (contacts_liststore, &iter, 1, type, 0, rname, -1);
@@ -981,9 +981,19 @@
 identity_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx,
              const char *name)
 {
+  struct GNUNET_CRYPTO_EcdsaPublicKey pk;
+  char *s;
 
-//  FPRINTF (stderr, _("identity_cb name: `%s'  caller_id: `%s' \n"), name,
-//           caller_id);
+  if (NULL != ego) 
+  { 
+  GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
+  s = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk);
+  fprintf (stdout, "%s \n", name);
+  gtk_list_store_insert_with_values (zone_liststore,
+                                       &iter, -1,
+                                       0, name,
+                                       -1); 
+  }
 
   if (NULL == name)
     return;
@@ -1172,6 +1182,15 @@
       GTK_TREE_STORE (get_object 
("gnunet_conversation_gtk_history_treestore"));
   history_treemodel = GTK_TREE_MODEL (history_treestore);
 
+  // zone list
+  zone_liststore =
+     GTK_LIST_STORE (get_object ("gnunet_conversation_gtk_zone_liststore"));
+  zone_treeview =
+      GTK_TREE_VIEW (get_object ("gnunet_conversation_gtk_zone_treeview"));
+  zone_treestore =
+      GTK_TREE_STORE (get_object ("gnunet_conversation_gtk_zone_treestore"));
+  zone_treemodel = GTK_TREE_MODEL (zone_treestore);
+
   //gtk_tree_view_set_activate_on_single_click(contacts_treeview, TRUE);
 
   GNUNET_assert (NULL != contacts_liststore);
@@ -1626,54 +1645,90 @@
   GNUNET_GTK_tray_icon_change (icon_name, "gnunet-conversation-gtk-status");
 }
 
+static void
+print_ego (void *cls,
+          struct GNUNET_IDENTITY_Ego *ego,
+          void **ctx,
+          const char *identifier)
+{
+  struct GNUNET_CRYPTO_EcdsaPublicKey pk;
+  char *s;
+  GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
+  s = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk);
+  fprintf (stdout, "%s \n", identifier);
+//  GNUNET_free (s);
+}
 
+
 /* end of gnunet-conversation-gtk.c */
 void
 GNUNET_contact_test ()
 {
-
+/*
   history_add (0, "test");
   history_add (1, "test");
   history_add (2, "test");
   history_add (3, "test");
   history_add (4, "test");
+//  struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc;
+//  edc = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginEnvironment); 
+*/
+//  GtkTreeIter iter;
+//  char *caller_id = "testje";
+//  int  caller_num = 10; 
 
-  GtkTreeIter iter;
-  char *caller_id = "testje";
-  int  caller_num = 10; 
-
  /*
  * active_liststore:
  * 0: *gchar caller_id
  * 1: pointer caller
  * 2: gint caller_num
  */
-
+/*
   gtk_list_store_append (active_liststore, &iter);
 
   gtk_list_store_set (active_liststore, &iter, 2, caller_num, 0, caller_id, 
-1);
 
+  gtk_list_store_insert_with_values (zone_liststore,
+                                       &iter, -1,
+                                       0, "test",
+                                       -1);
+*/ 
+//  static struct GNUNET_IDENTITY_Handle *sh;  
+//  GNUNET_IDENTITY_disconnect (id);
+//  &print_ego;
+  //sh = GNUNET_IDENTITY_connect (cfg, &print_ego, NULL); 
 
-
 }
 
+/**
+ * A different zone was selected in the zone toggle bar.  Load the
+ * appropriate zone.
+ *
+ * @param widget button that was toggled (could be to "on" or "off", we only 
react to "on")
+ * @param user_data builder, unused
+ */
 void
-test_button_clicked()
+gnunet_conversation_gtk_zone_combobox_changed_cb (GtkComboBox *widget,
+                                               gpointer user_data)
 {
-  FPRINTF(stderr,"testbt click \n");
-    GtkTreeIter iter;
-  char *caller_id = "testje";
-  int  caller_num = 10;
+  GtkTreeIter iter;
+  struct GNUNET_IDENTITY_Ego *ego;
+ // char *name;
 
- /*
- * active_liststore:
- * 0: *gchar caller_id
- * 1: pointer caller
- * 2: gint caller_num
- */
+//  if (! gtk_combo_box_get_active_iter (widget,
+//                                       &iter))
+//  {
+//    load_zone (NULL, NULL);
+//    return;
+//  }
+  gtk_tree_model_get (zone_liststore,
+                      &iter,
+                      0, name,
+                      -1);
+  GNUNET_IDENTITY_disconnect (id);
+//  ego_name = name;
+  id = GNUNET_IDENTITY_connect (cfg, &identity_cb, NULL);
+//  load_zone (name, ego);
+}
 
-  gtk_list_store_append (active_liststore, &iter);
 
-  gtk_list_store_set (active_liststore, &iter, 2, caller_num, 0, caller_id, 
-1);
-
-}

Modified: gnunet-gtk/src/conversation/gnunet-conversation-gtk.h
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk.h       2014-02-04 
16:35:19 UTC (rev 32216)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk.h       2014-02-04 
17:22:05 UTC (rev 32217)
@@ -316,7 +316,7 @@
 
 
 /**
- * List of all known zones/egos.
+ * List of contacts (records).
  */
 static GtkListStore *contacts_liststore;
 
@@ -358,6 +358,26 @@
 static GtkTreeModel *history_treemodel;
 
 
+/**
+ * list of zones
+ */
+static GtkListStore *zone_liststore;
+
+/**
+ * zone treestore
+ */
+static GtkTreeStore *zone_treestore;
+
+/**
+ * zone treeview
+ */
+static GtkTreeView *zone_treeview;
+
+/**
+ * zone tree model
+ */
+static GtkTreeModel *zone_treemodel;
+
 /**                      
  * Current state of iterating elements for the client.
  * NULL if we are not currently iterating.
@@ -394,109 +414,107 @@
 */
 GtkDialog *dialog;
 
-
-
 /**
  * Context for edit operations and environment for plugins.
  * Typical plugins will only use the @e check_validity callback.
  */
-//struct GNUNET_GTK_NAMESTORE_PluginEnvironment
-//{
-//
-//  /**
-//   * Function that should be called by the plugin whenever values in
-//   * the dialog were edited.  It will check the validity of the dialog
-//   * and update the "save" button accordingly.
-//   */
-//  void (*check_validity)(struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc);
-//
-//  /**
-//   * Builder for the dialog.
-//   */
-//  GtkBuilder *builder;
-//
-//  /**
-//   * Main dialog window.
-//   */
-//  GtkDialog *dialog;
-//
-//  /**
-//   * Where in the tree view are we editing?
-//   */
-//  struct RecordInfo *ri;
-//
-//  /**
-//   * Name of the record.
-//   */
-//  gchar *name;
-//
-//  /**
-//   * Value of the record in string format.
-//   */
-//  gchar *n_value;
-//
-//  /**
-//   * Name of the zone into which the record should be placed.
-//   */
-//  gchar *new_zone_option;
-//
-//  /**
-//   * Ego of the zone into which the record should be placed.
-//   */
-//  struct GNUNET_IDENTITY_Ego *ego;
-//
-//  /**
-//   * List of all zones.
-//   */
-//  GtkListStore *zone_liststore;
-//
-//  /**
-//   * The plugin we used to edit the value.
-//   */
-//  struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
-//
-//  /**
-//   * Name of the plugin library.
-//   */
-//  char *liblow;
-//
-//  /**
-//   * Expiration time value (absolute or relative).
-//   */
-//  guint64 n_exp_time;
-//
-//  /**
-//   * Offset of the record we are editing in the 'rd' list of 'ri'.
-//   */
-//  unsigned int off;
-//
-//  /**
-//   * Flag indicating if the old record was in the namestore.
-//   */
-//  int old_record_in_namestore;
-//
-//  /**
-//   * Type of the record.
-//   */
-//  uint32_t record_type;
-//
-//  /**
-//   * Is this record 'public'?
-//   */
-//  gboolean n_public;
-//
-//  /**
-//   * Is the expiration time relative?
-//   */
-//  gboolean n_is_relative;
-//
-//  /**
-//   * Is this record a shadow record?
-//   */
-//  gboolean n_is_shadow;
-//
-//};
-//
+struct GNUNET_GTK_NAMESTORE_PluginEnvironment
+{
 
+  /**
+   * Function that should be called by the plugin whenever values in
+   * the dialog were edited.  It will check the validity of the dialog
+   * and update the "save" button accordingly.
+   */
+  void (*check_validity)(struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc);
 
+  /**
+   * Builder for the dialog.
+   */
+  GtkBuilder *builder;
+
+  /**
+   * Main dialog window.
+   */
+  GtkDialog *dialog;
+
+  /**
+   * Where in the tree view are we editing?
+   */
+  struct RecordInfo *ri;
+
+  /**
+   * Name of the record.
+   */
+  gchar *name;
+
+  /**
+   * Value of the record in string format.
+   */
+  gchar *n_value;
+
+  /**
+   * Name of the zone into which the record should be placed.
+   */
+  gchar *new_zone_option;
+
+  /**
+   * Ego of the zone into which the record should be placed.
+   */
+  struct GNUNET_IDENTITY_Ego *ego;
+
+  /**
+   * List of all zones.
+   */
+  GtkListStore *zone_liststore;
+
+  /**
+   * The plugin we used to edit the value.
+   */
+  struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
+
+  /**
+   * Name of the plugin library.
+   */
+  char *liblow;
+
+  /**
+   * Expiration time value (absolute or relative).
+   */
+  guint64 n_exp_time;
+
+  /**
+   * Offset of the record we are editing in the 'rd' list of 'ri'.
+   */
+  unsigned int off;
+
+  /**
+   * Flag indicating if the old record was in the namestore.
+   */
+  int old_record_in_namestore;
+
+  /**
+   * Type of the record.
+   */
+  uint32_t record_type;
+
+  /**
+   * Is this record 'public'?
+   */
+  gboolean n_public;
+
+  /**
+   * Is the expiration time relative?
+   */
+  gboolean n_is_relative;
+
+  /**
+   * Is this record a shadow record?
+   */
+  gboolean n_is_shadow;
+
+};
+
+
+
 #endif




reply via email to

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