[nautilus] Use G_SETTINGS_BIND_INVERT_BOOLEAN where appropriate



commit df382f58d0ec2a1b779cf80048ad70944c8859df
Author: Tomas Bzatek <tbzatek redhat com>
Date:   Tue Nov 16 14:02:44 2010 +0100

    Use G_SETTINGS_BIND_INVERT_BOOLEAN where appropriate

 src/nautilus-file-management-properties.c |   26 +++-----------------------
 1 files changed, 3 insertions(+), 23 deletions(-)
---
diff --git a/src/nautilus-file-management-properties.c b/src/nautilus-file-management-properties.c
index 9e3d0f6..74c3dce 100644
--- a/src/nautilus-file-management-properties.c
+++ b/src/nautilus-file-management-properties.c
@@ -689,35 +689,15 @@ bind_builder_bool (GtkBuilder *builder,
 			 "active", G_SETTINGS_BIND_DEFAULT);
 }
 
-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);
+	g_settings_bind (settings, prefs,
+			 gtk_builder_get_object (builder, widget_name),
+			 "active", G_SETTINGS_BIND_INVERT_BOOLEAN);
 }
 
 static gboolean



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]