aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2013-06-16 23:16:19 -0500
committerCharles Kerr <charles.kerr@canonical.com>2013-06-16 23:16:19 -0500
commitf5c93cdcc7f2728560ea9aa27df17d85b74a28c1 (patch)
treeaadd45dce5917ddeacc79113227f28f4e71aa3a0 /src
parentcbbf63caf72e04919c4066902ff5008b3874047c (diff)
downloadayatana-indicator-power-f5c93cdcc7f2728560ea9aa27df17d85b74a28c1.tar.gz
ayatana-indicator-power-f5c93cdcc7f2728560ea9aa27df17d85b74a28c1.tar.bz2
ayatana-indicator-power-f5c93cdcc7f2728560ea9aa27df17d85b74a28c1.zip
explicitly use gio; remove unused glib-upower.h calls
Diffstat (limited to 'src')
-rw-r--r--src/device.c25
-rw-r--r--src/device.h33
2 files changed, 55 insertions, 3 deletions
diff --git a/src/device.c b/src/device.c
index d028ab7..02c9e65 100644
--- a/src/device.c
+++ b/src/device.c
@@ -26,6 +26,7 @@ License along with this library. If not, see
#endif
#include <glib/gi18n-lib.h>
+#include <gio/gio.h>
#include "device.h"
@@ -301,6 +302,26 @@ get_device_icon_index (gdouble percentage)
return "000";
}
+static const char *
+device_kind_to_string (UpDeviceKind kind)
+{
+ switch (kind)
+ {
+ case UP_DEVICE_KIND_LINE_POWER: return "line-power";
+ case UP_DEVICE_KIND_BATTERY: return "battery";
+ case UP_DEVICE_KIND_UPS: return "ups";
+ case UP_DEVICE_KIND_MONITOR: return "monitor";
+ case UP_DEVICE_KIND_MOUSE: return "mouse";
+ case UP_DEVICE_KIND_KEYBOARD: return "keyboard";
+ case UP_DEVICE_KIND_PDA: return "pda";
+ case UP_DEVICE_KIND_PHONE: return "phone";
+ case UP_DEVICE_KIND_MEDIA_PLAYER: return "media-player";
+ case UP_DEVICE_KIND_TABLET: return "tablet";
+ case UP_DEVICE_KIND_COMPUTER: return "computer";
+ default: return "unknown";
+ }
+}
+
/**
indicator_power_device_get_icon_names:
@device: #IndicatorPowerDevice from which to generate the icon names
@@ -334,7 +355,7 @@ indicator_power_device_get_icon_names (const IndicatorPowerDevice * device)
gdouble percentage = indicator_power_device_get_percentage (device);
const UpDeviceKind kind = indicator_power_device_get_kind (device);
const UpDeviceState state = indicator_power_device_get_state (device);
- const gchar * kind_str = up_device_kind_to_string (kind);
+ const gchar * kind_str = device_kind_to_string (kind);
GPtrArray * names = g_ptr_array_new ();
@@ -534,7 +555,7 @@ device_kind_to_localised_string (UpDeviceKind kind)
break;
default:
g_warning ("enum unrecognised: %i", kind);
- text = up_device_kind_to_string (kind);
+ text = device_kind_to_string (kind);
}
return text;
diff --git a/src/device.h b/src/device.h
index 3f7bbee..ffbb5da 100644
--- a/src/device.h
+++ b/src/device.h
@@ -25,7 +25,6 @@ License along with this library. If not, see
#define __INDICATOR_POWER_DEVICE_H__
#include <glib-object.h>
-#include <libupower-glib/upower.h>
G_BEGIN_DECLS
@@ -46,6 +45,38 @@ typedef struct _IndicatorPowerDevicePrivate IndicatorPowerDevicePrivate;
#define INDICATOR_POWER_DEVICE_PERCENTAGE "percentage"
#define INDICATOR_POWER_DEVICE_TIME "time"
+typedef enum
+{
+ UP_DEVICE_KIND_UNKNOWN,
+ UP_DEVICE_KIND_LINE_POWER,
+ UP_DEVICE_KIND_BATTERY,
+ UP_DEVICE_KIND_UPS,
+ UP_DEVICE_KIND_MONITOR,
+ UP_DEVICE_KIND_MOUSE,
+ UP_DEVICE_KIND_KEYBOARD,
+ UP_DEVICE_KIND_PDA,
+ UP_DEVICE_KIND_PHONE,
+ UP_DEVICE_KIND_MEDIA_PLAYER,
+ UP_DEVICE_KIND_TABLET,
+ UP_DEVICE_KIND_COMPUTER,
+ UP_DEVICE_KIND_LAST
+}
+UpDeviceKind;
+
+typedef enum
+{
+ UP_DEVICE_STATE_UNKNOWN,
+ UP_DEVICE_STATE_CHARGING,
+ UP_DEVICE_STATE_DISCHARGING,
+ UP_DEVICE_STATE_EMPTY,
+ UP_DEVICE_STATE_FULLY_CHARGED,
+ UP_DEVICE_STATE_PENDING_CHARGE,
+ UP_DEVICE_STATE_PENDING_DISCHARGE,
+ UP_DEVICE_STATE_LAST
+}
+UpDeviceState;
+
+
/**
* IndicatorPowerDeviceClass:
* @parent_class: #GObjectClass