summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaine Walker-Avina <[email protected]>2019-03-17 09:48:27 -0700
committerraveit65 <[email protected]>2019-03-23 22:28:11 +0100
commit1dc3ca457e773f6f3813f1181a8851971ec178e4 (patch)
treeeeed97e7ef32ac4d1705a5f8784cc33c909c2881
parentb2fea66d5591bb90a8cfabf00e0bb14bfa1956f5 (diff)
downloadmate-power-manager-1dc3ca457e773f6f3813f1181a8851971ec178e4.tar.bz2
mate-power-manager-1dc3ca457e773f6f3813f1181a8851971ec178e4.tar.xz
Add conf option to disable warnings for low mouse power
On certain mice, they can last several weeks after the first warning on certain kinds of batteries which makes the constant notifications quite annoying.
-rw-r--r--data/org.mate.power-manager.gschema.xml.in5
-rw-r--r--src/gpm-common.h1
-rw-r--r--src/gpm-manager.c10
3 files changed, 16 insertions, 0 deletions
diff --git a/data/org.mate.power-manager.gschema.xml.in b/data/org.mate.power-manager.gschema.xml.in
index d4a443d..db0593a 100644
--- a/data/org.mate.power-manager.gschema.xml.in
+++ b/data/org.mate.power-manager.gschema.xml.in
@@ -221,6 +221,11 @@
<summary>Notify on a low power</summary>
<description>If a notification message should be displayed when the battery is getting low.</description>
</key>
+ <key name="notify-low-capacity-mouse" type="b">
+ <default>false</default>
+ <summary>Notify on low capacity of mouse battery</summary>
+ <description>If a notification message should be displayed when the battery is getting low.</description>
+ </key>
<key name="info-history-graph-points" type="b">
<default>true</default>
<summary>Whether we should show the history data points</summary>
diff --git a/src/gpm-common.h b/src/gpm-common.h
index 7578f68..e9f0ac9 100644
--- a/src/gpm-common.h
+++ b/src/gpm-common.h
@@ -98,6 +98,7 @@ G_BEGIN_DECLS
#define GPM_SETTINGS_NOTIFY_SLEEP_FAILED "notify-sleep-failed"
#define GPM_SETTINGS_NOTIFY_SLEEP_FAILED_URI "notify-sleep-failed-uri"
#define GPM_SETTINGS_NOTIFY_LOW_POWER "notify-low-power"
+#define GPM_SETTINGS_NOTIFY_LOW_CAPACITY_MOUSE "notify-low-capacity-mouse"
/* thresholds */
#define GPM_SETTINGS_PERCENTAGE_LOW "percentage-low"
diff --git a/src/gpm-manager.c b/src/gpm-manager.c
index 91d787d..71e5de9 100644
--- a/src/gpm-manager.c
+++ b/src/gpm-manager.c
@@ -1328,6 +1328,11 @@ gpm_manager_engine_charge_low_cb (GpmEngine *engine, UpDevice *device, GpmManage
message = g_strdup_printf (_("Approximately <b>%s</b> of remaining UPS backup power (%.0f%%)"),
remaining_text, percentage);
} else if (kind == UP_DEVICE_KIND_MOUSE) {
+ gboolean notify = g_settings_get_boolean (manager->priv->settings,
+ GPM_SETTINGS_NOTIFY_LOW_CAPACITY_MOUSE);
+ if(!notify)
+ goto out;
+
/* TRANSLATORS: mouse is getting a little low */
title = _("Mouse battery low");
@@ -1462,6 +1467,11 @@ gpm_manager_engine_charge_critical_cb (GpmEngine *engine, UpDevice *device, GpmM
remaining_text, percentage);
g_free (remaining_text);
} else if (kind == UP_DEVICE_KIND_MOUSE) {
+ gboolean notify = g_settings_get_boolean (manager->priv->settings,
+ GPM_SETTINGS_NOTIFY_LOW_CAPACITY_MOUSE);
+ if(!notify)
+ goto out;
+
/* TRANSLATORS: the mouse battery is very low */
title = _("Mouse battery low");