summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gpm-statistics.c15
-rw-r--r--src/gpm-tray-icon.c15
2 files changed, 24 insertions, 6 deletions
diff --git a/src/gpm-statistics.c b/src/gpm-statistics.c
index a9436bd..f800cef 100644
--- a/src/gpm-statistics.c
+++ b/src/gpm-statistics.c
@@ -1216,6 +1216,7 @@ gpm_stats_add_device (UpDevice *device)
const gchar *text;
const gchar *icon;
UpDeviceKind kind;
+ gchar *label, *vendor, *model;
#if UP_CHECK_VERSION(0, 99, 0)
if (devices != NULL)
@@ -1228,17 +1229,27 @@ gpm_stats_add_device (UpDevice *device)
/* get device properties */
g_object_get (device,
"kind", &kind,
+ "vendor", &vendor,
+ "model", &model,
NULL);
id = up_device_get_object_path (device);
- text = gpm_device_kind_to_localised_text (kind, 1);
+ if ((vendor != NULL && strlen(vendor) != 0) && (model != NULL && strlen(model) != 0)) {
+ label = g_strdup_printf ("%s %s", vendor, model);
+ }
+ else {
+ label = g_strdup_printf ("%s", gpm_device_kind_to_localised_text (kind, 1));
+ }
icon = gpm_upower_get_device_icon (device);
gtk_list_store_append (list_store_devices, &iter);
gtk_list_store_set (list_store_devices, &iter,
GPM_DEVICES_COLUMN_ID, id,
- GPM_DEVICES_COLUMN_TEXT, text,
+ GPM_DEVICES_COLUMN_TEXT, label,
GPM_DEVICES_COLUMN_ICON, icon, -1);
+ g_free (label);
+ g_free (vendor);
+ g_free (model);
}
/**
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;
}