aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-power.c
diff options
context:
space:
mode:
authorJavier Jardón <javier.jardon@codethink.co.uk>2011-06-30 00:18:37 +0100
committerJavier Jardón <javier.jardon@codethink.co.uk>2011-06-30 00:18:37 +0100
commit363df287e4f74e65a7be71c0c4e689d348cdaa11 (patch)
treed779ecbf9bae01b4ac86097eb07bc6985ab920ce /src/indicator-power.c
parent5b5a98746946613462da51bbf1b7401c444f0433 (diff)
downloadayatana-indicator-power-363df287e4f74e65a7be71c0c4e689d348cdaa11.tar.gz
ayatana-indicator-power-363df287e4f74e65a7be71c0c4e689d348cdaa11.tar.bz2
ayatana-indicator-power-363df287e4f74e65a7be71c0c4e689d348cdaa11.zip
Change the status icon when the charge changes
Diffstat (limited to 'src/indicator-power.c')
-rw-r--r--src/indicator-power.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/indicator-power.c b/src/indicator-power.c
index f9c97d7..573c321 100644
--- a/src/indicator-power.c
+++ b/src/indicator-power.c
@@ -37,7 +37,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <libindicator/indicator-object.h>
#include <libindicator/indicator-image-helper.h>
-#define DEFAULT_ICON "battery"
+#define DEFAULT_ICON "battery-empty"
#define INDICATOR_POWER_TYPE (indicator_power_get_type ())
#define INDICATOR_POWER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), INDICATOR_POWER_TYPE, IndicatorPower))
@@ -162,6 +162,7 @@ get_primary_device_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
+ IndicatorPowerPrivate *priv = INDICATOR_POWER (user_data)->priv;
UpDeviceKind kind;
UpDeviceState state;
GVariant *result;
@@ -184,7 +185,7 @@ get_primary_device_cb (GObject *source_object,
return;
}
- /* set the text */
+ /* set the icon and text */
g_variant_get (result,
"((susdut))",
&object_path,
@@ -196,6 +197,10 @@ get_primary_device_cb (GObject *source_object,
g_debug ("got data from object %s", object_path);
+ /* set icon */
+ priv->status_image = indicator_image_helper (icon_name);
+ gtk_widget_show (GTK_WIDGET (priv->status_image));
+
/* get the title
* translate it as it has limited entries as devices that are
* fully charged are not returned as the primary device */
@@ -477,7 +482,7 @@ get_image (IndicatorObject *io)
if (priv->status_image == NULL)
{
/* Will create the status icon if it doesn't exist already */
- priv->status_image = indicator_image_helper (DEFAULT_ICON "-panel");
+ priv->status_image = indicator_image_helper (DEFAULT_ICON);
gtk_widget_show (GTK_WIDGET (priv->status_image));
}