[gnome-battery-bench] SystemInfo: include desktop environment



commit d32f583f740315a8ca7a2d6d5a8406ab2c264c68
Author: Christian Kellner <gicmo gnome org>
Date:   Fri May 12 16:59:55 2017 +0100

    SystemInfo: include desktop environment
    
    In case want to compare GNOME vs other DEs.

 src/system-info.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/system-info.c b/src/system-info.c
index 7e46820..34425d4 100644
--- a/src/system-info.c
+++ b/src/system-info.c
@@ -61,6 +61,8 @@ struct _GbbSystemInfo {
 
     char *display_proto;
 
+    char *desktop;
+
     /*  GNOME */
     gboolean gnome_valid;
     char *gnome_version;
@@ -98,6 +100,7 @@ enum {
     PROP_OS_KERNEL,
 
     PROP_DISPLAY_PROTO,
+    PROP_DESKTOP,
 
     PROP_GNOME_VERSION,
     PROP_GNOME_DISTRIBUTOR,
@@ -137,6 +140,7 @@ gbb_system_info_finalize(GbbSystemInfo *info)
     g_free(info->os_kernel);
 
     g_free(info->display_proto);
+    g_free(info->desktop);
 
     g_free(info->gnome_version);
     g_free(info->gnome_distributor);
@@ -245,6 +249,10 @@ gbb_system_info_get_property (GObject *object, guint prop_id, GValue *value, GPa
         value_set_string_or_unknown(value, info->display_proto);
         break;
 
+    case PROP_DESKTOP:
+        value_set_string_or_unknown(value, info->desktop);
+        break;
+
     case PROP_GNOME_VERSION:
         value_set_string_or_unknown(value, info->gnome_version);
         break;
@@ -385,6 +393,12 @@ gbb_system_info_class_init (GbbSystemInfoClass *klass)
                             NULL,
                             G_PARAM_READABLE);
 
+    props[PROP_DESKTOP] =
+        g_param_spec_string("desktop-environment",
+                            NULL, NULL,
+                            NULL,
+                            G_PARAM_READABLE);
+
     props[PROP_GNOME_VERSION] =
         g_param_spec_string("gnome-version",
                             NULL, NULL,
@@ -824,6 +838,7 @@ static void gbb_system_info_init (GbbSystemInfo *info)
     info->mem_total = read_mem_info();
     info->batteries = get_batteries();
     info->renderer = get_renderer_info();
+    info->desktop = gbb_strdup_clean(g_getenv("XDG_CURRENT_DESKTOP"));
 
     display = gdk_display_get_default ();
     if (display == NULL) {
@@ -1005,6 +1020,7 @@ gbb_system_info_to_json (const GbbSystemInfo *info, JsonBuilder *builder)
         }
 
         jsb_add_kv_string(builder, "display-protocol", info->display_proto);
+        jsb_add_kv_string(builder, "desktop-environment", info->desktop);
 
         if (info->gnome_valid) {
             json_builder_set_member_name(builder, "gnome");


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