summaryrefslogtreecommitdiff
path: root/src/caja-file-management-properties.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/caja-file-management-properties.c')
-rw-r--r--src/caja-file-management-properties.c37
1 files changed, 34 insertions, 3 deletions
diff --git a/src/caja-file-management-properties.c b/src/caja-file-management-properties.c
index fca7a149..9293f714 100644
--- a/src/caja-file-management-properties.c
+++ b/src/caja-file-management-properties.c
@@ -716,6 +716,37 @@ bind_builder_bool (GtkBuilder *builder,
}
static gboolean
+inverted_get_mapping (GValue *value,
+ GVariant *variant,
+ gpointer user_data)
+{
+ g_value_set_boolean (value, !g_variant_get_boolean (variant));
+ return TRUE;
+}
+
+static GVariant *
+inverted_set_mapping (const GValue *value,
+ const GVariantType *expected_type,
+ gpointer user_data)
+{
+ return g_variant_new_boolean (!g_value_get_boolean (value));
+}
+
+static void
+bind_builder_bool_inverted (GtkBuilder *builder,
+ GSettings *settings,
+ const char *widget_name,
+ const char *prefs)
+{
+ g_settings_bind_with_mapping (settings, prefs,
+ gtk_builder_get_object (builder, widget_name),
+ "active", G_SETTINGS_BIND_DEFAULT,
+ inverted_get_mapping,
+ inverted_set_mapping,
+ NULL, NULL);
+}
+
+static gboolean
enum_get_mapping (GValue *value,
GVariant *variant,
gpointer user_data)
@@ -879,9 +910,9 @@ caja_file_management_properties_dialog_setup (GtkBuilder *builder, GtkWindow *wi
eel_preferences_builder_connect_bool (builder,
CAJA_FILE_MANAGEMENT_PROPERTIES_FOLDERS_FIRST_WIDGET,
CAJA_PREFERENCES_SORT_DIRECTORIES_FIRST);
- eel_preferences_builder_connect_inverted_bool (builder,
- CAJA_FILE_MANAGEMENT_PROPERTIES_ALWAYS_USE_BROWSER_WIDGET,
- CAJA_PREFERENCES_ALWAYS_USE_BROWSER);
+ bind_builder_bool_inverted (builder, caja_preferences,
+ CAJA_FILE_MANAGEMENT_PROPERTIES_ALWAYS_USE_BROWSER_WIDGET,
+ CAJA_PREFERENCES_ALWAYS_USE_BROWSER);
bind_builder_bool (builder, caja_media_preferences,
CAJA_FILE_MANAGEMENT_PROPERTIES_MEDIA_AUTOMOUNT_OPEN,