summaryrefslogtreecommitdiff
path: root/libmate-desktop/mate-bg.c
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2012-11-03 19:30:53 +0100
committerStefano Karapetsas <[email protected]>2012-11-03 19:30:53 +0100
commitcc3914d206b705628f155b35f8c2530df540cad1 (patch)
treef7ff4d1a936f43d7b5d8bc1fe623a358b2558c49 /libmate-desktop/mate-bg.c
parentbbcb0fa4e357fa2a1f30ca74a0e68f6b053a014e (diff)
downloadmate-desktop-cc3914d206b705628f155b35f8c2530df540cad1.tar.bz2
mate-desktop-cc3914d206b705628f155b35f8c2530df540cad1.tar.xz
add function to load system settings instead of the user settings
this is needed in mate-screensaver
Diffstat (limited to 'libmate-desktop/mate-bg.c')
-rw-r--r--libmate-desktop/mate-bg.c39
1 files changed, 34 insertions, 5 deletions
diff --git a/libmate-desktop/mate-bg.c b/libmate-desktop/mate-bg.c
index 942d54f..0e95471 100644
--- a/libmate-desktop/mate-bg.c
+++ b/libmate-desktop/mate-bg.c
@@ -289,19 +289,50 @@ queue_transitioned (MateBG *bg)
NULL);
}
+/* This function load user settings */
void
mate_bg_load_from_preferences (MateBG *bg)
{
+ GSettings *settings;
+ settings = g_settings_new (MATE_BG_SCHEMA);
+ mate_bg_load_from_gsettings (bg, settings);
+ g_object_unref (settings);
+}
+
+/* This function load system settings */
+void
+mate_bg_load_from_system_preferences (MateBG *bg)
+{
+ GSettings *settings;
+ gchar **keys;
+ gchar **k;
+
+ /* FIXME: we need to bind system settings instead of user but
+ * that's currently impossible, not implemented yet.
+ * Hence, reset to system default values.
+ */
+ settings = g_settings_new (MATE_BG_SCHEMA);
+ g_settings_delay (settings);
+ keys = g_settings_list_keys (settings);
+ for (k = keys; *k; k++) {
+ g_settings_reset (settings, *k);
+ }
+ g_strfreev (keys);
+ mate_bg_load_from_gsettings (bg, settings);
+ g_settings_revert (settings);
+ g_object_unref (settings);
+}
+
+void
+mate_bg_load_from_gsettings (MateBG *bg, GSettings *settings)
+{
char *tmp;
char *filename;
MateBGColorType ctype;
GdkColor c1, c2;
MateBGPlacement placement;
- GSettings *settings;
g_return_if_fail (MATE_IS_BG (bg));
-
- settings = g_settings_new (MATE_BG_SCHEMA);
/* Filename */
filename = NULL;
@@ -342,8 +373,6 @@ mate_bg_load_from_preferences (MateBG *bg)
/* Placement */
placement = g_settings_get_enum (settings, BG_KEY_PICTURE_PLACEMENT);
- g_object_unref (settings);
-
mate_bg_set_color (bg, ctype, &c1, &c2);
mate_bg_set_placement (bg, placement);
mate_bg_set_filename (bg, filename);