diff options
Diffstat (limited to 'src/fs/gnunet-fs-gtk-event_handler.c')
-rw-r--r-- | src/fs/gnunet-fs-gtk-event_handler.c | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/src/fs/gnunet-fs-gtk-event_handler.c b/src/fs/gnunet-fs-gtk-event_handler.c index 83bfcb50..b20fb8a2 100644 --- a/src/fs/gnunet-fs-gtk-event_handler.c +++ b/src/fs/gnunet-fs-gtk-event_handler.c | |||
@@ -617,7 +617,7 @@ setup_download (struct DownloadEntry *de, struct DownloadEntry *pde, | |||
617 | */ | 617 | */ |
618 | static void | 618 | static void |
619 | start_download (GtkTreeView * tree_view, GtkTreePath * path, | 619 | start_download (GtkTreeView * tree_view, GtkTreePath * path, |
620 | GtkTreeViewColumn * column, gpointer user_data) | 620 | GtkTreeViewColumn * column, gboolean recursive, gpointer user_data) |
621 | { | 621 | { |
622 | struct SearchTab *tab = user_data; | 622 | struct SearchTab *tab = user_data; |
623 | GtkTreeModel *tm; | 623 | GtkTreeModel *tm; |
@@ -697,6 +697,7 @@ start_download (GtkTreeView * tree_view, GtkTreePath * path, | |||
697 | dlc->rr = gtk_tree_row_reference_new (tm, path); | 697 | dlc->rr = gtk_tree_row_reference_new (tm, path); |
698 | dlc->sr = sr->result; | 698 | dlc->sr = sr->result; |
699 | dlc->anonymity = -1; | 699 | dlc->anonymity = -1; |
700 | dlc->is_recursive = recursive; | ||
700 | GNUNET_FS_GTK_open_download_as_dialog (dlc); | 701 | GNUNET_FS_GTK_open_download_as_dialog (dlc); |
701 | g_free (mime); | 702 | g_free (mime); |
702 | } | 703 | } |
@@ -714,7 +715,7 @@ static GtkTreeRowReference *current_context_row_reference; | |||
714 | static struct SearchTab *current_context_search_tab; | 715 | static struct SearchTab *current_context_search_tab; |
715 | 716 | ||
716 | /** | 717 | /** |
717 | * Download was selected in the current search context menu. | 718 | * "Download" was selected in the current search context menu. |
718 | */ | 719 | */ |
719 | static void | 720 | static void |
720 | start_download_ctx_menu (gpointer user_data, guint unused, GtkWidget * widget) | 721 | start_download_ctx_menu (gpointer user_data, guint unused, GtkWidget * widget) |
@@ -733,7 +734,32 @@ start_download_ctx_menu (gpointer user_data, guint unused, GtkWidget * widget) | |||
733 | tv = GTK_TREE_VIEW (gtk_builder_get_object | 734 | tv = GTK_TREE_VIEW (gtk_builder_get_object |
734 | (current_context_search_tab->builder, | 735 | (current_context_search_tab->builder, |
735 | "_search_result_frame")); | 736 | "_search_result_frame")); |
736 | start_download (tv, path, NULL, current_context_search_tab); | 737 | start_download (tv, path, NULL, FALSE, current_context_search_tab); |
738 | gtk_tree_path_free (path); | ||
739 | current_context_search_tab = NULL; | ||
740 | } | ||
741 | |||
742 | /** | ||
743 | * "Download recursively" was selected in the current search context menu. | ||
744 | */ | ||
745 | static void | ||
746 | start_download_recursively_ctx_menu (gpointer user_data, guint unused, GtkWidget * widget) | ||
747 | { | ||
748 | GtkTreePath *path; | ||
749 | GtkTreeView *tv; | ||
750 | |||
751 | if (current_context_row_reference == NULL) | ||
752 | { | ||
753 | GNUNET_break (0); | ||
754 | return; | ||
755 | } | ||
756 | path = gtk_tree_row_reference_get_path (current_context_row_reference); | ||
757 | gtk_tree_row_reference_free (current_context_row_reference); | ||
758 | current_context_row_reference = NULL; | ||
759 | tv = GTK_TREE_VIEW (gtk_builder_get_object | ||
760 | (current_context_search_tab->builder, | ||
761 | "_search_result_frame")); | ||
762 | start_download (tv, path, NULL, TRUE, current_context_search_tab); | ||
737 | gtk_tree_path_free (path); | 763 | gtk_tree_path_free (path); |
738 | current_context_search_tab = NULL; | 764 | current_context_search_tab = NULL; |
739 | } | 765 | } |
@@ -869,6 +895,16 @@ search_list_on_menu (GtkWidget * widget, GdkEvent * event, gpointer user_data) | |||
869 | (gtk_bin_get_child (GTK_BIN (child))), | 895 | (gtk_bin_get_child (GTK_BIN (child))), |
870 | TRUE); | 896 | TRUE); |
871 | gtk_widget_show (child); | 897 | gtk_widget_show (child); |
898 | gtk_menu_shell_append (GTK_MENU_SHELL (menu), child); | ||
899 | |||
900 | child = gtk_menu_item_new_with_label (_("Download _recursively")); | ||
901 | g_signal_connect (child, "activate", | ||
902 | G_CALLBACK (start_download_recursively_ctx_menu), NULL); | ||
903 | gtk_label_set_use_underline (GTK_LABEL | ||
904 | (gtk_bin_get_child (GTK_BIN (child))), | ||
905 | TRUE); | ||
906 | gtk_widget_show (child); | ||
907 | gtk_menu_shell_append (GTK_MENU_SHELL (menu), child); | ||
872 | } | 908 | } |
873 | else | 909 | else |
874 | { | 910 | { |
@@ -879,7 +915,7 @@ search_list_on_menu (GtkWidget * widget, GdkEvent * event, gpointer user_data) | |||
879 | (gtk_bin_get_child (GTK_BIN (child))), | 915 | (gtk_bin_get_child (GTK_BIN (child))), |
880 | TRUE); | 916 | TRUE); |
881 | gtk_widget_show (child); | 917 | gtk_widget_show (child); |
882 | 918 | gtk_menu_shell_append (GTK_MENU_SHELL (menu), child); | |
883 | } | 919 | } |
884 | 920 | ||
885 | child = gtk_menu_item_new_with_label (_("_Copy URI to Clipboard")); | 921 | child = gtk_menu_item_new_with_label (_("_Copy URI to Clipboard")); |