[gnome-settings-daemon/wip/benzea/multiple-keybindings: 10/12] media-keys: Drop user set value if it used to be the default
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon/wip/benzea/multiple-keybindings: 10/12] media-keys: Drop user set value if it used to be the default
- Date: Mon, 20 May 2019 12:38:36 +0000 (UTC)
commit db66cc939dca3af32cf6d57dade98d7be64cd542
Author: Benjamin Berg <bberg redhat com>
Date: Mon May 13 22:02:55 2019 +0200
media-keys: Drop user set value if it used to be the default
Drop the user defined key if it is equivalent to the default value. The
reason to do is that we will migrate almost all old default values into
other setting keys. This allows the user to both keep the default and
set their own value.
plugins/media-keys/gsd-media-keys-manager.c | 8 ++++++++
1 file changed, 8 insertions(+)
---
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index c4e06111..d6f64fd0 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -3177,6 +3177,7 @@ map_keybinding (GVariant *variant, GVariant *old_default, GVariant *new_default)
{
g_autoptr(GPtrArray) array = g_ptr_array_new ();
g_autofree const gchar **defaults = NULL;
+ const gchar *old_default_value;
const gchar **pos;
const gchar *value;
@@ -3184,6 +3185,13 @@ map_keybinding (GVariant *variant, GVariant *old_default, GVariant *new_default)
pos = defaults;
value = g_variant_get_string (variant, NULL);
+ old_default_value = g_variant_get_string (old_default, NULL);
+
+ /* Reset the keybinding configuration even if the user has the default
+ * configured explicitly (as the key will be bound by the corresponding
+ * static binding now). */
+ if (g_strcmp0 (value, old_default_value) == 0)
+ return NULL;
/* If the user has a custom value that is not in the list, then
* insert it instead of the first default entry. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]