gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r18883 - gnunet-gtk/src/fs
Date: Sun, 1 Jan 2012 21:00:19 +0100

Author: grothoff
Date: 2012-01-01 21:00:19 +0100 (Sun, 01 Jan 2012)
New Revision: 18883

Modified:
   gnunet-gtk/src/fs/gnunet-fs-gtk-download.c
   gnunet-gtk/src/fs/gnunet-fs-gtk-event_handler.c
Log:
-LRN:  Add download+recursive/abort context menu items

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk-download.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk-download.c  2012-01-01 19:59:04 UTC (rev 
18882)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk-download.c  2012-01-01 20:00:19 UTC (rev 
18883)
@@ -175,6 +175,8 @@
                    (builder, "GNUNET_GTK_save_as_recursive_check_button"));
   if (GNUNET_FS_meta_data_test_for_directory (dc->meta))
     gtk_widget_set_sensitive (cb, TRUE);
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb), dc->is_recursive);
+    
   ad = GTK_WIDGET (gtk_builder_get_object
                    (builder, "GNUNET_GTK_save_as_dialog"));
   if (dc->filename != NULL)

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk-event_handler.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk-event_handler.c     2012-01-01 19:59:04 UTC 
(rev 18882)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk-event_handler.c     2012-01-01 20:00:19 UTC 
(rev 18883)
@@ -617,7 +617,7 @@
  */
 static void
 start_download (GtkTreeView * tree_view, GtkTreePath * path,
-                GtkTreeViewColumn * column, gpointer user_data)
+                GtkTreeViewColumn * column, gboolean recursive, gpointer 
user_data)
 {
   struct SearchTab *tab = user_data;
   GtkTreeModel *tm;
@@ -697,6 +697,7 @@
   dlc->rr = gtk_tree_row_reference_new (tm, path);
   dlc->sr = sr->result;
   dlc->anonymity = -1;
+  dlc->is_recursive = recursive;
   GNUNET_FS_GTK_open_download_as_dialog (dlc);
   g_free (mime);
 }
@@ -714,7 +715,7 @@
 static struct SearchTab *current_context_search_tab;
 
 /**
- * Download was selected in the current search context menu.
+ * "Download" was selected in the current search context menu.
  */
 static void
 start_download_ctx_menu (gpointer user_data, guint unused, GtkWidget * widget)
@@ -733,12 +734,37 @@
   tv = GTK_TREE_VIEW (gtk_builder_get_object
                       (current_context_search_tab->builder,
                        "_search_result_frame"));
-  start_download (tv, path, NULL, current_context_search_tab);
+  start_download (tv, path, NULL, FALSE, current_context_search_tab);
   gtk_tree_path_free (path);
   current_context_search_tab = NULL;
 }
 
+/**
+ * "Download recursively" was selected in the current search context menu.
+ */
+static void
+start_download_recursively_ctx_menu (gpointer user_data, guint unused, 
GtkWidget * widget)
+{
+  GtkTreePath *path;
+  GtkTreeView *tv;
 
+  if (current_context_row_reference == NULL)
+  {
+    GNUNET_break (0);
+    return;
+  }
+  path = gtk_tree_row_reference_get_path (current_context_row_reference);
+  gtk_tree_row_reference_free (current_context_row_reference);
+  current_context_row_reference = NULL;
+  tv = GTK_TREE_VIEW (gtk_builder_get_object
+                      (current_context_search_tab->builder,
+                       "_search_result_frame"));
+  start_download (tv, path, NULL, TRUE, current_context_search_tab);
+  gtk_tree_path_free (path);
+  current_context_search_tab = NULL;
+}
+
+
 /**
  * Download was selected in the current search context menu.
  */
@@ -869,6 +895,16 @@
                                      (gtk_bin_get_child (GTK_BIN (child))),
                                      TRUE);
         gtk_widget_show (child);
+        gtk_menu_shell_append (GTK_MENU_SHELL (menu), child);
+
+        child = gtk_menu_item_new_with_label (_("Download _recursively"));
+        g_signal_connect (child, "activate",
+                          G_CALLBACK (start_download_recursively_ctx_menu), 
NULL);
+        gtk_label_set_use_underline (GTK_LABEL
+                                     (gtk_bin_get_child (GTK_BIN (child))),
+                                     TRUE);
+        gtk_widget_show (child);
+        gtk_menu_shell_append (GTK_MENU_SHELL (menu), child);
       }
       else
       {
@@ -879,7 +915,7 @@
                                      (gtk_bin_get_child (GTK_BIN (child))),
                                      TRUE);
         gtk_widget_show (child);
-
+        gtk_menu_shell_append (GTK_MENU_SHELL (menu), child);
       }
 
       child = gtk_menu_item_new_with_label (_("_Copy URI to Clipboard"));




reply via email to

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