aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-01-18 08:24:26 +0000
committerChristian Grothoff <christian@grothoff.org>2012-01-18 08:24:26 +0000
commit979b48bd4b7356fb4ce4d9f2d6fd54d4aaa1b934 (patch)
treeac171a093b54b019ffff5d6a088962862f5f5d69
parentfaaac0e31528524f9fd39f5d71031cd483c3029b (diff)
downloadgnunet-gtk-979b48bd4b7356fb4ce4d9f2d6fd54d4aaa1b934.tar.gz
gnunet-gtk-979b48bd4b7356fb4ce4d9f2d6fd54d4aaa1b934.zip
LRN:
Whenever a file is downloaded, store its downloaded name in a treestore (FIXME: when a previously downloaded .gnd file is opened, set downloaded name appropriately? Or not, since it won't have anonymity?), as well as the anonymity level that was used. When one of its children is downloaded, this information is checked and, if present, is used to construct the child filename (and anonymity is used to download the child; FIXME: anonymity == -1 might be used, if parent supplied a filename, but not anonymity? This might need a fix), so it is downloaded without showing the "Save as" dialog. (TODO: the logic behind constructing the child filename from the name of already downloaded directory file relies on directory file having a '.gnd' extension; if it isn't there, the whole thing fails (tries to mkdir() with the name of the .gnd-less directory file, which isn't possible); Enforce .gnd extension? Change the name to avoid conflict?) In future it might be necessary to add a context menu item that overrides this behaviour and shows the dialog anyway. Also changes the way gtkfilechooser is set up, so that it fills the entry with short filename only, without the directory part, and the directory part is used to select a directory. Without this the entry gets absolute filename or directoryname, and if you later change the directory in the dialog, contents of the entry remain the same. It's intended to be relative most of the time! Slight API changes for "Save as" dialog, now it invokes a callback (FIXME: this breaks "Download URI", as it is not adapted to the callback yet, that must be fixed as soon as possible!). To that end one of its static functions was made public.
-rw-r--r--contrib/gnunet_fs_gtk_search_tab.glade4
-rw-r--r--src/fs/gnunet-fs-gtk-download.c67
-rw-r--r--src/fs/gnunet-fs-gtk-download.h12
-rw-r--r--src/fs/gnunet-fs-gtk-event_handler.c218
4 files changed, 235 insertions, 66 deletions
diff --git a/contrib/gnunet_fs_gtk_search_tab.glade b/contrib/gnunet_fs_gtk_search_tab.glade
index 42a87de5..71af274e 100644
--- a/contrib/gnunet_fs_gtk_search_tab.glade
+++ b/contrib/gnunet_fs_gtk_search_tab.glade
@@ -34,6 +34,10 @@
34 <column type="gint"/> 34 <column type="gint"/>
35 <!-- column-name completed --> 35 <!-- column-name completed -->
36 <column type="guint64"/> 36 <column type="guint64"/>
37 <!-- column-name downloaded_filename -->
38 <column type="gchararray"/>
39 <!-- column-name downloaded_anonymity -->
40 <column type="gint"/>
37 </columns> 41 </columns>
38 </object> 42 </object>
39 <object class="GtkWindow" id="_search_result_frame_window"> 43 <object class="GtkWindow" id="_search_result_frame_window">
diff --git a/src/fs/gnunet-fs-gtk-download.c b/src/fs/gnunet-fs-gtk-download.c
index e3ee68c4..dc5b2310 100644
--- a/src/fs/gnunet-fs-gtk-download.c
+++ b/src/fs/gnunet-fs-gtk-download.c
@@ -35,9 +35,8 @@ struct DownloadAsDialogContext
35 struct DownloadContext *dc; 35 struct DownloadContext *dc;
36}; 36};
37 37
38 38void
39static void 39GNUNET_GTK_save_as_dialog_free_download_context (struct DownloadContext *dc)
40free_download_context (struct DownloadContext *dc)
41{ 40{
42 if (NULL != dc->rr) 41 if (NULL != dc->rr)
43 gtk_tree_row_reference_free (dc->rr); 42 gtk_tree_row_reference_free (dc->rr);
@@ -50,7 +49,6 @@ free_download_context (struct DownloadContext *dc)
50 GNUNET_free (dc); 49 GNUNET_free (dc);
51} 50}
52 51
53
54gboolean 52gboolean
55GNUNET_GTK_save_as_dialog_delete_event_cb (GtkWidget * widget, GdkEvent * event, 53GNUNET_GTK_save_as_dialog_delete_event_cb (GtkWidget * widget, GdkEvent * event,
56 gpointer user_data) 54 gpointer user_data)
@@ -58,12 +56,7 @@ GNUNET_GTK_save_as_dialog_delete_event_cb (GtkWidget * widget, GdkEvent * event,
58 struct DownloadAsDialogContext *dlc = user_data; 56 struct DownloadAsDialogContext *dlc = user_data;
59 GtkBuilder *builder; 57 GtkBuilder *builder;
60 struct DownloadContext *dc; 58 struct DownloadContext *dc;
61 enum GNUNET_FS_DownloadOptions opt;
62 struct GNUNET_FS_Handle *fs;
63 struct DownloadEntry *de;
64 GtkWidget *cb; 59 GtkWidget *cb;
65 uint32_t anonymity;
66 uint64_t len;
67 60
68 if (dlc == NULL) 61 if (dlc == NULL)
69 { 62 {
@@ -76,7 +69,7 @@ GNUNET_GTK_save_as_dialog_delete_event_cb (GtkWidget * widget, GdkEvent * event,
76 (builder, "GNUNET_GTK_save_as_recursive_check_button")); 69 (builder, "GNUNET_GTK_save_as_recursive_check_button"));
77 if (GTK_RESPONSE_OK != dlc->response) 70 if (GTK_RESPONSE_OK != dlc->response)
78 { 71 {
79 free_download_context (dc); 72 GNUNET_GTK_save_as_dialog_free_download_context (dc);
80 g_object_unref (G_OBJECT (dlc->builder)); 73 g_object_unref (G_OBJECT (dlc->builder));
81 GNUNET_free (dlc); 74 GNUNET_free (dlc);
82 return FALSE; 75 return FALSE;
@@ -88,50 +81,16 @@ GNUNET_GTK_save_as_dialog_delete_event_cb (GtkWidget * widget, GdkEvent * event,
88 (TRUE == 81 (TRUE ==
89 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cb))) ? GNUNET_YES : 82 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cb))) ? GNUNET_YES :
90 GNUNET_NO; 83 GNUNET_NO;
91 fs = GNUNET_FS_GTK_get_fs_handle (); 84 dc->anonymity =
92 opt = GNUNET_FS_DOWNLOAD_OPTION_NONE;
93 if (dc->is_recursive)
94 opt |= GNUNET_FS_DOWNLOAD_OPTION_RECURSIVE;
95 anonymity =
96 gtk_spin_button_get_value (GTK_SPIN_BUTTON 85 gtk_spin_button_get_value (GTK_SPIN_BUTTON
97 (gtk_builder_get_object 86 (gtk_builder_get_object
98 (builder, 87 (builder,
99 "GNUNET_GTK_save_as_dialog_anonymity_spin_button"))); 88 "GNUNET_GTK_save_as_dialog_anonymity_spin_button")));
100 len = GNUNET_FS_uri_chk_get_file_size (dc->uri);
101 g_object_unref (G_OBJECT (builder)); 89 g_object_unref (G_OBJECT (builder));
102 90
103 de = GNUNET_malloc (sizeof (struct DownloadEntry));
104 de->uri = dc->uri;
105 dc->uri = NULL;
106 de->meta = dc->meta;
107 dc->meta = NULL;
108 if (dc->rr != NULL)
109 {
110 /* We're going to free "dc" very soon */
111 de->rr = gtk_tree_row_reference_copy (dc->rr);
112 de->ts = GTK_TREE_STORE (gtk_tree_row_reference_get_model (dc->rr));
113 }
114 if (dc->sr != NULL)
115 {
116 GNUNET_break (NULL !=
117 GNUNET_FS_download_start_from_search (fs, dc->sr,
118 dc->filename,
119 NULL /* tempname */ ,
120 0 /* offset */ ,
121 len, anonymity, opt,
122 de));
123 }
124 else
125 {
126 GNUNET_break (NULL !=
127 GNUNET_FS_download_start (fs, de->uri, NULL /* meta */ ,
128 dc->filename, NULL /* tempname */ ,
129 0 /* offset */ ,
130 len, anonymity, opt, de,
131 NULL /* parent download ctx */ ));
132 }
133 free_download_context (dc);
134 GNUNET_free (dlc); 91 GNUNET_free (dlc);
92
93 dc->cb (dc);
135 return FALSE; 94 return FALSE;
136} 95}
137 96
@@ -168,7 +127,7 @@ GNUNET_FS_GTK_open_download_as_dialog (struct DownloadContext *dc)
168 if (builder == NULL) 127 if (builder == NULL)
169 { 128 {
170 GNUNET_break (0); 129 GNUNET_break (0);
171 free_download_context (dc); 130 GNUNET_GTK_save_as_dialog_free_download_context (dc);
172 GNUNET_free (dlc); 131 GNUNET_free (dlc);
173 return; 132 return;
174 } 133 }
@@ -181,7 +140,17 @@ GNUNET_FS_GTK_open_download_as_dialog (struct DownloadContext *dc)
181 ad = GTK_WIDGET (gtk_builder_get_object 140 ad = GTK_WIDGET (gtk_builder_get_object
182 (builder, "GNUNET_GTK_save_as_dialog")); 141 (builder, "GNUNET_GTK_save_as_dialog"));
183 if (dc->filename != NULL) 142 if (dc->filename != NULL)
184 gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (ad), dc->filename); 143 {
144 char *dirname;
145 char *basename;
146 dirname = GNUNET_strdup (dc->filename);
147 basename = (char *) GNUNET_STRINGS_get_short_name (dirname);
148 if (basename > dirname)
149 basename[-1] = '\0';
150 gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (ad), dirname);
151 gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (ad), basename);
152 GNUNET_free (dirname);
153 }
185 dlc->builder = builder; 154 dlc->builder = builder;
186 dlc->dialog = ad; 155 dlc->dialog = ad;
187 dlc->response = 0; 156 dlc->response = 0;
diff --git a/src/fs/gnunet-fs-gtk-download.h b/src/fs/gnunet-fs-gtk-download.h
index c150ea2b..9d4af3e4 100644
--- a/src/fs/gnunet-fs-gtk-download.h
+++ b/src/fs/gnunet-fs-gtk-download.h
@@ -28,6 +28,10 @@
28#define GNUNET_FS_GTK_DOWNLOAD_H 28#define GNUNET_FS_GTK_DOWNLOAD_H
29#include "gnunet-fs-gtk-common.h" 29#include "gnunet-fs-gtk-common.h"
30 30
31struct DownloadContext;
32
33typedef void (*GNUNET_FS_DownloadAsCallback ) (struct DownloadContext *dc);
34
31/** 35/**
32 * Information we keep for a download. 36 * Information we keep for a download.
33 */ 37 */
@@ -79,9 +83,17 @@ struct DownloadContext
79 * (this is the same as sr->tab, but sr is opaque here). 83 * (this is the same as sr->tab, but sr is opaque here).
80 */ 84 */
81 struct SearchTab *tab; 85 struct SearchTab *tab;
86
87 /**
88 * A function to call once a filename is picked.
89 */
90 GNUNET_FS_DownloadAsCallback cb;
82}; 91};
83 92
84 93
94void
95GNUNET_GTK_save_as_dialog_free_download_context (struct DownloadContext *dc);
96
85 97
86void 98void
87GNUNET_FS_GTK_open_download_as_dialog (struct DownloadContext *dc); 99GNUNET_FS_GTK_open_download_as_dialog (struct DownloadContext *dc);
diff --git a/src/fs/gnunet-fs-gtk-event_handler.c b/src/fs/gnunet-fs-gtk-event_handler.c
index aa870b0c..32852aef 100644
--- a/src/fs/gnunet-fs-gtk-event_handler.c
+++ b/src/fs/gnunet-fs-gtk-event_handler.c
@@ -596,6 +596,8 @@ move_children (GtkTreeModel * src_model, GtkTreeIter * src_iter,
596 guint applicability_rank; 596 guint applicability_rank;
597 guint availability_certainty; 597 guint availability_certainty;
598 gint availability_rank; 598 gint availability_rank;
599 gchar *downloaded_filename;
600 gint downloaded_anonymity;
599 601
600 if (TRUE == gtk_tree_model_iter_children (src_model, &src_child, src_iter)) 602 if (TRUE == gtk_tree_model_iter_children (src_model, &src_child, src_iter))
601 { 603 {
@@ -607,7 +609,8 @@ move_children (GtkTreeModel * src_model, GtkTreeIter * src_iter,
607 &uri_as_string, 8, &status_colour, 9, &search_result, 609 &uri_as_string, 8, &status_colour, 9, &search_result,
608 10, &mimetype, 11, &applicability_rank, 12, 610 10, &mimetype, 11, &applicability_rank, 12,
609 &availability_certainty, 13, &availability_rank, 14, 611 &availability_certainty, 13, &availability_rank, 14,
610 &completed, -1); 612 &completed, 15, &downloaded_filename, 16,
613 &downloaded_anonymity, -1);
611 gtk_tree_store_insert_with_values (GTK_TREE_STORE (dst_model), &dst_child, 614 gtk_tree_store_insert_with_values (GTK_TREE_STORE (dst_model), &dst_child,
612 dst_iter, G_MAXINT, 0, meta, 1, uri, 2, 615 dst_iter, G_MAXINT, 0, meta, 1, uri, 2,
613 filesize, 3, preview, 4, 616 filesize, 3, preview, 4,
@@ -617,8 +620,11 @@ move_children (GtkTreeModel * src_model, GtkTreeIter * src_iter,
617 search_result, 10, mimetype, 11, 620 search_result, 10, mimetype, 11,
618 applicability_rank, 12, 621 applicability_rank, 12,
619 availability_certainty, 13, 622 availability_certainty, 13,
620 availability_rank, 14, completed, -1); 623 availability_rank, 14, completed, 15,
624 downloaded_filename, 16,
625 downloaded_anonymity, -1);
621 g_free (filename); 626 g_free (filename);
627 g_free (downloaded_filename);
622 g_free (uri_as_string); 628 g_free (uri_as_string);
623 g_free (status_colour); 629 g_free (status_colour);
624 g_free (mimetype); 630 g_free (mimetype);
@@ -807,6 +813,164 @@ setup_download (struct DownloadEntry *de, struct DownloadEntry *pde,
807 return de; 813 return de;
808} 814}
809 815
816/**
817 * This should get the default download directory
818 * (so that GNUnet won't offer the user to download files
819 * to the 'bin' subdirectory, or whatever is the cwd).
820 * Returns NULL on failure (such as non-existend directory).
821 * Should also preserve the last setting (so if the user
822 * saves files somewhere else, next time we default to
823 * somewhere else, at least until application restart, or maybe even
824 * between application restarts).
825 * Fills the @buffer up to @size bytes, returns a pointer to it.
826 */
827static char *
828get_default_download_directory (char *buffer, size_t size)
829{
830 return NULL;
831}
832
833/**
834 * Called recursively to build a suggested filename by
835 * prepending suggested names for its parent directories (if any).
836 * Might return NULL. Returned name might be absolute.
837 * local_parents is set to GNUNET_YES if all parents are directories,
838 * and are downloaded.
839 */
840static char *
841get_suggested_filename_anonymity (GtkTreeModel *tm, GtkTreeIter *iter, int top,
842 int *local_parents, int *anonymity, int *filename_is_absolute)
843{
844 char *result;
845 char *dirname;
846 char *local_filename, *filename;
847 int downloaded_anonymity;
848 int have_a_parent;
849 struct GNUNET_CONTAINER_MetaData *meta;
850 GtkTreeIter parent;
851 gtk_tree_model_get (tm, iter, 0, &meta, 15, &local_filename, 16, &downloaded_anonymity, -1);
852 if (local_filename == NULL && !top)
853 *local_parents = GNUNET_NO;
854 if (downloaded_anonymity != -1 && *anonymity == -1 && !top)
855 *anonymity = downloaded_anonymity;
856 if (gtk_tree_model_iter_parent (tm, &parent, iter))
857 {
858 have_a_parent = GNUNET_YES;
859 dirname = get_suggested_filename_anonymity (tm, &parent, GNUNET_NO, local_parents, anonymity, filename_is_absolute);
860 }
861 else
862 {
863 have_a_parent = GNUNET_NO;
864 dirname = NULL;
865 if (top)
866 *local_parents = GNUNET_NO;
867 }
868 if (local_filename == NULL)
869 filename = GNUNET_FS_meta_data_suggest_filename (meta);
870 else
871 {
872 /* This directory was downloaded as /foo/bar/baz/somedirname
873 * Hopefully, "somedirname" is actually "somedir.gnd"
874 * We need to strip the ".gnd" part to get "somedir", which is
875 * what we're going to use instead of suggested original filename
876 * Without the .gnd extension we're going to just use a copy
877 * of the directory file name - and that would fail. Sad.
878 */
879 const char *basename;
880 if (dirname == NULL && !have_a_parent)
881 {
882 /* This is the ealderlest parent directory. Use absolute path. */
883 basename = (const char *) local_filename;
884 *filename_is_absolute = GNUNET_YES;
885 }
886 else
887 basename = GNUNET_STRINGS_get_short_name (local_filename);
888 if (basename != NULL && strlen (basename) > 0)
889 {
890 char *dot;
891 filename = GNUNET_strdup (basename);
892 dot = strrchr (filename, '.');
893 if (dot)
894 *dot = '\0';
895 }
896 else
897 filename = GNUNET_FS_meta_data_suggest_filename (meta);
898 }
899 if (dirname && filename)
900 {
901 GNUNET_asprintf (&result, "%s%s%s", dirname, DIR_SEPARATOR_STR, filename);
902 GNUNET_free (filename);
903 GNUNET_free (dirname);
904 return result;
905 }
906 else if (filename)
907 return filename;
908 else
909 return NULL;
910}
911
912static void
913open_download_as_callback (struct DownloadContext *dc)
914{
915 enum GNUNET_FS_DownloadOptions opt;
916 struct GNUNET_FS_Handle *fs;
917 struct DownloadEntry *de;
918 uint64_t len;
919
920 GtkTreeIter iter;
921 GtkTreePath *path;
922
923 fs = GNUNET_FS_GTK_get_fs_handle ();
924 opt = GNUNET_FS_DOWNLOAD_OPTION_NONE;
925 if (dc->is_recursive)
926 opt |= GNUNET_FS_DOWNLOAD_OPTION_RECURSIVE;
927 len = GNUNET_FS_uri_chk_get_file_size (dc->uri);
928
929 de = GNUNET_malloc (sizeof (struct DownloadEntry));
930 de->uri = dc->uri;
931 dc->uri = NULL;
932 de->meta = dc->meta;
933 dc->meta = NULL;
934 if (dc->rr != NULL)
935 {
936 /* We're going to free "dc" very soon */
937 de->rr = gtk_tree_row_reference_copy (dc->rr);
938 de->ts = GTK_TREE_STORE (gtk_tree_row_reference_get_model (dc->rr));
939
940 path = gtk_tree_row_reference_get_path (de->rr);
941 GNUNET_assert (NULL != path);
942 if (gtk_tree_model_get_iter (GTK_TREE_MODEL (de->ts), &iter, path))
943 {
944 /* Store filename and anonymity as specified by the user.
945 * These will be re-used when this is a directory, and the user
946 * downloads its children.
947 */
948 gtk_tree_store_set (de->ts, &iter, 15, dc->filename, 16, dc->anonymity, -1);
949 }
950 gtk_tree_path_free (path);
951
952 }
953 if (dc->sr != NULL)
954 {
955 GNUNET_break (NULL !=
956 GNUNET_FS_download_start_from_search (fs, dc->sr,
957 dc->filename,
958 NULL /* tempname */ ,
959 0 /* offset */ ,
960 len, dc->anonymity, opt,
961 de));
962 }
963 else
964 {
965 GNUNET_break (NULL !=
966 GNUNET_FS_download_start (fs, de->uri, NULL /* meta */ ,
967 dc->filename, NULL /* tempname */ ,
968 0 /* offset */ ,
969 len, dc->anonymity, opt, de,
970 NULL /* parent download ctx */ ));
971 }
972 GNUNET_GTK_save_as_dialog_free_download_context (dc);
973}
810 974
811/** 975/**
812 * Tell FS to start a download. Begins by opening the 976 * Tell FS to start a download. Begins by opening the
@@ -825,11 +989,16 @@ start_download (GtkTreeView * tree_view, GtkTreePath * path,
825 struct SearchResult *sr; 989 struct SearchResult *sr;
826 gchar *mime; 990 gchar *mime;
827 struct DownloadContext *dc; 991 struct DownloadContext *dc;
828 char *buf; 992 char *buf = NULL;
829 char *tmp; 993 char *tmp;
830 size_t tmplen; 994 size_t tmplen;
831 char cwd[FILENAME_MAX]; 995 char cwd[FILENAME_MAX];
996 char *download_directory;
832 char *filename; 997 char *filename;
998 int local_parents;
999 int have_a_suggestion;
1000 int anonymity;
1001 int filename_is_absolute;
833 1002
834 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1003 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
835 "Starting a %sdownload\n", sdc->recursive ? "recursive " : ""); 1004 "Starting a %sdownload\n", sdc->recursive ? "recursive " : "");
@@ -858,24 +1027,32 @@ start_download (GtkTreeView * tree_view, GtkTreePath * path,
858 return; 1027 return;
859 } 1028 }
860 1029
861 1030 download_directory = get_default_download_directory (cwd, sizeof (cwd));
862 /* FIXME: we should check if this download is a file in some directory 1031 /* If no download directory is known, try working directory */
863 (gtk_tree_model_iter_get_parent) and if so obtain the name under which 1032 if (download_directory == NULL)
864 the directory was stored! */ 1033 download_directory = getcwd (cwd, sizeof (cwd));
865 /* Calculate suggested filename; first, pre-pend current working directory */ 1034 /* Calculate suggested filename */
866 filename = GNUNET_FS_meta_data_suggest_filename (meta); 1035 local_parents = GNUNET_YES;
867 if (NULL != getcwd (cwd, sizeof (cwd))) 1036 anonymity = -1;
1037 filename_is_absolute = GNUNET_NO;
1038 filename = get_suggested_filename_anonymity (tm, &iter, GNUNET_YES, &local_parents, &anonymity, &filename_is_absolute);
1039 have_a_suggestion = GNUNET_NO;
1040 if (NULL != download_directory)
868 { 1041 {
869 if (NULL == filename) 1042 if (NULL == filename)
870 { 1043 {
871 buf = GNUNET_strdup (cwd); 1044 buf = GNUNET_strdup (download_directory);
872 } 1045 }
873 else 1046 else
874 { 1047 {
875 GNUNET_asprintf (&tmp, "%s%s%s", 1048 have_a_suggestion = GNUNET_YES;
876 cwd, 1049 if (filename_is_absolute)
877 DIR_SEPARATOR_STR, 1050 GNUNET_asprintf (&tmp, "%s", filename);
878 filename); 1051 else
1052 GNUNET_asprintf (&tmp, "%s%s%s",
1053 download_directory,
1054 DIR_SEPARATOR_STR,
1055 filename);
879 tmplen = strlen (tmp); 1056 tmplen = strlen (tmp);
880 /* now, if we have a directory, replace trailing '/' with ".gnd" */ 1057 /* now, if we have a directory, replace trailing '/' with ".gnd" */
881 if (GNUNET_YES == 1058 if (GNUNET_YES ==
@@ -906,10 +1083,15 @@ start_download (GtkTreeView * tree_view, GtkTreePath * path,
906 dc->meta = GNUNET_CONTAINER_meta_data_duplicate (meta); 1083 dc->meta = GNUNET_CONTAINER_meta_data_duplicate (meta);
907 dc->rr = gtk_tree_row_reference_new (tm, path); 1084 dc->rr = gtk_tree_row_reference_new (tm, path);
908 dc->sr = sr->result; 1085 dc->sr = sr->result;
909 dc->anonymity = -1; 1086 dc->anonymity = anonymity;
910 dc->is_recursive = sdc->recursive; 1087 dc->is_recursive = sdc->recursive;
911 dc->tab = tab; 1088 dc->tab = tab;
912 GNUNET_FS_GTK_open_download_as_dialog (dc); 1089 dc->cb = &open_download_as_callback;
1090 if (local_parents && have_a_suggestion)
1091 /* Skip the dialog, call directly */
1092 open_download_as_callback (dc);
1093 else
1094 GNUNET_FS_GTK_open_download_as_dialog (dc);
913} 1095}
914 1096
915 1097
@@ -1608,6 +1790,8 @@ GNUNET_GTK_add_search_result (struct SearchTab *tab, GtkTreeIter * iter,
1608 0 /* avail-cert */ , 1790 0 /* avail-cert */ ,
1609 13, 0, /* avail-rank */ 1791 13, 0, /* avail-rank */
1610 14, (guint64) 0, /* completed */ 1792 14, (guint64) 0, /* completed */
1793 15, NULL, /* downloaded_filename */
1794 16, -1, /* downloaded_anonymity */
1611 -1); 1795 -1);
1612 if (tab != NULL) 1796 if (tab != NULL)
1613 { 1797 {