gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r22226 - in gnunet-gtk: contrib src/gns


From: gnunet
Subject: [GNUnet-SVN] r22226 - in gnunet-gtk: contrib src/gns
Date: Sat, 23 Jun 2012 18:38:33 +0200

Author: grothoff
Date: 2012-06-23 18:38:33 +0200 (Sat, 23 Jun 2012)
New Revision: 22226

Modified:
   gnunet-gtk/contrib/gnunet_setup_gtk_main_window.glade
   gnunet-gtk/src/gns/gnunet-gns-gtk.c
   gnunet-gtk/src/gns/gnunet-gns-gtk_zone.c
Log:
-code cleanup

Modified: gnunet-gtk/contrib/gnunet_setup_gtk_main_window.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_setup_gtk_main_window.glade       2012-06-23 
15:59:18 UTC (rev 22225)
+++ gnunet-gtk/contrib/gnunet_setup_gtk_main_window.glade       2012-06-23 
16:38:33 UTC (rev 22226)
@@ -2,140 +2,6 @@
 <interface>
   <requires lib="gtk+" version="2.20"/>
   <!-- interface-naming-policy toplevel-contextual -->
-  <object class="GtkMenu" id="GNUNET_GNS_GTK_delete_popup_menu">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <child>
-      <object class="GtkMenuItem" id="GNUNET_GNS_GTK_delete_button">
-        <property name="use_action_appearance">False</property>
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="tooltip_text" translatable="yes">Delete GNS 
entry</property>
-        <property name="label" translatable="yes">Delete</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkSeparatorMenuItem" id="GNUNET_GTK_delete_sep">
-        <property name="use_action_appearance">False</property>
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkMenuItem" id="1d_exp">
-        <property name="use_action_appearance">False</property>
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="label" translatable="yes">1 day</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkMenuItem" id="1w_exp">
-        <property name="use_action_appearance">False</property>
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="label" translatable="yes">1 week</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkMenuItem" id="1y_exp">
-        <property name="use_action_appearance">False</property>
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="label" translatable="yes">1 year</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkMenuItem" id="exp_inf">
-        <property name="use_action_appearance">False</property>
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="label" translatable="yes">never</property>
-      </object>
-    </child>
-  </object>
-  <object class="GtkTreeStore" id="GNUNET_GNS_GTK_treestore">
-    <columns>
-      <!-- column-name name -->
-      <column type="gchararray"/>
-      <!-- column-name is_public -->
-      <column type="gboolean"/>
-      <!-- column-name record_type -->
-      <column type="guint"/>
-      <!-- column-name record_type_as_string -->
-      <column type="gchararray"/>
-      <!-- column-name expiration_time -->
-      <column type="guint64"/>
-      <!-- column-name expiration_time_is_relative -->
-      <column type="gboolean"/>
-      <!-- column-name expiration_time_as_string -->
-      <column type="gchararray"/>
-      <!-- column-name value_as_string -->
-      <column type="gchararray"/>
-      <!-- column-name value_color -->
-      <column type="gchararray"/>
-      <!-- column-name name_is_editable -->
-      <column type="gboolean"/>
-      <!-- column-name name_is_row -->
-      <column type="gboolean"/>
-      <!-- column-name not_dummy_row -->
-      <column type="gboolean"/>
-      <!-- column-name expiration_time_as_color -->
-      <column type="gchararray"/>
-      <!-- column-name name_color -->
-      <column type="gchararray"/>
-    </columns>
-  </object>
-  <object class="GtkListStore" id="GNUNET_GNS_GTK_type_liststore">
-    <columns>
-      <!-- column-name type -->
-      <column type="guint"/>
-      <!-- column-name typename -->
-      <column type="gchararray"/>
-    </columns>
-    <data>
-      <row>
-        <col id="0">1</col>
-        <col id="1" translatable="yes">A</col>
-      </row>
-      <row>
-        <col id="0">2</col>
-        <col id="1" translatable="yes">NS</col>
-      </row>
-      <row>
-        <col id="0">5</col>
-        <col id="1" translatable="yes">CNAME</col>
-      </row>
-      <row>
-        <col id="0">6</col>
-        <col id="1" translatable="yes">SOA</col>
-      </row>
-      <row>
-        <col id="0">12</col>
-        <col id="1" translatable="yes">PTR</col>
-      </row>
-      <row>
-        <col id="0">15</col>
-        <col id="1" translatable="yes">MX</col>
-      </row>
-      <row>
-        <col id="0">16</col>
-        <col id="1" translatable="yes">TXT</col>
-      </row>
-      <row>
-        <col id="0">28</col>
-        <col id="1" translatable="yes">AAAA</col>
-      </row>
-      <row>
-        <col id="0">65536</col>
-        <col id="1" translatable="yes">PKEY</col>
-      </row>
-      <row>
-        <col id="0">65538</col>
-        <col id="1" translatable="yes">LEHO</col>
-      </row>
-    </data>
-  </object>
   <object class="GtkAdjustment" id="GNUNET_setup_bandwidth_in_adjustment">
     <property name="lower">5000</property>
     <property name="upper">999999999</property>
@@ -150,27 +16,6 @@
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
-  <object class="GtkAdjustment" 
id="GNUNET_setup_exit_interface_mask_adjustment">
-    <property name="lower">1</property>
-    <property name="upper">127</property>
-    <property name="value">48</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
-  <object class="GtkAdjustment" 
id="GNUNET_setup_fs_datacache_mysql_port_adjustment">
-    <property name="lower">1</property>
-    <property name="upper">65535</property>
-    <property name="value">3306</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
-  <object class="GtkAdjustment" 
id="GNUNET_setup_fs_datacache_quota_adjustment">
-    <property name="lower">65536</property>
-    <property name="upper">9999999999</property>
-    <property name="value">1024000</property>
-    <property name="step_increment">65536</property>
-    <property name="page_increment">1024000</property>
-  </object>
   <object class="GtkDialog" id="GNUNET_setup_dialog">
     <property name="can_focus">False</property>
     <property name="border_width">5</property>
@@ -4445,7 +4290,7 @@
                       <object class="GtkTreeView" 
id="GNUNET_setup_gns_main_treeview">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
-                        <property name="model"></property>
+                        <property 
name="model">GNUNET_setup_gns_treestore</property>
                         <property name="search_column">0</property>
                         <child>
                           <object class="GtkTreeViewColumn" 
id="GNUNET_setup_gns_name_treeviewcolumn">
@@ -4599,6 +4444,27 @@
       <action-widget response="-3">GNUNET_setup_save_button</action-widget>
     </action-widgets>
   </object>
+  <object class="GtkAdjustment" 
id="GNUNET_setup_exit_interface_mask_adjustment">
+    <property name="lower">1</property>
+    <property name="upper">127</property>
+    <property name="value">48</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" 
id="GNUNET_setup_fs_datacache_mysql_port_adjustment">
+    <property name="lower">1</property>
+    <property name="upper">65535</property>
+    <property name="value">3306</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" 
id="GNUNET_setup_fs_datacache_quota_adjustment">
+    <property name="lower">65536</property>
+    <property name="upper">9999999999</property>
+    <property name="value">1024000</property>
+    <property name="step_increment">65536</property>
+    <property name="page_increment">1024000</property>
+  </object>
   <object class="GtkAdjustment" 
id="GNUNET_setup_fs_datastore_mysql_port_adjustment">
     <property name="lower">1</property>
     <property name="upper">65535</property>
@@ -4613,10 +4479,60 @@
     <property name="step_increment">1000000</property>
     <property name="page_increment">1000000000</property>
   </object>
-  <object class="GtkListStore" id="GNUNET_setup_gns_liststore">
+  <object class="GtkMenu" id="GNUNET_setup_gns_delete_popup_menu">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkMenuItem" id="GNUNET_setup_gns_popup_delete_button">
+        <property name="use_action_appearance">False</property>
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="tooltip_text" translatable="yes">Delete GNS 
entry</property>
+        <property name="label" translatable="yes">Delete</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkSeparatorMenuItem" id="GNUNET_GTK_delete_sep">
+        <property name="use_action_appearance">False</property>
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="GNUNET_setup_gns_popup_1d_exp_button">
+        <property name="use_action_appearance">False</property>
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">1 day</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="GNUNET_setup_gns_popup_1w_exp_button">
+        <property name="use_action_appearance">False</property>
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">1 week</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="GNUNET_setup_gns_popup_1y_exp_button">
+        <property name="use_action_appearance">False</property>
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">1 year</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" 
id="GNUNET_setup_gns_popup_forever_exp_button">
+        <property name="use_action_appearance">False</property>
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">never</property>
+      </object>
+    </child>
+  </object>
+  <object class="GtkListStore" id="GNUNET_setup_gns_exit_dialog_liststore">
     <columns>
-      <!-- column-name hostname -->
-      <column type="gchararray"/>
       <!-- column-name sourceport -->
       <column type="guint"/>
       <!-- column-name targetport -->
@@ -4627,6 +4543,104 @@
       <column type="gchararray"/>
     </columns>
   </object>
+  <object class="GtkTreeStore" id="GNUNET_setup_gns_treestore">
+    <columns>
+      <!-- column-name name -->
+      <column type="gchararray"/>
+      <!-- column-name is_public -->
+      <column type="gboolean"/>
+      <!-- column-name record_type -->
+      <column type="guint"/>
+      <!-- column-name record_type_as_string -->
+      <column type="gchararray"/>
+      <!-- column-name expiration_time -->
+      <column type="guint64"/>
+      <!-- column-name expiration_time_is_relative -->
+      <column type="gboolean"/>
+      <!-- column-name expiration_time_as_string -->
+      <column type="gchararray"/>
+      <!-- column-name value_as_string -->
+      <column type="gchararray"/>
+      <!-- column-name value_color -->
+      <column type="gchararray"/>
+      <!-- column-name name_is_editable -->
+      <column type="gboolean"/>
+      <!-- column-name name_is_row -->
+      <column type="gboolean"/>
+      <!-- column-name not_dummy_row -->
+      <column type="gboolean"/>
+      <!-- column-name expiration_time_as_color -->
+      <column type="gchararray"/>
+      <!-- column-name name_color -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
+  <object class="GtkListStore" id="GNUNET_setup_gns_type_liststore">
+    <columns>
+      <!-- column-name type -->
+      <column type="guint"/>
+      <!-- column-name typename -->
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0">1</col>
+        <col id="1" translatable="yes">A</col>
+      </row>
+      <row>
+        <col id="0">2</col>
+        <col id="1" translatable="yes">NS</col>
+      </row>
+      <row>
+        <col id="0">5</col>
+        <col id="1" translatable="yes">CNAME</col>
+      </row>
+      <row>
+        <col id="0">6</col>
+        <col id="1" translatable="yes">SOA</col>
+      </row>
+      <row>
+        <col id="0">12</col>
+        <col id="1" translatable="yes">PTR</col>
+      </row>
+      <row>
+        <col id="0">15</col>
+        <col id="1" translatable="yes">MX</col>
+      </row>
+      <row>
+        <col id="0">16</col>
+        <col id="1" translatable="yes">TXT</col>
+      </row>
+      <row>
+        <col id="0">28</col>
+        <col id="1" translatable="yes">AAAA</col>
+      </row>
+      <row>
+        <col id="0">65536</col>
+        <col id="1" translatable="yes">PKEY</col>
+      </row>
+      <row>
+        <col id="0">65538</col>
+        <col id="1" translatable="yes">LEHO</col>
+      </row>
+      <row>
+        <col id="0">33</col>
+        <col id="1" translatable="yes">SRV</col>
+      </row>
+      <row>
+        <col id="0">65539</col>
+        <col id="1" translatable="yes">VPN</col>
+      </row>
+      <row>
+        <col id="0">65540</col>
+        <col id="1" translatable="yes">REV</col>
+      </row>
+      <row>
+        <col id="0">65537</col>
+        <col id="1" translatable="yes">PSEU</col>
+      </row>
+    </data>
+  </object>
   <object class="GtkAdjustment" 
id="GNUNET_setup_hostlist_server_port_adjustment">
     <property name="lower">1</property>
     <property name="upper">65535</property>

Modified: gnunet-gtk/src/gns/gnunet-gns-gtk.c
===================================================================
--- gnunet-gtk/src/gns/gnunet-gns-gtk.c 2012-06-23 15:59:18 UTC (rev 22225)
+++ gnunet-gtk/src/gns/gnunet-gns-gtk.c 2012-06-23 16:38:33 UTC (rev 22226)
@@ -141,9 +141,10 @@
 }
 
 
-void pseu_change_cont (void *cls,
-                 int32_t success,
-                 const char *emsg)
+static void 
+pseu_change_cont (void *cls,
+                 int32_t success,
+                 const char *emsg)
 {
   struct GNUNET_GNS_Context *gns = cls;
   GtkWidget *dialog;
@@ -204,6 +205,7 @@
   GNUNET_SCHEDULER_add_now (&shutdown_task, gns);
 }
 
+
 gboolean
 GNUNET_GNS_GTK_pseu_entry_enter_cb (GtkWidget *widget,
                                     GdkEvent  *event,
@@ -439,7 +441,7 @@
 }
 
 
-void
+static void
 close_error_box (GtkDialog *dialog,
                 gint       response_id,
                 gpointer   user_data)

Modified: gnunet-gtk/src/gns/gnunet-gns-gtk_zone.c
===================================================================
--- gnunet-gtk/src/gns/gnunet-gns-gtk_zone.c    2012-06-23 15:59:18 UTC (rev 
22225)
+++ gnunet-gtk/src/gns/gnunet-gns-gtk_zone.c    2012-06-23 16:38:33 UTC (rev 
22226)
@@ -26,38 +26,130 @@
 #include "gnunet_gtk.h"
 #include "gnunet-gns-gtk.h"
 
-enum TREESTORE_COLUMNS
+
+/**
+ * FIXME: duplicated with "enum GNS_ModelColumns"!
+ */
+enum GNSTreestoreColumn
 {
-  TREE_COL_NAME = 0,
-  TREE_COL_IS_PUBLIC,
-  TREE_COL_RECORD_TYPE,
-  TREE_COL_RECORD_TYPE_AS_STR,
-  TREE_COL_EXP_TIME,
-  TREE_COL_EXP_TIME_IS_REL,
-  TREE_COL_EXP_TIME_AS_STR,
-  TREE_COL_VAL_AS_STR,
-  TREE_COL_VAL_COLOR,
-  TREE_COL_NAME_IS_VISIBLE,
-  TREE_COL_IS_RECORD_ROW,
-  TREE_COL_NOT_DUMMY_ROW,
-  TREE_COL_EXP_TIME_COLOR,
-  TREE_COL_NAME_COLOR
+  /**
+   *
+   */
+  GNS_TREESTORE_COL_NAME = 0,
+
+  /**
+   *
+   */
+  GNS_TREESTORE_COL_IS_PUBLIC,
+
+  /**
+   *
+   */
+  GNS_TREESTORE_COL_RECORD_TYPE,
+
+  /**
+   *
+   */
+  GNS_TREESTORE_COL_RECORD_TYPE_AS_STR,
+
+  /**
+   *
+   */
+  GNS_TREESTORE_COL_EXP_TIME,
+
+  /**
+   *
+   */
+  GNS_TREESTORE_COL_EXP_TIME_IS_REL,
+
+  /**
+   *
+   */
+  GNS_TREESTORE_COL_EXP_TIME_AS_STR,
+
+  /**
+   *
+   */
+  GNS_TREESTORE_COL_VAL_AS_STR,
+
+  /**
+   *
+   */
+  GNS_TREESTORE_COL_VAL_COLOR,
+
+  /**
+   *
+   */
+  GNS_TREESTORE_COL_NAME_IS_VISIBLE,
+
+  /**
+   *
+   */
+  GNS_TREESTORE_COL_IS_RECORD_ROW,
+
+  /**
+   *
+   */
+  GNS_TREESTORE_COL_NOT_DUMMY_ROW,
+
+  /**
+   *
+   */
+  GNS_TREESTORE_COL_EXP_TIME_COLOR,
+
+  /**
+   *
+   */
+  GNS_TREESTORE_COL_NAME_COLOR
 };
 
+
+/**
+ *
+ */
 enum LIST_COLUMNS
 {
-  TYPE_LIST_TYPE = 0,
-  TYPE_LIST_TYPENAME
+
+  /**
+   *
+   */
+  GNS_TYPE_TO_NAME_LISTSTORE_COLUMN_TYPE = 0,
+
+
+  /**
+   *
+   */
+  GNS_TYPE_TO_NAME_LISTSTORE_COLUMN_TYPENAME
 };
 
+
+/**
+ *
+ */
 struct UpdateContext
 {
+  /**
+   *
+   */
   struct GNUNET_GNS_Context *gns;
+
+  /**
+   *
+   */
   struct GNUNET_NAMESTORE_RecordData *rd;
+
+  /**
+   *
+   */
+  char * name;
+
+  /**
+   *
+   */
   unsigned int rd_count;
-  char * name;
 };
 
+
 static void
 check_name_validity_and_commit_remove_proc (void *cls,
                                             int32_t success,
@@ -92,6 +184,7 @@
   }
 }
 
+
 static void
 check_name_validity_and_commit (struct GNUNET_GNS_Context *gns, gchar *path, 
char * oldname)
 {
@@ -130,7 +223,7 @@
   }
 
   gtk_tree_model_get(gns->tm, &parent,
-                     TREE_COL_NAME, &name,
+                     GNS_TREESTORE_COL_NAME, &name,
                      -1);
 
   if (0 == strcmp (name, ROOT_STR))
@@ -153,15 +246,15 @@
   for (c = 0; c < children; c++)
   {
     gtk_tree_model_get(gns->tm, &it,
-                       TREE_COL_NAME, &n_name,
-                       TREE_COL_RECORD_TYPE, &n_type,
-                       TREE_COL_IS_PUBLIC, &n_public,
-                       TREE_COL_EXP_TIME_COLOR, &n_exp_color,
-                       TREE_COL_EXP_TIME, &n_exp_time,
-                       TREE_COL_EXP_TIME_IS_REL, &n_is_relative,
-                       TREE_COL_EXP_TIME_AS_STR, &n_exp_str,
-                       TREE_COL_VAL_AS_STR, &n_value,
-                       TREE_COL_VAL_COLOR, &n_value_color,
+                       GNS_TREESTORE_COL_NAME, &n_name,
+                       GNS_TREESTORE_COL_RECORD_TYPE, &n_type,
+                       GNS_TREESTORE_COL_IS_PUBLIC, &n_public,
+                       GNS_TREESTORE_COL_EXP_TIME_COLOR, &n_exp_color,
+                       GNS_TREESTORE_COL_EXP_TIME, &n_exp_time,
+                       GNS_TREESTORE_COL_EXP_TIME_IS_REL, &n_is_relative,
+                       GNS_TREESTORE_COL_EXP_TIME_AS_STR, &n_exp_str,
+                       GNS_TREESTORE_COL_VAL_AS_STR, &n_value,
+                       GNS_TREESTORE_COL_VAL_COLOR, &n_value_color,
                        -1);
     /* valid name */
     if (NULL == n_name)
@@ -263,16 +356,29 @@
   }
 }
 
+
+/**
+ *
+ */
 struct Remove_Context
 {
+
+  /**
+   *
+   */
   struct GNUNET_GNS_Context *gns;
+
+  /**
+   *
+   */
   char *path;
 };
 
-void
+
+static void
 check_name_validity_and_remove_proc (void *cls,
-                                            int32_t success,
-                                            const char *emsg)
+                                    int32_t success,
+                                    const char *emsg)
 {
   struct Remove_Context *rcc = cls;
   GtkDialog *dialog;
@@ -300,7 +406,8 @@
   GNUNET_free (rcc);
 }
 
-void
+
+static void
 check_name_validity_and_remove (struct GNUNET_GNS_Context *gns, gchar *path)
 {
   GtkTreeIter it;
@@ -322,7 +429,7 @@
 
   gtk_tree_model_get_iter_from_string(gns->tm, &it, path);
   gtk_tree_model_get(gns->tm, &it,
-                     TREE_COL_NAME, &name,
+                     GNS_TREESTORE_COL_NAME, &name,
                      -1);
 
   if (TRUE == gtk_tree_model_iter_parent (gns->tm, &parent, &it))
@@ -332,15 +439,15 @@
         "Removing single record for name `%s'\n", name);
 
     gtk_tree_model_get(gns->tm, &it,
-                       TREE_COL_NAME, &n_name,
-                       TREE_COL_RECORD_TYPE, &n_type,
-                       TREE_COL_IS_PUBLIC, &n_public,
-                       TREE_COL_EXP_TIME_COLOR, &n_exp_color,
-                       TREE_COL_EXP_TIME, &n_exp_time,
-                       TREE_COL_EXP_TIME_IS_REL, &n_is_relative,
-                       TREE_COL_EXP_TIME_AS_STR, &n_exp_str,
-                       TREE_COL_VAL_AS_STR, &n_value,
-                       TREE_COL_VAL_COLOR, &n_value_color,
+                       GNS_TREESTORE_COL_NAME, &n_name,
+                       GNS_TREESTORE_COL_RECORD_TYPE, &n_type,
+                       GNS_TREESTORE_COL_IS_PUBLIC, &n_public,
+                       GNS_TREESTORE_COL_EXP_TIME_COLOR, &n_exp_color,
+                       GNS_TREESTORE_COL_EXP_TIME, &n_exp_time,
+                       GNS_TREESTORE_COL_EXP_TIME_IS_REL, &n_is_relative,
+                       GNS_TREESTORE_COL_EXP_TIME_AS_STR, &n_exp_str,
+                       GNS_TREESTORE_COL_VAL_AS_STR, &n_value,
+                       GNS_TREESTORE_COL_VAL_COLOR, &n_value_color,
                        -1);
 
     /* valid name */
@@ -399,6 +506,7 @@
   g_free (name);
 }
 
+
 /**
  * The user has selected a new record type.  Update the
  * model, possibly invalidating (marking 'red') the existing
@@ -427,20 +535,20 @@
   size_t data_size;
 
   gtk_tree_model_get(GTK_TREE_MODEL(gns->ls), new_iter, 0, &type, -1);
-  gtk_tree_model_get(GTK_TREE_MODEL(gns->ls), new_iter, TYPE_LIST_TYPENAME, 
&type_str, -1);
+  gtk_tree_model_get(GTK_TREE_MODEL(gns->ls), new_iter, 
GNS_TYPE_TO_NAME_LISTSTORE_COLUMN_TYPENAME, &type_str, -1);
 
 
   /* check if this is a new record */
   gtk_tree_model_get_iter_from_string(gns->tm, &it, path);
-  gtk_tree_model_get(gns->tm, &it, TREE_COL_IS_RECORD_ROW, &record_row, -1);
-  gtk_tree_model_get(gns->tm, &it, TREE_COL_NAME, &name_str, -1);
+  gtk_tree_model_get(gns->tm, &it, GNS_TREESTORE_COL_IS_RECORD_ROW, 
&record_row, -1);
+  gtk_tree_model_get(gns->tm, &it, GNS_TREESTORE_COL_NAME, &name_str, -1);
 
   if (GNUNET_YES == record_row)
   {
     /* Updating an existing record */
     gtk_tree_store_set(gns->ts, &it,
-                       TREE_COL_RECORD_TYPE, type,
-                       TREE_COL_RECORD_TYPE_AS_STR, type_str,
+                       GNS_TREESTORE_COL_RECORD_TYPE, type,
+                       GNS_TREESTORE_COL_RECORD_TYPE_AS_STR, type_str,
                        -1);
   }
   else if ((NULL != name_str) && (0 != strcmp (NEW_NAME_STR, name_str)))
@@ -448,15 +556,15 @@
     /* Adding a new record */
 
     gtk_tree_store_insert_with_values(gns->ts, &child , &it, 0,
-        TREE_COL_NAME, name_str,
-        TREE_COL_NAME_IS_VISIBLE, FALSE,
-        TREE_COL_RECORD_TYPE, type,
-        TREE_COL_RECORD_TYPE_AS_STR, type_str,
-        TREE_COL_EXP_TIME_AS_STR, EXPIRE_NEVER_STRING,
-       TREE_COL_EXP_TIME, GNUNET_TIME_UNIT_FOREVER_ABS,
-        TREE_COL_EXP_TIME_IS_REL, FALSE,
-        TREE_COL_IS_RECORD_ROW, GNUNET_YES,
-        TREE_COL_NOT_DUMMY_ROW, GNUNET_YES,
+        GNS_TREESTORE_COL_NAME, name_str,
+        GNS_TREESTORE_COL_NAME_IS_VISIBLE, FALSE,
+        GNS_TREESTORE_COL_RECORD_TYPE, type,
+        GNS_TREESTORE_COL_RECORD_TYPE_AS_STR, type_str,
+        GNS_TREESTORE_COL_EXP_TIME_AS_STR, EXPIRE_NEVER_STRING,
+       GNS_TREESTORE_COL_EXP_TIME, GNUNET_TIME_UNIT_FOREVER_ABS,
+        GNS_TREESTORE_COL_EXP_TIME_IS_REL, FALSE,
+        GNS_TREESTORE_COL_IS_RECORD_ROW, GNUNET_YES,
+        GNS_TREESTORE_COL_NOT_DUMMY_ROW, GNUNET_YES,
         -1);
     gtk_tree_view_expand_row (gns->tv, gtk_tree_model_get_path(gns->tm, &it), 
0);
 
@@ -464,25 +572,25 @@
   GNUNET_free (type_str);
 
   /* check if value is still valid */
-  gtk_tree_model_get(gns->tm, &it, TREE_COL_VAL_AS_STR, &value_str, -1);
+  gtk_tree_model_get(gns->tm, &it, GNS_TREESTORE_COL_VAL_AS_STR, &value_str, 
-1);
   if (NULL != value_str)
   {
     if (GNUNET_OK != GNUNET_NAMESTORE_string_to_value (type,
                                       value_str,
                                       &data,
                                       &data_size))
-      gtk_tree_store_set (gns->ts, &it, TREE_COL_VAL_COLOR, "red", -1);
+      gtk_tree_store_set (gns->ts, &it, GNS_TREESTORE_COL_VAL_COLOR, "red", 
-1);
     else
-      gtk_tree_store_set (gns->ts, &it, TREE_COL_VAL_COLOR, NULL, -1);
+      gtk_tree_store_set (gns->ts, &it, GNS_TREESTORE_COL_VAL_COLOR, NULL, -1);
     GNUNET_free (value_str);
   }
   else if (NULL == value_str)
   {
     /* Empty value field */
     if (GNUNET_YES == record_row)
-      gtk_tree_store_set (gns->ts, &it, TREE_COL_VAL_COLOR, "red", -1);
+      gtk_tree_store_set (gns->ts, &it, GNS_TREESTORE_COL_VAL_COLOR, "red", 
-1);
     else
-      gtk_tree_store_set (gns->ts, &child, TREE_COL_VAL_COLOR, "red", -1);
+      gtk_tree_store_set (gns->ts, &child, GNS_TREESTORE_COL_VAL_COLOR, "red", 
-1);
   }
 
   check_name_validity_and_commit (gns, path, NULL);
@@ -508,14 +616,15 @@
   gboolean value;
 
   gtk_tree_model_get_iter_from_string(gns->tm, &it, path);
-  gtk_tree_model_get(gns->tm, &it, TREE_COL_IS_PUBLIC, &value, -1);
-  gtk_tree_store_set(gns->ts, &it, TREE_COL_IS_PUBLIC, !value, -1);
+  gtk_tree_model_get(gns->tm, &it, GNS_TREESTORE_COL_IS_PUBLIC, &value, -1);
+  gtk_tree_store_set(gns->ts, &it, GNS_TREESTORE_COL_IS_PUBLIC, !value, -1);
 
   check_name_validity_and_commit (gns, path, NULL);
 }
 
-static
-char * convert_time_to_string (struct GNUNET_TIME_Absolute t)
+
+static char * 
+convert_time_to_string (struct GNUNET_TIME_Absolute t)
 {
   time_t tt;
   struct tm *time;
@@ -533,8 +642,9 @@
   return ret;
 }
 
-static
-int check_time (const char * text)
+
+static int 
+check_time (const char * text)
 {
   unsigned int t_mon;
   unsigned int t_day;
@@ -558,8 +668,9 @@
   return GNUNET_OK;
 }
 
-static
-const struct GNUNET_TIME_Absolute convert_string_to_abs_time (const char * 
text)
+
+static const struct GNUNET_TIME_Absolute
+convert_string_to_abs_time (const char * text)
 {
   static struct GNUNET_TIME_Absolute abs_t;
   struct tm time;
@@ -628,8 +739,8 @@
   {
     gtk_tree_model_get_iter_from_string(gns->tm, &it, path);
     gtk_tree_model_get(gns->tm, &it,
-                       TREE_COL_EXP_TIME_AS_STR, &old_text,
-                       TREE_COL_EXP_TIME_IS_REL, &is_rel,
+                       GNS_TREESTORE_COL_EXP_TIME_AS_STR, &old_text,
+                       GNS_TREESTORE_COL_EXP_TIME_IS_REL, &is_rel,
                        -1);
     if (0 == strcmp(new_text, old_text))
       return;
@@ -644,9 +755,9 @@
       if (GNUNET_SYSERR == check_time(new_text))
       {
         gtk_tree_store_set (gns->ts, &it,
-                            TREE_COL_EXP_TIME_AS_STR, new_text,
-                            TREE_COL_EXP_TIME_COLOR, "red",
-                            TREE_COL_EXP_TIME, 0,
+                            GNS_TREESTORE_COL_EXP_TIME_AS_STR, new_text,
+                            GNS_TREESTORE_COL_EXP_TIME_COLOR, "red",
+                            GNS_TREESTORE_COL_EXP_TIME, 0,
                             -1);
         abstime = GNUNET_TIME_UNIT_ZERO_ABS;
         return;
@@ -662,9 +773,9 @@
       }
     }
     gtk_tree_store_set (gns->ts, &it,
-                        TREE_COL_EXP_TIME_AS_STR, new_text,
-                        TREE_COL_EXP_TIME, abstime.abs_value,
-                        TREE_COL_EXP_TIME_COLOR, NULL,
+                        GNS_TREESTORE_COL_EXP_TIME_AS_STR, new_text,
+                        GNS_TREESTORE_COL_EXP_TIME, abstime.abs_value,
+                        GNS_TREESTORE_COL_EXP_TIME_COLOR, NULL,
                         -1);
     check_name_validity_and_commit (gns, path, NULL);
   }
@@ -699,8 +810,8 @@
   {
     gtk_tree_model_get_iter_from_string(tm, &it, path);
     gtk_tree_model_get(tm, &it,
-        TREE_COL_RECORD_TYPE, &type,
-        TREE_COL_VAL_AS_STR, &old_value,
+        GNS_TREESTORE_COL_RECORD_TYPE, &type,
+        GNS_TREESTORE_COL_VAL_AS_STR, &old_value,
         -1);
 
     if (old_value != NULL)
@@ -718,14 +829,14 @@
                                       &data,
                                       &data_size))
     {
-      gtk_tree_store_set (gns->ts, &it, TREE_COL_VAL_COLOR, NULL, -1);
-      gtk_tree_store_set (gns->ts, &it, TREE_COL_VAL_AS_STR, new_text, -1);
+      gtk_tree_store_set (gns->ts, &it, GNS_TREESTORE_COL_VAL_COLOR, NULL, -1);
+      gtk_tree_store_set (gns->ts, &it, GNS_TREESTORE_COL_VAL_AS_STR, 
new_text, -1);
       check_name_validity_and_commit (gns, path, NULL);
     }
     else
     {
-      gtk_tree_store_set (gns->ts, &it, TREE_COL_VAL_COLOR, "red", -1);
-      gtk_tree_store_set (gns->ts, &it, TREE_COL_VAL_AS_STR, new_text, -1);
+      gtk_tree_store_set (gns->ts, &it, GNS_TREESTORE_COL_VAL_COLOR, "red", 
-1);
+      gtk_tree_store_set (gns->ts, &it, GNS_TREESTORE_COL_VAL_AS_STR, 
new_text, -1);
     }
   }
 }
@@ -758,40 +869,40 @@
     return;
 
   gtk_tree_model_get_iter_from_string(tm, &it, path);
-  gtk_tree_model_get(tm, &it, TREE_COL_NOT_DUMMY_ROW, &not_dummy, -1);
-  gtk_tree_model_get(tm, &it, TREE_COL_NAME, &name, -1);
+  gtk_tree_model_get(tm, &it, GNS_TREESTORE_COL_NOT_DUMMY_ROW, &not_dummy, -1);
+  gtk_tree_model_get(tm, &it, GNS_TREESTORE_COL_NAME, &name, -1);
 
   if (not_dummy == GNUNET_NO)
   {
     /* update name */
     gtk_tree_store_set (gns->ts, &it,
-                        TREE_COL_NAME, new_text,
-                        TREE_COL_RECORD_TYPE, 0,
-                        TREE_COL_RECORD_TYPE_AS_STR, _(NEW_RECORD_STR),
-                        TREE_COL_NOT_DUMMY_ROW, GNUNET_YES,
+                        GNS_TREESTORE_COL_NAME, new_text,
+                        GNS_TREESTORE_COL_RECORD_TYPE, 0,
+                        GNS_TREESTORE_COL_RECORD_TYPE_AS_STR, 
_(NEW_RECORD_STR),
+                        GNS_TREESTORE_COL_NOT_DUMMY_ROW, GNUNET_YES,
                         -1);
     check_name_validity_and_commit (gns, 
gtk_tree_model_get_string_from_iter(gns->tm, &it), name);
 
     /* add a new dummy line */
     gtk_tree_store_insert_with_values (gns->ts, &it,NULL, 0,
-        TREE_COL_NAME, _(NEW_NAME_STR),
-        TREE_COL_NAME_IS_VISIBLE, TRUE,
-        TREE_COL_RECORD_TYPE, 1,
-        TREE_COL_NOT_DUMMY_ROW, GNUNET_NO,
-        TREE_COL_IS_RECORD_ROW, GNUNET_NO,
+        GNS_TREESTORE_COL_NAME, _(NEW_NAME_STR),
+        GNS_TREESTORE_COL_NAME_IS_VISIBLE, TRUE,
+        GNS_TREESTORE_COL_RECORD_TYPE, 1,
+        GNS_TREESTORE_COL_NOT_DUMMY_ROW, GNUNET_NO,
+        GNS_TREESTORE_COL_IS_RECORD_ROW, GNUNET_NO,
         -1);
   }
   else
   {
     /* update name */
-    gtk_tree_store_set (gns->ts, &it, TREE_COL_NAME, new_text, -1);
+    gtk_tree_store_set (gns->ts, &it, GNS_TREESTORE_COL_NAME, new_text, -1);
 
     if (TRUE == gtk_tree_model_iter_children (gns->tm, &child, &it))
     {
       do
       {
         gtk_tree_store_set (gns->ts, &child,
-                           TREE_COL_NAME, &new_text,
+                           GNS_TREESTORE_COL_NAME, &new_text,
                            -1);
         GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "New text for `%s' is `%s'\n", 
path, new_text);
       }
@@ -804,17 +915,18 @@
   if (GNUNET_SYSERR == GNUNET_NAMESTORE_check_name (new_text))
   {
     gtk_tree_store_set (gns->ts, &it,
-                        TREE_COL_NAME_COLOR, "red",
+                        GNS_TREESTORE_COL_NAME_COLOR, "red",
                         -1);
   }
   else
   {
     gtk_tree_store_set (gns->ts, &it,
-                        TREE_COL_NAME_COLOR, NULL,
+                        GNS_TREESTORE_COL_NAME_COLOR, NULL,
                         -1);
   }
 }
 
+
 /**
  * The zone treeview pop up menu is supposed to be created.
  * (Note: this is not the only method that might need to be
@@ -839,7 +951,7 @@
   ts = gtk_tree_view_get_selection(gns->tv);
   if (! gtk_tree_selection_get_selected (ts, &tm, &it))
     return TRUE;
-  gtk_tree_model_get(gns->tm, &it, TREE_COL_NOT_DUMMY_ROW, &not_dummy, -1);
+  gtk_tree_model_get(gns->tm, &it, GNS_TREESTORE_COL_NOT_DUMMY_ROW, 
&not_dummy, -1);
   if (GNUNET_NO == not_dummy)
     return TRUE;
 
@@ -849,6 +961,7 @@
   return TRUE;
 }
 
+
 static void
 set_relative_expiration_time (struct GNUNET_GNS_Context *gns, struct 
GNUNET_TIME_Relative reltime)
 {
@@ -865,7 +978,7 @@
   if (! gtk_tree_selection_get_selected (ts, &tm, &it))
     return;
 
-  gtk_tree_model_get(tm, &it, TREE_COL_NOT_DUMMY_ROW, &not_dummy, -1);
+  gtk_tree_model_get(tm, &it, GNS_TREESTORE_COL_NOT_DUMMY_ROW, &not_dummy, -1);
   if (GNUNET_NO == not_dummy)
     return;
 
@@ -904,6 +1017,7 @@
   return TRUE;
 }
 
+
 gboolean
 GNUNET_GNS_GTK_main_treeview_popup_menu_exp1y_cb (GtkWidget *widget,
                                             gpointer user_data)
@@ -912,6 +1026,7 @@
   return TRUE;
 }
 
+
 gboolean
 GNUNET_GNS_GTK_main_treeview_popup_menu_expinf_cb (GtkWidget *widget,
                                             gpointer user_data)
@@ -921,7 +1036,6 @@
 }
 
 
-
 gboolean
 GNUNET_GNS_GTK_main_treeview_button_press_popup_menu_cb (GtkWidget *widget, 
GdkEventButton *event, gpointer user_data)
 {
@@ -933,6 +1047,7 @@
   return FALSE;
 }
 
+
 gboolean
 GNUNET_GNS_GTK_main_treeview_key_press_popup_menu_cb (GtkWidget *widget, 
GdkEventKey  *event, gpointer user_data)
 {
@@ -942,6 +1057,7 @@
   return FALSE;
 }
 
+
 struct ZoneIteration_Context
 {
   struct GNUNET_GNS_Context *gns;
@@ -950,6 +1066,7 @@
   char *label;
 };
 
+
 void
 GNUNET_GNS_GTK_delete_popup_menu_delete_cb (GtkMenuItem *menuitem,
                                                  gpointer user_data)
@@ -964,7 +1081,7 @@
   ts = gtk_tree_view_get_selection(gns->tv);
   if (gtk_tree_selection_get_selected (ts, &tm, &it))
   {
-    gtk_tree_model_get(tm, &it, TREE_COL_NOT_DUMMY_ROW, &not_dummy, -1);
+    gtk_tree_model_get(tm, &it, GNS_TREESTORE_COL_NOT_DUMMY_ROW, &not_dummy, 
-1);
     if (GNUNET_NO == not_dummy)
       return; /* do not delete the dummy line */
 
@@ -974,6 +1091,7 @@
   }
 }
 
+
 static void
 zone_iteration_proc (void *cls,
                           const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded 
*zone_key,
@@ -1021,18 +1139,18 @@
   GNUNET_assert(GTK_IS_TREE_STORE(zc_ctx->gns->ts));
   gtk_tree_store_append(zc_ctx->gns->ts, &iter_name, NULL);
   gtk_tree_store_set(zc_ctx->gns->ts, &iter_name,
-                     TREE_COL_NAME, name,
-                     TREE_COL_NAME_IS_VISIBLE, TRUE,
-                     TREE_COL_RECORD_TYPE, 0,
-                     TREE_COL_RECORD_TYPE_AS_STR, _(NEW_RECORD_STR),
-                     TREE_COL_IS_RECORD_ROW, GNUNET_NO,
-                     TREE_COL_NOT_DUMMY_ROW, GNUNET_YES,
+                     GNS_TREESTORE_COL_NAME, name,
+                     GNS_TREESTORE_COL_NAME_IS_VISIBLE, TRUE,
+                     GNS_TREESTORE_COL_RECORD_TYPE, 0,
+                     GNS_TREESTORE_COL_RECORD_TYPE_AS_STR, _(NEW_RECORD_STR),
+                     GNS_TREESTORE_COL_IS_RECORD_ROW, GNUNET_NO,
+                     GNS_TREESTORE_COL_NOT_DUMMY_ROW, GNUNET_YES,
                      -1);
 
   if (GNUNET_SYSERR == GNUNET_NAMESTORE_check_name (name))
   {
     gtk_tree_store_set (zc_ctx->gns->ts, &iter_name,
-                        TREE_COL_NAME_COLOR, "red",
+                        GNS_TREESTORE_COL_NAME_COLOR, "red",
                         -1);
   }
   /* Append elements for records */
@@ -1091,17 +1209,17 @@
     else
     {
       gtk_tree_store_insert_with_values(zc_ctx->gns->ts, &iter_record , 
&iter_name, 0,
-                                         TREE_COL_NAME, name,
-                                         TREE_COL_NAME_IS_VISIBLE, FALSE,
-                                         TREE_COL_RECORD_TYPE, 
rd[c].record_type,
-                                         TREE_COL_RECORD_TYPE_AS_STR, type_str,
-                                         TREE_COL_IS_PUBLIC, public,
-                                         TREE_COL_EXP_TIME, exp_t,
-                                         TREE_COL_EXP_TIME_AS_STR, exp,
-                                         TREE_COL_EXP_TIME_IS_REL, 
time_is_relative,
-                                         TREE_COL_VAL_AS_STR, val,
-                                         TREE_COL_IS_RECORD_ROW, GNUNET_YES,
-                                         TREE_COL_NOT_DUMMY_ROW, GNUNET_YES,
+                                         GNS_TREESTORE_COL_NAME, name,
+                                         GNS_TREESTORE_COL_NAME_IS_VISIBLE, 
FALSE,
+                                         GNS_TREESTORE_COL_RECORD_TYPE, 
rd[c].record_type,
+                                         GNS_TREESTORE_COL_RECORD_TYPE_AS_STR, 
type_str,
+                                         GNS_TREESTORE_COL_IS_PUBLIC, public,
+                                         GNS_TREESTORE_COL_EXP_TIME, exp_t,
+                                         GNS_TREESTORE_COL_EXP_TIME_AS_STR, 
exp,
+                                         GNS_TREESTORE_COL_EXP_TIME_IS_REL, 
time_is_relative,
+                                         GNS_TREESTORE_COL_VAL_AS_STR, val,
+                                         GNS_TREESTORE_COL_IS_RECORD_ROW, 
GNUNET_YES,
+                                         GNS_TREESTORE_COL_NOT_DUMMY_ROW, 
GNUNET_YES,
                                          -1);
     }
     GNUNET_free (type_str);
@@ -1112,6 +1230,7 @@
   GNUNET_NAMESTORE_zone_iterator_next(zc_ctx->it);
 }
 
+
 /**
  * The zone treeview was realized.   Setup the model.
  *
@@ -1128,11 +1247,11 @@
 
   /* Append a top level row and leave it empty */
   gtk_tree_store_insert_with_values(gns->ts, &toplevel, NULL, 0,
-                                     TREE_COL_NAME, _(NEW_NAME_STR),
-                                     TREE_COL_NAME_IS_VISIBLE, TRUE,
-                                     TREE_COL_RECORD_TYPE, 1,
-                                     TREE_COL_IS_RECORD_ROW, GNUNET_NO,
-                                     TREE_COL_NOT_DUMMY_ROW, GNUNET_NO,
+                                     GNS_TREESTORE_COL_NAME, _(NEW_NAME_STR),
+                                     GNS_TREESTORE_COL_NAME_IS_VISIBLE, TRUE,
+                                     GNS_TREESTORE_COL_RECORD_TYPE, 1,
+                                     GNS_TREESTORE_COL_IS_RECORD_ROW, 
GNUNET_NO,
+                                     GNS_TREESTORE_COL_NOT_DUMMY_ROW, 
GNUNET_NO,
                                      -1);
 
   zc_ctx = GNUNET_malloc (sizeof (struct ZoneIteration_Context));




reply via email to

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