[epiphany] Handle EPHY_EMBED_PERSIST_NO_VIEW flag
- From: Diego Escalante Urrelo <diegoe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Handle EPHY_EMBED_PERSIST_NO_VIEW flag
- Date: Tue, 9 Mar 2010 15:40:47 +0000 (UTC)
commit 0c012fba8e9f3119e2fb66aac2baf39bce663fd4
Author: Diego Escalante Urrelo <descalante igalia com>
Date: Tue Mar 2 18:30:58 2010 -0500
Handle EPHY_EMBED_PERSIST_NO_VIEW flag
This flag determines if a download should not appear in the DownloaderView
window. The default is to appear, like in gecko times.
Bug #611635
embed/ephy-embed-persist.c | 19 +++++++++++++++++++
tests/testephyembedpersist.c | 1 +
2 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/embed/ephy-embed-persist.c b/embed/ephy-embed-persist.c
index f413af5..44910fe 100644
--- a/embed/ephy-embed-persist.c
+++ b/embed/ephy-embed-persist.c
@@ -22,6 +22,7 @@
#include "config.h"
+#include "downloader-view.h"
#include "ephy-embed-persist.h"
#include "ephy-embed-shell.h"
#include "ephy-embed-type-builtins.h"
@@ -61,6 +62,7 @@ struct _EphyEmbedPersistPrivate
GtkWindow *fc_parent;
guint32 user_time;
WebKitDownload *download;
+ DownloaderView *dview;
};
static void ephy_embed_persist_class_init (EphyEmbedPersistClass *klass);
@@ -478,6 +480,7 @@ ephy_embed_persist_init (EphyEmbedPersist *persist)
LOG ("EphyEmbedPersist initialising %p", persist);
persist->priv->max_size = -1;
+ persist->priv->dview = NULL;
ephy_embed_persist_set_user_time (persist, gtk_get_current_event_time ());
}
@@ -685,6 +688,9 @@ response_cb (GtkDialog *dialog,
uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER(dialog));
+ if (persist->priv->dview)
+ downloader_view_add_download (persist->priv->dview, download);
+
webkit_download_set_destination_uri (download, uri);
webkit_download_start (download);
@@ -765,6 +771,16 @@ ephy_embed_persist_save (EphyEmbedPersist *persist)
G_CALLBACK (download_status_changed_cb),
persist);
+ /* Should we include downloads in DownloaderView? */
+ if (!(priv->flags & EPHY_EMBED_PERSIST_NO_VIEW))
+ {
+ priv->dview = EPHY_DOWNLOADER_VIEW
+ (ephy_embed_shell_get_downloader_view (embed_shell));
+
+ g_object_set_data (G_OBJECT (priv->download), "download-action",
+ GINT_TO_POINTER (DOWNLOAD_ACTION_DOWNLOAD));
+ }
+
if (priv->flags & EPHY_EMBED_PERSIST_ASK_DESTINATION)
{
EphyFileChooser *dialog;
@@ -825,6 +841,9 @@ ephy_embed_persist_save (EphyEmbedPersist *persist)
dest_uri = g_filename_to_uri (dest_filename, NULL, NULL);
}
+ if (priv->dview)
+ downloader_view_add_download (priv->dview, priv->download);
+
webkit_download_set_destination_uri (priv->download, dest_uri);
webkit_download_start (priv->download);
diff --git a/tests/testephyembedpersist.c b/tests/testephyembedpersist.c
index d5a982b..21b6c4c 100644
--- a/tests/testephyembedpersist.c
+++ b/tests/testephyembedpersist.c
@@ -94,6 +94,7 @@ persist_fixture_setup (PersistFixture *fixture,
ephy_embed_persist_set_source (fixture->embed, uri_string);
ephy_embed_persist_set_dest (fixture->embed, fixture->destination);
+ ephy_embed_persist_set_flags (fixture->embed, EPHY_EMBED_PERSIST_NO_VIEW);
g_free (tmp_filename);
g_free (uri_string);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]