[gnome-power-manager] Don't show the whole object path in the GUI, just show the ID
- From: Richard Hughes <rhughes src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-power-manager] Don't show the whole object path in the GUI, just show the ID
- Date: Wed, 1 Jul 2009 15:38:53 +0000 (UTC)
commit 4da7290dd5543840a12d3ff6b5742ab813665471
Author: Richard Hughes <richard hughsie com>
Date: Wed Jul 1 16:37:46 2009 +0100
Don't show the whole object path in the GUI, just show the ID
src/gpm-statistics.c | 30 +++++++++++++++++++++++++++++-
1 files changed, 29 insertions(+), 1 deletions(-)
---
diff --git a/src/gpm-statistics.c b/src/gpm-statistics.c
index eb911ea..cd6749a 100644
--- a/src/gpm-statistics.c
+++ b/src/gpm-statistics.c
@@ -304,6 +304,29 @@ gpm_stats_bool_to_text (gboolean ret)
}
/**
+ * gpm_stats_get_printable_device_path:
+ **/
+static gchar *
+gpm_stats_get_printable_device_path (DkpDevice *device)
+{
+ const gchar *prefix = "/org/freedesktop/DeviceKit/Power/devices/";
+ const gchar *object_path;
+ gchar *device_path = NULL;
+ guint len;
+
+ /* get object path */
+ object_path = dkp_device_get_object_path (device);
+ if (!g_str_has_prefix (object_path, prefix))
+ goto out;
+
+ /* trim */
+ len = strlen (prefix);
+ device_path = g_strdup (object_path+len);
+out:
+ return device_path;
+}
+
+/**
* gpm_stats_update_info_page_details:
**/
static void
@@ -335,6 +358,7 @@ gpm_stats_update_info_page_details (DkpDevice *device)
gchar *vendor = NULL;
gchar *serial = NULL;
gchar *model = NULL;
+ gchar *device_path = NULL;
gtk_list_store_clear (list_store_info);
@@ -368,7 +392,11 @@ gpm_stats_update_info_page_details (DkpDevice *device)
time_tm = localtime (&t);
strftime (time_buf, sizeof time_buf, "%c", time_tm);
- gpm_stats_add_info_data (_("Device"), dkp_device_get_object_path (device));
+ /* remove prefix */
+ device_path = gpm_stats_get_printable_device_path (device);
+ gpm_stats_add_info_data (_("Device"), device_path);
+ g_free (device_path);
+
gpm_stats_add_info_data (_("Type"), gpm_device_type_to_localised_text (type, 1));
if (vendor != NULL && vendor[0] != '\0')
gpm_stats_add_info_data (_("Vendor"), vendor);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]