aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-fs-gtk_main-window-search.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-09-10 14:41:58 +0000
committerChristian Grothoff <christian@grothoff.org>2013-09-10 14:41:58 +0000
commit33dfe25f2f0f6f3fc867bcf1b589e9685205b756 (patch)
tree7c682a1cef8fd102b3e04b85db120be97e6bf5ae /src/fs/gnunet-fs-gtk_main-window-search.c
parentf582de9a0908211ec5205245ef195059f15911b9 (diff)
downloadgnunet-gtk-33dfe25f2f0f6f3fc867bcf1b589e9685205b756.tar.gz
gnunet-gtk-33dfe25f2f0f6f3fc867bcf1b589e9685205b756.zip
-towards having a way to learn namespaces via gnunet-fs-gtk
Diffstat (limited to 'src/fs/gnunet-fs-gtk_main-window-search.c')
-rw-r--r--src/fs/gnunet-fs-gtk_main-window-search.c72
1 files changed, 60 insertions, 12 deletions
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,
117 117
118 sl->gns = NULL; 118 sl->gns = NULL;
119 for (i=0;i<rd_count;i++) 119 for (i=0;i<rd_count;i++)
120 {
121 if (GNUNET_NAMESTORE_TYPE_PKEY != rd[i].record_type)
122 continue;
123 if (sizeof (struct GNUNET_CRYPTO_EccPublicKey) != rd[i].data_size)
120 { 124 {
121 if (GNUNET_NAMESTORE_TYPE_PKEY != rd[i].record_type) 125 GNUNET_break_op (0);
122 continue; 126 continue;
123 if (sizeof (struct GNUNET_CRYPTO_EccPublicKey) != rd[i].data_size)
124 {
125 GNUNET_break_op (0);
126 continue;
127 }
128 uri = GNUNET_FS_uri_sks_create (rd[i].data, sl->keywords);
129 search_for_uri (uri, sl->anonymity_level);
130 abort_search_lookup (sl);
131 return;
132 } 127 }
128 uri = GNUNET_FS_uri_sks_create (rd[i].data, sl->keywords);
129 search_for_uri (uri, sl->anonymity_level);
130 abort_search_lookup (sl);
131 return;
132 }
133 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 133 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
134 _("Failed to resolve namespace in time\n")); 134 _("Failed to resolve namespace in time\n"));
135 abort_search_lookup (sl); 135 abort_search_lookup (sl);
@@ -216,7 +216,8 @@ start_search (struct GNUNET_GTK_MainWindowContext *main_ctx)
216 } 216 }
217 217
218 /* build KSK/SKS URI */ 218 /* build KSK/SKS URI */
219 if (NULL != nsid) 219 if ( (NULL != nsid) &&
220 (0 < strlen (nsid)) )
220 { 221 {
221 sl = GNUNET_new (struct SearchLookup); 222 sl = GNUNET_new (struct SearchLookup);
222 sl->keywords = keywords; 223 sl->keywords = keywords;
@@ -295,4 +296,51 @@ main_window_search_entry_key_press_event_cb (GtkWidget * widget,
295 return FALSE; 296 return FALSE;
296} 297}
297 298
299
300/**
301 * User clicked on the 'save' button in the search line of the main window.
302 * Store the selected namespace in the "sks-fs" zone.
303 *
304 * @param button the "save" button
305 * @param user_data the main window context builder
306 */
307
308void
309GNUNET_FS_GTK_save_button_clicked_cb (GtkButton * button,
310 gpointer user_data)
311{
312 struct GNUNET_GTK_MainWindowContext *main_ctx = user_data;
313
314 GNUNET_break (0);
315 (void) main_ctx;
316}
317
318
319/**
320 * The user has somehow changed the selectionin the namespace combo box entry.
321 * Update the visibility of the "save" button.
322 *
323 * @param widget the combo box
324 * @param user_data the main window context builder (unused)
325 */
326void
327main_window_search_namespace_combobox_changed_cb (GtkComboBox *widget,
328 gpointer user_data)
329{
330 GtkButton *button;
331 const gchar *text;
332 struct GNUNET_CRYPTO_EccPublicKey pkey;
333 int ret;
334
335 text = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (widget))));
336 ret = GNUNET_NAMESTORE_zkey_to_pkey (text, &pkey);
337 button = GTK_BUTTON (GNUNET_FS_GTK_get_main_window_object
338 ("GNUNET_FS_GTK_save_button"));
339 gtk_widget_set_visible (GTK_WIDGET (button),
340 (GNUNET_OK == ret) ? TRUE : FALSE);
341 gtk_widget_set_sensitive (GTK_WIDGET (button),
342 (GNUNET_OK == ret) ? TRUE : FALSE);
343}
344
345
298/* end of gnunet-fs-gtk_main-window-search.c */ 346/* end of gnunet-fs-gtk_main-window-search.c */