[epiphany] Keep track of last up/download directories
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Keep track of last up/download directories
- Date: Wed, 2 Jan 2019 20:37:54 +0000 (UTC)
commit 2f6e062747e35ca77aeab67b77d03a007825b606
Author: Jan-Michael Brummer <jan brummer tabos org>
Date: Wed Jan 2 18:56:49 2019 +0100
Keep track of last up/download directories
Fixes: https://gitlab.gnome.org/GNOME/epiphany/issues/133
data/org.gnome.epiphany.gschema.xml | 10 ++++++++++
embed/ephy-web-view.c | 2 ++
lib/ephy-prefs.h | 6 +++++-
src/popup-commands.c | 2 ++
src/window-commands.c | 3 +++
5 files changed, 22 insertions(+), 1 deletion(-)
---
diff --git a/data/org.gnome.epiphany.gschema.xml b/data/org.gnome.epiphany.gschema.xml
index cf57e7ceb..a22939bfb 100644
--- a/data/org.gnome.epiphany.gschema.xml
+++ b/data/org.gnome.epiphany.gschema.xml
@@ -254,6 +254,16 @@
<summary>Enable mouse gesture</summary>
<description>Whether to enable mouse gestures. Mouse gestures are based on Opera’s
behaviour and are activated using the middle mouse button + gesture.</description>
</key>
+ <key type="s" name="last-upload-directory">
+ <default>''</default>
+ <summary>Last upload directory</summary>
+ <description>Keep track of last upload directory</description>
+ </key>
+ <key type="s" name="last-download-directory">
+ <default>''</default>
+ <summary>Last download directory</summary>
+ <description>Keep track of last download directory</description>
+ </key>
</schema>
<schema id="org.gnome.Epiphany.webapp">
<key type="as" name="additional-urls">
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 8aa412149..ca58dca8c 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -317,6 +317,7 @@ open_response_cb (GtkFileChooser *dialog,
webkit_file_chooser_request_select_files (request, (const char * const *)file_array->pdata);
g_slist_free_full (file_list, g_free);
g_ptr_array_free (file_array, FALSE);
+ g_settings_set_string (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_LAST_UPLOAD_DIRECTORY,
gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (dialog)));
} else {
webkit_file_chooser_request_cancel (request);
}
@@ -343,6 +344,7 @@ ephy_web_view_run_file_chooser (WebKitWebView *web_view,
if (filter)
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter);
+ gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), g_settings_get_string (EPHY_SETTINGS_WEB,
EPHY_PREFS_WEB_LAST_UPLOAD_DIRECTORY));
gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dialog), allows_multiple_selection);
g_signal_connect (dialog, "response",
diff --git a/lib/ephy-prefs.h b/lib/ephy-prefs.h
index d5568a156..f18fd0c58 100644
--- a/lib/ephy-prefs.h
+++ b/lib/ephy-prefs.h
@@ -120,6 +120,8 @@ static const char * const ephy_prefs_state_schema[] = {
#define EPHY_PREFS_WEB_DEFAULT_ZOOM_LEVEL "default-zoom-level"
#define EPHY_PREFS_WEB_ENABLE_AUTOSEARCH "enable-autosearch"
#define EPHY_PREFS_WEB_ENABLE_MOUSE_GESTURES "enable-mouse-gestures"
+#define EPHY_PREFS_WEB_LAST_UPLOAD_DIRECTORY "last-upload-directory"
+#define EPHY_PREFS_WEB_LAST_DOWNLOAD_DIRECTORY "last-download-directory"
static const char * const ephy_prefs_web_schema[] = {
EPHY_PREFS_WEB_FONT_MIN_SIZE,
@@ -146,7 +148,9 @@ static const char * const ephy_prefs_web_schema[] = {
EPHY_PREFS_WEB_GSB_API_KEY,
EPHY_PREFS_WEB_DEFAULT_ZOOM_LEVEL,
EPHY_PREFS_WEB_ENABLE_AUTOSEARCH,
- EPHY_PREFS_WEB_ENABLE_MOUSE_GESTURES
+ EPHY_PREFS_WEB_ENABLE_MOUSE_GESTURES,
+ EPHY_PREFS_WEB_LAST_UPLOAD_DIRECTORY,
+ EPHY_PREFS_WEB_LAST_DOWNLOAD_DIRECTORY,
};
#define EPHY_PREFS_SCHEMA "org.gnome.Epiphany"
diff --git a/src/popup-commands.c b/src/popup-commands.c
index 798c30ba8..ffbbed3c2 100644
--- a/src/popup-commands.c
+++ b/src/popup-commands.c
@@ -161,6 +161,7 @@ filename_suggested_cb (EphyDownload *download,
GTK_FILE_CHOOSER_ACTION_SAVE,
EPHY_FILE_FILTER_NONE);
gtk_file_chooser_set_do_overwrite_confirmation (dialog, TRUE);
+ gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), g_settings_get_string (EPHY_SETTINGS_WEB,
EPHY_PREFS_WEB_LAST_DOWNLOAD_DIRECTORY));
sanitized_filename = ephy_sanitize_filename (g_strdup (suggested_filename));
gtk_file_chooser_set_current_name (dialog, sanitized_filename);
@@ -179,6 +180,7 @@ filename_suggested_cb (EphyDownload *download,
ephy_downloads_manager_add_download (ephy_embed_shell_get_downloads_manager
(ephy_embed_shell_get_default ()),
download);
+ g_settings_set_string (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_LAST_DOWNLOAD_DIRECTORY,
gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (dialog)));
} else {
g_idle_add_full (G_PRIORITY_DEFAULT,
(GSourceFunc)cancel_download_idle_cb,
diff --git a/src/window-commands.c b/src/window-commands.c
index a725d9863..81f5ea506 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -1458,6 +1458,8 @@ save_response_cb (GtkNativeDialog *dialog, int response, EphyEmbed *embed)
g_free (converted);
g_free (uri);
}
+
+ g_settings_set_string (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_LAST_DOWNLOAD_DIRECTORY,
gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (dialog)));
}
g_object_unref (dialog);
@@ -1482,6 +1484,7 @@ window_cmd_save_as (GSimpleAction *action,
EPHY_FILE_FILTER_NONE);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
+ gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), g_settings_get_string (EPHY_SETTINGS_WEB,
EPHY_PREFS_WEB_LAST_DOWNLOAD_DIRECTORY));
suggested_filename = ephy_sanitize_filename (get_suggested_filename (embed));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]