aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Jardón <javier.jardon@codethink.co.uk>2011-07-05 11:47:31 +0100
committerJavier Jardón <javier.jardon@codethink.co.uk>2011-07-05 11:47:31 +0100
commit4de587558adb2bfc4050638c9a8c0a6099a61813 (patch)
treeccebf75df6aa739b1905bcf34dd60493ba70e569
parentfe2b41fc72b4a039e2d98b502ad3970a2c1876a1 (diff)
downloadayatana-indicator-power-4de587558adb2bfc4050638c9a8c0a6099a61813.tar.gz
ayatana-indicator-power-4de587558adb2bfc4050638c9a8c0a6099a61813.tar.bz2
ayatana-indicator-power-4de587558adb2bfc4050638c9a8c0a6099a61813.zip
Store the current device in the private structure
-rw-r--r--src/indicator-power.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/indicator-power.c b/src/indicator-power.c
index 8eb6ae6..7980234 100644
--- a/src/indicator-power.c
+++ b/src/indicator-power.c
@@ -350,12 +350,8 @@ menu_add_device (GtkMenu *menu,
icon = gtk_image_new_from_icon_name (device_icon, GTK_ICON_SIZE_MENU);
device_name = device_kind_to_localised_string (kind);
- g_print ("Device: %s\n", device_name);
-
build_device_time_details (device_name, time, state, percentage, &short_details, &details);
- g_print ("Details: %s\n", details);
-
item = gtk_image_menu_item_new ();
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), icon);
gtk_menu_item_set_label (GTK_MENU_ITEM (item), details);
@@ -421,7 +417,6 @@ get_primary_device_cb (GObject *source_object,
IndicatorPowerPrivate *priv = self->priv;
UpDeviceKind kind;
UpDeviceState state;
- GVariant *result;
GError *error = NULL;
gchar *short_details = NULL;
gchar *details = NULL;
@@ -434,8 +429,8 @@ get_primary_device_cb (GObject *source_object,
gchar *short_timestring = NULL;
gchar *detailed_timestring = NULL;
- result = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error);
- if (result == NULL)
+ priv->device = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error);
+ if (priv->device == NULL)
{
g_printerr ("Error getting primary device: %s\n", error->message);
g_error_free (error);
@@ -443,10 +438,8 @@ get_primary_device_cb (GObject *source_object,
return;
}
- priv->device = result;
-
/* set the icon and text */
- g_variant_get (result,
+ g_variant_get (priv->device,
"((susdut))",
&object_path,
&kind,
@@ -482,7 +475,6 @@ get_primary_device_cb (GObject *source_object,
g_free (short_timestring);
g_free (detailed_timestring);
g_free (object_path);
- g_variant_unref (result);
}
static void