View Issue Details

IDProjectCategoryView StatusLast Update
0002129gnunet-gtkotherpublic2012-06-02 19:15
ReporterChristian Grothoff Assigned Tovminko  
PriorityhighSeveritytrivialReproducibilityN/A
Status closedResolutionfixed 
Product VersionGit master 
Target Version0.9.3Fixed in Version0.9.3 
Summary0002129: code contains lots of un-named constants for access to GtkTreeModel's
DescriptionWhenever we access the 'GtkTreeModel's, the code currently simply inlines the numeric column offsets as a number, for example like this:


gtk_tree_store_set (de->ts, &iter, 15, dc->filename, 16, dc->anonymity, -1);


Having "15" like this in the code is both ugly an error-prone. Instead, we should for *each* model have an 'enum' defining nice names for each of the columns. The name should be pre-fixed by something relating to the model and postfixed by the desired type, for example:

GNUNET_GTK_FS_SEARCH_TAB_MODEL_FILENAME_gchararray = 15
GNUNET_GTK_FS_SEARCH_TAB_MODEL_ANONYMITY_guint = 16

That way, (a) checking that the types match would be trivial, (b) making sure that updates to the model definition in the glade file match the source code would be easier and (c) it would finally be clear which column of which model the code talks about ;-). This would also be more in line with Gtk-best-practices....
TagsNo tags attached.
Attached Files
gnunet-bug2129-fix.patch (77,361 bytes)   
Index: src/setup/gnunet-setup.h
===================================================================
--- src/setup/gnunet-setup.h	(revision 20790)
+++ src/setup/gnunet-setup.h	(working copy)
@@ -32,7 +32,57 @@
 #include <gladeui/glade.h>
 #include <gtk/gtk.h>
 
+
 /**
+ * Columns in the gns setup model.
+ */
+enum GNUNET_GTK_SETUP_HostlistUrlModelColumns
+  {
+    /**
+     * A gchararray 
+     */
+    GNUNET_GTK_SETUP_HOSTLIST_URL_MC_URL = 0,
+
+    /**
+     * A gboolean
+     */
+    GNUNET_GTK_SETUP_HOSTLIST_URL_MC_EDITABLE = 1,
+  };
+
+
+/**
+ * Columns in the hostlist url setup model.
+ */
+enum GNUNET_GTK_SETUP_GnsModelColumns
+  {
+    /**
+     * A gchararray 
+     */
+    GNUNET_GTK_SETUP_GNS_MC_HOSTNAME = 0,
+      
+    /**
+     * A guint
+     */
+    GNUNET_GTK_SETUP_GNS_MC_SOURCEPORT = 1,
+
+    /**
+     * A guint
+     */
+    GNUNET_GTK_SETUP_GNS_MC_TARGETPORT = 2,
+
+    /**
+     * A gchararray 
+     */
+    GNUNET_GTK_SETUP_GNS_MC_TARGETHOSTNAME = 3,
+
+    /**
+     * A gchararray 
+     */
+    GNUNET_GTK_SETUP_GNS_MC_ISUDP = 4,
+  };
+
+
+/**
  * Get an object from the main window.
  *
  * @param name name of the object
Index: src/setup/gnunet-setup-hostlist-editing.c
===================================================================
--- src/setup/gnunet-setup-hostlist-editing.c	(revision 20790)
+++ src/setup/gnunet-setup-hostlist-editing.c	(working copy)
@@ -64,11 +64,17 @@
   if (strlen (oldtext) == 0)
   {
     gtk_list_store_insert_before (ls, &iter, &old);
-    gtk_list_store_set (ls, &iter, 0, new_text, 1, FALSE, -1);
+    gtk_list_store_set (ls, &iter,
+                        GNUNET_GTK_SETUP_HOSTLIST_URL_MC_URL, new_text,
+                        GNUNET_GTK_SETUP_HOSTLIST_URL_MC_EDITABLE, FALSE,
+                        -1);
   }
   else
   {
-    gtk_list_store_set (ls, &old, 0, new_text, 1, FALSE, -1);
+    gtk_list_store_set (ls, &old,
+                        GNUNET_GTK_SETUP_HOSTLIST_URL_MC_URL, new_text,
+                        GNUNET_GTK_SETUP_HOSTLIST_URL_MC_EDITABLE, FALSE,
+                        -1);
   }
   g_free (oldtext);
 }
Index: src/setup/gnunet-setup-options.c
===================================================================
--- src/setup/gnunet-setup-options.c	(revision 20790)
+++ src/setup/gnunet-setup-options.c	(working copy)
@@ -23,6 +23,7 @@
  * @brief configuration details
  * @author Christian Grothoff
  */
+#include "gnunet-setup.h"
 #include "gnunet-setup-options.h"
 #include <gnunet/gnunet_util_lib.h>
 #include <gdk/gdkkeysyms.h>
@@ -605,7 +606,9 @@
   sel = gtk_tree_view_get_selection (tv);
   if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
     return FALSE;
-  gtk_tree_model_get (tm, &iter, 1, &editable, -1);
+  gtk_tree_model_get (tm, &iter,
+                      GNUNET_GTK_SETUP_HOSTLIST_URL_MC_EDITABLE, &editable,
+                      -1);
   if (TRUE == editable)
     return FALSE;               /* likely currently editing... */
   gtk_list_store_remove (ls, &iter);
@@ -641,9 +644,17 @@
     return GNUNET_SYSERR;
   t = GNUNET_strdup (value);
   for (w = strtok (t, " "); w != NULL; w = strtok (NULL, " "))
-    gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, w, 1, FALSE, -1);
+    gtk_list_store_insert_with_values (ls, &iter, G_MAXINT,
+                                       GNUNET_GTK_SETUP_HOSTLIST_URL_MC_URL, w,
+                                       GNUNET_GTK_SETUP_HOSTLIST_URL_MC_EDITABLE,
+                                       FALSE,
+                                       -1);
   GNUNET_free (t);
-  gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, "", 1, TRUE, -1);
+  gtk_list_store_insert_with_values (ls, &iter, G_MAXINT,
+                                     GNUNET_GTK_SETUP_HOSTLIST_URL_MC_URL, "",
+                                     GNUNET_GTK_SETUP_HOSTLIST_URL_MC_EDITABLE,
+                                     TRUE,
+                                     -1);
   return GNUNET_OK;
 }
 
@@ -678,7 +689,8 @@
   {
     do
     {
-      gtk_tree_model_get (tm, &iter, 0, &val, -1);
+      gtk_tree_model_get (tm, &iter,
+                          GNUNET_GTK_SETUP_HOSTLIST_URL_MC_URL, &val, -1);
       if (0 < strlen (val))
       {
 	if (value == NULL)
@@ -725,9 +737,16 @@
 
   if (NULL == section)
   {
-    gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, "", 1,
-                                       (guint) 80, 2, (guint) 8080, 3,
-                                       "localhost4", 4, "tcp", -1);
+    gtk_list_store_insert_with_values (ls, &iter, G_MAXINT,
+                                       GNUNET_GTK_SETUP_GNS_MC_HOSTNAME, "",
+                                       GNUNET_GTK_SETUP_GNS_MC_SOURCEPORT,
+                                       (guint) 80,
+                                       GNUNET_GTK_SETUP_GNS_MC_TARGETPORT,
+                                       (guint) 8080,
+                                       GNUNET_GTK_SETUP_GNS_MC_HOSTNAME,
+                                       "localhost4",
+                                       GNUNET_GTK_SETUP_GNS_MC_ISUDP, "tcp",
+                                       -1);
     return;
   }
 
@@ -781,9 +800,16 @@
                       _("`%s' is not a valid port number!\n"), hostport);
           continue;
         }
-        gtk_list_store_insert_with_values (ls, &iter, 0, 0, sld, 1,
-                                           (guint) local_port, 2,
-                                           (guint) host_port, 3, hostname, 4,
+        gtk_list_store_insert_with_values (ls, &iter, 0,
+                                           GNUNET_GTK_SETUP_GNS_MC_HOSTNAME,
+                                           sld,
+                                           GNUNET_GTK_SETUP_GNS_MC_SOURCEPORT,
+                                           (guint) local_port,
+                                           GNUNET_GTK_SETUP_GNS_MC_TARGETPORT,
+                                           (guint) host_port,
+                                           GNUNET_GTK_SETUP_GNS_MC_TARGETHOSTNAME,
+                                           hostname,
+                                           GNUNET_GTK_SETUP_GNS_MC_ISUDP,
                                            (TRUE == udp) ? "udp" : "tcp", -1);
       }
       GNUNET_free (cpy);
@@ -916,8 +942,13 @@
   if (TRUE == gtk_tree_model_get_iter_first (tm, &iter))
     do
     {
-      gtk_tree_model_get (tm, &iter, 0, &hostname, 1, &srcport, 2, &targetport,
-                          3, &targethost, 4, &tcpudp, -1);
+      gtk_tree_model_get (tm, &iter,
+                          GNUNET_GTK_SETUP_GNS_MC_HOSTNAME, &hostname,
+                          GNUNET_GTK_SETUP_GNS_MC_SOURCEPORT, &srcport,
+                          GNUNET_GTK_SETUP_GNS_MC_TARGETPORT, &targetport,
+                          GNUNET_GTK_SETUP_GNS_MC_TARGETHOSTNAME, &targethost,
+                          GNUNET_GTK_SETUP_GNS_MC_ISUDP, &tcpudp,
+                          -1);
       if (0 != strlen (hostname))
       {
         pos = head;
@@ -1025,7 +1056,7 @@
     GNUNET_break (0);
     return;
   }
-  gtk_tree_model_get (tm, &iter, 0, &old, -1);
+  gtk_tree_model_get (tm, &iter, GNUNET_GTK_SETUP_GNS_MC_HOSTNAME, &old, -1);
   if ((0 != strlen (old)) && (0 == strlen (new_text)))
   {
     /* deletion */
@@ -1036,7 +1067,8 @@
     return;
   }
   /* update model */
-  gtk_list_store_set (ls, &iter, 0, new_text, -1);
+  gtk_list_store_set (ls, &iter,
+                      GNUNET_GTK_SETUP_GNS_MC_HOSTNAME, new_text, -1);
   /* update configuration */
   update_vpn_dns_configuration (tm);
   if ((0 == strlen (old)) && (0 != strlen (new_text)))
@@ -1126,7 +1158,7 @@
     return;
   }
   /* update model */
-  gtk_list_store_set (ls, &iter, 4, new_text, -1);
+  gtk_list_store_set (ls, &iter, GNUNET_GTK_SETUP_GNS_MC_ISUDP, new_text, -1);
   /* update configuration */
   update_vpn_dns_configuration (tm);
 }
@@ -1210,7 +1242,8 @@
     return;
   }
   /* update model */
-  gtk_list_store_set (ls, &iter, 1, (guint) port, -1);
+  gtk_list_store_set (ls, &iter,
+                      GNUNET_GTK_SETUP_GNS_MC_SOURCEPORT, (guint) port, -1);
   /* update configuration */
   update_vpn_dns_configuration (tm);
 }
@@ -1289,7 +1322,8 @@
     return;
   }
   /* update model */
-  gtk_list_store_set (ls, &iter, 3, new_text, -1);
+  gtk_list_store_set (ls, &iter,
+                      GNUNET_GTK_SETUP_GNS_MC_TARGETHOSTNAME, new_text, -1);
   /* update configuration */
   update_vpn_dns_configuration (tm);
 }
Index: src/gns/gnunet-gns-gtk.c
===================================================================
--- src/gns/gnunet-gns-gtk.c	(revision 20790)
+++ src/gns/gnunet-gns-gtk.c	(working copy)
@@ -27,7 +27,77 @@
 #include "gnunet-gns-gtk.h"
 #include <gnunet/gnunet_namestore_service.h>
 
+
 /**
+ * Columns in the gns model.
+ */
+enum GNS_ModelColumns
+  {
+    /**
+     * A gchararray
+     */
+    GNS_MC_NAME = 0,
+
+    /**
+     * A gboolean
+     */
+    GNS_MC_IS_PUBLIC = 1,
+
+    /**
+     * A guint
+     */
+    GNS_MC_RECORD_TYPE = 2,
+
+    /**
+     * A gchararray
+     */
+    GNS_MC_RECORD_TYPE_AS_STRING = 3,
+
+    /**
+     * A guint64
+     */
+    GNS_MC_EXPIRATION_TIME = 4,
+
+    /**
+     * A gboolean
+     */
+    GNS_MC_EXPIRATION_TIME_IS_RELATIVE = 5,
+
+    /**
+     * A gchararray
+     */
+    GNS_MC_EXPIRATION_TIME_AS_STRING = 6,
+
+    /**
+     * A gchararray
+     */
+    GNS_MC_VALUE_AS_STRING = 7,
+
+    /**
+     * A gchararray
+     */
+    GNS_MC_VALUE_COLOR = 8,
+  };
+
+
+/**
+ * Columns in the gns type model.
+ */
+enum GNS_TypeModelColumns
+  {
+    /**
+     * A guint
+     */
+    GNS_TYPE_MC_TYPE  = 0,
+
+    /**
+     * A gchararray
+     */
+    GNS_TYPE_MC_TYPENAME = 1,
+  };
+
+
+/**
  * Handle to our main loop.
  */
 static struct GNUNET_GTK_MainLoop *ml;
Index: src/fs/gnunet-fs-gtk.h
===================================================================
--- src/fs/gnunet-fs-gtk.h	(revision 20790)
+++ src/fs/gnunet-fs-gtk.h	(working copy)
@@ -60,7 +60,116 @@
   gulong ns_manager_delete_handler_id;
 };
 
+
 /**
+ * Columns in the search namespace model.
+ */
+enum GNUNET_GTK_FS_MAIN_WINDOW_SearchNamespaceModelColumns
+  {
+    /**
+     * A gchararray.
+     */
+    GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_NAME = 0,
+
+    /**
+     * A gpointer.
+     */
+    GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_KEY = 1,
+    
+    /**
+     * A gchararray.
+     */
+    GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_ROOT = 2,
+    
+    /**
+     * A gchararray.
+     */
+    GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_TOOLTIP = 3,
+  };
+
+
+/**
+ * Columns in the meta data model.
+ */
+enum GNUNET_GTK_FS_MAIN_WINDOW_MetaDataModelColumns
+  {
+    /**
+     * A guint.
+     */
+    GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_TYPE = 0,
+
+    /**
+     * A guint.
+     */
+    GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_FORMAT = 1,
+    
+    /**
+     * A gchararray.
+     */
+    GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_TYPE_STRING = 2,
+    
+    /**
+     * A gchararray.
+     */
+    GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_VALUE = 3,
+  };
+
+
+/**
+ * Columns in the anonymity level model.
+ */
+enum GNUNET_GTK_FS_MAIN_WINDOW_AnonymityLevelModelColumns
+  {
+    /**
+     * A gchararray.
+     */
+    GNUNET_GTK_FS_MAIN_WINDOW_ANONYMITY_LEVEL_MC_NAME = 0,
+
+    /**
+     * A guint.
+     */
+    GNUNET_GTK_FS_MAIN_WINDOW_ANONYMITY_LEVEL_MC_LEVEL = 1,
+    
+    /**
+     * A gchararray.
+     */
+    GNUNET_GTK_FS_MAIN_WINDOW_ANONYMITY_LEVEL_MC_COLOR = 2,
+  };
+
+
+/**
+ * Columns in the search mime model.
+ */
+enum GNUNET_GTK_FS_MAIN_WINDOW_SearchMimeModelColumns
+  {
+    /**
+     * A gchararray.
+     */
+    GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_MIME_MC_MIME = 0,
+
+    /**
+     * A gchararray.
+     */
+    GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_MIME_MC_TYPE = 1,
+
+    /**
+     * A gchararray.
+     */
+    GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_MIME_MC_EXTENSION = 2,
+
+    /**
+     * A gchararray.
+     */
+    GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_MIME_MC_LOSSYNESS = 3,
+
+    /**
+     * A gchararray.
+     */
+    GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_MIME_MC_FREEDOM = 4,
+  };
+
+
+/**
  * Get our configuration.
  */
 const struct GNUNET_CONFIGURATION_Handle *
Index: src/fs/gnunet-fs-gtk_publish-edit-dialog.c
===================================================================
--- src/fs/gnunet-fs-gtk_publish-edit-dialog.c	(revision 20790)
+++ src/fs/gnunet-fs-gtk_publish-edit-dialog.c	(working copy)
@@ -30,6 +30,99 @@
 
 
 /**
+ * Columns in the publication metadata model.
+ */
+enum PUBLISH_MetadataModelColumns
+  {
+    /**
+     * A guint.
+     */
+    PUBLISH_METADATA_MC_TYPE = 0,
+
+    /**
+     * A guint.
+     */
+    PUBLISH_METADATA_MC_FORMAT = 1,
+
+    /**
+     * A gchararray.
+     */
+    PUBLISH_METADATA_MC_TYPE_NAME = 2,
+
+    /**
+     * A gchararray.
+     */
+    PUBLISH_METADATA_MC_VALUE = 3,
+
+    /**
+     * A gchararray.
+     */
+    PUBLISH_METADATA_MC_DESCRIPTION = 4,
+  };
+
+
+/**
+ * Columns in the publication metadata types model.
+ */
+enum PUBLISH_MetadataTypesModelColumns
+  {
+    /**
+     * A gint.
+     */
+    PUBLISH_METADATA_TYPES_MC_TYPE = 0,
+
+    /**
+     * A gint.
+     */
+    PUBLISH_METADATA_TYPES_MC_FORMAT = 1,
+
+    /**
+     * A gchararray.
+     */
+    PUBLISH_METADATA_TYPES_MC_TYPE_NAME = 2,
+
+    /**
+     * A gchararray.
+     */
+    PUBLISH_METADATA_TYPES_MC_DESCRIPTION = 3,
+  };
+
+
+/**
+ * Columns in the publication types model.
+ */
+enum PUBLISH_TypesModelColumns
+  {
+    /**
+     * A gint.
+     */
+    PUBLISH_TYPES_MC_TYPE = 0,
+
+    /**
+     * A gchararray.
+     */
+    PUBLISH_TYPES_MC_TYPE_NAME = 1,
+  };
+
+
+/**
+ * Columns in the publication keywords model.
+ */
+enum PUBLISH_KeywordsModelColumns
+  {
+    /**
+     * A gchararray.
+     */
+    PUBLISH_TYPES_MC_KEYWORD = 0,
+
+    /**
+     * A gboolean.
+     */
+    PUBLISH_TYPES_MC_ADDED = 1,
+  };
+
+
+/**
  * Internal state kept for each "edit" dialog where the user can edit
  * publishing information for a file.
  */
@@ -215,12 +308,18 @@
   for (i = 0; types[code][i] != EXTRACTOR_METATYPE_RESERVED; i++)  
     if ( (types[code][i] < max_type) && (types[code][i] > 0) )
       gtk_list_store_insert_with_values (ctx->metatypes_liststore, 
-					 &iter, G_MAXINT, 
-					 0, types[code][i], 
-					 1, EXTRACTOR_METAFORMAT_UTF8, 
-					 2, EXTRACTOR_metatype_to_string (types [code][i]), 
-					 3, EXTRACTOR_metatype_to_description (types[code][i]), 
-					 -1);  
+                                         &iter, G_MAXINT, 
+                                         PUBLISH_METADATA_TYPES_MC_TYPE,
+                                         types[code][i], 
+                                         PUBLISH_METADATA_TYPES_MC_FORMAT,
+                                         EXTRACTOR_METAFORMAT_UTF8, 
+                                         PUBLISH_METADATA_TYPES_MC_TYPE_NAME,
+                                         EXTRACTOR_metatype_to_string
+                                         (types [code][i]),
+                                         PUBLISH_METADATA_TYPES_MC_DESCRIPTION,
+                                         EXTRACTOR_metatype_to_description
+                                         (types[code][i]), 
+                                         -1);  
 }
 
 
@@ -241,7 +340,8 @@
 
   if (! gtk_combo_box_get_active_iter (widget, &iter))
     return;
-  gtk_tree_model_get (GTK_TREE_MODEL (ctx->pubtypes_liststore), &iter, 0, &code, -1);
+  gtk_tree_model_get (GTK_TREE_MODEL (ctx->pubtypes_liststore), &iter,
+                      PUBLISH_TYPES_MC_TYPE, &code, -1);
   change_metatypes (ctx, code);
 }
 
@@ -301,11 +401,13 @@
   }
   type_id = ctx->meta_combo_selected_type_id;
   ctx->meta_combo_selected_type_id = -1;
-  gtk_list_store_set (ctx->meta_liststore, &iter, 
-		      0, type_id, 
-		      1, EXTRACTOR_METAFORMAT_UTF8, 
-		      2, EXTRACTOR_metatype_to_string (type_id),
-		      4, EXTRACTOR_metatype_to_description (type_id),
+  gtk_list_store_set (ctx->meta_liststore, &iter,
+                      PUBLISH_METADATA_MC_TYPE, type_id,
+                      PUBLISH_METADATA_MC_FORMAT, EXTRACTOR_METAFORMAT_UTF8,
+                      PUBLISH_METADATA_MC_TYPE_NAME,
+                      EXTRACTOR_metatype_to_string (type_id),
+                      PUBLISH_METADATA_MC_DESCRIPTION,
+                      EXTRACTOR_metatype_to_description (type_id),
                       -1);
 }
 
@@ -334,8 +436,8 @@
   g_object_get (combo,
 		"model", &combo_model, NULL);
   gtk_tree_model_get (combo_model, new_iter,
-		      0, &type_id,
-		      -1);
+                      PUBLISH_METADATA_MC_TYPE, &type_id,
+                      -1);
   ctx->meta_combo_selected_type_id = type_id;
 }
 
@@ -373,7 +475,7 @@
   }
 
   gtk_tree_model_get (GTK_TREE_MODEL (ctx->meta_liststore), &iter, 
-		      0, &metatype, -1);
+                      PUBLISH_METADATA_MC_TYPE, &metatype, -1);
   if (metatype == EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME) 
   {
     /* apply filename rules */
@@ -413,8 +515,8 @@
     avalue = NULL;
   }
   gtk_list_store_set (ctx->meta_liststore, &iter, 
-		      3, ivalue, 
-		      -1);
+                      PUBLISH_METADATA_MC_VALUE, ivalue, 
+                      -1);
   GNUNET_free_non_null (avalue);
 }
 
@@ -434,13 +536,16 @@
   GtkTreeIter iter;
 
   gtk_list_store_insert_with_values (ctx->meta_liststore,
-				     &iter, 0,
-				     0, 0,
-				     1, EXTRACTOR_METAFORMAT_UTF8, 
-				     2, _("Select a type"), 
-				     3, _("Specify a value"), 
-				     4, NULL, 
-				     -1);
+                                     &iter, 0,
+                                     PUBLISH_METADATA_MC_TYPE, 0,
+                                     PUBLISH_METADATA_MC_FORMAT,
+                                     EXTRACTOR_METAFORMAT_UTF8,
+                                     PUBLISH_METADATA_MC_TYPE_NAME,
+                                     _("Select a type"),
+                                     PUBLISH_METADATA_MC_VALUE,
+                                     _("Specify a value"),
+                                     PUBLISH_METADATA_MC_DESCRIPTION, NULL,
+                                     -1);
 }
 
 
@@ -608,10 +713,10 @@
   if (strlen (keyword) == 0)
     return;
   gtk_list_store_insert_with_values (ctx->keywords_liststore, 
-				     &iter, G_MAXINT,
-				     0, keyword,
-				     1, TRUE,
-				     -1);
+                                     &iter, G_MAXINT,
+                                     PUBLISH_TYPES_MC_KEYWORD, keyword,
+                                     PUBLISH_TYPES_MC_ADDED, TRUE,
+                                     -1);
   gtk_entry_set_text (ctx->keyword_entry, "");
   update_confirm_sensitivity (ctx);
 }
@@ -731,7 +836,11 @@
     {
       do
       {
-        gtk_tree_model_get (GTK_TREE_MODEL (ctx->meta_liststore), &iter, 0, &ntype, 1, &nformat, 3, &value, -1);
+        gtk_tree_model_get (GTK_TREE_MODEL (ctx->meta_liststore), &iter,
+                            PUBLISH_METADATA_MC_TYPE, &ntype,
+                            PUBLISH_METADATA_MC_FORMAT, &nformat,
+                            PUBLISH_METADATA_MC_VALUE, &value,
+                            -1);
         if ((ntype == type) && (nformat == format) &&
             (0 == strcmp (value, data)))
         {
@@ -809,7 +918,9 @@
     {
       gchar *value;
 
-      gtk_tree_model_get (GTK_TREE_MODEL (ctx->keywords_liststore), &iter, 0, &value, -1);
+      gtk_tree_model_get (GTK_TREE_MODEL (ctx->keywords_liststore), &iter,
+                          PUBLISH_TYPES_MC_KEYWORD, &value,
+                          -1);
       if (NULL == *uri)
 	*uri = GNUNET_FS_uri_ksk_create_from_args (1, (const char **) &value);
       else
@@ -840,7 +951,11 @@
       guint nformat;
       gchar *value;
 
-      gtk_tree_model_get (GTK_TREE_MODEL (ctx->meta_liststore), &iter, 0, &ntype, 1, &nformat, 3, &value, -1);
+      gtk_tree_model_get (GTK_TREE_MODEL (ctx->meta_liststore), &iter,
+                          PUBLISH_METADATA_MC_TYPE, &ntype,
+                          PUBLISH_METADATA_MC_FORMAT, &nformat,
+                          PUBLISH_METADATA_MC_VALUE, &value,
+                          -1);
       if (ntype > 0)
       {
         GNUNET_CONTAINER_meta_data_insert (meta, "<user>", ntype, nformat,
@@ -941,8 +1056,8 @@
 
   ls = GTK_LIST_STORE (cls);
   gtk_list_store_insert_with_values (ls, &iter, G_MAXINT,
-				     0, keyword, 
-				     1, FALSE,
+                                     PUBLISH_TYPES_MC_KEYWORD, keyword,
+                                     PUBLISH_TYPES_MC_ADDED, FALSE,
                                      -1);
   return GNUNET_OK;
 }
@@ -1154,7 +1269,8 @@
                      (ctx->builder, "GNUNET_GTK_edit_publication_type_combo"));
   if (gtk_combo_box_get_active_iter (pubtypes_combo, &iter))
   {
-    gtk_tree_model_get (GTK_TREE_MODEL (ctx->pubtypes_liststore), &iter, 0, &code, -1);
+    gtk_tree_model_get (GTK_TREE_MODEL (ctx->pubtypes_liststore), &iter,
+                        PUBLISH_TYPES_MC_TYPE, &code, -1);
     change_metatypes (ctx, 0);
   }
   else
Index: src/fs/gnunet-fs-gtk_common.c
===================================================================
--- src/fs/gnunet-fs-gtk_common.c	(revision 20790)
+++ src/fs/gnunet-fs-gtk_common.c	(working copy)
@@ -106,9 +106,16 @@
   data_to_insert = GNUNET_FS_GTK_dubious_meta_to_utf8 (format, data, data_len);
   if (NULL == data_to_insert)
     return 0;
-  gtk_list_store_insert_with_values (ls, NULL, G_MAXINT, 0, type, 1, format,
-				     2, EXTRACTOR_metatype_to_string (type),
-				     3, data_to_insert, -1);
+  gtk_list_store_insert_with_values (ls, NULL, G_MAXINT,
+                                     GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_TYPE,
+                                     type,
+                                     GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_FORMAT,
+                                     format,
+                                     GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_TYPE_STRING,
+                                     EXTRACTOR_metatype_to_string (type),
+                                     GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_VALUE,
+                                     data_to_insert,
+                                     -1);
   GNUNET_free (data_to_insert); 
   return 0;
 }
@@ -353,16 +360,18 @@
       return;
     }
     gtk_tree_model_get (namespace_treestore, &iter,
-			1, &nsid,
-			-1);
+                        GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_KEY,
+                        &nsid,
+                        -1);
     while ( ( (NULL == nsid) ||
 	      (0 != memcmp (nsid,
 			    &want,
 			    sizeof (GNUNET_HashCode))) ) &&
 	    (gtk_tree_model_iter_next (namespace_treestore, &iter)) )
       gtk_tree_model_get (namespace_treestore, &iter,
-			  1, &nsid,
-			  -1);
+                          GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_KEY,
+                          &nsid,
+                          -1);
     if ( (NULL == nsid) ||
 	 (0 != memcmp (nsid,
 		       &want,
@@ -376,7 +385,9 @@
 				    (namespace_tree), &iter);
     treepath = gtk_tree_model_get_path (namespace_treestore, 
 					&iter);
-    if (GNUNET_GTK_get_tree_string (namespace_tree, treepath, 0, &value))
+    if (GNUNET_GTK_get_tree_string (namespace_tree, treepath,
+                                    GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_NAME,
+                                    &value))
       gtk_label_set_text (sel_namespace_label, value);
     gtk_tree_path_free (treepath);          
 
@@ -401,7 +412,9 @@
       gtk_tree_selection_select_iter (gtk_tree_view_get_selection
 				      (namespace_tree), &iter);
       treepath = gtk_tree_model_get_path (namespace_treestore, &iter);
-      if (GNUNET_GTK_get_tree_string (namespace_tree, treepath, 0, &value))
+      if (GNUNET_GTK_get_tree_string (namespace_tree, treepath,
+                                      GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_NAME,
+                                      &value))
 	gtk_label_set_text (sel_namespace_label, value);
       gtk_tree_path_free (treepath);      
     }
Index: src/fs/gnunet-fs-gtk_anonymity-widgets.c
===================================================================
--- src/fs/gnunet-fs-gtk_anonymity-widgets.c	(revision 20790)
+++ src/fs/gnunet-fs-gtk_anonymity-widgets.c	(working copy)
@@ -23,6 +23,7 @@
  * @author Christian Grothoff
  * @brief operations to manage user's anonymity level selections
  */
+#include "gnunet-fs-gtk.h"
 #include "gnunet-fs-gtk_common.h"
 #include "gnunet-fs-gtk_anonymity-widgets.h"
 #include <gdk/gdk.h>
@@ -112,7 +113,10 @@
   model = gtk_combo_box_get_model (combo);
   if (!model)
     return FALSE;
-  gtk_tree_model_get (model, &iter, 1, &level, -1);
+  gtk_tree_model_get (model, &iter,
+                      GNUNET_GTK_FS_MAIN_WINDOW_ANONYMITY_LEVEL_MC_LEVEL,
+                      &level,
+                      -1);
   if (p_level)
     *p_level = level;
   return TRUE;
@@ -161,7 +165,10 @@
     return FALSE;
   do
   {
-    gtk_tree_model_get (model, &iter, 1, &level, -1);
+    gtk_tree_model_get (model, &iter,
+                        GNUNET_GTK_FS_MAIN_WINDOW_ANONYMITY_LEVEL_MC_LEVEL,
+                        &level,
+                        -1);
     if (level == sel_level)
     {
       gtk_combo_box_set_active_iter (combo, &iter);
Index: src/fs/gnunet-fs-gtk_main-window-search.c
===================================================================
--- src/fs/gnunet-fs-gtk_main-window-search.c	(revision 20790)
+++ src/fs/gnunet-fs-gtk_main-window-search.c	(working copy)
@@ -62,7 +62,10 @@
     mime_keyword = NULL;
     if ( (NULL != mime_model) && 
 	 gtk_combo_box_get_active_iter (mime_combo, &iter))
-      gtk_tree_model_get (mime_model, &iter, 0, &mime_keyword, -1);
+      gtk_tree_model_get (mime_model, &iter,
+                          GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_MIME_MC_MIME,
+                          &mime_keyword,
+                          -1);
     if ( (NULL != mime_keyword) &&
 	 (0 == strcmp (mime_keyword, " ")) )
     {
@@ -87,7 +90,10 @@
       namespace_treepath = gtk_tree_row_reference_get_path (ref);
       if ( (NULL != namespace_treepath) &&
 	   (gtk_tree_model_get_iter (namespace_model, &iter, namespace_treepath)))
-	gtk_tree_model_get (namespace_model, &iter, 1, &nsid, -1);
+        gtk_tree_model_get (namespace_model, &iter,
+                            GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_MIME_MC_TYPE,
+                            &nsid,
+                            -1);
     }
   }
    
Index: src/fs/gnunet-fs-gtk_event-handler.c
===================================================================
--- src/fs/gnunet-fs-gtk_event-handler.c	(revision 20790)
+++ src/fs/gnunet-fs-gtk_event-handler.c	(working copy)
@@ -29,7 +29,137 @@
 #include "gnunet-fs-gtk_event-handler.h"
 #include "gnunet-fs-gtk_unindex.h"
 
+
 /**
+ * Columns in the file sharing result model.
+ */
+enum SEARCH_TAB_ModelColumns
+  {
+    /**
+     * A gpointer.
+     */
+    SEARCH_TAB_MC_METADATA = 0,
+
+    /**
+     * A gpointer.
+     */
+    SEARCH_TAB_MC_URI = 1,
+
+    /**
+     * A guint64.
+     */
+    SEARCH_TAB_MC_FILESIZE = 2,
+
+    /**
+     * A GdkPixbuf.
+     */
+    SEARCH_TAB_MC_PREVIEW = 3,
+
+    /**
+     * A guint.
+     */
+    SEARCH_TAB_MC_PERCENT_PROGRESS = 4,
+
+    /**
+     * A guint.
+     */
+    SEARCH_TAB_MC_PERCENT_AVAILABILITY = 5,
+
+    /**
+     * A gchararray.
+     */
+    SEARCH_TAB_MC_FILENAME = 6,
+
+    /**
+     * A gchararray.
+     */
+    SEARCH_TAB_MC_URI_AS_STRING = 7,
+
+    /**
+     * A gchararray.
+     */
+    SEARCH_TAB_MC_STATUS_COLOUR = 8,
+
+    /**
+     * A gpointer.
+     */
+    SEARCH_TAB_MC_SEARCH_RESULT = 9,
+
+    /**
+     * A gchararray.
+     */
+    SEARCH_TAB_MC_MIMETYPE = 10,
+
+    /**
+     * A guint.
+     */
+    SEARCH_TAB_MC_APPLICABILITY_RANK = 11,
+
+    /**
+     * A guint.
+     */
+    SEARCH_TAB_MC_AVAILABILITY_CERTAINTY = 12,
+
+    /**
+     * A gint.
+     */
+    SEARCH_TAB_MC_AVAILABILITY_RANK = 13,
+
+    /**
+     * A guint64.
+     */
+    SEARCH_TAB_MC_COMPLETED = 14,
+
+    /**
+     * A gchararray.
+     */
+    SEARCH_TAB_MC_DOWNLOADED_FILENAME = 15,
+
+    /**
+     * A gint.
+     */
+    SEARCH_TAB_MC_DOWNLOADED_ANONYMITY = 16,
+  };
+
+
+/**
+ * Columns in the publish frame model.
+ */
+enum PUBLISH_TAB_ModelColumns
+  {
+    /**
+     * A gchararray.
+     */
+    PUBLISH_TAB_MC_FILENAME = 0,
+
+    /**
+     * A gchararray.
+     */
+    PUBLISH_TAB_MC_FILESIZE = 1,
+
+    /**
+     * A gchararray.
+     */
+    PUBLISH_TAB_MC_BGCOLOUR = 2,
+
+    /**
+     * A guint.
+     */
+    PUBLISH_TAB_MC_PROGRESS = 3,
+
+    /**
+     * A gpointer.
+     */
+    PUBLISH_TAB_MC_ENT = 4,
+
+    /**
+     * A gchararray.
+     */
+    PUBLISH_TAB_MC_RESULT_STRING = 5,
+  };
+
+
+/**
  * We have a single tab where we display publishing operations.
  * So there is only one instance of this struct.
  */ 
@@ -190,10 +320,12 @@
 
   /* FIXME-BUG-MAYBE: this function is likely responsible for not always
      suggesting the best filename... To be investigated some more... */
-  gtk_tree_model_get (tm, iter, 0, &meta, 
-		      15, &local_filename, 
-		      16, &downloaded_anonymity, 
-		      -1);  
+  gtk_tree_model_get (tm, iter,
+                      SEARCH_TAB_MC_METADATA, &meta, 
+                      SEARCH_TAB_MC_DOWNLOADED_FILENAME, &local_filename, 
+                      SEARCH_TAB_MC_DOWNLOADED_ANONYMITY,
+                      &downloaded_anonymity, 
+                      -1);  
   if (GNUNET_NO == top)
   {
     if (NULL != local_filename)
@@ -305,7 +437,11 @@
     GNUNET_break (0);
     return;
   }
-  gtk_tree_model_get (tm, &iter, 0, &meta, 1, &uri, 9, &sr, -1);
+  gtk_tree_model_get (tm, &iter,
+                      SEARCH_TAB_MC_METADATA, &meta,
+                      SEARCH_TAB_MC_URI, &uri,
+                      SEARCH_TAB_MC_SEARCH_RESULT, &sr,
+                      -1);
   if (NULL == uri)
   {
     /* user clicked on directory that was opened (not downloaded!), so we
@@ -463,7 +599,8 @@
     GNUNET_break (0);
     return;
   }
-  gtk_tree_model_get (tm, &iter, 1, &uri, -1);
+  gtk_tree_model_get (tm, &iter,
+                      SEARCH_TAB_MC_URI, &uri, -1);
   if (NULL == uri)
   {
     /* user clicked on directory that was opened (not downloaded!), so we
@@ -598,7 +735,8 @@
     gtk_tree_path_free (path);
     return;
   }
-  gtk_tree_model_get (tm, &iter, 1, &uri, -1);
+  gtk_tree_model_get (tm, &iter,
+                      SEARCH_TAB_MC_URI, &uri, -1);
   gtk_tree_path_free (path);
   if (uri == NULL)
   {
@@ -643,7 +781,10 @@
   path = gtk_tree_model_get_path (tm, iter);
   spc->rr = gtk_tree_row_reference_new (tm, path);
   gtk_tree_path_free (path);
-  gtk_tree_model_get (tm, iter, 1, &uri, 9, &sr, -1);
+  gtk_tree_model_get (tm, iter,
+                      SEARCH_TAB_MC_URI, &uri,
+                      SEARCH_TAB_MC_SEARCH_RESULT, &sr,
+                      -1);
   spc->sr = sr;
   menu = GTK_MENU (gtk_menu_new ());
   if ( (NULL == sr->download) &&
@@ -882,25 +1023,28 @@
     return;
   do
   {
-    gtk_tree_model_get (src_model, &src_child, 
-			0, &meta, 
-			1, &uri, 
-			2, &filesize, 
-			3, &preview,
-			4, &percent_progress, 
-			5, &percent_availability, 
-			6, &filename, 
-			7, &uri_as_string, 
-			8, &status_colour,
-			9, &search_result_old,
-			10, &mimetype, 
-			11, &applicability_rank, 
-			12, &availability_certainty, 
-			13, &availability_rank, 
-			14, &completed, 
-			15, &downloaded_filename, 
-			16, &downloaded_anonymity, 
-			-1);
+    gtk_tree_model_get (src_model, &src_child,
+                        SEARCH_TAB_MC_METADATA, &meta,
+                        SEARCH_TAB_MC_URI, &uri,
+                        SEARCH_TAB_MC_FILESIZE, &filesize,
+                        SEARCH_TAB_MC_PREVIEW, &preview,
+                        SEARCH_TAB_MC_PERCENT_PROGRESS, &percent_progress,
+                        SEARCH_TAB_MC_PERCENT_AVAILABILITY,
+                        &percent_availability,
+                        SEARCH_TAB_MC_FILENAME, &filename,
+                        SEARCH_TAB_MC_URI_AS_STRING, &uri_as_string,
+                        SEARCH_TAB_MC_STATUS_COLOUR, &status_colour,
+                        SEARCH_TAB_MC_SEARCH_RESULT, &search_result_old,
+                        SEARCH_TAB_MC_MIMETYPE, &mimetype,
+                        SEARCH_TAB_MC_APPLICABILITY_RANK, &applicability_rank,
+                        SEARCH_TAB_MC_AVAILABILITY_CERTAINTY,
+                        &availability_certainty,
+                        SEARCH_TAB_MC_AVAILABILITY_RANK, &availability_rank,
+                        SEARCH_TAB_MC_COMPLETED, &completed,
+                        SEARCH_TAB_MC_DOWNLOADED_FILENAME, &downloaded_filename,
+                        SEARCH_TAB_MC_DOWNLOADED_ANONYMITY,
+                        &downloaded_anonymity,
+                        -1);
     search_result_new = GNUNET_malloc (sizeof (struct SearchResult));
     search_result_new->tab = dst_tab;
     search_result_new->download = search_result_old->download;
@@ -910,25 +1054,37 @@
       search_result_new->download->sr = search_result_new;
     }
     gtk_tree_store_insert_with_values (dst_tab->ts, &dst_child,
-				       dst_iter, G_MAXINT, 
-				       0, GNUNET_CONTAINER_meta_data_duplicate (meta), 
-				       1, GNUNET_FS_uri_dup (uri), 
-				       2, filesize, 
-				       3, preview, 
-				       4, percent_progress, 
-				       5, percent_availability, 
-				       6, filename, 
-				       7, uri_as_string, 
-				       8, status_colour, 
-				       9, search_result_new, 
-				       10, mimetype,
-				       11, applicability_rank, 
-				       12, availability_certainty, 
-				       13, availability_rank, 
-				       14, completed, 
-				       15, downloaded_filename,
-				       16, downloaded_anonymity, 
-				       -1);
+                                       dst_iter, G_MAXINT,
+                                       SEARCH_TAB_MC_METADATA,
+                                       GNUNET_CONTAINER_meta_data_duplicate (meta),
+                                       SEARCH_TAB_MC_URI,
+                                       GNUNET_FS_uri_dup (uri),
+                                       SEARCH_TAB_MC_SEARCH_RESULT, filesize,
+                                       SEARCH_TAB_MC_PREVIEW, preview,
+                                       SEARCH_TAB_MC_PERCENT_PROGRESS,
+                                       percent_progress,
+                                       SEARCH_TAB_MC_PERCENT_AVAILABILITY,
+                                       percent_availability,
+                                       SEARCH_TAB_MC_FILENAME, filename,
+                                       SEARCH_TAB_MC_URI_AS_STRING,
+                                       uri_as_string,
+                                       SEARCH_TAB_MC_STATUS_COLOUR,
+                                       status_colour,
+                                       SEARCH_TAB_MC_SEARCH_RESULT,
+                                       search_result_new,
+                                       SEARCH_TAB_MC_MIMETYPE, mimetype,
+                                       SEARCH_TAB_MC_APPLICABILITY_RANK,
+                                       applicability_rank,
+                                       SEARCH_TAB_MC_AVAILABILITY_CERTAINTY,
+                                       availability_certainty,
+                                       SEARCH_TAB_MC_AVAILABILITY_RANK,
+                                       availability_rank,
+                                       SEARCH_TAB_MC_COMPLETED, completed,
+                                       SEARCH_TAB_MC_DOWNLOADED_FILENAME,
+                                       downloaded_filename,
+                                       SEARCH_TAB_MC_DOWNLOADED_ANONYMITY,
+                                       downloaded_anonymity,
+                                       -1);
     g_free (filename);
     g_free (downloaded_filename);
     g_free (uri_as_string);
@@ -985,19 +1141,20 @@
   }
   gtk_tree_path_free (path);
   gtk_tree_model_get (tm_old, &iter_old, 
-		      0, &meta,
-		      1, &uri,
-		      4, &percent_progress, 
-		      5, &percent_availability, 
-		      6, &filename, 
-		      8, &status_colour,
-		      11, &applicability_rank, 
-		      12, &availability_certainty, 
-		      13, &availability_rank, 
-		      14, &completed, 
-		      15, &downloaded_filename, 
-		      16, &downloaded_anonymity, 
-		      -1);
+                      SEARCH_TAB_MC_METADATA, &meta,
+                      SEARCH_TAB_MC_URI, &uri,
+                      SEARCH_TAB_MC_PERCENT_PROGRESS, &percent_progress, 
+                      SEARCH_TAB_MC_PERCENT_AVAILABILITY, &percent_availability,
+                      SEARCH_TAB_MC_FILENAME, &filename,
+                      SEARCH_TAB_MC_STATUS_COLOUR, &status_colour,
+                      SEARCH_TAB_MC_APPLICABILITY_RANK, &applicability_rank,
+                      SEARCH_TAB_MC_AVAILABILITY_CERTAINTY,
+                      &availability_certainty,
+                      SEARCH_TAB_MC_AVAILABILITY_RANK, &availability_rank,
+                      SEARCH_TAB_MC_COMPLETED, &completed,
+                      SEARCH_TAB_MC_DOWNLOADED_FILENAME, &downloaded_filename,
+                      SEARCH_TAB_MC_DOWNLOADED_ANONYMITY, &downloaded_anonymity,
+                      -1);
   GNUNET_assert (GNUNET_YES == GNUNET_FS_uri_test_equal (uri, de->uri));
   GNUNET_assert (de->sr->download == de);
   de->sr->download = NULL;
@@ -1018,17 +1175,18 @@
   gtk_tree_path_free (path);
 
   gtk_tree_store_set (de->sr->tab->ts, &iter,
-		      4, percent_progress, 
-		      5, percent_availability, 
-		      6, filename, 
-		      8, status_colour, 
-		      11, applicability_rank, 
-		      12, availability_certainty, 
-		      13, availability_rank, 
-		      14, completed, 
-		      15, downloaded_filename,
-		      16, downloaded_anonymity, 
-		      -1);
+                      SEARCH_TAB_MC_PERCENT_PROGRESS, percent_progress,
+                      SEARCH_TAB_MC_PERCENT_AVAILABILITY, percent_availability,
+                      SEARCH_TAB_MC_FILENAME, filename,
+                      SEARCH_TAB_MC_STATUS_COLOUR, status_colour,
+                      SEARCH_TAB_MC_APPLICABILITY_RANK, applicability_rank,
+                      SEARCH_TAB_MC_AVAILABILITY_CERTAINTY,
+                      availability_certainty,
+                      SEARCH_TAB_MC_AVAILABILITY_RANK, availability_rank,
+                      SEARCH_TAB_MC_COMPLETED, completed,
+                      SEARCH_TAB_MC_DOWNLOADED_FILENAME, downloaded_filename,
+                      SEARCH_TAB_MC_DOWNLOADED_ANONYMITY, downloaded_anonymity,
+                      -1);
   g_free (filename);
   g_free (downloaded_filename);
   g_free (status_colour);
@@ -1062,10 +1220,10 @@
     do
     {
       gtk_tree_model_get (tm, &child,
-			  0, &meta,
-			  1, &uri,
-			  9, &sr, 
-			  -1);
+                          SEARCH_TAB_MC_METADATA, &meta,
+                          SEARCH_TAB_MC_URI, &uri,
+                          SEARCH_TAB_MC_SEARCH_RESULT, &sr, 
+                          -1);
       if (NULL != sr->download) 
       {
 	if (sr->download->is_done == GNUNET_YES)
@@ -1088,10 +1246,10 @@
       GNUNET_free (sr);
       /* get ready for removal of the tree */
       gtk_tree_store_set (GTK_TREE_STORE (tm), &child,
-			  0, NULL,
-			  1, NULL,
-			  9, NULL, 
-			  -1);
+                          SEARCH_TAB_MC_METADATA, NULL,
+                          SEARCH_TAB_MC_URI, NULL,
+                          SEARCH_TAB_MC_SEARCH_RESULT, NULL,
+                          -1);
     }
     while (TRUE == gtk_tree_model_iter_next (tm, &child));    
   }
@@ -1133,7 +1291,10 @@
     return;
   }
   gtk_tree_path_free (tp);
-  gtk_tree_model_get (tm, &iter, 0, &meta, 1, &uri, -1);
+  gtk_tree_model_get (tm, &iter,
+                      SEARCH_TAB_MC_METADATA, &meta,
+                      SEARCH_TAB_MC_URI, &uri,
+                      -1);
   if (uri != NULL)
     GNUNET_FS_uri_destroy (uri);
   if (meta != NULL)
@@ -1181,7 +1342,10 @@
   }
   meta = NULL;
   pixbuf = NULL;
-  gtk_tree_model_get (model, &iter, 0, &meta, 3, &pixbuf, -1);
+  gtk_tree_model_get (model, &iter,
+                      SEARCH_TAB_MC_METADATA, &meta,
+                      SEARCH_TAB_MC_PREVIEW, &pixbuf,
+                      -1);
   if (NULL != pixbuf)
   {
     gtk_image_set_from_pixbuf (image, pixbuf);
@@ -1328,7 +1492,9 @@
   {
     do
     {
-      gtk_tree_model_get (tm, &child, 9, &sr, -1);
+      gtk_tree_model_get (tm, &child,
+                          SEARCH_TAB_MC_SEARCH_RESULT, &sr,
+                          -1);
       if ( (NULL != sr->download) &&
 	   (sr->download->is_done == GNUNET_YES) )
       {
@@ -1371,7 +1537,9 @@
     return;
   do
   {    
-    gtk_tree_model_get (tm, &iter, 9, &sr, -1);
+    gtk_tree_model_get (tm, &iter,
+                        SEARCH_TAB_MC_SEARCH_RESULT, &sr,
+                        -1);
     if ( (sr->download != NULL) &&
 	 (sr->download->is_done == GNUNET_YES) )
     {
@@ -1480,7 +1648,9 @@
   desc = GNUNET_FS_GTK_get_description_from_metadata (meta, &desc_is_a_dup);
   mime = get_mimetype_from_metadata (meta);
   pixbuf = GNUNET_FS_GTK_get_thumbnail_from_meta_data (meta);
-  gtk_tree_model_get (tm, &iter, 0, &ometa, -1);
+  gtk_tree_model_get (tm, &iter,
+                      SEARCH_TAB_MC_METADATA, &ometa,
+                      -1);
   if (NULL != ometa)
     GNUNET_CONTAINER_meta_data_destroy (ometa);
   if (availability_certainty > 0)
@@ -1488,13 +1658,18 @@
   else
     percent_avail = 50;
   gtk_tree_store_set (ts, &iter, 
-		      0, GNUNET_CONTAINER_meta_data_duplicate (meta),
-                      3, pixbuf /* preview */ ,
-                      5, (guint) percent_avail /* percent availability */ ,
-                      6, desc /* filename/description */ ,
-                      10, mime, 11, (guint) applicability_rank, 12,
-                      (guint) availability_certainty, 13,
-                      (gint) availability_rank, -1);
+                      SEARCH_TAB_MC_METADATA,
+                      GNUNET_CONTAINER_meta_data_duplicate (meta),
+                      SEARCH_TAB_MC_PREVIEW, pixbuf,
+                      SEARCH_TAB_MC_PERCENT_AVAILABILITY, (guint) percent_avail,
+                      SEARCH_TAB_MC_FILENAME, desc,
+                      SEARCH_TAB_MC_MIMETYPE, mime,
+                      SEARCH_TAB_MC_APPLICABILITY_RANK,
+                      (guint) applicability_rank,
+                      SEARCH_TAB_MC_AVAILABILITY_CERTAINTY,
+                      (guint) availability_certainty,
+                      SEARCH_TAB_MC_AVAILABILITY_RANK, (gint) availability_rank,
+                      -1);
   if (pixbuf != NULL)
     g_object_unref (pixbuf);
   GNUNET_free (desc);
@@ -1615,24 +1790,28 @@
     pitr = NULL;
     ts = tab->ts;
   }
-  gtk_tree_store_insert_with_values (ts, &iter, pitr, G_MAXINT, 
-				     0, GNUNET_CONTAINER_meta_data_duplicate (meta), 
-				     1, (uri == NULL) ? NULL : GNUNET_FS_uri_dup (uri), 
-				     2, fsize, 
-				     3, pixbuf /* preview */ ,
-                                     4, 0 /* percent progress */ ,
-                                     5, (fsize == 0) ? 100 : 0 /* percent availability */ ,
-                                     6, desc /* filename/description */ ,
-                                     7, uris, 
-				     8, status_colour, 
-				     9, sr, 
-				     10, mime,
-                                     11, applicability_rank, 
-				     12, 0 /* avail-cert */ ,
-                                     13, 0, /* avail-rank */
-                                     14, (guint64) 0, /* completed */
-                                     15, NULL, /* downloaded_filename */
-                                     16, -1, /* downloaded_anonymity */
+  gtk_tree_store_insert_with_values (ts, &iter, pitr, G_MAXINT,
+                                     SEARCH_TAB_MC_METADATA,
+                                     GNUNET_CONTAINER_meta_data_duplicate (meta),
+                                     SEARCH_TAB_MC_URI,
+                                     (uri == NULL) ? NULL : GNUNET_FS_uri_dup (uri), 
+                                     SEARCH_TAB_MC_FILESIZE, fsize,
+                                     SEARCH_TAB_MC_PREVIEW, pixbuf,
+                                     SEARCH_TAB_MC_PERCENT_PROGRESS, 0,
+                                     SEARCH_TAB_MC_PERCENT_AVAILABILITY,
+                                     (fsize == 0) ? 100 : 0,
+                                     SEARCH_TAB_MC_FILENAME, desc,
+                                     SEARCH_TAB_MC_URI_AS_STRING, uris,
+                                     SEARCH_TAB_MC_STATUS_COLOUR, status_colour,
+                                     SEARCH_TAB_MC_SEARCH_RESULT, sr,
+                                     SEARCH_TAB_MC_MIMETYPE, mime,
+                                     SEARCH_TAB_MC_APPLICABILITY_RANK,
+                                     applicability_rank,
+                                     SEARCH_TAB_MC_AVAILABILITY_CERTAINTY, 0,
+                                     SEARCH_TAB_MC_AVAILABILITY_RANK, 0,
+                                     SEARCH_TAB_MC_COMPLETED, (guint64) 0,
+                                     SEARCH_TAB_MC_DOWNLOADED_FILENAME, NULL,
+                                     SEARCH_TAB_MC_DOWNLOADED_ANONYMITY, -1,
                                      -1);
   if (pixbuf != NULL)
     g_object_unref (pixbuf);
@@ -1881,7 +2060,9 @@
     return;
   }
   gtk_tree_path_free (path);
-  gtk_tree_store_set (de->sr->tab->ts, &iter, 8, color, -1);
+  gtk_tree_store_set (de->sr->tab->ts, &iter,
+                      SEARCH_TAB_MC_STATUS_COLOUR, color,
+                      -1);
 }
 
 
@@ -1989,7 +2170,7 @@
     {
       do
       {
-        gtk_tree_model_get (tm, &iter, 1, &xuri, -1);
+        gtk_tree_model_get (tm, &iter, SEARCH_TAB_MC_URI, &xuri, -1);
         if (GNUNET_YES == GNUNET_FS_uri_test_equal (xuri, uri))
           return;               /* already present */
       }
@@ -2042,15 +2223,13 @@
      'progress' once the download has started and re-use the
      space in the display? Probably yes, at least once we have
      a custom CellRenderer... */
-  gtk_tree_store_set (de->sr->tab->ts, &iter, 
-		      4, (guint) ((size >
-				   0) ? (100 * completed /
-					 size) : 100) /* progress */,
-		      5, (guint) ((size >
-				   0) ? (100 * completed /
-					 size) : 100) /* availability == progress */,
-                      14, completed, 
-		      -1);
+  gtk_tree_store_set (de->sr->tab->ts, &iter,
+                      SEARCH_TAB_MC_PERCENT_PROGRESS,
+                      (guint) ((size > 0) ?  (100 * completed / size) : 100),
+                      SEARCH_TAB_MC_PERCENT_AVAILABILITY,
+                      (guint) ((size > 0) ?  (100 * completed / size) : 100),
+                      SEARCH_TAB_MC_COMPLETED, completed,
+                      -1);
   if (completed < size)
   {
     /* partial completion, consider looking at the block */
@@ -2070,8 +2249,8 @@
       {
 	/* Mime type was wrong, this is not a directory, update model! */
 	de->is_directory = GNUNET_SYSERR;
-	gtk_tree_store_set (de->sr->tab->ts, &iter, 
-			    10, "" /* unknown mime type */, -1);
+        gtk_tree_store_set (de->sr->tab->ts, &iter, 
+                            SEARCH_TAB_MC_MIMETYPE, "", -1);
       }
     }
   }
@@ -2120,7 +2299,10 @@
     return;
   }
   gtk_tree_path_free (path);
-  gtk_tree_store_set (de->sr->tab->ts, &iter, 4, 0, 7, emsg, -1);
+  gtk_tree_store_set (de->sr->tab->ts, &iter,
+                      SEARCH_TAB_MC_PERCENT_PROGRESS, 0,
+                      SEARCH_TAB_MC_URI_AS_STRING, emsg
+                      -1);
 }
 
 
@@ -2148,9 +2330,9 @@
   }
   gtk_tree_path_free (path);
   gtk_tree_store_set (de->sr->tab->ts, &iter, 
-		      4, (guint) 100,
-		      5, (guint) 100,
-		      -1);
+                      SEARCH_TAB_MC_PERCENT_PROGRESS, (guint) 100,
+                      SEARCH_TAB_MC_PERCENT_AVAILABILITY, (guint) 100,
+                      -1);
 }
 
 
@@ -2229,9 +2411,10 @@
     {
       do
       {
-	gtk_tree_model_get (tm, &child, 1, &uri, 
-			    9, &de->sr,
-			    -1);
+        gtk_tree_model_get (tm, &child,
+                            SEARCH_TAB_MC_URI, &uri,
+                            SEARCH_TAB_MC_SEARCH_RESULT, &de->sr,
+                            -1);
 	if (GNUNET_YES == GNUNET_FS_uri_test_equal (de->uri,
 						    uri))	
 	  break;
@@ -2278,21 +2461,20 @@
       return de;
     }
     gtk_tree_model_get (GTK_TREE_MODEL (de->sr->tab->ts), &iter,
-			0, &meta,
-			-1);
+                        SEARCH_TAB_MC_METADATA, &meta,
+                        -1);
     de->is_directory = GNUNET_FS_meta_data_test_for_directory (meta);
   }
   gtk_tree_path_free (path);
   gtk_tree_store_set (de->sr->tab->ts, &iter, 
-		      4,   (guint) ((size >
-                                0) ? (100 * completed /
-                                      size) : 100) /* progress */ ,
-                      6, filename /* filename/description */ ,
-                      8, "blue" /* status colour: pending */ ,
-		      9, de->sr, 
-		      14, completed,
-		      15, de->filename,
-		      16, de->anonymity,
+                      SEARCH_TAB_MC_PERCENT_PROGRESS,
+                      (guint) ((size > 0) ? (100 * completed / size) : 100),
+                      SEARCH_TAB_MC_FILENAME, filename,
+                      SEARCH_TAB_MC_STATUS_COLOUR, "blue",
+                      SEARCH_TAB_MC_SEARCH_RESULT, de->sr, 
+                      SEARCH_TAB_MC_COMPLETED, completed,
+                      SEARCH_TAB_MC_FILENAME, de->filename,
+                      SEARCH_TAB_MC_DOWNLOADED_ANONYMITY, de->anonymity,
                       -1);
   return de;
 }
@@ -2327,7 +2509,7 @@
     return;
   }
   gtk_tree_path_free (path);
-  gtk_tree_store_set (pe->tab->ts, &iter, 2, color, -1);
+  gtk_tree_store_set (pe->tab->ts, &iter, PUBLISH_TAB_MC_BGCOLOUR, color, -1);
 }
 
 
@@ -2354,10 +2536,9 @@
     return;
   }
   gtk_tree_path_free (path);
-  gtk_tree_store_set (pe->tab->ts, &iter, 3,
-                      (guint) ((size >
-                                0) ? (100 * completed /
-                                      size) : 100) /* progress */ ,
+  gtk_tree_store_set (pe->tab->ts, &iter,
+                      PUBLISH_TAB_MC_PROGRESS,
+                      (guint) ((size > 0) ? (100 * completed / size) : 100),
                       -1);
 }
 
@@ -2388,7 +2569,7 @@
   pe->uri = GNUNET_FS_uri_dup (uri);
   uris = GNUNET_FS_uri_to_string (uri);
   gtk_tree_store_set (pe->tab->ts, &iter, 
-		      5, uris,
+                      PUBLISH_TAB_MC_RESULT_STRING, uris,
                       -1);
   GNUNET_free (uris);
   change_publish_color (pe, "green");
@@ -2418,7 +2599,7 @@
   }
   gtk_tree_path_free (path);
   gtk_tree_store_set (pe->tab->ts, &iter, 
-		      5, emsg,
+                      PUBLISH_TAB_MC_RESULT_STRING, emsg,
                       -1);
   change_publish_color (pe, "red");
 }
@@ -2480,7 +2661,7 @@
   tm = GTK_TREE_MODEL (publish_tab->ts);
   while (gtk_tree_model_iter_children (tm, &iter, NULL))
   {
-    gtk_tree_model_get (tm, &iter, 4, &pe, -1);
+    gtk_tree_model_get (tm, &iter, PUBLISH_TAB_MC_ENT, &pe, -1);
     GNUNET_FS_publish_stop (pe->pc);
   }
   clear_metadata_display ();
@@ -2586,9 +2767,12 @@
   ent->pc = pc;
   size_fancy = GNUNET_STRINGS_byte_size_fancy (fsize);
   gtk_tree_store_insert_with_values (publish_tab->ts, &iter, pitrptr, G_MAXINT,
-                                     0, fn, 1, size_fancy, 2, "white", 3,
-                                     (guint) 0 /* progress */ ,
-                                     4, ent, -1);
+                                     PUBLISH_TAB_MC_FILENAME, fn,
+                                     PUBLISH_TAB_MC_FILESIZE, size_fancy,
+                                     PUBLISH_TAB_MC_BGCOLOUR, "white",
+                                     PUBLISH_TAB_MC_PROGRESS, (guint) 0,
+                                     PUBLISH_TAB_MC_ENT, ent,
+                                     -1);
   GNUNET_free (size_fancy);
   path = gtk_tree_model_get_path (GTK_TREE_MODEL (publish_tab->ts), &iter);
   ent->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (publish_tab->ts), path);
@@ -2709,7 +2893,7 @@
   struct PublishEntry *pe;
   struct PublishListPopupContext *ppc;
 
-  gtk_tree_model_get (tm, iter, 4, &pe, -1);
+  gtk_tree_model_get (tm, iter, PUBLISH_TAB_MC_ENT, &pe, -1);
   if ( (NULL == pe->uri) &&
        ( (NULL == pe->pc) ||
 	 (GNUNET_NO == pe->is_top) ) )
Index: src/fs/gnunet-fs-gtk_publish-dialog.c
===================================================================
--- src/fs/gnunet-fs-gtk_publish-dialog.c	(revision 20790)
+++ src/fs/gnunet-fs-gtk_publish-dialog.c	(working copy)
@@ -38,6 +38,105 @@
 
 
 /**
+ * Columns in the publish model.
+ */
+enum PUBLISH_ModelColumns
+  {
+    /**
+     * A gchararray.
+     */
+    PUBLISH_MC_FILESIZE = 0,
+
+    /**
+     * A gboolean.
+     */
+    PUBLISH_MC_DO_INDEX = 1,
+
+    /**
+     * A gchararray.
+     */
+    PUBLISH_MC_FILENAME = 2,
+
+    /**
+     * A guint.
+     */
+    PUBLISH_MC_ANONYMITY_LEVEL = 3,
+
+    /**
+     * A guint.
+     */
+    PUBLISH_MC_PRIORITY = 4,
+
+    /**
+     * A gpointer.
+     */
+    PUBLISH_MC_FILE_INFORMATION_STRUCT = 5,
+
+    /**
+     * A guint64.
+     */
+    PUBLISH_MC_EXPIRATION_TIME_ABSOLUTE = 6,
+
+    /**
+     * A guint.
+     */
+    PUBLISH_MC_REPLICATION_LEVEL = 7,
+  };
+
+
+/**
+ * Columns in the pseudonym model.
+ */
+enum PSEUDONYM_ModelColumns
+  {
+    /**
+     * A gchararray.
+     */
+    PSEUDONYM_MC_LOCAL_NAME = 0,
+
+    /**
+     * A gpointer.
+     */
+    PSEUDONYM_MC_NAMESPACE_HANDLE = 1,
+
+    /**
+     * A gchararray.
+     */
+    PSEUDONYM_MC_LAST_ID = 2,
+
+    /**
+     * A gchararray.
+     */
+    PSEUDONYM_MC_LAST_URI = 3,
+
+    /**
+     * A gpointer.
+     */
+    PSEUDONYM_MC_LAST_META = 4,
+
+    /**
+     * A gchararray.
+     */
+    PSEUDONYM_MC_NEXT_ID = 5,
+
+    /**
+     * A gchararray.
+     */
+    PSEUDONYM_MC_LAST_DESCRIPTION_FROM_META = 6,
+
+    /**
+     * A gboolean.
+     */
+    PSEUDONYM_MC_NEXT_ID_EDITABLE = 7,
+
+    /**
+     * A gboolean.
+     */
+    PSEUDONYM_MC_CURRENT_ID_EDITABLE = 8,
+  };
+
+
+/**
  * Context we create when we are scanning a directory.
  */
 struct AddDirClientContext;
@@ -281,7 +380,8 @@
   ns_ok = GNUNET_YES;
   if (gtk_tree_selection_get_selected (ctx->pseudonym_selection, NULL, &iter))
   {
-    gtk_tree_model_get (ctx->pseudonym_treemodel, &iter, 2, &namespace_id, -1);
+    gtk_tree_model_get (ctx->pseudonym_treemodel, &iter,
+                        PSEUDONYM_MC_LAST_ID, &namespace_id, -1);
     if (namespace_id == NULL)
       ns_ok = GNUNET_NO;
     else
@@ -339,7 +439,8 @@
   is_dir = GNUNET_SYSERR;
   while (GNUNET_YES != gtk_tree_iter_equals (ctx->file_info_treemodel, &pred, &iter))
   {
-    gtk_tree_model_get (ctx->file_info_treemodel, &pred, 5, &fip, -1);
+    gtk_tree_model_get (ctx->file_info_treemodel, &pred,
+                        PUBLISH_MC_FILE_INFORMATION_STRUCT, &fip, -1);
     is_dir = GNUNET_FS_file_information_is_directory (fip);
     GNUNET_assert (gtk_tree_model_iter_next (ctx->file_info_treemodel, &pred));
   }
@@ -405,15 +506,17 @@
       (GNUNET_FS_GTK_get_fs_handle (), row_reference, NULL, meta, bo, name);
   GNUNET_CONTAINER_meta_data_destroy (meta);
   gtk_tree_store_set (GTK_TREE_STORE (ctx->file_info_treemodel), pos, 
-		      0, MARKER_DIR_FILE_SIZE, 
-		      1, (gboolean) GNUNET_NO,
-                      2, name, 
-		      3, (guint) bo->anonymity_level, 
-		      4, (guint) bo->content_priority, 
-		      5, fi,
-		      6, (guint64) bo->expiration_time.abs_value,
-		      7, (guint) bo->replication_level,
-		      -1);
+                      PUBLISH_MC_FILESIZE, MARKER_DIR_FILE_SIZE, 
+                      PUBLISH_MC_DO_INDEX, (gboolean) GNUNET_NO,
+                      PUBLISH_MC_FILENAME, name, 
+                      PUBLISH_MC_ANONYMITY_LEVEL, (guint) bo->anonymity_level, 
+                      PUBLISH_MC_PRIORITY, (guint) bo->content_priority, 
+                      PUBLISH_MC_FILE_INFORMATION_STRUCT, fi,
+                      PUBLISH_MC_EXPIRATION_TIME_ABSOLUTE,
+                      (guint64) bo->expiration_time.abs_value,
+                      PUBLISH_MC_REPLICATION_LEVEL,
+                      (guint) bo->replication_level,
+                      -1);
   update_selectivity (ctx);
 }
 
@@ -453,25 +556,27 @@
     char *fsf;
 
     gtk_tree_model_get (tm, old,
-			0, &fsf, 
-			1, &do_index, 
-			2, &short_fn, 
-			3, &anonymity_level, 
-			4, &priority,
-			5, &fip, 
-			6, &expiration_time_abs,
-			7, &replication_level, 
-			-1);
-    gtk_tree_store_set (GTK_TREE_STORE (tm), newpos, 
-			0, fsf, 
-			1, do_index, 
-			2, short_fn, 
-			3, anonymity_level, 
-			4, priority,
-			5, fip, 
-			6, expiration_time_abs,
-			7, replication_level, 
-			-1);
+                        PUBLISH_MC_FILESIZE, &fsf, 
+                        PUBLISH_MC_DO_INDEX, &do_index,
+                        PUBLISH_MC_FILENAME, &short_fn,
+                        PUBLISH_MC_ANONYMITY_LEVEL, &anonymity_level,
+                        PUBLISH_MC_PRIORITY, &priority,
+                        PUBLISH_MC_FILE_INFORMATION_STRUCT, &fip,
+                        PUBLISH_MC_EXPIRATION_TIME_ABSOLUTE,
+                        &expiration_time_abs,
+                        PUBLISH_MC_REPLICATION_LEVEL, &replication_level,
+                        -1);
+    gtk_tree_store_set (GTK_TREE_STORE (tm), newpos,
+                        PUBLISH_MC_FILESIZE, fsf,
+                        PUBLISH_MC_DO_INDEX, do_index,
+                        PUBLISH_MC_FILENAME, short_fn,
+                        PUBLISH_MC_ANONYMITY_LEVEL, anonymity_level,
+                        PUBLISH_MC_PRIORITY, priority,
+                        PUBLISH_MC_FILE_INFORMATION_STRUCT, fip,
+                        PUBLISH_MC_EXPIRATION_TIME_ABSOLUTE,
+                        expiration_time_abs,
+                        PUBLISH_MC_REPLICATION_LEVEL, replication_level,
+                        -1);
     g_free (short_fn);
     g_free (fsf);
   }
@@ -548,8 +653,8 @@
     return;
   }
   gtk_tree_store_set (GTK_TREE_STORE (ctx->pseudonym_treemodel), &iter, 
-		      5, new_text, 
-		      -1);
+                      PSEUDONYM_MC_NEXT_ID, new_text, 
+                      -1);
   update_selectivity (ctx);
 }
 
@@ -578,8 +683,8 @@
     return;
   }
   gtk_tree_store_set (GTK_TREE_STORE (ctx->pseudonym_treemodel), &iter, 
-		      2, new_text, 
-		      -1);
+                      PSEUDONYM_MC_LAST_ID, new_text, 
+                      -1);
   update_selectivity (ctx);
 }
 
@@ -878,7 +983,8 @@
   GNUNET_assert (gtk_tree_selection_get_selected (ctx->file_info_selection, NULL, &iter));
 
   /* now delete the subtree */
-  gtk_tree_model_get (ctx->file_info_treemodel, &iter, 5, &fip, -1);
+  gtk_tree_model_get (ctx->file_info_treemodel, &iter,
+                      PUBLISH_MC_FILE_INFORMATION_STRUCT, &fip, -1);
   GNUNET_FS_file_information_destroy (fip, &free_fi_row_reference, NULL);
   GNUNET_FS_GTK_remove_treestore_subtree  (GTK_TREE_STORE (ctx->file_info_treemodel), 
 					   &iter);
@@ -1058,14 +1164,19 @@
     file_size_fancy = GNUNET_STRINGS_byte_size_fancy (fsize);
   }
   gtk_tree_store_set (ts, item_iter, 
-		      0, file_size_fancy,
-		      1, (gboolean) adcc->directory_scan_do_index,
-		      2, item->short_filename,
-		      3, (guint) adcc->directory_scan_bo.anonymity_level,
-		      4, (guint) adcc->directory_scan_bo.content_priority,
-		      5, fi,
-		      6, (guint64) adcc->directory_scan_bo.expiration_time.abs_value,
-		      7, (guint) adcc->directory_scan_bo.replication_level, -1);
+                      PUBLISH_MC_FILESIZE, file_size_fancy,
+                      PUBLISH_MC_DO_INDEX,
+                      (gboolean) adcc->directory_scan_do_index,
+                      PUBLISH_MC_FILENAME, item->short_filename,
+                      PUBLISH_MC_ANONYMITY_LEVEL,
+                      (guint) adcc->directory_scan_bo.anonymity_level,
+                      PUBLISH_MC_PRIORITY,
+                      (guint) adcc->directory_scan_bo.content_priority,
+                      PUBLISH_MC_FILE_INFORMATION_STRUCT, fi,
+                      PUBLISH_MC_EXPIRATION_TIME_ABSOLUTE,
+                      (guint64) adcc->directory_scan_bo.expiration_time.abs_value,
+                      PUBLISH_MC_REPLICATION_LEVEL,
+                      (guint) adcc->directory_scan_bo.replication_level, -1);
   GNUNET_free (file_size_fancy);
 }
 
@@ -1553,13 +1664,15 @@
 {
   struct EditPublishContext *epc = cls;
   
-  gtk_tree_store_set (GTK_TREE_STORE (epc->tm), &epc->iter, 
-		      1, *do_index,
-		      3, (guint) bo->anonymity_level, 
-		      4, (guint) bo->content_priority, 
-		      6, (guint64) bo->expiration_time.abs_value,
-		      7, (guint) bo->replication_level,			
-		      -1); 
+  gtk_tree_store_set (GTK_TREE_STORE (epc->tm), &epc->iter,
+                      PUBLISH_MC_DO_INDEX, *do_index,
+                      PUBLISH_MC_ANONYMITY_LEVEL, (guint) bo->anonymity_level,
+                      PUBLISH_MC_PRIORITY, (guint) bo->content_priority,
+                      PUBLISH_MC_EXPIRATION_TIME_ABSOLUTE,
+                      (guint64) bo->expiration_time.abs_value,
+                      PUBLISH_MC_REPLICATION_LEVEL,
+                      (guint) bo->replication_level,
+                      -1);
   return GNUNET_SYSERR;
 }
 
@@ -1607,9 +1720,9 @@
     return;
   }
   gtk_tree_model_get (ctx->file_info_treemodel,
-		      &epc->iter,
-		      5, &epc->fip, 
-		      -1);
+                      &epc->iter,
+                      PUBLISH_MC_FILE_INFORMATION_STRUCT, &epc->fip,
+                      -1);
   GNUNET_FS_GTK_edit_publish_dialog (ctx->master_pubdialog, 
                                      epc->fip, 
 				     GNUNET_NO, 
@@ -1639,8 +1752,9 @@
   struct GNUNET_FS_FileInformation *fic;
   GtkTreeIter child;
 
-  gtk_tree_model_get (tm, iter, 5, &fi, -1);
-  gtk_tree_store_set (GTK_TREE_STORE (tm), iter, 5, NULL, -1);
+  gtk_tree_model_get (tm, iter, PUBLISH_MC_FILE_INFORMATION_STRUCT, &fi, -1);
+  gtk_tree_store_set (GTK_TREE_STORE (tm), iter,
+                      PUBLISH_MC_FILE_INFORMATION_STRUCT, NULL, -1);
   GNUNET_assert (fi != NULL);
   if (gtk_tree_model_iter_children (tm, &child, iter))
   {
@@ -1670,9 +1784,9 @@
   struct GNUNET_FS_Namespace *ns;
 
   gtk_tree_model_get (tm, iter, 
-		      1, &ns, 
-		      4, &meta, 
-		      -1);
+                      PSEUDONYM_MC_NAMESPACE_HANDLE, &ns, 
+                      PSEUDONYM_MC_LAST_META, &meta, 
+                      -1);
   if (NULL != meta)
     GNUNET_CONTAINER_meta_data_destroy (meta);
   if (NULL != ns)
@@ -1700,7 +1814,7 @@
   GtkTreeIter child;
   struct GNUNET_FS_FileInformation *fip;
 
-  gtk_tree_model_get (tm, iter, 5, &fip, -1);
+  gtk_tree_model_get (tm, iter, PUBLISH_MC_FILE_INFORMATION_STRUCT, &fip, -1);
   if (NULL != fip)
     GNUNET_FS_file_information_destroy (fip, NULL, NULL);
   /* recursively clean up children */
@@ -1782,8 +1896,11 @@
   }
   if (TRUE == gtk_tree_selection_get_selected (ctx->pseudonym_selection, NULL, &iter))
   {
-    gtk_tree_model_get (ctx->pseudonym_treemodel, &iter, 1, &namespace, 2, &namespace_id, 5,
-			&namespace_uid, -1);
+    gtk_tree_model_get (ctx->pseudonym_treemodel, &iter,
+                        PSEUDONYM_MC_NAMESPACE_HANDLE, &namespace,
+                        PSEUDONYM_MC_LAST_ID, &namespace_id,
+                        PSEUDONYM_MC_NEXT_ID, &namespace_uid,
+                        -1);
   }
   else
   {
@@ -1919,14 +2036,23 @@
                                      GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
   /* FIXME-BUG-MAYBE: what if this put fails?  Not convinced it cannot... */
   desc = GNUNET_FS_GTK_get_description_from_metadata (last_meta, &desc_is_a_dup);
-  gtk_tree_store_insert_with_values (uc->ts, &iter, uc->parent, G_MAXINT, 0,
-                                     uc->namespace_name, 1,
-				     GNUNET_FS_namespace_dup (uc->ns), 2, last_id,
-                                     3, GNUNET_FS_uri_dup (last_uri), 4,
+  gtk_tree_store_insert_with_values (uc->ts, &iter, uc->parent, G_MAXINT,
+                                     PSEUDONYM_MC_LOCAL_NAME,
+                                     uc->namespace_name,
+                                     PSEUDONYM_MC_NAMESPACE_HANDLE,
+                                     GNUNET_FS_namespace_dup (uc->ns),
+                                     PSEUDONYM_MC_LAST_ID, last_id,
+                                     PSEUDONYM_MC_LAST_URI,
+                                     GNUNET_FS_uri_dup (last_uri),
+                                     PSEUDONYM_MC_LAST_META,
                                      GNUNET_CONTAINER_meta_data_duplicate
-                                     (last_meta), 5, "", 6, desc, 7,
+                                     (last_meta),
+                                     PSEUDONYM_MC_NEXT_ID, "",
+                                     PSEUDONYM_MC_LAST_DESCRIPTION_FROM_META,
+                                     desc,
+                                     PSEUDONYM_MC_NEXT_ID_EDITABLE,
                                      TRUE /* update editable (always) */ ,
-                                     8, FALSE
+                                     PSEUDONYM_MC_CURRENT_ID_EDITABLE, FALSE
                                      /* current not editable (only for top-level) */
                                      , -1);
   GNUNET_free_non_null (desc);
@@ -1942,12 +2068,21 @@
       (strlen (next_id) > 0))
   {
     /* add leaf */
-    gtk_tree_store_insert_with_values (uc->ts, &titer, &iter, G_MAXINT, 0,
-                                       uc->namespace_name, 1,
-				       GNUNET_FS_namespace_dup (uc->ns), 2,
-                                       next_id, 3, NULL, 4, NULL, 5, "", 6, "",
-                                       7, TRUE /* update editable (always) */ ,
-                                       8, FALSE
+    gtk_tree_store_insert_with_values (uc->ts, &titer, &iter, G_MAXINT,
+                                       PSEUDONYM_MC_LOCAL_NAME,
+                                       uc->namespace_name,
+                                       PSEUDONYM_MC_NAMESPACE_HANDLE,
+                                       GNUNET_FS_namespace_dup (uc->ns),
+                                       PSEUDONYM_MC_LAST_ID, next_id,
+                                       PSEUDONYM_MC_LAST_URI, NULL,
+                                       PSEUDONYM_MC_LAST_META, NULL,
+                                       PSEUDONYM_MC_NEXT_ID, "",
+                                       PSEUDONYM_MC_LAST_DESCRIPTION_FROM_META,
+                                       "",
+                                       PSEUDONYM_MC_NEXT_ID_EDITABLE,
+                                       TRUE /* update editable (always) */ ,
+                                       PSEUDONYM_MC_CURRENT_ID_EDITABLE,
+                                       FALSE
                                        /* current not editable (only for top-level) */
                                        , -1);
   }
@@ -1975,15 +2110,16 @@
   uc.ns = GNUNET_FS_namespace_create (GNUNET_FS_GTK_get_fs_handle (), name);
   uc.update_called = GNUNET_NO;
   gtk_tree_store_insert_with_values (ts, &iter, NULL, G_MAXINT, 
-				     0, name, 
-				     1, uc.ns, 
-				     2, NULL /* last-id */ ,
-                                     3, NULL /* last-uri (as string!) */ ,
-                                     4, NULL /* meta */ ,
-                                     5, NULL /* next-ID */ ,
-                                     6, NULL /* last-description */ ,
-                                     7, TRUE /* update editable */ ,
-                                     8, TRUE /* current editable */ ,
+                                     PSEUDONYM_MC_LOCAL_NAME, name,
+                                     PSEUDONYM_MC_NAMESPACE_HANDLE, uc.ns,
+                                     PSEUDONYM_MC_LAST_ID, NULL,
+                                     PSEUDONYM_MC_LAST_URI, NULL,
+                                     PSEUDONYM_MC_LAST_META, NULL,
+                                     PSEUDONYM_MC_NEXT_ID, NULL,
+                                     PSEUDONYM_MC_LAST_DESCRIPTION_FROM_META,
+                                     NULL,
+                                     PSEUDONYM_MC_NEXT_ID_EDITABLE, TRUE,
+                                     PSEUDONYM_MC_CURRENT_ID_EDITABLE, TRUE,
                                      -1);
   uc.seen = GNUNET_CONTAINER_multihashmap_create (128);
   GNUNET_FS_namespace_list_updateable (uc.ns, NULL, &add_updateable_to_ts, &uc);
Index: src/fs/gnunet-fs-gtk_advertise-pseudonym.c
===================================================================
--- src/fs/gnunet-fs-gtk_advertise-pseudonym.c	(revision 20790)
+++ src/fs/gnunet-fs-gtk_advertise-pseudonym.c	(working copy)
@@ -30,6 +30,23 @@
 #include "gnunet-fs-gtk_publish-edit-dialog.h"
 
 
+/**
+ * Columns in the select pseudonym model.
+ */
+enum FS_SelectPseudonymModelColumns
+  {
+    /**
+     * A gchararray
+     */
+    FS_SELECT_PSEUDONYM_NAMESPACE_NAME = 0,
+
+    /**
+     * A gpointer
+     */
+    FS_SELECT_PSEUDONYM_NAMESPACE_HANDLE = 1,
+  };
+
+
 /* *************************** handlers run on closing of the dialog ********************** */
 
 
@@ -156,13 +173,15 @@
     g_object_unref (G_OBJECT (builder));
     return;
   }
-  gtk_tree_model_get (tm, &iter, 1, &ns, -1);
+  gtk_tree_model_get (tm, &iter,
+                      FS_SELECT_PSEUDONYM_NAMESPACE_MC_HANDLE, &ns, -1);
   /* free all namespaces from list store except "ns" */
   if (gtk_tree_model_get_iter_first (tm, &iter))
   {
     do
     {
-      gtk_tree_model_get (tm, &iter, 1, &nso, -1);
+      gtk_tree_model_get (tm, &iter,
+                          FS_SELECT_PSEUDONYM_NAMESPACE_MC_HANDLE, &nso, -1);
       if (ns != nso)
         GNUNET_FS_namespace_delete (nso, GNUNET_NO);
     }
@@ -218,7 +237,8 @@
     {
       struct GNUNET_FS_Namespace *nso;
 
-      gtk_tree_model_get (tm, &iter, 1, &nso, -1);
+      gtk_tree_model_get (tm, &iter,
+                          FS_SELECT_PSEUDONYM_NAMESPACE_HANDLE, &nso, -1);
       GNUNET_FS_namespace_delete (nso, GNUNET_NO);
     }
     while (gtk_tree_model_iter_next (tm, &iter));
@@ -250,10 +270,12 @@
   GtkListStore *ls = cls;
   GtkTreeIter iter;
 
-  gtk_list_store_insert_with_values (ls, &iter, -1, 
-				     0,  name, 
-				     1, GNUNET_FS_namespace_create (GNUNET_FS_GTK_get_fs_handle (), 
-								    name),
+  gtk_list_store_insert_with_values (ls, &iter, -1,
+                                     FS_SELECT_PSEUDONYM_NAMESPACE_MC_NAME,
+                                     name,
+                                     FS_SELECT_PSEUDONYM_NAMESPACE_MC_HANDLE,
+                                     GNUNET_FS_namespace_create (GNUNET_FS_GTK_get_fs_handle (),
+                                                                 name),
                                      -1);
 }
 
Index: src/fs/gnunet-fs-gtk_main-window-meta-data-context-menu.c
===================================================================
--- src/fs/gnunet-fs-gtk_main-window-meta-data-context-menu.c	(revision 20790)
+++ src/fs/gnunet-fs-gtk_main-window-meta-data-context-menu.c	(working copy)
@@ -48,7 +48,12 @@
   gchar *type;
   gchar *value;
 
-  gtk_tree_model_get (model, iter, 2, &type, 3, &value, -1);
+  gtk_tree_model_get (model, iter,
+                      GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_TYPE_STRING,
+                      &type,
+                      GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_VALUE,
+                      &value,
+                      -1);
   *l = g_list_prepend (*l, type);
   *l = g_list_prepend (*l, value);
 }
Index: src/fs/gnunet-fs-gtk_main-window-namespace-dropdown.c
===================================================================
--- src/fs/gnunet-fs-gtk_main-window-namespace-dropdown.c	(revision 20790)
+++ src/fs/gnunet-fs-gtk_main-window-namespace-dropdown.c	(working copy)
@@ -150,12 +150,16 @@
   main_ctx->selected_ns_row = get_selected_row_from_treeview (tv);
 
   treepath = gtk_tree_row_reference_get_path (main_ctx->selected_ns_row);
-  if (GNUNET_GTK_get_tree_string (tv, treepath, 0, &value))
+  if (GNUNET_GTK_get_tree_string (tv, treepath,
+                                  GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_NAME,
+                                  &value))
   {
     gtk_label_set_text (main_ctx->search_ns_label, (NULL != value) ? value : "");
     g_free (value);
   }
-  if (GNUNET_GTK_get_tree_string (tv, treepath, 2, &value))
+  if (GNUNET_GTK_get_tree_string (tv, treepath,
+                                  GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_ROOT,
+                                  &value))
   {
     gtk_entry_set_text (main_ctx->search_entry, (NULL != value) ? value : "");
     g_free (value);
@@ -326,11 +330,15 @@
   }
   description = GNUNET_FS_GTK_get_description_from_metadata (md, &desc_is_a_dup);
   gtk_tree_store_insert_with_values (ts, &iter, NULL, G_MAXINT,
-				     0, unique_ns_name,
-				     1, nsid,
-				     2, root,
-				     3, description,
-				     -1);
+                                     GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_NAME,
+                                     unique_ns_name,
+                                     GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_KEY,
+                                     nsid,
+                                     GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_ROOT,
+                                     root,
+                                     GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_TOOLTIP,
+                                     description,
+                                     -1);
   GNUNET_free (unique_ns_name);
   GNUNET_free_non_null (root);
   GNUNET_free (description);
@@ -356,7 +364,10 @@
     {
       if (gtk_tree_model_get_iter (model, &iter, treepath))
       {
-        gtk_tree_model_get (model, &iter, 1, &key, -1);
+        gtk_tree_model_get (model, &iter,
+                            GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_KEY,
+                            &key,
+                            -1);
       }
     }
     gtk_tree_path_free (treepath);
@@ -376,8 +387,9 @@
     while (TRUE)
     {
       gtk_tree_model_get (GTK_TREE_MODEL (main_ctx->search_ns_treestore), &iter,
-          1, &key,
-          -1);
+                          GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_KEY,
+                          &key,
+                          -1);
       GNUNET_free_non_null (key);
       if (TRUE != gtk_tree_model_iter_next (GTK_TREE_MODEL (
         main_ctx->search_ns_treestore), &iter))
@@ -387,7 +399,13 @@
   gtk_tree_store_clear (main_ctx->search_ns_treestore);
  
   gtk_tree_store_insert_with_values (main_ctx->search_ns_treestore, &iter, NULL, G_MAXINT,
-                                     0, "Any", 1, NULL, 2, "", 3,
+                                     GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_NAME,
+                                     "Any",
+                                     GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_KEY,
+                                     NULL,
+                                     GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_ROOT,
+                                     "",
+                                     GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_TOOLTIP,
                                      "Do not search in any particular namespace",
                                      -1);
 
@@ -404,9 +422,11 @@
     while (TRUE)
     {
       gtk_tree_model_get (GTK_TREE_MODEL (main_ctx->search_ns_treestore), &iter,
-          0, &value,
-          1, &key,
-          -1);
+                          GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_NAME,
+                          &value,
+                          GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_KEY,
+                          &key,
+                          -1);
       if (selected_ns_id == NULL)
         found = TRUE;
       else if (key != NULL && memcmp (key, selected_ns_id, sizeof (GNUNET_HashCode)) == 0)
@@ -423,7 +443,11 @@
 						      main_ctx->search_ns_treestore), &iter))
   {
     gtk_tree_model_get (GTK_TREE_MODEL (main_ctx->search_ns_treestore), &iter,
-        0, &value, 1, &key, -1);
+                        GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_NAME,
+                        &value,
+                        GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_KEY,
+                        &key,
+                        -1);
     found = TRUE;
   }
   if (found)
gnunet-bug2129-fix.patch (77,361 bytes)   

Activities

vminko

2012-03-16 08:10

developer   ~0005617

The naming convention you described here contradicts the way the enums are named in the source code, for example:

    /**
     * A guint
     */
    PEERINFO_MC_NUMBER_OF_ADDRESSES = 1,

I.e. there is no `GNUNET_GTK_' prefix and no desired type in the end.

What should I do - use the current notation or rename the existing enums?

Christian Grothoff

2012-03-16 11:29

manager   ~0005618

I think the question is what the scope of the 'enum' is. If it is a single file, then the short version without the "GNUNET_XXX"-prefix is fine. If the scope is larger, then the long version should be used (that's in line with the overall coding style guidelines we use).

vminko

2012-03-27 22:35

developer   ~0005657

The proposed fix is attached.

Christian Grothoff

2012-03-28 09:28

manager   ~0005658

Applied patch in SVN 20792. Thanks!

Issue History

Date Modified Username Field Change
2012-01-31 21:56 Christian Grothoff New Issue
2012-01-31 21:58 Christian Grothoff Status new => confirmed
2012-02-21 21:58 Christian Grothoff Target Version => 0.9.4
2012-03-16 08:10 vminko Note Added: 0005617
2012-03-16 08:10 vminko Assigned To => vminko
2012-03-16 08:10 vminko Status confirmed => assigned
2012-03-16 11:29 Christian Grothoff Note Added: 0005618
2012-03-27 22:35 vminko File Added: gnunet-bug2129-fix.patch
2012-03-27 22:35 vminko Note Added: 0005657
2012-03-28 09:28 Christian Grothoff Note Added: 0005658
2012-03-28 09:28 Christian Grothoff Status assigned => resolved
2012-03-28 09:28 Christian Grothoff Fixed in Version => 0.9.3
2012-03-28 09:28 Christian Grothoff Resolution open => fixed
2012-03-28 09:28 Christian Grothoff Target Version 0.9.4 => 0.9.3
2012-06-02 19:15 Christian Grothoff Status resolved => closed