[gnome-power-manager] Correctly pluralize multiple batteries
- From: Richard Hughes <rhughes src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-power-manager] Correctly pluralize multiple batteries
- Date: Tue, 16 Jun 2009 04:45:11 -0400 (EDT)
commit 7d0d2940205efe0860f68fd661a7936e1628f3ce
Author: Richard Hughes <richard hughsie com>
Date: Tue Jun 16 09:44:06 2009 +0100
Correctly pluralize multiple batteries
src/gpm-manager.c | 12 ++++++++++--
src/gpm-notify.c | 6 +++---
src/gpm-notify.h | 3 ++-
3 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/src/gpm-manager.c b/src/gpm-manager.c
index 69c69e5..0806598 100644
--- a/src/gpm-manager.c
+++ b/src/gpm-manager.c
@@ -1037,7 +1037,9 @@ static void
gpm_engine_fully_charged_cb (GpmEngine *engine, DkpDevice *device, GpmManager *manager)
{
DkpDeviceType type;
+ gchar *native_path;
gboolean ret;
+ guint plural = 1;
/* only action this if specified in gconf */
ret = gconf_client_get_bool (manager->priv->conf, GPM_CONF_NOTIFY_FULLY_CHARGED, NULL);
@@ -1049,10 +1051,16 @@ gpm_engine_fully_charged_cb (GpmEngine *engine, DkpDevice *device, GpmManager *m
/* get device properties */
g_object_get (device,
"type", &type,
+ "native-path", &native_path,
NULL);
- if (type == DKP_DEVICE_TYPE_BATTERY)
- gpm_notify_fully_charged_primary (manager->priv->notify);
+ if (type == DKP_DEVICE_TYPE_BATTERY) {
+ /* is this a dummy composite device, which is plural? */
+ if (g_str_has_prefix (native_path, "dummy"))
+ plural = 2;
+ gpm_notify_fully_charged_primary (manager->priv->notify, plural);
+ }
+ g_free (native_path);
}
/**
diff --git a/src/gpm-notify.c b/src/gpm-notify.c
index 697ea04..e8ff539 100644
--- a/src/gpm-notify.c
+++ b/src/gpm-notify.c
@@ -388,13 +388,13 @@ gpm_notify_inhibit_lid (GpmNotify *notify)
* gpm_notify_fully_charged_primary:
**/
gboolean
-gpm_notify_fully_charged_primary (GpmNotify *notify)
+gpm_notify_fully_charged_primary (GpmNotify *notify, guint plural)
{
const gchar *msg;
const gchar *title;
- title = _("Battery Charged");
- msg = _("Your laptop battery is now fully charged");
+ title = ngettext ("Battery Charged", "Batteries Charged", plural);
+ msg = ngettext ("Your laptop battery is now fully charged", "Your laptop batteries are now fully charged", plural);
gpm_notify_create (notify, title, msg, GPM_NOTIFY_TIMEOUT_SHORT,
GTK_STOCK_DIALOG_WARNING,
diff --git a/src/gpm-notify.h b/src/gpm-notify.h
index 24495cd..ae323aa 100644
--- a/src/gpm-notify.h
+++ b/src/gpm-notify.h
@@ -80,7 +80,8 @@ gboolean gpm_notify_perhaps_recall (GpmNotify *notify,
gboolean gpm_notify_low_capacity (GpmNotify *notify,
guint capacity);
gboolean gpm_notify_inhibit_lid (GpmNotify *notify);
-gboolean gpm_notify_fully_charged_primary (GpmNotify *notify);
+gboolean gpm_notify_fully_charged_primary (GpmNotify *notify,
+ guint plural);
gboolean gpm_notify_discharging_primary (GpmNotify *notify);
gboolean gpm_notify_discharging_ups (GpmNotify *notify);
gboolean gpm_notify_sleep_failed (GpmNotify *notify,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]