[yelp] Add a test token for classic mode



commit ef92b1f67eb0341838920c16916421d50f48443c
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Apr 2 20:36:48 2013 -0400

    Add a test token for classic mode
    
    The test token is called platform:gnome-classic.
    This will be used to adjust the GNOME user guide for classic mode
    in a few places.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=697154

 libyelp/yelp-settings.c |   35 +++++++++++++++++++++++++++++++++--
 1 files changed, 33 insertions(+), 2 deletions(-)
---
diff --git a/libyelp/yelp-settings.c b/libyelp/yelp-settings.c
index 155bf82..ad7b80c 100644
--- a/libyelp/yelp-settings.c
+++ b/libyelp/yelp-settings.c
@@ -248,9 +248,10 @@ yelp_settings_constructed (GObject *object)
     YelpSettings *settings = YELP_SETTINGS (object);
     GDBusConnection *connection;
     GVariant *ret, *names;
+    GVariant *ret2;
     GVariantIter iter;
     gchar *name;
-    gboolean env_shell, env_panel, env_unity, env_xfce;
+    gboolean env_shell, env_classic, env_panel, env_unity, env_xfce;
     GError *error = NULL;
 
     connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
@@ -274,7 +275,7 @@ yelp_settings_constructed (GObject *object)
         g_error_free (error);
         return;
     }
-    env_shell = env_panel = env_unity = env_xfce = FALSE;
+    env_shell = env_classic = env_panel = env_unity = env_xfce = FALSE;
     names = g_variant_get_child_value (ret, 0);
     g_variant_iter_init (&iter, names);
     while (g_variant_iter_loop (&iter, "&s", &name)) {
@@ -289,6 +290,36 @@ yelp_settings_constructed (GObject *object)
     }
     g_variant_unref (names);
     g_variant_unref (ret);
+    if (env_shell) {
+        ret = g_dbus_connection_call_sync (connection,
+                                               "org.gnome.Shell",
+                                               "/org/gnome/Shell",
+                                               "org.freedesktop.DBus.Properties",
+                                               "Get",
+                                               g_variant_new ("(ss)",
+                                                              "org.gnome.Shell",
+                                                              "Mode"),
+                                               G_VARIANT_TYPE ("(v)"),
+                                               G_DBUS_CALL_FLAGS_NONE,
+                                               -1, NULL, &error);
+        if (ret == NULL) {
+            g_warning ("Failed to get GNOME shell mode: %s", error->message);
+            g_error_free (error);
+        } else {
+            GVariant *v;
+            g_variant_get (ret, "(v)", &v);
+            if (g_variant_is_of_type (v, G_VARIANT_TYPE_STRING) &&
+                g_str_equal (g_variant_get_string (v, NULL), "classic")) {
+                env_classic = TRUE;
+            }
+            g_variant_unref (v);
+            g_variant_unref (ret);
+        }
+    }
+
+    if (env_classic)
+        yelp_settings_set_if_token (settings, "platform:gnome-classic");
+
     if (env_shell)
         yelp_settings_set_if_token (settings, "platform:gnome-shell");
     else if (env_xfce)


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