summaryrefslogtreecommitdiff
path: root/src/fr-window.c
diff options
context:
space:
mode:
authorBalló György <[email protected]>2014-10-02 14:29:01 +0200
committerStefano Karapetsas <[email protected]>2014-10-02 16:12:04 +0200
commit49f97664d7fdfc7914245cb26f660cbedd36afa4 (patch)
tree779e3a6dc990832a3a663989ab2cfc90ec62a2c7 /src/fr-window.c
parent025cf3f9ebb5860be67dc30c6f5d06554301ade7 (diff)
downloadengrampa-49f97664d7fdfc7914245cb26f660cbedd36afa4.tar.bz2
engrampa-49f97664d7fdfc7914245cb26f660cbedd36afa4.tar.xz
Use Caja GSettings schema optionally
This makes Caja dependency optional. Closes https://github.com/mate-desktop/engrampa/pull/60
Diffstat (limited to 'src/fr-window.c')
-rw-r--r--src/fr-window.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/src/fr-window.c b/src/fr-window.c
index f9ceef8..6994066 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -638,7 +638,9 @@ fr_window_free_private_data (FrWindow *window)
_g_object_unref (window->priv->settings_ui);
_g_object_unref (window->priv->settings_general);
_g_object_unref (window->priv->settings_dialogs);
- _g_object_unref (window->priv->settings_caja);
+
+ if (window->priv->settings_caja)
+ _g_object_unref (window->priv->settings_caja);
}
@@ -4598,11 +4600,13 @@ static gboolean
is_single_click_policy (FrWindow *window)
{
char *value;
- gboolean result;
+ gboolean result = FALSE;
- value = g_settings_get_string (window->priv->settings_caja, CAJA_CLICK_POLICY);
- result = (value != NULL) && (strncmp (value, "single", 6) == 0);
- g_free (value);
+ if (window->priv->settings_caja) {
+ value = g_settings_get_string (window->priv->settings_caja, CAJA_CLICK_POLICY);
+ result = (value != NULL) && (strncmp (value, "single", 6) == 0);
+ g_free (value);
+ }
return result;
}
@@ -5384,6 +5388,8 @@ fr_window_construct (FrWindow *window)
GtkToolItem *open_recent_tool_item;
GtkWidget *menu_item;
GError *error = NULL;
+ GSettingsSchemaSource *schema_source;
+ GSettingsSchema *caja_schema;
/* data common to all windows. */
@@ -5401,7 +5407,13 @@ fr_window_construct (FrWindow *window)
window->priv->settings_ui = g_settings_new (ENGRAMPA_SCHEMA_UI);
window->priv->settings_general = g_settings_new (ENGRAMPA_SCHEMA_GENERAL);
window->priv->settings_dialogs = g_settings_new (ENGRAMPA_SCHEMA_DIALOGS);
- window->priv->settings_caja = g_settings_new (CAJA_SCHEMA);
+
+ schema_source = g_settings_schema_source_get_default ();
+ caja_schema = g_settings_schema_source_lookup (schema_source, CAJA_SCHEMA, FALSE);
+ if (caja_schema) {
+ window->priv->settings_caja = g_settings_new (CAJA_SCHEMA);
+ g_settings_schema_unref (caja_schema);
+ }
/* Create the application. */
@@ -5994,10 +6006,12 @@ fr_window_construct (FrWindow *window)
"changed::" PREF_LISTING_USE_MIME_ICONS,
G_CALLBACK (pref_use_mime_icons_changed),
window);
- g_signal_connect (window->priv->settings_caja,
- "changed::" CAJA_CLICK_POLICY,
- G_CALLBACK (pref_click_policy_changed),
- window);
+
+ if (window->priv->settings_caja)
+ g_signal_connect (window->priv->settings_caja,
+ "changed::" CAJA_CLICK_POLICY,
+ G_CALLBACK (pref_click_policy_changed),
+ window);
/* Give focus to the list. */