aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-09-10 10:37:17 +0000
committerChristian Grothoff <christian@grothoff.org>2013-09-10 10:37:17 +0000
commita00927143391f89fa253f6054fb28b4af492fea8 (patch)
treebc4965f29d67b40b60732bbb7e764faaf69bf9d8
parent55d292c2881c9dd5ef9e91140b52f41518acd2e5 (diff)
downloadgnunet-gtk-a00927143391f89fa253f6054fb28b4af492fea8.tar.gz
gnunet-gtk-a00927143391f89fa253f6054fb28b4af492fea8.zip
-handle SKS uri from command line
-rw-r--r--src/fs/gnunet-fs-gtk_common.c75
1 files changed, 11 insertions, 64 deletions
diff --git a/src/fs/gnunet-fs-gtk_common.c b/src/fs/gnunet-fs-gtk_common.c
index f2f0d07c..f883d05b 100644
--- a/src/fs/gnunet-fs-gtk_common.c
+++ b/src/fs/gnunet-fs-gtk_common.c
@@ -273,16 +273,12 @@ void
273GNUNET_FS_GTK_handle_uri (const struct GNUNET_FS_Uri *uri, 273GNUNET_FS_GTK_handle_uri (const struct GNUNET_FS_Uri *uri,
274 guint anonymity_level) 274 guint anonymity_level)
275{ 275{
276 GtkTreeIter iter;
277 GtkTreeModel *namespace_treestore;
278 GtkTreeView *namespace_tree;
279 gchar *value;
280 GtkLabel *sel_namespace_label;
281 GtkTreePath *treepath;
282 GtkEntry *query_entry; 276 GtkEntry *query_entry;
283 struct GNUNET_CRYPTO_EccPublicKey *nsid; 277 GtkComboBox *ns_cb;
278 GtkEntry *ns_entry;
284 struct GNUNET_CRYPTO_EccPublicKey want; 279 struct GNUNET_CRYPTO_EccPublicKey want;
285 280
281
286 if (GNUNET_FS_uri_test_chk (uri) || GNUNET_FS_uri_test_loc (uri)) 282 if (GNUNET_FS_uri_test_chk (uri) || GNUNET_FS_uri_test_loc (uri))
287 { 283 {
288 struct DownloadEntry *de; 284 struct DownloadEntry *de;
@@ -294,15 +290,8 @@ GNUNET_FS_GTK_handle_uri (const struct GNUNET_FS_Uri *uri,
294 return; 290 return;
295 } 291 }
296 query_entry = GTK_ENTRY (GNUNET_FS_GTK_get_main_window_object ("main_window_search_entry")); 292 query_entry = GTK_ENTRY (GNUNET_FS_GTK_get_main_window_object ("main_window_search_entry"));
297 namespace_tree = 293 ns_cb = GTK_COMBO_BOX (GNUNET_FS_GTK_get_main_window_object ("main_window_search_namespace_combobox"));
298 GTK_TREE_VIEW (GNUNET_FS_GTK_get_main_window_object 294 ns_entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (ns_cb)));
299 ("namespace_selector_treeview"));
300 namespace_treestore =
301 GTK_TREE_MODEL (GNUNET_FS_GTK_get_main_window_object
302 ("main_window_search_namespace_treestore"));
303 sel_namespace_label =
304 GTK_LABEL (GNUNET_FS_GTK_get_main_window_object ("main_window_search_selected_namespace_label"));
305
306 if (GNUNET_FS_uri_test_sks (uri)) 295 if (GNUNET_FS_uri_test_sks (uri))
307 { 296 {
308 /* select the namespace */ 297 /* select the namespace */
@@ -312,43 +301,13 @@ GNUNET_FS_GTK_handle_uri (const struct GNUNET_FS_Uri *uri,
312 GNUNET_break (0); 301 GNUNET_break (0);
313 return; 302 return;
314 } 303 }
315 if (! gtk_tree_model_get_iter_first (namespace_treestore, &iter))
316 {
317 GNUNET_break (0);
318 return;
319 }
320 gtk_tree_model_get (namespace_treestore, &iter,
321 GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_KEY,
322 &nsid,
323 -1);
324 while ( ( (NULL == nsid) ||
325 (0 != memcmp (nsid,
326 &want,
327 sizeof (struct GNUNET_CRYPTO_EccPublicKey))) ) &&
328 (gtk_tree_model_iter_next (namespace_treestore, &iter)) )
329 gtk_tree_model_get (namespace_treestore, &iter,
330 GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_KEY,
331 &nsid,
332 -1);
333 if ( (NULL == nsid) ||
334 (0 != memcmp (nsid,
335 &want,
336 sizeof (struct GNUNET_CRYPTO_EccPublicKey))) )
337 { 304 {
338 /* namespace unknown / not in list!? */ 305 const char *ns_zkey;
339 GNUNET_break (0);
340 return;
341 }
342 gtk_tree_selection_select_iter (gtk_tree_view_get_selection
343 (namespace_tree), &iter);
344 treepath = gtk_tree_model_get_path (namespace_treestore,
345 &iter);
346 if (GNUNET_GTK_get_tree_string (namespace_tree, treepath,
347 GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_NAME,
348 &value))
349 gtk_label_set_text (sel_namespace_label, value);
350 gtk_tree_path_free (treepath);
351 306
307 ns_zkey = GNUNET_NAMESTORE_pkey_to_zkey (&want);
308 gtk_entry_set_text (ns_entry,
309 ns_zkey);
310 }
352 /* set search entry to the namespace identifier */ 311 /* set search entry to the namespace identifier */
353 { 312 {
354 char *query_string; 313 char *query_string;
@@ -363,19 +322,7 @@ GNUNET_FS_GTK_handle_uri (const struct GNUNET_FS_Uri *uri,
363 322
364 if (GNUNET_FS_uri_test_ksk (uri)) 323 if (GNUNET_FS_uri_test_ksk (uri))
365 { 324 {
366 /* select "no" namespace, which should be the first entry 325 gtk_entry_set_text (ns_entry, "");
367 in the namespace */
368 if (gtk_tree_model_get_iter_first (namespace_treestore, &iter))
369 {
370 gtk_tree_selection_select_iter (gtk_tree_view_get_selection
371 (namespace_tree), &iter);
372 treepath = gtk_tree_model_get_path (namespace_treestore, &iter);
373 if (GNUNET_GTK_get_tree_string (namespace_tree, treepath,
374 GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_NAME,
375 &value))
376 gtk_label_set_text (sel_namespace_label, value);
377 gtk_tree_path_free (treepath);
378 }
379 /* set search entry to the query string */ 326 /* set search entry to the query string */
380 { 327 {
381 char *query_string; 328 char *query_string;