aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
Diffstat (limited to 'embed')
-rw-r--r--embed/ephy-embed-utils.c28
-rw-r--r--embed/mozilla/mozilla-embed-single.cpp6
2 files changed, 18 insertions, 16 deletions
diff --git a/embed/ephy-embed-utils.c b/embed/ephy-embed-utils.c
index ecb3dff7c..ff3dcbef5 100644
--- a/embed/ephy-embed-utils.c
+++ b/embed/ephy-embed-utils.c
@@ -61,7 +61,6 @@ ephy_embed_utils_save (GtkWidget *window,
char *retPath = NULL;
char *fileName = NULL;
char *dirName = NULL;
- char *retDir;
char *target;
const char *source;
gresult ret;
@@ -136,18 +135,27 @@ ephy_embed_utils_save (GtkWidget *window,
if (ask_dest)
{
+ char *ret_dir;
+
/* show the file picker */
ret = ephy_embed_single_show_file_picker
(single, window, title,
dirName, fileName, modeSave, &retPath,
NULL, NULL);
- }
-
- uri = gnome_vfs_uri_new (retPath);
- g_return_if_fail (uri != NULL);
-
- retDir = gnome_vfs_uri_extract_dirname (uri);
+ if (g_file_test (retPath, G_FILE_TEST_IS_DIR))
+ {
+ ret_dir = g_strdup (retPath);
+ }
+ else
+ {
+ ret_dir = g_path_get_dirname (retPath);
+ }
+
+ /* set default save dir */
+ eel_gconf_set_string (default_dir_pref, ret_dir);
+ g_free (ret_dir);
+ }
if (ret == G_OK)
{
@@ -173,12 +181,6 @@ ephy_embed_utils_save (GtkWidget *window,
}
- /* set default save dir */
- eel_gconf_set_string (default_dir_pref,
- retDir);
-
- g_free (retDir);
- gnome_vfs_uri_unref (uri);
g_free (retPath);
g_object_unref (G_OBJECT(persist));
diff --git a/embed/mozilla/mozilla-embed-single.cpp b/embed/mozilla/mozilla-embed-single.cpp
index b4f5fc2f8..8bbfc43c1 100644
--- a/embed/mozilla/mozilla-embed-single.cpp
+++ b/embed/mozilla/mozilla-embed-single.cpp
@@ -38,6 +38,7 @@
#include <time.h>
#include <libgnome/gnome-i18n.h>
+#include <libgnomevfs/gnome-vfs-utils.h>
#include <string.h>
#include <nsICacheService.h>
#include <nsCOMPtr.h>
@@ -1017,15 +1018,14 @@ impl_show_file_picker (EphyEmbedSingle *shell,
GFilePicker *filePicker = new GFilePicker (file_formats);
- /* FIXME sane path: expand tilde ... */
- expanded_directory = g_strdup (directory);
+ expanded_directory = gnome_vfs_expand_initial_tilde (directory);
/* make sure the directory exists, and use the home directory
* otherwise */
if (!expanded_directory ||
!g_file_test (expanded_directory, G_FILE_TEST_IS_DIR))
{
- if (expanded_directory) g_free (expanded_directory);
+ g_free (expanded_directory);
expanded_directory = g_strdup (g_get_home_dir());
}