From 54c0655650740372c790ecfec7e6bb7c6e628e9d Mon Sep 17 00:00:00 2001 From: Laine Walker-Avina Date: Sun, 17 Mar 2019 09:48:27 -0700 Subject: 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. --- src/gpm-common.h | 1 + src/gpm-manager.c | 10 ++++++++++ 2 files changed, 11 insertions(+) (limited to 'src') 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 %s 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"); -- cgit v1.2.1