gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r19704 - gnunet-gtk/src/fs
Date: Sun, 5 Feb 2012 19:59:26 +0100

Author: grothoff
Date: 2012-02-05 19:59:26 +0100 (Sun, 05 Feb 2012)
New Revision: 19704

Modified:
   gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c
Log:
-towards fixing 2132

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c     2012-02-05 18:52:38 UTC 
(rev 19703)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c     2012-02-05 18:59:26 UTC 
(rev 19704)
@@ -299,11 +299,6 @@
   int anonymity;
   int filename_is_absolute;
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-             "Starting a %sdownload\n", 
-             is_recursive ? "recursive " : "");
-
-  GNUNET_assert (tab != NULL);
   tm = gtk_tree_view_get_model (tree_view);
   if (TRUE != gtk_tree_model_get_iter (tm, &iter, path))
   {
@@ -325,6 +320,8 @@
   if (!(GNUNET_FS_uri_test_chk (uri) || GNUNET_FS_uri_test_loc (uri)))
   {
     /* can only download chk/loc URIs, ignore */
+    /* break because in this case, we should not have even gotten here */
+    GNUNET_break (0);
     return;
   }
 
@@ -456,7 +453,34 @@
                                             gpointer user_data)
 {
   struct SearchTab *tab = user_data;
+  struct GNUNET_FS_Uri *uri;
+  GtkTreeModel *tm;
+  GtkTreeIter iter;
 
+  tm = gtk_tree_view_get_model (tree_view);
+  if (TRUE != gtk_tree_model_get_iter (tm, &iter, path))
+  {
+    GNUNET_break (0);
+    return;
+  }
+  gtk_tree_model_get (tm, &iter, 1, &uri, -1);
+  if (NULL == uri)
+  {
+    /* user clicked on directory that was opened (not downloaded!), so we
+       have no URI and downloading makes no sense. Ignore! */
+    return;
+  }
+  if (GNUNET_FS_uri_test_ksk (uri))
+  {
+    /* FIXME-FEATURE: copy keywords to search bar (and select 'no' namespace) 
*/
+    return;
+  }
+  if (GNUNET_FS_uri_test_sks (uri))
+  {
+    /* FIXME-FEATURE: select namespace and copy root to search bar */
+    return;
+  }
+  /* must be chk/loc URI, start download */
   start_download (tree_view, path, tab, GNUNET_NO, GNUNET_NO);
 }
 
@@ -627,7 +651,8 @@
   spc->sr = sr;
   menu = GTK_MENU (gtk_menu_new ());
   if ( (NULL == sr->download) &&
-       (NULL != uri) )
+       (NULL != uri) &&
+       ( (GNUNET_FS_uri_test_chk (uri) || GNUNET_FS_uri_test_loc (uri))) )
   {
     /* only display download menus if there is a URI */
     child = gtk_menu_item_new_with_label (_("_Download"));




reply via email to

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