[epiphany] ephy-download: Pass suggested filename to define_destination_uri()



commit 188de2119d0375ac7c27252917778038200210b8
Author: Carlos Garcia Campos <cgarcia igalia com>
Date:   Fri Jun 22 09:53:30 2012 +0200

    ephy-download: Pass suggested filename to define_destination_uri()
    
    Instead of getting it from the download to make define_destination_uri()
    function compatible with WebKit2.

 embed/ephy-download.c |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/embed/ephy-download.c b/embed/ephy-download.c
index 5d77c0e..756a1e5 100644
--- a/embed/ephy-download.c
+++ b/embed/ephy-download.c
@@ -281,20 +281,13 @@ parse_extension (const char *filename)
 }
 
 static char *
-define_destination_uri (EphyDownload *download)
+define_destination_uri (EphyDownload *download, const char *suggested_filename)
 {
   char *dest_dir;
   char *dest_name;
   char *destination_filename;
   char *destination_uri;
-  const char *suggested_filename;
 
-#ifdef HAVE_WEBKIT2
-  /* TODO: Downloads */
-  suggested_filename = NULL;
-#else
-  suggested_filename = webkit_download_get_suggested_filename (download->priv->download);
-#endif
   dest_dir = ephy_file_get_downloads_dir ();
 
   /* Make sure the download directory exists */
@@ -395,14 +388,19 @@ ephy_download_set_destination_uri (EphyDownload *download,
 void
 ephy_download_set_auto_destination (EphyDownload *download)
 {
+#ifdef HAVE_WEBKIT2
+  /* In WebKit2 priv->destination == NULL means auto_destination */
+#else
   char *dest;
 
   g_return_if_fail (EPHY_IS_DOWNLOAD (download));
 
-  dest = define_destination_uri (download);
+  dest = define_destination_uri (download,
+                                 webkit_download_get_suggested_filename (download->priv->download));
   ephy_download_set_destination_uri (download, dest);
 
   g_free (dest);
+#endif
 }
 
 /**



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]