gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r29055 - gnunet-gtk/src/fs


From: gnunet
Subject: [GNUnet-SVN] r29055 - gnunet-gtk/src/fs
Date: Fri, 6 Sep 2013 11:33:20 +0200

Author: grothoff
Date: 2013-09-06 11:33:20 +0200 (Fri, 06 Sep 2013)
New Revision: 29055

Modified:
   gnunet-gtk/src/fs/gnunet-fs-gtk.c
   gnunet-gtk/src/fs/gnunet-fs-gtk_main-window-search.c
Log:
-implement monitor zone (#1952, Note #7411)

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk.c   2013-09-06 09:32:33 UTC (rev 29054)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk.c   2013-09-06 09:33:20 UTC (rev 29055)
@@ -223,7 +223,6 @@
 
 /**
  * Task run on shutdown.
- * FIXME-STYLE: does this need to be a separate task!?
  *
  * @param cls NULL
  * @param tc scheduler context, unused
@@ -553,10 +552,10 @@
  * "namespace_label_liststore".
  *
  * @param cls closure
- * @param zone private key of the zone
- * @param label label of the records
- * @param rd_count number of entries in @a rd array
- * @param rd array of records with data to store
+ * @param zone private key of the zone; NULL on disconnect
+ * @param label label of the records; NULL on disconnect
+ * @param rd_count number of entries in @a rd array; 0 on removal
+ * @param rd array of records for the label
  */
 static void 
 monitor_zone_records (void *cls,
@@ -565,7 +564,49 @@
                      unsigned int rd_count,
                      const struct GNUNET_NAMESTORE_RecordData *rd)
 {
-  GNUNET_break (0); // not implemented
+  GtkListStore *ls;
+  GtkTreeModel *tm;
+  GtkTreeIter iter;
+  gchar *id;
+  gchar *label_gnu;
+
+  ls = GTK_LIST_STORE (GNUNET_FS_GTK_get_main_window_object (""));
+  if (NULL == zone)
+  {
+    gtk_list_store_clear (ls);
+    return;
+  }
+  label_gnu = g_strdup_printf ("%s.%s",
+                              label,
+                              "gnu");
+  if (0 == rd_count)
+  {
+    tm = GTK_TREE_MODEL (ls);
+    if (gtk_tree_model_get_iter_first (tm, &iter))
+      do
+       {
+         gtk_tree_model_get (tm, &iter, 
+                             0, &id,
+                             -1);
+         if (0 == strcmp (id, label_gnu))
+           {
+             GNUNET_assert (gtk_list_store_remove (ls, &iter));
+             g_free (id);
+             g_free (label_gnu);
+             return;
+           }
+         g_free (id);
+       }
+      while (gtk_tree_model_iter_next (tm, &iter));
+    GNUNET_break (0);
+    return;
+  }
+  gtk_list_store_insert_with_values (ls,
+                                    &iter,
+                                    -1,
+                                    0, label_gnu,
+                                    -1);
+  g_free (label_gnu);
 }
 
 
@@ -590,11 +631,11 @@
   main_context.id_op = NULL;
   
   if (NULL == ego)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                 _("No default ego specified for `fs-sks` service, will not 
enable namespace search.\n"));
-      return;
-    }
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+               _("No default ego specified for `fs-sks` service, will not 
enable namespace search.\n"));
+    return;
+  }
   main_context.sks_zone = GNUNET_new (struct GNUNET_CRYPTO_EccPrivateKey);
   *main_context.sks_zone = *GNUNET_IDENTITY_ego_get_private_key (ego);
   gtk_widget_show (GTK_WIDGET (GNUNET_FS_GTK_get_main_window_object 
("main_window_search_namespace_label")));

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk_main-window-search.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk_main-window-search.c        2013-09-06 
09:32:33 UTC (rev 29054)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_main-window-search.c        2013-09-06 
09:33:20 UTC (rev 29055)
@@ -43,7 +43,6 @@
 search_for_uri (struct GNUNET_FS_Uri *uri,
                guint anonymity_level)
 {
-  /* start search */
   GNUNET_FS_search_start (GNUNET_FS_GTK_get_fs_handle (), 
                          uri, anonymity_level,
                           GNUNET_FS_SEARCH_OPTION_NONE, NULL);
@@ -51,8 +50,6 @@
 }
 
 
-
-
 /**
  * Abort the given search lookup.
  *
@@ -101,7 +98,6 @@
 }
 
 
-
 /**
  * Iterator called on obtained result for a GNS lookup for
  * the public key of a namespace identifier.
@@ -139,6 +135,7 @@
   abort_search_lookup (sl);
 }
 
+
 /**
  * Start a search.
  *
@@ -273,6 +270,7 @@
   start_search (main_ctx);
 }
 
+
 /**
  * User pushed a key (possibly ENTER) in the search entry widget.
  * Start the search if it was ENTER.




reply via email to

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