[devhelp] Preferences: bind to the DhSettings:group-books-by-language property



commit e099386d0e29642ef161223e2358797078b7b42c
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Tue Apr 3 13:35:36 2018 +0200

    Preferences: bind to the DhSettings:group-books-by-language property
    
    It is planned to remove dh_settings_peek_contents_settings() from the
    libdevhelp API, to not expose the GSettings objects.
    
    Small regression: g_settings_bind() establishes a binding between the
    writability of the GSettings key and the "sensitive" property of the
    preferences widget. With g_object_bind_property() it is no longer the
    case. I don't think that for Devhelp this is an important feature. If in
    the future someone complains and the feature is really wanted, with a
    valid use-case, then DhSettings can expose publicly the GSettings
    objects and g_settings_bind() can again be used.

 src/dh-preferences.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/src/dh-preferences.c b/src/dh-preferences.c
index 2cdc082..3a17ea6 100644
--- a/src/dh-preferences.c
+++ b/src/dh-preferences.c
@@ -596,7 +596,6 @@ dh_preferences_init (DhPreferences *prefs)
         DhSettings *settings_lib;
         DhSettingsApp *settings_app;
         GSettings *settings_fonts;
-        GSettings *settings_contents;
 
         priv = dh_preferences_get_instance_private (prefs);
 
@@ -626,7 +625,6 @@ dh_preferences_init (DhPreferences *prefs)
         /* setup GSettings bindings */
         settings_app = dh_settings_app_get_singleton ();
         settings_fonts = dh_settings_app_peek_fonts_settings (settings_app);
-        settings_contents = dh_settings_peek_contents_settings (settings_lib);
         g_settings_bind (settings_fonts, "use-system-fonts",
                          priv->system_fonts_button, "active",
                          G_SETTINGS_BIND_DEFAULT);
@@ -640,9 +638,9 @@ dh_preferences_init (DhPreferences *prefs)
                          priv->variable_font_button, "font-name",
                          G_SETTINGS_BIND_DEFAULT);
 
-        g_settings_bind (settings_contents, "group-books-by-language",
-                         priv->bookshelf_group_by_language_button, "active",
-                         G_SETTINGS_BIND_DEFAULT);
+        g_object_bind_property (settings_lib, "group-books-by-language",
+                                priv->bookshelf_group_by_language_button, "active",
+                                G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
 
         g_signal_connect (priv->bookshelf_enabled_toggle,
                           "toggled",


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