aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2013-07-09 12:04:01 +0100
committerRoss Burton <ross.burton@intel.com>2013-07-09 13:57:00 +0100
commit0d980cf0df31259ea29453d95866c914fceabfe2 (patch)
tree74af7d87ff4a31176cfecd7bb7e76eb8a0fab943
parent6718a0987ad5a26730564451c2725812660c8272 (diff)
downloadmatchbox-panel-2-0d980cf0df31259ea29453d95866c914fceabfe2.tar.gz
matchbox-panel-2-0d980cf0df31259ea29453d95866c914fceabfe2.tar.bz2
matchbox-panel-2-0d980cf0df31259ea29453d95866c914fceabfe2.zip
battery: various small improvements
-rw-r--r--applets/battery/battery.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/applets/battery/battery.c b/applets/battery/battery.c
index 41db42d..ade3ff6 100644
--- a/applets/battery/battery.c
+++ b/applets/battery/battery.c
@@ -1,4 +1,4 @@
-/*
+/*
* (C) 2006 OpenedHand Ltd.
*
* Author: Jorn Baayen <jorn@openedhand.com>
@@ -11,11 +11,9 @@
typedef struct {
MBPanelScalingImage *image;
const char *last_icon;
-
guint timeout_id;
} BatteryApplet;
-/* Applet destroyed */
static void
battery_applet_free (BatteryApplet *applet)
{
@@ -24,13 +22,12 @@ battery_applet_free (BatteryApplet *applet)
g_slice_free (BatteryApplet, applet);
}
-/* Called every 5 minutes */
static gboolean
timeout (BatteryApplet *applet)
{
const char *icon;
- icon = pm_battery_icon();
+ icon = pm_battery_icon ();
if (!icon)
return FALSE;
@@ -40,8 +37,7 @@ timeout (BatteryApplet *applet)
return TRUE;
applet->last_icon = icon;
-
- /* Load icon */
+
mb_panel_scaling_image_set_icon (applet->image, icon);
/* Keep going */
@@ -59,12 +55,10 @@ mb_panel_applet_create (const char *id,
if (!pm_support())
return NULL;
- /* Create applet data structure */
applet = g_slice_new (BatteryApplet);
applet->last_icon = NULL;
- /* Create image */
image = mb_panel_scaling_image_new (orientation, NULL);
applet->image = MB_PANEL_SCALING_IMAGE (image);
@@ -75,13 +69,12 @@ mb_panel_applet_create (const char *id,
applet);
/* Set up a timeout that will be called every 5 minutes */
- applet->timeout_id = g_timeout_add (5 * 60 * 1000,
- (GSourceFunc) timeout,
- applet);
+ applet->timeout_id = g_timeout_add_seconds (5 * 60,
+ (GSourceFunc) timeout,
+ applet);
timeout (applet);
- /* Show! */
gtk_widget_show (image);
return image;