diff options
Diffstat (limited to 'gnome-settings-daemon/gnome-settings-bus.c')
-rw-r--r-- | gnome-settings-daemon/gnome-settings-bus.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/gnome-settings-daemon/gnome-settings-bus.c b/gnome-settings-daemon/gnome-settings-bus.c index 9e884a66..cd1a6860 100644 --- a/gnome-settings-daemon/gnome-settings-bus.c +++ b/gnome-settings-daemon/gnome-settings-bus.c @@ -122,6 +122,52 @@ gnome_settings_bus_get_shell_proxy (void) return shell_proxy; } +char * +gnome_settings_get_chassis_type (void) +{ + char *ret = NULL; + GError *error = NULL; + GVariant *inner; + GVariant *variant = NULL; + GDBusConnection *connection; + + connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, + NULL, + &error); + if (connection == NULL) { + g_warning ("system bus not available: %s", error->message); + g_error_free (error); + goto out; + } + + variant = g_dbus_connection_call_sync (connection, + "org.freedesktop.hostname1", + "/org/freedesktop/hostname1", + "org.freedesktop.DBus.Properties", + "Get", + g_variant_new ("(ss)", + "org.freedesktop.hostname1", + "Chassis"), + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (variant == NULL) { + g_debug ("Failed to get property '%s': %s", "Chassis", error->message); + g_error_free (error); + goto out; + } + + g_variant_get (variant, "(v)", &inner); + ret = g_variant_dup_string (inner, NULL); + g_variant_unref (inner); +out: + g_clear_object (&connection); + g_clear_pointer (&variant, g_variant_unref); + return ret; +} + static gpointer is_wayland_session (gpointer user_data) { |