From 33dfe25f2f0f6f3fc867bcf1b589e9685205b756 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 10 Sep 2013 14:41:58 +0000 Subject: -towards having a way to learn namespaces via gnunet-fs-gtk --- src/fs/gnunet-fs-gtk_main-window-search.c | 72 +++++++++++++++++++++++++------ 1 file changed, 60 insertions(+), 12 deletions(-) (limited to 'src/fs/gnunet-fs-gtk_main-window-search.c') diff --git a/src/fs/gnunet-fs-gtk_main-window-search.c b/src/fs/gnunet-fs-gtk_main-window-search.c index 23a9ddb3..3032b501 100644 --- a/src/fs/gnunet-fs-gtk_main-window-search.c +++ b/src/fs/gnunet-fs-gtk_main-window-search.c @@ -117,19 +117,19 @@ handle_gns_result (void *cls, sl->gns = NULL; for (i=0;ikeywords); - search_for_uri (uri, sl->anonymity_level); - abort_search_lookup (sl); - return; + GNUNET_break_op (0); + continue; } + uri = GNUNET_FS_uri_sks_create (rd[i].data, sl->keywords); + search_for_uri (uri, sl->anonymity_level); + abort_search_lookup (sl); + return; + } GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Failed to resolve namespace in time\n")); abort_search_lookup (sl); @@ -216,7 +216,8 @@ start_search (struct GNUNET_GTK_MainWindowContext *main_ctx) } /* build KSK/SKS URI */ - if (NULL != nsid) + if ( (NULL != nsid) && + (0 < strlen (nsid)) ) { sl = GNUNET_new (struct SearchLookup); sl->keywords = keywords; @@ -295,4 +296,51 @@ main_window_search_entry_key_press_event_cb (GtkWidget * widget, return FALSE; } + +/** + * User clicked on the 'save' button in the search line of the main window. + * Store the selected namespace in the "sks-fs" zone. + * + * @param button the "save" button + * @param user_data the main window context builder + */ + +void +GNUNET_FS_GTK_save_button_clicked_cb (GtkButton * button, + gpointer user_data) +{ + struct GNUNET_GTK_MainWindowContext *main_ctx = user_data; + + GNUNET_break (0); + (void) main_ctx; +} + + +/** + * The user has somehow changed the selectionin the namespace combo box entry. + * Update the visibility of the "save" button. + * + * @param widget the combo box + * @param user_data the main window context builder (unused) + */ +void +main_window_search_namespace_combobox_changed_cb (GtkComboBox *widget, + gpointer user_data) +{ + GtkButton *button; + const gchar *text; + struct GNUNET_CRYPTO_EccPublicKey pkey; + int ret; + + text = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (widget)))); + ret = GNUNET_NAMESTORE_zkey_to_pkey (text, &pkey); + button = GTK_BUTTON (GNUNET_FS_GTK_get_main_window_object + ("GNUNET_FS_GTK_save_button")); + gtk_widget_set_visible (GTK_WIDGET (button), + (GNUNET_OK == ret) ? TRUE : FALSE); + gtk_widget_set_sensitive (GTK_WIDGET (button), + (GNUNET_OK == ret) ? TRUE : FALSE); +} + + /* end of gnunet-fs-gtk_main-window-search.c */ -- cgit v1.2.3