diff options
author | Diego Escalante Urrelo <descalante@igalia.com> | 2010-03-03 07:30:58 +0800 |
---|---|---|
committer | Diego Escalante Urrelo <descalante@igalia.com> | 2010-03-09 23:38:26 +0800 |
commit | 0c012fba8e9f3119e2fb66aac2baf39bce663fd4 (patch) | |
tree | d68eb0a54df50228799a784fcb7dc23d83fd1a62 | |
parent | 4a9440cdc83655f653029a8acf86ba805743c377 (diff) | |
download | gsoc2013-epiphany-0c012fba8e9f3119e2fb66aac2baf39bce663fd4.tar.gz gsoc2013-epiphany-0c012fba8e9f3119e2fb66aac2baf39bce663fd4.tar.zst gsoc2013-epiphany-0c012fba8e9f3119e2fb66aac2baf39bce663fd4.zip |
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
-rw-r--r-- | embed/ephy-embed-persist.c | 19 | ||||
-rw-r--r-- | 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 f413af533..44910fe9c 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 d5a982ba1..21b6c4c51 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); |