[gthumb] gthumb doesn't honour privacy settings
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] gthumb doesn't honour privacy settings
- Date: Sun, 19 Jan 2014 14:57:04 +0000 (UTC)
commit 5460215470389ee0738169da5f8c90a773010dbf
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sun Jan 19 15:52:13 2014 +0100
gthumb doesn't honour privacy settings
[bug #722349]
gthumb/glib-utils.c | 22 ++++++++++++++++++++++
gthumb/glib-utils.h | 2 ++
gthumb/gth-browser.c | 9 +++++++++
3 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/gthumb/glib-utils.c b/gthumb/glib-utils.c
index c8e1079..e639078 100644
--- a/gthumb/glib-utils.c
+++ b/gthumb/glib-utils.c
@@ -3070,6 +3070,28 @@ _g_settings_get_string_list (GSettings *settings,
}
+GSettings *
+_g_settings_new_if_schema_installed (const char *schema_name)
+{
+ GSettings *settings;
+ const char * const *schemas;
+
+ settings = NULL;
+
+ for (schemas = g_settings_list_schemas ();
+ *schemas != NULL;
+ schemas++)
+ {
+ if (g_strcmp0 (*schemas, schema_name) == 0) {
+ settings = g_settings_new (schema_name);
+ break;
+ }
+ }
+
+ return settings;
+}
+
+
/* this is totem_time_to_string renamed, thanks to the authors :) */
char *
_g_format_duration_for_display (gint64 msecs)
diff --git a/gthumb/glib-utils.h b/gthumb/glib-utils.h
index b0b7f30..0ae5b8c 100644
--- a/gthumb/glib-utils.h
+++ b/gthumb/glib-utils.h
@@ -335,6 +335,8 @@ void _g_settings_set_string_list (GSettings *settings,
GList *list);
GList * _g_settings_get_string_list (GSettings *settings,
const char *key);
+GSettings * _g_settings_new_if_schema_installed
+ (const char *schema_name);
/* Other */
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index 871c265..3839aa3 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -562,12 +562,21 @@ _gth_browser_history_add (GthBrowser *browser,
static void
_gth_browser_history_save (GthBrowser *browser)
{
+ GSettings *privacy_settings;
+ gboolean save_history;
GBookmarkFile *bookmarks;
GFile *file;
char *filename;
GList *scan;
int n;
+ privacy_settings = _g_settings_new_if_schema_installed ("org.gnome.desktop.privacy");
+ save_history = (privacy_settings == NULL) || g_settings_get_boolean (privacy_settings,
"remember-recent-files");
+ _g_object_unref (privacy_settings);
+
+ if (! save_history)
+ return;
+
bookmarks = g_bookmark_file_new ();
for (scan = browser->priv->history, n = 0; scan && (n < MAX_HISTORY_LENGTH); scan = scan->next, n++) {
GFile *location = scan->data;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]