[Xfce4-commits] <midori:master> Don't confuse filename and input in midori_browser_save_uri

Christian Dywan noreply at xfce.org
Tue Nov 8 00:30:03 CET 2011


Updating branch refs/heads/master
         to aa5aeaf23c145d18401eeed9d41ae927a37c92e6 (commit)
       from 49317da35c8309afaa39c8a06a46c10124ad51b4 (commit)

commit aa5aeaf23c145d18401eeed9d41ae927a37c92e6
Author: Christian Dywan <christian at twotoasts.de>
Date:   Mon Nov 7 23:11:08 2011 +0100

    Don't confuse filename and input in midori_browser_save_uri
    
    The file chooser expects UTF-8 as if typed by the user, not
    a filename in the local encoding.

 midori/midori-browser.c |   15 ++++-----------
 1 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/midori/midori-browser.c b/midori/midori-browser.c
index dae48ad..b89a350 100644
--- a/midori/midori-browser.c
+++ b/midori/midori-browser.c
@@ -1046,17 +1046,10 @@ midori_browser_save_uri (MidoriBrowser* browser,
             g_free (filename);
         }
 
-        /* Try to provide a good default filename */
-        filename = g_filename_from_uri (uri, NULL, NULL);
-        if (!filename && (last_slash = g_strrstr (uri, "/")))
-        {
-            if (last_slash[0] == '/')
-                last_slash++;
-            filename = g_strdup (last_slash);
-        }
-        else
-            filename = g_strdup (uri);
-        gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), filename);
+        /* Try to provide a good default filename, UTF-8 encoded */
+        filename = soup_uri_decode (uri);
+        last_slash = g_strrstr (filename, "/") + 1;
+        gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), last_slash);
         g_free (filename);
     }
 


More information about the Xfce4-commits mailing list