From bc541864b12e85185251765c99a103718b92b994 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Sat, 29 Oct 2005 21:38:41 +0000 Subject: Add ephy_file_get_downloads_dir() to get the actual downloads directory, 2005-10-29 Christian Persch * embed/mozilla/MozDownload.cpp: * lib/ephy-file-chooser.c: (ephy_file_chooser_constructor): * lib/ephy-file-helpers.c: (ephy_file_get_downloads_dir): * lib/ephy-file-helpers.h: * src/prefs-dialog.c: (download_path_changed_cb), (create_download_path_button): Add ephy_file_get_downloads_dir() to get the actual downloads directory, and use it in the prefs dialogue, the filechooser, and the backend. --- src/prefs-dialog.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'src/prefs-dialog.c') diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c index 2b8d00bd1..60f965d78 100644 --- a/src/prefs-dialog.c +++ b/src/prefs-dialog.c @@ -1117,17 +1117,34 @@ create_language_section (EphyDialog *dialog) static void download_path_changed_cb (GtkFileChooser *button) { - char *dir; + char *dir, *downloads_dir, *desktop_dir; /* FIXME: use _uri variant when we support downloading * to gnome-vfs remote locations */ dir = gtk_file_chooser_get_filename (button); - if (dir != NULL) + if (dir == NULL) return; + + downloads_dir = ephy_file_downloads_dir (); + desktop_dir = ephy_file_desktop_dir (); + g_return_if_fail (downloads_dir != NULL && desktop_dir != NULL); + + if (strcmp (dir, downloads_dir) == 0) + { + eel_gconf_set_string (CONF_STATE_DOWNLOAD_DIR, "Downloads"); + } + else if (strcmp (dir, desktop_dir) == 0) + { + eel_gconf_set_string (CONF_STATE_DOWNLOAD_DIR, "Desktop"); + } + else { eel_gconf_set_path (CONF_STATE_DOWNLOAD_DIR, dir); - g_free (dir); } + + g_free (dir); + g_free (downloads_dir); + g_free (desktop_dir); } static void @@ -1137,7 +1154,7 @@ create_download_path_button (EphyDialog *dialog) EphyFileChooser *fc; char *dir; - dir = ephy_file_downloads_dir (); + dir = ephy_file_get_downloads_dir (); ephy_dialog_get_controls (dialog, properties[DOWNLOAD_PATH_HBOX_PROP].id, &hbox, -- cgit v1.2.3