gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r7063 - in gnunet-gtk: po src/core src/plugins/fs


From: gnunet
Subject: [GNUnet-SVN] r7063 - in gnunet-gtk: po src/core src/plugins/fs
Date: Sat, 7 Jun 2008 00:08:00 -0600 (MDT)

Author: grothoff
Date: 2008-06-07 00:08:00 -0600 (Sat, 07 Jun 2008)
New Revision: 7063

Modified:
   gnunet-gtk/po/Makefile.in
   gnunet-gtk/src/core/main.c
   gnunet-gtk/src/plugins/fs/collection.c
   gnunet-gtk/src/plugins/fs/fs.h
   gnunet-gtk/src/plugins/fs/meta.c
   gnunet-gtk/src/plugins/fs/namespace.c
   gnunet-gtk/src/plugins/fs/namespace_create.c
   gnunet-gtk/src/plugins/fs/namespace_search.c
   gnunet-gtk/src/plugins/fs/search.c
Log:
update to new ns api'
'

Modified: gnunet-gtk/po/Makefile.in
===================================================================
--- gnunet-gtk/po/Makefile.in   2008-06-07 06:00:59 UTC (rev 7062)
+++ gnunet-gtk/po/Makefile.in   2008-06-07 06:08:00 UTC (rev 7063)
@@ -20,7 +20,7 @@
 top_srcdir = ..
 
 
-prefix = /home/grothoff/
+prefix = /home/grothoff
 exec_prefix = ${prefix}
 datadir = ${prefix}/share
 localedir = $(datadir)/locale

Modified: gnunet-gtk/src/core/main.c
===================================================================
--- gnunet-gtk/src/core/main.c  2008-06-07 06:00:59 UTC (rev 7062)
+++ gnunet-gtk/src/core/main.c  2008-06-07 06:08:00 UTC (rev 7063)
@@ -138,8 +138,7 @@
   root =
     glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "mainWindow");
   dataDir = GNUNET_get_installation_path (GNUNET_IPK_DATADIR);
-  gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
-                                     dataDir);
+  gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), dataDir);
   GNUNET_free (dataDir);
   gtk_window_maximize (GTK_WINDOW (root));
   gtk_widget_show (root);

Modified: gnunet-gtk/src/plugins/fs/collection.c
===================================================================
--- gnunet-gtk/src/plugins/fs/collection.c      2008-06-07 06:00:59 UTC (rev 
7062)
+++ gnunet-gtk/src/plugins/fs/collection.c      2008-06-07 06:08:00 UTC (rev 
7063)
@@ -65,13 +65,11 @@
 void
 createCollection_clicked_fs (GtkWidget * dummy1, GtkWidget * dummy2)
 {
-  const char *updateIntervalString;
   GtkWidget *w;
   GtkWidget *dialog;
   GtkWidget *spin;
   struct GNUNET_MetaData *meta;
   struct GNUNET_ECRS_URI *root;
-  GNUNET_Int32Time updateInterval;
 
   metaXML
     = glade_xml_new (GNUNET_GTK_get_glade_filename (),
@@ -84,33 +82,12 @@
   gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
   if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
     {
-      updateIntervalString
-        = getEntryLineValue (metaXML,
-                             "collectionUpdateIntervalComboBoxEntry");
-      if (0 == strcmp (_("--sporadic update--"), updateIntervalString))
-        updateInterval = GNUNET_ECRS_SBLOCK_UPDATE_SPORADIC;
-      else if (0 == strcmp (_("--no update--"), updateIntervalString))
-        updateInterval = GNUNET_ECRS_SBLOCK_UPDATE_NONE;
-      else if (GNUNET_OK != parseTime (updateIntervalString, &updateInterval))
-        {
-          gtk_widget_destroy (dialog);
-          UNREF (metaXML);
-          metaXML = NULL;
-          dialog = gtk_message_dialog_new
-            (NULL,
-             GTK_DIALOG_MODAL,
-             GTK_MESSAGE_ERROR,
-             GTK_BUTTONS_CLOSE, _("Failed to parse given time interval!"));
-          gtk_dialog_run (GTK_DIALOG (dialog));
-          gtk_widget_destroy (dialog);
-          return;
-        }
       meta = getMetaDataFromList (metaXML,
                                   "collectionMetaDataTreeView", NULL);
       spin = glade_xml_get_widget (metaXML, "collectionAnonymityLevel");
       root = NULL;
       if (GNUNET_OK == GNUNET_CO_collection_start 
(gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spin)), 1000,     /* 
priority */
-                                                   updateInterval, meta))
+                                                   meta))
         {
           w =
             glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),

Modified: gnunet-gtk/src/plugins/fs/fs.h
===================================================================
--- gnunet-gtk/src/plugins/fs/fs.h      2008-06-07 06:00:59 UTC (rev 7062)
+++ gnunet-gtk/src/plugins/fs/fs.h      2008-06-07 06:08:00 UTC (rev 7063)
@@ -122,8 +122,6 @@
   IN_NAMESPACE_MIMETYPE,
   IN_NAMESPACE_LAST_STRING,
   IN_NAMESPACE_NEXT_STRING,
-  IN_NAMESPACE_PUB_FREQ_STRING,
-  IN_NAMESPACE_PUB_DATE_STRING,
   IN_NAMESPACE_URI,
   IN_NAMESPACE_META,
   IN_NAMESPACE_NUM

Modified: gnunet-gtk/src/plugins/fs/meta.c
===================================================================
--- gnunet-gtk/src/plugins/fs/meta.c    2008-06-07 06:00:59 UTC (rev 7062)
+++ gnunet-gtk/src/plugins/fs/meta.c    2008-06-07 06:08:00 UTC (rev 7063)
@@ -408,41 +408,6 @@
   return keywordURI;
 }
 
-char *
-updateIntervalToString (GNUNET_Int32Time interval)
-{
-  if (interval == GNUNET_ECRS_SBLOCK_UPDATE_SPORADIC)
-    return strdup (_("--sporadic update--"));
-  if (interval == GNUNET_ECRS_SBLOCK_UPDATE_NONE)
-    return strdup (_("--no update--"));
-  return GNUNET_get_time_interval_as_fancy_string (interval *
-                                                   GNUNET_CRON_SECONDS);
-}
-
-int
-parseTimeInterval (const char *timeSpec, GNUNET_Int32Time * interval)
-{
-  if (timeSpec == NULL)
-    return GNUNET_SYSERR;
-  if (0 == strcmp (_("--sporadic update--"), timeSpec))
-    *interval = GNUNET_ECRS_SBLOCK_UPDATE_SPORADIC;
-  else if (0 == strcmp (_("--no update--"), timeSpec))
-    *interval = GNUNET_ECRS_SBLOCK_UPDATE_NONE;
-  else
-    return parseTime (timeSpec, interval);
-  return GNUNET_OK;
-}
-
-int
-tryParseTimeInterval (GladeXML * xml,
-                      const char *intervalComboBoxEntry,
-                      GNUNET_Int32Time * interval)
-{
-  return parseTimeInterval (getEntryLineValue (xml,
-                                               intervalComboBoxEntry),
-                            interval);
-}
-
 unsigned int
 getSpinButtonValue (GladeXML * xml, const char *spinButtonName)
 {

Modified: gnunet-gtk/src/plugins/fs/namespace.c
===================================================================
--- gnunet-gtk/src/plugins/fs/namespace.c       2008-06-07 06:00:59 UTC (rev 
7062)
+++ gnunet-gtk/src/plugins/fs/namespace.c       2008-06-07 06:08:00 UTC (rev 
7063)
@@ -76,7 +76,7 @@
   int ncount;
   GtkTreeSelection *ns;
   GtkTreeIter iter;
-  char *freq;
+  char *next;
   int ok;
 
   count = gtk_tree_selection_count_selected_rows (content_selection);
@@ -91,12 +91,12 @@
           (ncount == 1) &&
           (TRUE == gtk_tree_selection_get_selected (ns, NULL, &iter)))
         {
-          freq = NULL;
+          next = NULL;
           gtk_tree_model_get (list->model,
-                              &iter, IN_NAMESPACE_PUB_DATE_STRING, &freq, -1);
-          if ((freq != NULL) && (0 != strcmp (freq, _("never"))))
+                              &iter, IN_NAMESPACE_NEXT_STRING, &next, -1);
+          if ((next != NULL) && (0 != strlen (next)))
             ok = 1;
-          GNUNET_free_non_null (freq);
+          GNUNET_free_non_null (next);
         }
       gtk_widget_set_sensitive (list->updateButton, ok);
       list = list->next;
@@ -134,8 +134,6 @@
                               G_TYPE_STRING,    /* mime-type */
                               G_TYPE_STRING,    /* last-ID */
                               G_TYPE_STRING,    /* next-ID */
-                              G_TYPE_STRING,    /* pub-freq */
-                              G_TYPE_STRING,    /* next pub date */
                               G_TYPE_POINTER,   /* URI */
                               G_TYPE_POINTER);  /* META */
   entry->model = GTK_TREE_MODEL (model);
@@ -217,42 +215,6 @@
   renderer = gtk_cell_renderer_text_new ();
   col =
     gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (resultList),
-                                                 -1,
-                                                 _("Publication Frequency"),
-                                                 renderer, "text",
-                                                 IN_NAMESPACE_PUB_FREQ_STRING,
-                                                 NULL);
-  column = gtk_tree_view_get_column (GTK_TREE_VIEW (resultList), col - 1);
-  gtk_tree_view_column_set_resizable (column, TRUE);
-  gtk_tree_view_column_set_clickable (column, TRUE);
-  gtk_tree_view_column_set_reorderable (column, TRUE);
-  gtk_tree_view_column_set_sort_column_id (column,
-                                           IN_NAMESPACE_PUB_FREQ_STRING);
-  /*gtk_tree_view_column_set_sort_indicator(column, TRUE); */
-  gtk_tree_view_column_set_resizable (gtk_tree_view_get_column
-                                      (GTK_TREE_VIEW (resultList), col - 1),
-                                      TRUE);
-  renderer = gtk_cell_renderer_text_new ();
-  col =
-    gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (resultList),
-                                                 -1,
-                                                 _("Next Publication Date"),
-                                                 renderer, "text",
-                                                 IN_NAMESPACE_PUB_DATE_STRING,
-                                                 NULL);
-  column = gtk_tree_view_get_column (GTK_TREE_VIEW (resultList), col - 1);
-  gtk_tree_view_column_set_reorderable (column, TRUE);
-  gtk_tree_view_column_set_resizable (column, TRUE);
-  gtk_tree_view_column_set_clickable (column, TRUE);
-  gtk_tree_view_column_set_sort_column_id (column,
-                                           IN_NAMESPACE_PUB_DATE_STRING);
-  /*gtk_tree_view_column_set_sort_indicator(column, TRUE); */
-  gtk_tree_view_column_set_resizable (gtk_tree_view_get_column
-                                      (GTK_TREE_VIEW (resultList), col - 1),
-                                      TRUE);
-  renderer = gtk_cell_renderer_text_new ();
-  col =
-    gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (resultList),
                                                  -1, _("Last ID"), renderer,
                                                  "text",
                                                  IN_NAMESPACE_LAST_STRING,
@@ -301,10 +263,7 @@
 static int
 addNamespaceContentToModel (void *cls,
                             const GNUNET_ECRS_FileInfo * fi,
-                            const GNUNET_HashCode * lastId,
-                            const GNUNET_HashCode * nextId,
-                            GNUNET_Int32Time publicationFrequency,
-                            GNUNET_Int32Time nextPublicationTime)
+                            const char *lastId, const char *nextId)
 {
   GtkListStore *model = GTK_LIST_STORE (cls);
   GtkTreeIter iter;
@@ -312,10 +271,6 @@
   char *desc;
   char *mime;
   char *uriString;
-  GNUNET_EncName last;
-  GNUNET_EncName next;
-  char *freq;
-  char *date;
   unsigned long long size;
   char *size_h;
 
@@ -357,21 +312,8 @@
   else
     size = 0;
   uriString = GNUNET_ECRS_uri_to_string (fi->uri);
-  GNUNET_hash_to_enc (lastId, &last);
-  if (nextId != NULL)
-    GNUNET_hash_to_enc (nextId, &next);
-  else
-    memset (&next, 0, sizeof (GNUNET_EncName));
-  if (publicationFrequency == GNUNET_ECRS_SBLOCK_UPDATE_SPORADIC)
-    date = GNUNET_strdup (_("unspecified"));
-  else if (publicationFrequency == GNUNET_ECRS_SBLOCK_UPDATE_NONE)
-    date = GNUNET_strdup (_("never"));
-  else
-    date = GNUNET_int32_time_to_string (&nextPublicationTime);
-  if (date[strlen (date) - 1] == '\n')
-    date[strlen (date) - 1] = '\0';
-
-  freq = updateIntervalToString (publicationFrequency);
+  if (nextId == NULL)
+    nextId = "";
   size_h = GNUNET_get_byte_size_as_fancy_string (size);
   gtk_list_store_append (model, &iter);
   gtk_list_store_set (model,
@@ -381,18 +323,14 @@
                       IN_NAMESPACE_HSIZE, size_h,
                       IN_NAMESPACE_DESCRIPTION, desc,
                       IN_NAMESPACE_MIMETYPE, mime,
-                      IN_NAMESPACE_LAST_STRING, &last,
-                      IN_NAMESPACE_NEXT_STRING, &next,
-                      IN_NAMESPACE_PUB_FREQ_STRING, freq,
-                      IN_NAMESPACE_PUB_DATE_STRING, date,
+                      IN_NAMESPACE_LAST_STRING, &lastId,
+                      IN_NAMESPACE_NEXT_STRING, &nextId,
                       IN_NAMESPACE_URI, GNUNET_ECRS_uri_duplicate (fi->uri),
                       IN_NAMESPACE_META,
                       GNUNET_meta_data_duplicate (fi->meta), -1);
   GNUNET_free (size_h);
   GNUNET_free (filename);
   GNUNET_free (uriString);
-  GNUNET_free (freq);
-  GNUNET_free (date);
   GNUNET_free (mime);
   GNUNET_free (desc);
   GNUNET_GTK_DEBUG_END ();
@@ -574,10 +512,8 @@
   unsigned int anonymityLevel;
   char *namespaceName;
   GNUNET_HashCode nsid;
-  GNUNET_Int32Time updateInterval;
-  GNUNET_HashCode *lastId;
-  GNUNET_HashCode thisId;
-  GNUNET_HashCode *nextId;
+  const char *thisId;
+  const char *nextId;
 } IUC;
 
 /**
@@ -607,9 +543,7 @@
   resultURI = GNUNET_NS_add_to_namespace (ectx, cfg, cls->anonymityLevel, 
1000, /* FIXME: priority */
                                           GNUNET_get_time () + 2 * 
GNUNET_CRON_YEARS,   /* FIXME: expiration */
                                           &cls->nsid,
-                                          cls->updateInterval,
-                                          cls->lastId,
-                                          &cls->thisId, cls->nextId, dst,
+                                          cls->thisId, cls->nextId, dst,
                                           meta);
   if (resultURI != NULL)
     {
@@ -626,12 +560,7 @@
           fi.uri = dst;
           fi.meta = meta;
           addNamespaceContentToModel (list->model,
-                                      &fi,
-                                      &cls->thisId,
-                                      cls->nextId,
-                                      cls->updateInterval,
-                                      cls->updateInterval +
-                                      GNUNET_get_time_int32 (NULL));
+                                      &fi, cls->thisId, cls->nextId);
         }
       GNUNET_ECRS_uri_destroy (resultURI);
     }
@@ -665,14 +594,11 @@
 on_namespaceInsertButton_clicked_fs (GtkWidget * dummy1, GtkWidget * dummy2)
 {
 
-  const char *identifierName;
   NamespaceList *list;
   GtkWidget *nameLine;
   GtkWidget *page;
   GtkWidget *notebook;
   GtkWidget *dialog;
-  GtkWidget *updateIntervalComboBox;
-  GNUNET_HashCode nextId;
   IUC cls;
   gint num;
 
@@ -699,53 +625,15 @@
   GNUNET_GTK_connect_glade_with_plugins (metaXML);
   dialog = glade_xml_get_widget (metaXML, "namespaceInsertDialog");
   gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
-
-  updateIntervalComboBox = glade_xml_get_widget (metaXML,
-                                                 
"updateIntervalComboBoxEntry");
-  gtk_combo_box_set_active (GTK_COMBO_BOX (updateIntervalComboBox), 0);
-
-
   if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
     {
-      if (GNUNET_OK != tryParseTimeInterval (metaXML,
-                                             "updateIntervalComboBoxEntry",
-                                             &cls.updateInterval))
-        {
-          /* this should be impossible - GNUNET_OK button is
-             deactivated while parse errors are there */
-          gtk_widget_destroy (dialog);
-          UNREF (metaXML);
-          metaXML = NULL;
-          dialog = gtk_message_dialog_new
-            (NULL,
-             GTK_DIALOG_MODAL,
-             GTK_MESSAGE_ERROR,
-             GTK_BUTTONS_CLOSE, _("Failed to parse given time interval!"));
-          gtk_dialog_run (GTK_DIALOG (dialog));
-          gtk_widget_destroy (dialog);
-          return;
-        }
       cls.anonymityLevel
         = getSpinButtonValue (metaXML, "anonymitySpinButton");
       nameLine = glade_xml_get_widget (metaXML,
                                        "namespaceContentIdentifierEntry");
-      identifierName = gtk_entry_get_text (GTK_ENTRY (nameLine));
-      if (identifierName == NULL)
-        identifierName = "";
-      GNUNET_hash (identifierName, strlen (identifierName), &cls.thisId);
-      cls.lastId = NULL;
-
+      cls.thisId = gtk_entry_get_text (GTK_ENTRY (nameLine));
       nameLine = glade_xml_get_widget (metaXML, "nextIdentifierEntry");
-      identifierName = gtk_entry_get_text (GTK_ENTRY (nameLine));
-      if ((identifierName == NULL) || (strlen (identifierName) == 0))
-        {
-          cls.nextId = NULL;
-        }
-      else
-        {
-          GNUNET_hash (identifierName, strlen (identifierName), &nextId);
-          cls.nextId = &nextId;
-        }
+      cls.nextId = gtk_entry_get_text (GTK_ENTRY (nameLine));
       GNUNET_GTK_tree_selection_selected_foreach
         (content_selection, &addToNamespaceCB, &cls);
     }
@@ -764,24 +652,16 @@
 {
   NamespaceList *list;
   GtkTreeIter iter;
-  GNUNET_HashCode nextId;
-  GNUNET_HashCode lastId;
   GtkTreeSelection *selection;
   IUC cls;
   char *last;
   char *next;
-  char *freq;
-  GNUNET_EncName nextnext;
   GtkWidget *nextEntryLine;
   GtkWidget *identifierLabel;
-  GtkWidget *updateIntervalComboBox;
   GtkWidget *dialog;
-  GtkWidget *mdialog;
   GtkWidget *notebook;
   GtkWidget *page;
-  GtkTreeModel *model;
   gint num;
-  const char *nn_str;
 
   GNUNET_GTK_DEBUG_BEGIN ();
   /* find out which namespace this is about */
@@ -810,21 +690,12 @@
       return;
     }
   gtk_tree_model_get (list->model,
-                      &iter,
-                      IN_NAMESPACE_LAST_STRING, &last,
-                      IN_NAMESPACE_NEXT_STRING, &next,
-                      IN_NAMESPACE_PUB_FREQ_STRING, &freq, -1);
-  if ((last == NULL) || (next == NULL) || (freq == NULL))
+                      &iter, IN_NAMESPACE_NEXT_STRING, &next, -1);
+  if ((last == NULL) || (next == NULL))
     {
       GNUNET_GE_BREAK (NULL, 0);
       return;
     }
-  if (GNUNET_OK != parseTimeInterval (freq, &cls.updateInterval))
-    {
-      GNUNET_GE_BREAK (ectx, 0);
-      cls.updateInterval = GNUNET_ECRS_SBLOCK_UPDATE_SPORADIC;
-    }
-
   /* create update dialog */
   metaXML
     = glade_xml_new (GNUNET_GTK_get_glade_filename (),
@@ -834,60 +705,15 @@
   gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
   identifierLabel = glade_xml_get_widget (metaXML, "identifierLabel");
   gtk_label_set_text (GTK_LABEL (identifierLabel), next);
-  GNUNET_enc_to_hash (last, &lastId);
-  cls.lastId = &lastId;
-  GNUNET_enc_to_hash (next, &cls.thisId);
-
+  cls.thisId = next;
   nextEntryLine = glade_xml_get_widget (metaXML, "nextIdentifierEntry");
-  if ((cls.updateInterval != GNUNET_ECRS_SBLOCK_UPDATE_SPORADIC) &&
-      (GNUNET_OK == GNUNET_NS_compute_next_identifier (NULL,
-                                                       cfg,
-                                                       &cls.nsid,
-                                                       &lastId,
-                                                       &cls.thisId,
-                                                       cls.updateInterval,
-                                                       &nextId)))
-    {
-      GNUNET_hash_to_enc (&nextId, &nextnext);
-      gtk_entry_set_text (GTK_ENTRY (nextEntryLine), (char *) &nextnext);
-      gtk_widget_set_sensitive (nextEntryLine, FALSE);
-    }
-  /* set update interval in dialog to
-     the existing update interval */
-  updateIntervalComboBox = glade_xml_get_widget (metaXML,
-                                                 
"namespaceUpdateIntervalComboBoxEntry");
-  model = gtk_combo_box_get_model (GTK_COMBO_BOX (updateIntervalComboBox));
-  gtk_list_store_insert (GTK_LIST_STORE (model), &iter, 0);
-  gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, freq, -1);
-  gtk_combo_box_set_active (GTK_COMBO_BOX (updateIntervalComboBox), 0);
-
   /* run update dialog */
   if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK)
     goto CLEANUP;
   gtk_widget_hide (dialog);
 
   /* get data from update dialog */
-  nn_str = gtk_entry_get_text (GTK_ENTRY (nextEntryLine));
-  if (nn_str == NULL)
-    nn_str = "";
-  GNUNET_hash (nn_str, strlen (nn_str), &nextId);
-  cls.nextId = &nextId;
-
-  if (GNUNET_OK != tryParseTimeInterval (metaXML,
-                                         
"namespaceUpdateIntervalComboBoxEntry",
-                                         &cls.updateInterval))
-    {
-      /* This should be impossible since the
-         the GNUNET_OK button is deactivated while parse errors are present */
-      mdialog = gtk_message_dialog_new
-        (NULL,
-         GTK_DIALOG_MODAL,
-         GTK_MESSAGE_ERROR,
-         GTK_BUTTONS_CLOSE, _("Failed to parse given time interval!"));
-      gtk_dialog_run (GTK_DIALOG (mdialog));
-      gtk_widget_destroy (mdialog);
-      goto CLEANUP;
-    }
+  cls.nextId = gtk_entry_get_text (GTK_ENTRY (nextEntryLine));
   cls.anonymityLevel
     = getSpinButtonValue (metaXML, "namespaceUpdateAnonymitySpinButton");
 
@@ -900,7 +726,6 @@
   metaXML = NULL;
   free (last);
   free (next);
-  free (freq);
   GNUNET_GTK_DEBUG_END ();
 }
 

Modified: gnunet-gtk/src/plugins/fs/namespace_create.c
===================================================================
--- gnunet-gtk/src/plugins/fs/namespace_create.c        2008-06-07 06:00:59 UTC 
(rev 7062)
+++ gnunet-gtk/src/plugins/fs/namespace_create.c        2008-06-07 06:08:00 UTC 
(rev 7063)
@@ -193,7 +193,7 @@
 void
 create_namespace_clicked_fs (GtkWidget * dummy1, GtkWidget * dummy2)
 {
-  const char *namespaceName;
+  const char *rootName;
   GtkWidget *nameLine;
   GtkWidget *dialog;
   GtkWidget *spin;
@@ -201,7 +201,6 @@
   struct GNUNET_ECRS_URI *keywordURI;
   struct GNUNET_ECRS_URI *root;
   GNUNET_HashCode namespaceId;
-  GNUNET_HashCode rootEntry;
 
   GNUNET_GTK_DEBUG_BEGIN ();
   metaXML
@@ -241,15 +240,12 @@
                                  "namespaceMetaDataDialogKeywordList");
       spin = glade_xml_get_widget (metaXML, "namespaceAnonymityspinbutton");
       nameLine = glade_xml_get_widget (metaXML, "namespaceRootEntry");
-      namespaceName = gtk_entry_get_text (GTK_ENTRY (nameLine));
-      if (namespaceName == NULL)
-        namespaceName = "root"; /* do NOT translate "root"! */
-      GNUNET_hash (namespaceName, strlen (namespaceName), &rootEntry);
-      nameLine = glade_xml_get_widget (metaXML, "namespaceNameEntry");
-      namespaceName = gtk_entry_get_text (GTK_ENTRY (nameLine));
+      rootName = gtk_entry_get_text (GTK_ENTRY (nameLine));
+      if (rootName == NULL)
+        rootName = "root";      /* do NOT translate "root"! */
       root = GNUNET_NS_namespace_create (ectx, cfg, 
gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spin)), 1000,    /* FIXME: 
priority */
                                          GNUNET_get_time () + 2 * 
GNUNET_CRON_YEARS,    /* FIXME: expiration */
-                                         meta, keywordURI, &rootEntry);
+                                         meta, keywordURI, rootName);
       if (root != NULL)
         {
           GNUNET_ECRS_uri_get_namespace_from_sks (root, &namespaceId);
@@ -269,10 +265,7 @@
              GTK_DIALOG_MODAL,
              GTK_MESSAGE_ERROR,
              GTK_BUTTONS_CLOSE,
-             _("Failed to create namespace `%s'."
-               "Consult logs, most likely error is"
-               " that a namespace with that name "
-               "already exists."), namespaceName);
+             _("Failed to create namespace." "Consult logs."));
           gtk_dialog_run (GTK_DIALOG (dialog));
           gtk_widget_destroy (dialog);
         }

Modified: gnunet-gtk/src/plugins/fs/namespace_search.c
===================================================================
--- gnunet-gtk/src/plugins/fs/namespace_search.c        2008-06-07 06:00:59 UTC 
(rev 7062)
+++ gnunet-gtk/src/plugins/fs/namespace_search.c        2008-06-07 06:08:00 UTC 
(rev 7063)
@@ -128,8 +128,7 @@
   char *encStr;
   char *descStr;
   GNUNET_HashCode ns;
-  GNUNET_HashCode root;
-  GNUNET_EncName enc;
+  char *root;
 
   GNUNET_GTK_DEBUG_BEGIN ();
   spin =
@@ -161,13 +160,13 @@
           keyword
             = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
                                     "fssearchKeywordComboBoxEntry");
-          if (GNUNET_OK ==
-              GNUNET_NS_namespace_get_root (ectx, cfg, &ns, &root))
+          root = GNUNET_NS_namespace_get_root (ectx, cfg, &ns);
+          if (root != NULL)
             {
-              GNUNET_hash_to_enc (&root, &enc);
               gtk_entry_set_text (GTK_ENTRY
                                   (gtk_bin_get_child (GTK_BIN (keyword))),
-                                  (const gchar *) &enc);
+                                  root);
+              GNUNET_free (root);
             }
           else
             {

Modified: gnunet-gtk/src/plugins/fs/search.c
===================================================================
--- gnunet-gtk/src/plugins/fs/search.c  2008-06-07 06:00:59 UTC (rev 7062)
+++ gnunet-gtk/src/plugins/fs/search.c  2008-06-07 06:08:00 UTC (rev 7063)
@@ -229,28 +229,30 @@
                                  GNUNET_ECRS_uri_get_keyword_count_from_ksk
                                  (searchContext->uri));
 #ifdef HAVE_GIO
-  if (0 == strcmp(rawMime, GNUNET_DIRECTORY_MIME))
-  {
-    mime = GNUNET_strdup(_("Directory"));
-    icon = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
-                                     "folder", 16, 0, (GError **)NULL);
-  }
+  if (0 == strcmp (rawMime, GNUNET_DIRECTORY_MIME))
+    {
+      mime = GNUNET_strdup (_("Directory"));
+      icon = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
+                                       "folder", 16, 0, (GError **) NULL);
+    }
   else
-  {
-    mime = g_content_type_get_description (rawMime);
-    gicon = g_content_type_get_icon (rawMime);
-    if (G_IS_THEMED_ICON (gicon))
-      {
-        iconNames = (const gchar **)g_themed_icon_get_names
-                                           (G_THEMED_ICON (gicon));
-        do {
-            icon = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
-                                             iconNames[i], 16, 0,
-                                             (GError **)NULL);
-            i++;
-          } while ( (icon == NULL) && iconNames[i] );
-      }
-  }
+    {
+      mime = g_content_type_get_description (rawMime);
+      gicon = g_content_type_get_icon (rawMime);
+      if (G_IS_THEMED_ICON (gicon))
+        {
+          iconNames = (const gchar **) g_themed_icon_get_names
+            (G_THEMED_ICON (gicon));
+          do
+            {
+              icon = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
+                                               iconNames[i], 16, 0,
+                                               (GError **) NULL);
+              i++;
+            }
+          while ((icon == NULL) && iconNames[i]);
+        }
+    }
 #else
   mime = rawMime;
 #endif
@@ -712,9 +714,9 @@
   g_signal_connect_swapped (list->treeview,
                             "button-press-event",
                             G_CALLBACK (search_click_handler), list);
-  list->tree = gtk_tree_store_new (SEARCH_NUM, G_TYPE_STRING,  /* name */
+  list->tree = gtk_tree_store_new (SEARCH_NUM, G_TYPE_STRING,   /* name */
 #ifdef HAVE_GIO
-                                   GDK_TYPE_PIXBUF,    /* icon */
+                                   GDK_TYPE_PIXBUF,     /* icon */
 #endif
                                    G_TYPE_UINT64,       /* size */
                                    G_TYPE_STRING,       /* human-readable size 
*/





reply via email to

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