diff options
author | Clement Lefebvre <[email protected]> | 2015-09-04 18:38:52 +0100 |
---|---|---|
committer | Clement Lefebvre <[email protected]> | 2015-09-04 18:38:52 +0100 |
commit | efd226f094d55b85f335b35e863cb487f0ae3292 (patch) | |
tree | 5ae5fa99ff3f55411c83fb52717f649d2cb8f990 /src/gpm-tray-icon.c | |
parent | 74f1af8766f91cadf87d976cf43a7006a7ab9132 (diff) | |
download | mate-power-manager-efd226f094d55b85f335b35e863cb487f0ae3292.tar.bz2 mate-power-manager-efd226f094d55b85f335b35e863cb487f0ae3292.tar.xz |
Show vendor/model information
Diffstat (limited to 'src/gpm-tray-icon.c')
-rw-r--r-- | src/gpm-tray-icon.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/gpm-tray-icon.c b/src/gpm-tray-icon.c index fa7f5da..967e4c2 100644 --- a/src/gpm-tray-icon.c +++ b/src/gpm-tray-icon.c @@ -234,11 +234,10 @@ gpm_tray_icon_add_device (GpmTrayIcon *icon, GtkMenu *menu, const GPtrArray *arr guint i; guint added = 0; gchar *icon_name; - gchar *label; + gchar *label, *vendor, *model; GtkWidget *item; GtkWidget *image; const gchar *object_path; - const gchar *desc; UpDevice *device; UpDeviceKind kind_tmp; gdouble percentage; @@ -251,6 +250,8 @@ gpm_tray_icon_add_device (GpmTrayIcon *icon, GtkMenu *menu, const GPtrArray *arr g_object_get (device, "kind", &kind_tmp, "percentage", &percentage, + "vendor", &vendor, + "model", &model, NULL); if (kind != kind_tmp) @@ -261,8 +262,12 @@ gpm_tray_icon_add_device (GpmTrayIcon *icon, GtkMenu *menu, const GPtrArray *arr added++; /* generate the label */ - desc = gpm_device_kind_to_localised_text (kind, 1); - label = g_strdup_printf ("%s (%.1f%%)", desc, percentage); + if ((vendor != NULL && strlen(vendor) != 0) && (model != NULL && strlen(model) != 0)) { + label = g_strdup_printf ("%s %s (%.1f%%)", vendor, model, percentage); + } + else { + label = g_strdup_printf ("%s (%.1f%%)", gpm_device_kind_to_localised_text (kind, 1), percentage); + } item = gtk_image_menu_item_new_with_label (label); /* generate the image */ @@ -278,6 +283,8 @@ gpm_tray_icon_add_device (GpmTrayIcon *icon, GtkMenu *menu, const GPtrArray *arr g_free (icon_name); g_free (label); + g_free (vendor); + g_free (model); } return added; } |