diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2003-09-20 19:17:54 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2003-09-20 19:17:54 +0800 |
commit | b93121c147570503f42ce2d1d619296b26081d59 (patch) | |
tree | 3a0d846c2d897d711ee3ae22d6584101d298b095 /src | |
parent | 68616208eeeee369e62c9256fc9aba5dbe139e3e (diff) | |
download | gsoc2013-epiphany-b93121c147570503f42ce2d1d619296b26081d59.tar gsoc2013-epiphany-b93121c147570503f42ce2d1d619296b26081d59.tar.gz gsoc2013-epiphany-b93121c147570503f42ce2d1d619296b26081d59.tar.bz2 gsoc2013-epiphany-b93121c147570503f42ce2d1d619296b26081d59.tar.lz gsoc2013-epiphany-b93121c147570503f42ce2d1d619296b26081d59.tar.xz gsoc2013-epiphany-b93121c147570503f42ce2d1d619296b26081d59.tar.zst gsoc2013-epiphany-b93121c147570503f42ce2d1d619296b26081d59.zip |
Fix directory selection persistence [bug #122780].
2003-09-20 Christian Persch <chpe@cvs.gnome.org>
* embed/ephy-embed-utils.c: (ephy_embed_utils_save):
* embed/mozilla/mozilla-embed-single.cpp:
* src/window-commands.c: (window_cmd_file_open):
Fix directory selection persistence [bug #122780].
Diffstat (limited to 'src')
-rw-r--r-- | src/window-commands.c | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/src/window-commands.c b/src/window-commands.c index e4dcac9d5..bb2286848 100644 --- a/src/window-commands.c +++ b/src/window-commands.c @@ -318,10 +318,7 @@ void window_cmd_file_open (GtkAction *action, EphyWindow *window) { - gchar *dir, *retDir; - gchar *file; - GnomeVFSURI *uri; - GtkWidget *wmain; + char *dir, *ret_dir, *file; EphyEmbedShell *embed_shell; gresult result; EphyEmbedSingle *single; @@ -331,35 +328,37 @@ window_cmd_file_open (GtkAction *action, embed_shell = EPHY_EMBED_SHELL (ephy_shell); - wmain = GTK_WIDGET (window); - g_return_if_fail (wmain != NULL); - dir = eel_gconf_get_string (CONF_STATE_OPEN_DIR); result = ephy_embed_single_show_file_picker - (single, wmain, + (single, GTK_WIDGET (window), _("Open"), dir, NULL, modeOpen, &file, NULL, NULL); - uri = gnome_vfs_uri_new (file); - if (uri) + /* persist directory choice */ + /* Fix for bug 122780: + * if the user selected a directory, or aborted with no filename typed, + * g_path_get_dirname and gnome_vfs_uri_extract_dirname strip the last + * path component, so test if the returned file is actually a directory. + */ + if (g_file_test (file, G_FILE_TEST_IS_DIR)) { - retDir = gnome_vfs_uri_extract_dirname (uri); - - /* set default open dir */ - eel_gconf_set_string (CONF_STATE_OPEN_DIR, - retDir); + ret_dir = g_strdup (file); + } + else + { + ret_dir = g_path_get_dirname (file); + } - g_free (retDir); - gnome_vfs_uri_unref (uri); + eel_gconf_set_string (CONF_STATE_OPEN_DIR, ret_dir); - if (result == G_OK) - { - ephy_window_load_url(window, file); - } - } + if (result == G_OK) + { + ephy_window_load_url(window, file); + } + g_free (ret_dir); g_free (file); g_free (dir); } |