From 4de587558adb2bfc4050638c9a8c0a6099a61813 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jard=C3=B3n?= Date: Tue, 5 Jul 2011 11:47:31 +0100 Subject: Store the current device in the private structure --- src/indicator-power.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'src') 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 -- cgit v1.2.3