summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2013-04-02 20:36:48 -0400
committerMatthias Clasen <mclasen@redhat.com>2013-04-05 13:45:05 -0400
commitef92b1f67eb0341838920c16916421d50f48443c (patch)
tree387d9cf6c7cbc5e20ffdbc8886159c22c54f14cc
parent875daa13aa64d5c35b1e87de9f8a8cec245ea690 (diff)
downloadyelp-ef92b1f67eb0341838920c16916421d50f48443c.tar.gz
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
-rw-r--r--libyelp/yelp-settings.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/libyelp/yelp-settings.c b/libyelp/yelp-settings.c
index 155bf82f..ad7b80cf 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)