diff options
author | Stefano Karapetsas <[email protected]> | 2013-02-21 11:52:16 +0100 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2013-02-21 11:52:16 +0100 |
commit | 20397a105ba058c252a98cfdfcbaba31aff68390 (patch) | |
tree | efd764f23f11aac1a9b778a9943df3c8ff96a046 /libmate-desktop | |
parent | 1a6f28cce679b4758f990aa16b1b31283735de6b (diff) | |
download | mate-desktop-20397a105ba058c252a98cfdfcbaba31aff68390.tar.bz2 mate-desktop-20397a105ba058c252a98cfdfcbaba31aff68390.tar.xz |
Add check if default MATE background exists before to use it
Closes https://github.com/mate-desktop/mate-settings-daemon/issues/39
Diffstat (limited to 'libmate-desktop')
-rw-r--r-- | libmate-desktop/mate-bg.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/libmate-desktop/mate-bg.c b/libmate-desktop/mate-bg.c index 7877b9c..b2cfcbf 100644 --- a/libmate-desktop/mate-bg.c +++ b/libmate-desktop/mate-bg.c @@ -388,9 +388,19 @@ mate_bg_load_from_gsettings (MateBG *bg, /* Fallback to default BG if the filename set is non-existent */ if (filename != NULL && !g_file_test (filename, G_FILE_TEST_EXISTS)) { - /* FIXME: better to use g_settings_get_mapped() here */ + + g_free (filename); + + g_settings_delay (settings); g_settings_reset (settings, MATE_BG_KEY_PICTURE_FILENAME); filename = g_settings_get_string (settings, MATE_BG_KEY_PICTURE_FILENAME); + g_settings_revert (settings); + + //* Check if default background exists, also */ + if (filename != NULL && !g_file_test (filename, G_FILE_TEST_EXISTS)) { + g_free (filename); + filename = NULL; + } } } g_free (tmp); @@ -414,7 +424,8 @@ mate_bg_load_from_gsettings (MateBG *bg, mate_bg_set_placement (bg, placement); mate_bg_set_filename (bg, filename); - g_free (filename); + if (filename != NULL) + g_free (filename); } void |