[gnome-power-manager] Add low power notifications and an entry in the drop-down for media-player and tablet devices
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-power-manager] Add low power notifications and an entry in the drop-down for media-player and tablet devices
- Date: Fri, 28 May 2010 11:12:49 +0000 (UTC)
commit 7e4d8eecfbfce9b569d12544c2d82d309b7291af
Author: Richard Hughes <richard hughsie com>
Date: Fri May 28 12:12:27 2010 +0100
Add low power notifications and an entry in the drop-down for media-player and tablet devices
src/gpm-engine.c | 4 ++++
src/gpm-manager.c | 38 ++++++++++++++++++++++++++++++++++++++
src/gpm-tray-icon.c | 4 ++++
3 files changed, 46 insertions(+), 0 deletions(-)
---
diff --git a/src/gpm-engine.c b/src/gpm-engine.c
index e71e206..5d60803 100644
--- a/src/gpm-engine.c
+++ b/src/gpm-engine.c
@@ -196,6 +196,10 @@ gpm_engine_get_warning (GpmEngine *engine, UpDevice *device)
warning_type = gpm_engine_get_warning_csr (engine, device);
} else if (kind == UP_DEVICE_KIND_UPS ||
+#if UP_CHECK_VERSION(0,9,5)
+ kind == UP_DEVICE_KIND_MEDIA_PLAYER ||
+ kind == UP_DEVICE_KIND_TABLET ||
+#endif
kind == UP_DEVICE_KIND_PDA) {
warning_type = gpm_engine_get_warning_percentage (engine, device);
diff --git a/src/gpm-manager.c b/src/gpm-manager.c
index 9aa1646..bfa0bf0 100644
--- a/src/gpm-manager.c
+++ b/src/gpm-manager.c
@@ -1534,7 +1534,23 @@ gpm_manager_engine_charge_low_cb (GpmEngine *engine, UpDevice *device, GpmManage
/* TRANSLATORS: tell user more details */
message = g_strdup_printf (_("Cell phone is low in power (%.0f%%)"), percentage);
+
+#if UP_CHECK_VERSION(0,9,5)
+ } else if (kind == UP_DEVICE_KIND_MEDIA_PLAYER) {
+ /* TRANSLATORS: media player, e.g. mp3 is getting a little low */
+ title = _("Media player battery low");
+
+ /* TRANSLATORS: tell user more details */
+ message = g_strdup_printf (_("Media player is low in power (%.0f%%)"), percentage);
+
+ } else if (kind == UP_DEVICE_KIND_TABLET) {
+ /* TRANSLATORS: tablet, e.g. ipad is getting a little low */
+ title = _("Tablet battery low");
+
+ /* TRANSLATORS: tell user more details */
+ message = g_strdup_printf (_("Tablet is low in power (%.0f%%)"), percentage);
}
+#endif
/* get correct icon */
icon = gpm_upower_get_device_icon (device, TRUE);
@@ -1650,6 +1666,7 @@ gpm_manager_engine_charge_critical_cb (GpmEngine *engine, UpDevice *device, GpmM
message = g_strdup_printf (_("PDA is very low in power (%.0f%%). "
"This device will soon stop functioning if not charged."),
percentage);
+
} else if (kind == UP_DEVICE_KIND_PHONE) {
/* TRANSLATORS: the cell battery is very low */
@@ -1659,7 +1676,28 @@ gpm_manager_engine_charge_critical_cb (GpmEngine *engine, UpDevice *device, GpmM
message = g_strdup_printf (_("Cell phone is very low in power (%.0f%%). "
"This device will soon stop functioning if not charged."),
percentage);
+
+#if UP_CHECK_VERSION(0,9,5)
+ } else if (kind == UP_DEVICE_KIND_MEDIA_PLAYER) {
+
+ /* TRANSLATORS: the cell battery is very low */
+ title = _("Cell phone battery low");
+
+ /* TRANSLATORS: the device is just going to stop working */
+ message = g_strdup_printf (_("Media player is very low in power (%.0f%%). "
+ "This device will soon stop functioning if not charged."),
+ percentage);
+ } else if (kind == UP_DEVICE_KIND_TABLET) {
+
+ /* TRANSLATORS: the cell battery is very low */
+ title = _("Tablet battery low");
+
+ /* TRANSLATORS: the device is just going to stop working */
+ message = g_strdup_printf (_("Tablet is very low in power (%.0f%%). "
+ "This device will soon shutdown if not charged."),
+ percentage);
}
+#endif
/* get correct icon */
icon = gpm_upower_get_device_icon (device, TRUE);
diff --git a/src/gpm-tray-icon.c b/src/gpm-tray-icon.c
index fe11f06..cdc27b8 100644
--- a/src/gpm-tray-icon.c
+++ b/src/gpm-tray-icon.c
@@ -321,6 +321,10 @@ gpm_tray_icon_create_menu (GpmTrayIcon *icon)
dev_cnt += gpm_tray_icon_add_device (icon, menu, array, UP_DEVICE_KIND_KEYBOARD);
dev_cnt += gpm_tray_icon_add_device (icon, menu, array, UP_DEVICE_KIND_PDA);
dev_cnt += gpm_tray_icon_add_device (icon, menu, array, UP_DEVICE_KIND_PHONE);
+#if UP_CHECK_VERSION(0,9,5)
+ dev_cnt += gpm_tray_icon_add_device (icon, menu, array, UP_DEVICE_KIND_MEDIA_PLAYER);
+ dev_cnt += gpm_tray_icon_add_device (icon, menu, array, UP_DEVICE_KIND_TABLET);
+#endif
g_ptr_array_unref (array);
/* skip for things like live-cd's and GDM */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]