[gnome-settings-daemon] xsettings: Fix swapping out of WM settings schemas



commit a3e35131b62f206c1c70f6df9e5b8d0a235d5578
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Sep 19 15:33:36 2014 +0200

    xsettings: Fix swapping out of WM settings schemas
    
    Until we get session-specific defaults in GSettings, we pick up the
    button-layout setting from different schemas depending on whether we
    are running in classic mode or not. However there is a serious thinko
    in the current implementation: When running in classic mode, the
    settings value is swapped with the one from the classic schema,
    otherwise it is used directly - which turns out to be wrong when
    the value itself is taken from the classic schema, e.g. when receiving a
    change notification (which apparently may even be the case randomly
    at startup).
    Avoid this confusion by not trying to add the classic schema unless
    actually running in a classic session.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=736974

 plugins/xsettings/gsd-xsettings-manager.c |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)
---
diff --git a/plugins/xsettings/gsd-xsettings-manager.c b/plugins/xsettings/gsd-xsettings-manager.c
index 142167f..7e20794 100644
--- a/plugins/xsettings/gsd-xsettings-manager.c
+++ b/plugins/xsettings/gsd-xsettings-manager.c
@@ -338,17 +338,15 @@ translate_button_layout (GnomeXSettingsManager *manager,
 {
         GSettings *classic_settings;
         GVariant *classic_value = NULL;
-        const char *session;
         char *layout;
 
         /* Hack: until we get session-dependent defaults in GSettings,
          *       swap out the usual schema for the "classic" one when
          *       running in classic mode
          */
-        session = g_getenv ("XDG_CURRENT_DESKTOP");
         classic_settings = g_hash_table_lookup (manager->priv->settings,
                                                 CLASSIC_WM_SETTINGS_SCHEMA);
-        if (session && strstr (session, "GNOME-Classic") && classic_settings) {
+        if (classic_settings) {
                 classic_value = g_settings_get_value (classic_settings, "button-layout");
                 layout = g_variant_dup_string (classic_value, NULL);
         } else {
@@ -1131,10 +1129,10 @@ gboolean
 gnome_xsettings_manager_start (GnomeXSettingsManager *manager,
                                GError               **error)
 {
-        GSettingsSchema *schema;
         GVariant    *overrides;
         guint        i;
         GList       *list, *l;
+        const char  *session;
 
         g_debug ("Starting xsettings manager");
         gnome_settings_profile_start (NULL);
@@ -1170,13 +1168,18 @@ gnome_xsettings_manager_start (GnomeXSettingsManager *manager,
         g_hash_table_insert (manager->priv->settings,
                              WM_SETTINGS_SCHEMA, g_settings_new (WM_SETTINGS_SCHEMA));
 
-        schema = g_settings_schema_source_lookup (g_settings_schema_source_get_default (),
+        session = g_getenv ("XDG_CURRENT_DESKTOP");
+        if (session && strstr (session, "GNOME-Classic")) {
+                GSettingsSchema *schema;
+
+                schema = g_settings_schema_source_lookup (g_settings_schema_source_get_default (),
                                                   CLASSIC_WM_SETTINGS_SCHEMA, FALSE);
-        if (schema) {
-                g_hash_table_insert (manager->priv->settings,
-                                     CLASSIC_WM_SETTINGS_SCHEMA,
-                                     g_settings_new_full (schema, NULL, NULL));
-                g_settings_schema_unref (schema);
+                if (schema) {
+                        g_hash_table_insert (manager->priv->settings,
+                                             CLASSIC_WM_SETTINGS_SCHEMA,
+                                             g_settings_new_full (schema, NULL, NULL));
+                        g_settings_schema_unref (schema);
+                }
         }
 
         g_signal_connect (G_OBJECT (g_hash_table_lookup (manager->priv->settings, 
INTERFACE_SETTINGS_SCHEMA)), "changed::enable-animations",


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