From 0c012fba8e9f3119e2fb66aac2baf39bce663fd4 Mon Sep 17 00:00:00 2001 From: Diego Escalante Urrelo Date: Tue, 2 Mar 2010 18:30:58 -0500 Subject: 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 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'embed') 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); -- cgit v1.2.3