aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-09-06 09:33:20 +0000
committerChristian Grothoff <christian@grothoff.org>2013-09-06 09:33:20 +0000
commit4f161d34e810f595212fa7a1be47c50e49352b10 (patch)
tree8bede652787cebbf4608bb9d89eb709de05830ab
parent7a30e74ac9df08c93e4e5637b5893365a3c61807 (diff)
downloadgnunet-gtk-4f161d34e810f595212fa7a1be47c50e49352b10.tar.gz
gnunet-gtk-4f161d34e810f595212fa7a1be47c50e49352b10.zip
-implement monitor zone (#1952, Note #7411)
-rw-r--r--src/fs/gnunet-fs-gtk.c63
-rw-r--r--src/fs/gnunet-fs-gtk_main-window-search.c6
2 files changed, 54 insertions, 15 deletions
diff --git a/src/fs/gnunet-fs-gtk.c b/src/fs/gnunet-fs-gtk.c
index ceaed0fc..e1261256 100644
--- a/src/fs/gnunet-fs-gtk.c
+++ b/src/fs/gnunet-fs-gtk.c
@@ -223,7 +223,6 @@ GNUNET_GTK_main_window_configure_event_cb (GtkWidget *main_window,
223 223
224/** 224/**
225 * Task run on shutdown. 225 * Task run on shutdown.
226 * FIXME-STYLE: does this need to be a separate task!?
227 * 226 *
228 * @param cls NULL 227 * @param cls NULL
229 * @param tc scheduler context, unused 228 * @param tc scheduler context, unused
@@ -553,10 +552,10 @@ service_status_change (void *cls,
553 * "namespace_label_liststore". 552 * "namespace_label_liststore".
554 * 553 *
555 * @param cls closure 554 * @param cls closure
556 * @param zone private key of the zone 555 * @param zone private key of the zone; NULL on disconnect
557 * @param label label of the records 556 * @param label label of the records; NULL on disconnect
558 * @param rd_count number of entries in @a rd array 557 * @param rd_count number of entries in @a rd array; 0 on removal
559 * @param rd array of records with data to store 558 * @param rd array of records for the label
560 */ 559 */
561static void 560static void
562monitor_zone_records (void *cls, 561monitor_zone_records (void *cls,
@@ -565,7 +564,49 @@ monitor_zone_records (void *cls,
565 unsigned int rd_count, 564 unsigned int rd_count,
566 const struct GNUNET_NAMESTORE_RecordData *rd) 565 const struct GNUNET_NAMESTORE_RecordData *rd)
567{ 566{
568 GNUNET_break (0); // not implemented 567 GtkListStore *ls;
568 GtkTreeModel *tm;
569 GtkTreeIter iter;
570 gchar *id;
571 gchar *label_gnu;
572
573 ls = GTK_LIST_STORE (GNUNET_FS_GTK_get_main_window_object (""));
574 if (NULL == zone)
575 {
576 gtk_list_store_clear (ls);
577 return;
578 }
579 label_gnu = g_strdup_printf ("%s.%s",
580 label,
581 "gnu");
582 if (0 == rd_count)
583 {
584 tm = GTK_TREE_MODEL (ls);
585 if (gtk_tree_model_get_iter_first (tm, &iter))
586 do
587 {
588 gtk_tree_model_get (tm, &iter,
589 0, &id,
590 -1);
591 if (0 == strcmp (id, label_gnu))
592 {
593 GNUNET_assert (gtk_list_store_remove (ls, &iter));
594 g_free (id);
595 g_free (label_gnu);
596 return;
597 }
598 g_free (id);
599 }
600 while (gtk_tree_model_iter_next (tm, &iter));
601 GNUNET_break (0);
602 return;
603 }
604 gtk_list_store_insert_with_values (ls,
605 &iter,
606 -1,
607 0, label_gnu,
608 -1);
609 g_free (label_gnu);
569} 610}
570 611
571 612
@@ -590,11 +631,11 @@ handle_sks_zone_identity (void *cls,
590 main_context.id_op = NULL; 631 main_context.id_op = NULL;
591 632
592 if (NULL == ego) 633 if (NULL == ego)
593 { 634 {
594 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 635 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
595 _("No default ego specified for `fs-sks` service, will not enable namespace search.\n")); 636 _("No default ego specified for `fs-sks` service, will not enable namespace search.\n"));
596 return; 637 return;
597 } 638 }
598 main_context.sks_zone = GNUNET_new (struct GNUNET_CRYPTO_EccPrivateKey); 639 main_context.sks_zone = GNUNET_new (struct GNUNET_CRYPTO_EccPrivateKey);
599 *main_context.sks_zone = *GNUNET_IDENTITY_ego_get_private_key (ego); 640 *main_context.sks_zone = *GNUNET_IDENTITY_ego_get_private_key (ego);
600 gtk_widget_show (GTK_WIDGET (GNUNET_FS_GTK_get_main_window_object ("main_window_search_namespace_label"))); 641 gtk_widget_show (GTK_WIDGET (GNUNET_FS_GTK_get_main_window_object ("main_window_search_namespace_label")));
diff --git a/src/fs/gnunet-fs-gtk_main-window-search.c b/src/fs/gnunet-fs-gtk_main-window-search.c
index 32d3ce6d..23a9ddb3 100644
--- a/src/fs/gnunet-fs-gtk_main-window-search.c
+++ b/src/fs/gnunet-fs-gtk_main-window-search.c
@@ -43,7 +43,6 @@ static void
43search_for_uri (struct GNUNET_FS_Uri *uri, 43search_for_uri (struct GNUNET_FS_Uri *uri,
44 guint anonymity_level) 44 guint anonymity_level)
45{ 45{
46 /* start search */
47 GNUNET_FS_search_start (GNUNET_FS_GTK_get_fs_handle (), 46 GNUNET_FS_search_start (GNUNET_FS_GTK_get_fs_handle (),
48 uri, anonymity_level, 47 uri, anonymity_level,
49 GNUNET_FS_SEARCH_OPTION_NONE, NULL); 48 GNUNET_FS_SEARCH_OPTION_NONE, NULL);
@@ -51,8 +50,6 @@ search_for_uri (struct GNUNET_FS_Uri *uri,
51} 50}
52 51
53 52
54
55
56/** 53/**
57 * Abort the given search lookup. 54 * Abort the given search lookup.
58 * 55 *
@@ -101,7 +98,6 @@ timeout_search_lookup (void *cls,
101} 98}
102 99
103 100
104
105/** 101/**
106 * Iterator called on obtained result for a GNS lookup for 102 * Iterator called on obtained result for a GNS lookup for
107 * the public key of a namespace identifier. 103 * the public key of a namespace identifier.
@@ -139,6 +135,7 @@ handle_gns_result (void *cls,
139 abort_search_lookup (sl); 135 abort_search_lookup (sl);
140} 136}
141 137
138
142/** 139/**
143 * Start a search. 140 * Start a search.
144 * 141 *
@@ -273,6 +270,7 @@ main_window_search_button_clicked_cb (GtkButton * button,
273 start_search (main_ctx); 270 start_search (main_ctx);
274} 271}
275 272
273
276/** 274/**
277 * User pushed a key (possibly ENTER) in the search entry widget. 275 * User pushed a key (possibly ENTER) in the search entry widget.
278 * Start the search if it was ENTER. 276 * Start the search if it was ENTER.