summaryrefslogtreecommitdiff
path: root/plugins/filebrowser/pluma-file-browser-plugin.c
diff options
context:
space:
mode:
authorMonsta <[email protected]>2015-03-19 17:24:55 +0300
committerStefano Karapetsas <[email protected]>2015-04-06 11:21:42 +0200
commitaac60a700814be8ecd72b5ab18eef95c1c4ad68d (patch)
tree33d4bbb725f0e77198e6d0f2d9f7b54149e5c602 /plugins/filebrowser/pluma-file-browser-plugin.c
parentdc5a473cbec079114a2dfcbf482b72f649b3dc92 (diff)
downloadpluma-aac60a700814be8ecd72b5ab18eef95c1c4ad68d.tar.bz2
pluma-aac60a700814be8ecd72b5ab18eef95c1c4ad68d.tar.xz
filebrowser plugin: first connect to settings, then read them.
fixes the issue with GLib >= 2.43, https://git.gnome.org/browse/glib/commit/?id=8ff5668a458344da22d30491e3ce726d861b3619 Closes https://github.com/mate-desktop/pluma/pull/109
Diffstat (limited to 'plugins/filebrowser/pluma-file-browser-plugin.c')
-rw-r--r--plugins/filebrowser/pluma-file-browser-plugin.c54
1 files changed, 30 insertions, 24 deletions
diff --git a/plugins/filebrowser/pluma-file-browser-plugin.c b/plugins/filebrowser/pluma-file-browser-plugin.c
index 11b77189..750b2be0 100644
--- a/plugins/filebrowser/pluma-file-browser-plugin.c
+++ b/plugins/filebrowser/pluma-file-browser-plugin.c
@@ -312,6 +312,18 @@ on_confirm_trash_changed (GSettings *settings,
data->confirm_trash = enable;
}
+static gboolean
+have_click_policy (void)
+{
+ GSettings *settings = g_settings_new (CAJA_SCHEMA);
+ gchar *pref = g_settings_get_string (settings, CAJA_CLICK_POLICY_KEY);
+ gboolean result = (pref != NULL);
+
+ g_free (pref);
+ g_object_unref (settings);
+ return result;
+}
+
static void
install_caja_prefs (PlumaFileBrowserPluginData *data)
{
@@ -320,41 +332,35 @@ install_caja_prefs (PlumaFileBrowserPluginData *data)
PlumaFileBrowserViewClickPolicy policy;
PlumaFileBrowserView *view;
- /* Get click_policy */
- pref = g_settings_get_string (data->caja_settings, CAJA_CLICK_POLICY_KEY);
+ if (have_click_policy ()) {
+ g_signal_connect (data->caja_settings,
+ "changed::" CAJA_CLICK_POLICY_KEY,
+ G_CALLBACK (on_click_policy_changed),
+ data);
+ }
+
+ g_signal_connect (data->caja_settings,
+ "changed::" CAJA_ENABLE_DELETE_KEY,
+ G_CALLBACK (on_enable_delete_changed),
+ data);
+ g_signal_connect (data->caja_settings,
+ "changed::" CAJA_CONFIRM_TRASH_KEY,
+ G_CALLBACK (on_confirm_trash_changed),
+ data);
+
+ pref = g_settings_get_string (data->caja_settings, CAJA_CLICK_POLICY_KEY);
policy = click_policy_from_string (pref);
+ g_free (pref);
view = pluma_file_browser_widget_get_browser_view (data->tree_widget);
pluma_file_browser_view_set_click_policy (view, policy);
- if (pref) {
- g_signal_connect (data->caja_settings,
- "changed::" CAJA_CLICK_POLICY_KEY,
- G_CALLBACK (on_click_policy_changed),
- data);
- g_free (pref);
- }
-
- /* Get enable_delete */
prefb = g_settings_get_boolean (data->caja_settings, CAJA_ENABLE_DELETE_KEY);
-
g_object_set (G_OBJECT (data->tree_widget), "enable-delete", prefb, NULL);
- g_signal_connect (data->caja_settings,
- "changed::" CAJA_ENABLE_DELETE_KEY,
- G_CALLBACK (on_enable_delete_changed),
- data);
-
- /* Get confirm_trash */
prefb = g_settings_get_boolean (data->caja_settings, CAJA_CONFIRM_TRASH_KEY);
-
data->confirm_trash = prefb;
-
- g_signal_connect (data->caja_settings,
- "changed::" CAJA_CONFIRM_TRASH_KEY,
- G_CALLBACK (on_confirm_trash_changed),
- data);
}
static void