[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r19245 - gnunet-gtk/src/fs
From: |
gnunet |
Subject: |
[GNUnet-SVN] r19245 - gnunet-gtk/src/fs |
Date: |
Wed, 18 Jan 2012 16:42:16 +0100 |
Author: grothoff
Date: 2012-01-18 16:42:16 +0100 (Wed, 18 Jan 2012)
New Revision: 19245
Modified:
gnunet-gtk/src/fs/gnunet-fs-gtk-download.c
gnunet-gtk/src/fs/gnunet-fs-gtk-download.h
gnunet-gtk/src/fs/gnunet-fs-gtk-event_handler.c
gnunet-gtk/src/fs/gnunet-fs-gtk-main_window_file_download.c
Log:
-LRN: bugfix: Move-callback-make-it-public-use-it-in-URI-opener
Modified: gnunet-gtk/src/fs/gnunet-fs-gtk-download.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk-download.c 2012-01-18 15:10:50 UTC (rev
19244)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk-download.c 2012-01-18 15:42:16 UTC (rev
19245)
@@ -158,4 +158,67 @@
gtk_window_present (GTK_WINDOW (ad));
}
+void
+GNUNET_FS_GTK_default_open_download_as_callback (struct DownloadContext *dc)
+{
+ enum GNUNET_FS_DownloadOptions opt;
+ struct GNUNET_FS_Handle *fs;
+ struct DownloadEntry *de;
+ uint64_t len;
+
+ GtkTreeIter iter;
+ GtkTreePath *path;
+
+ fs = GNUNET_FS_GTK_get_fs_handle ();
+ opt = GNUNET_FS_DOWNLOAD_OPTION_NONE;
+ if (dc->is_recursive)
+ opt |= GNUNET_FS_DOWNLOAD_OPTION_RECURSIVE;
+ len = GNUNET_FS_uri_chk_get_file_size (dc->uri);
+
+ de = GNUNET_malloc (sizeof (struct DownloadEntry));
+ de->uri = dc->uri;
+ dc->uri = NULL;
+ de->meta = dc->meta;
+ dc->meta = NULL;
+ if (dc->rr != NULL)
+ {
+ /* We're going to free "dc" very soon */
+ de->rr = gtk_tree_row_reference_copy (dc->rr);
+ de->ts = GTK_TREE_STORE (gtk_tree_row_reference_get_model (dc->rr));
+
+ path = gtk_tree_row_reference_get_path (de->rr);
+ GNUNET_assert (NULL != path);
+ if (gtk_tree_model_get_iter (GTK_TREE_MODEL (de->ts), &iter, path))
+ {
+ /* Store filename and anonymity as specified by the user.
+ * These will be re-used when this is a directory, and the user
+ * downloads its children.
+ */
+ gtk_tree_store_set (de->ts, &iter, 15, dc->filename, 16, dc->anonymity,
-1);
+ }
+ gtk_tree_path_free (path);
+
+ }
+ if (dc->sr != NULL)
+ {
+ GNUNET_break (NULL !=
+ GNUNET_FS_download_start_from_search (fs, dc->sr,
+ dc->filename,
+ NULL /* tempname */ ,
+ 0 /* offset */ ,
+ len, dc->anonymity,
opt,
+ de));
+ }
+ else
+ {
+ GNUNET_break (NULL !=
+ GNUNET_FS_download_start (fs, de->uri, NULL /* meta */ ,
+ dc->filename, NULL /* tempname */ ,
+ 0 /* offset */ ,
+ len, dc->anonymity, opt, de,
+ NULL /* parent download ctx */ ));
+ }
+ GNUNET_GTK_save_as_dialog_free_download_context (dc);
+}
+
/* end of gnunet-fs-gtk-download.c */
Modified: gnunet-gtk/src/fs/gnunet-fs-gtk-download.h
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk-download.h 2012-01-18 15:10:50 UTC (rev
19244)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk-download.h 2012-01-18 15:42:16 UTC (rev
19245)
@@ -96,6 +96,9 @@
void
+GNUNET_FS_GTK_default_open_download_as_callback (struct DownloadContext *dc);
+
+void
GNUNET_FS_GTK_open_download_as_dialog (struct DownloadContext *dc);
Modified: gnunet-gtk/src/fs/gnunet-fs-gtk-event_handler.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk-event_handler.c 2012-01-18 15:10:50 UTC
(rev 19244)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk-event_handler.c 2012-01-18 15:42:16 UTC
(rev 19245)
@@ -909,69 +909,6 @@
return NULL;
}
-static void
-open_download_as_callback (struct DownloadContext *dc)
-{
- enum GNUNET_FS_DownloadOptions opt;
- struct GNUNET_FS_Handle *fs;
- struct DownloadEntry *de;
- uint64_t len;
-
- GtkTreeIter iter;
- GtkTreePath *path;
-
- fs = GNUNET_FS_GTK_get_fs_handle ();
- opt = GNUNET_FS_DOWNLOAD_OPTION_NONE;
- if (dc->is_recursive)
- opt |= GNUNET_FS_DOWNLOAD_OPTION_RECURSIVE;
- len = GNUNET_FS_uri_chk_get_file_size (dc->uri);
-
- de = GNUNET_malloc (sizeof (struct DownloadEntry));
- de->uri = dc->uri;
- dc->uri = NULL;
- de->meta = dc->meta;
- dc->meta = NULL;
- if (dc->rr != NULL)
- {
- /* We're going to free "dc" very soon */
- de->rr = gtk_tree_row_reference_copy (dc->rr);
- de->ts = GTK_TREE_STORE (gtk_tree_row_reference_get_model (dc->rr));
-
- path = gtk_tree_row_reference_get_path (de->rr);
- GNUNET_assert (NULL != path);
- if (gtk_tree_model_get_iter (GTK_TREE_MODEL (de->ts), &iter, path))
- {
- /* Store filename and anonymity as specified by the user.
- * These will be re-used when this is a directory, and the user
- * downloads its children.
- */
- gtk_tree_store_set (de->ts, &iter, 15, dc->filename, 16, dc->anonymity,
-1);
- }
- gtk_tree_path_free (path);
-
- }
- if (dc->sr != NULL)
- {
- GNUNET_break (NULL !=
- GNUNET_FS_download_start_from_search (fs, dc->sr,
- dc->filename,
- NULL /* tempname */ ,
- 0 /* offset */ ,
- len, dc->anonymity,
opt,
- de));
- }
- else
- {
- GNUNET_break (NULL !=
- GNUNET_FS_download_start (fs, de->uri, NULL /* meta */ ,
- dc->filename, NULL /* tempname */ ,
- 0 /* offset */ ,
- len, dc->anonymity, opt, de,
- NULL /* parent download ctx */ ));
- }
- GNUNET_GTK_save_as_dialog_free_download_context (dc);
-}
-
/**
* Tell FS to start a download. Begins by opening the
* "save as" window.
@@ -1086,10 +1023,10 @@
dc->anonymity = anonymity;
dc->is_recursive = sdc->recursive;
dc->tab = tab;
- dc->cb = &open_download_as_callback;
+ dc->cb = &GNUNET_FS_GTK_default_open_download_as_callback;
if (local_parents && have_a_suggestion)
/* Skip the dialog, call directly */
- open_download_as_callback (dc);
+ GNUNET_FS_GTK_default_open_download_as_callback (dc);
else
GNUNET_FS_GTK_open_download_as_dialog (dc);
}
Modified: gnunet-gtk/src/fs/gnunet-fs-gtk-main_window_file_download.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk-main_window_file_download.c 2012-01-18
15:10:50 UTC (rev 19244)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk-main_window_file_download.c 2012-01-18
15:42:16 UTC (rev 19245)
@@ -117,6 +117,7 @@
dc = GNUNET_malloc (sizeof (struct DownloadContext));
dc->uri = uri;
dc->anonymity = anonymity_level;
+ dc->cb = GNUNET_FS_GTK_default_open_download_as_callback;
GNUNET_FS_GTK_open_download_as_dialog (dc);
return;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r19245 - gnunet-gtk/src/fs,
gnunet <=