diff options
author | infirit <[email protected]> | 2014-12-15 23:52:55 +0100 |
---|---|---|
committer | infirit <[email protected]> | 2014-12-15 23:52:55 +0100 |
commit | e18af0c730ecf306ad81b075167ce596309739a7 (patch) | |
tree | 517379015fc9f056d592cfa8c9fbdf177840f7ed /mate-screenshot | |
parent | 21c397d825cb06890efb0e847c13b9c3c6254db0 (diff) | |
download | mate-utils-e18af0c730ecf306ad81b075167ce596309739a7.tar.bz2 mate-utils-e18af0c730ecf306ad81b075167ce596309739a7.tar.xz |
Revert "mate-screenshot: simplify get_desktop_dir()"
This reverts commit 21c397d825cb06890efb0e847c13b9c3c6254db0.
Diffstat (limited to 'mate-screenshot')
-rw-r--r-- | mate-screenshot/mate-screenshot.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/mate-screenshot/mate-screenshot.c b/mate-screenshot/mate-screenshot.c index 40d10d06..0e122b47 100644 --- a/mate-screenshot/mate-screenshot.c +++ b/mate-screenshot/mate-screenshot.c @@ -1120,8 +1120,34 @@ prepare_screenshot_timeout (gpointer data) static gchar * get_desktop_dir (void) { + gboolean desktop_is_home_dir = FALSE; gchar *desktop_dir; - desktop_dir = g_strconcat ("file://", g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP), NULL); + const char * const *schemas; + gboolean schema_exists = FALSE; + gint i; + + /* Check if caja schema is installed before trying to read settings */ + schemas = g_settings_list_schemas (); + for (i = 0; schemas[i] != NULL; i++) { + if (g_strcmp0 (schemas[i], CAJA_PREFERENCES_SCHEMA) == 0) { + schema_exists = TRUE; + break; + } + } + + if (schema_exists) { + GSettings *caja_prefs; + + caja_prefs = g_settings_new (CAJA_PREFERENCES_SCHEMA); + desktop_is_home_dir = g_settings_get_boolean (caja_prefs, "desktop-is-home-dir"); + + g_object_unref (caja_prefs); + } + + if (desktop_is_home_dir) + desktop_dir = g_strconcat ("file://", g_get_home_dir (), NULL); + else + desktop_dir = g_strconcat ("file://", g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP), NULL); return desktop_dir; } |