[gnome-settings-daemon] media-keys: Fix custom binding command changes not getting applied
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] media-keys: Fix custom binding command changes not getting applied
- Date: Thu, 2 Nov 2017 14:00:47 +0000 (UTC)
commit 8778c2dd422f2a3589f24394896710284eff545f
Author: Rui Matos <tiagomatos gmail com>
Date: Wed Nov 1 18:53:39 2017 +0100
media-keys: Fix custom binding command changes not getting applied
This is a regression from commit
8966dd939641ecde2d75aeb291634630d2bea148.
https://bugzilla.gnome.org/show_bug.cgi?id=789782
plugins/media-keys/gsd-media-keys-manager.c | 33 ++++++++++++++++++++++----
1 files changed, 28 insertions(+), 5 deletions(-)
---
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index 59209b0..37fc6e6 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -650,7 +650,7 @@ media_key_new_for_path (GsdMediaKeysManager *manager,
if (settings == NULL) {
settings = g_settings_new_with_path (CUSTOM_BINDING_SCHEMA, path);
- g_signal_connect (settings, "changed::binding",
+ g_signal_connect (settings, "changed",
G_CALLBACK (custom_binding_changed), manager);
g_hash_table_insert (manager->priv->custom_settings,
g_strdup (path), settings);
@@ -708,17 +708,40 @@ update_custom_binding (GsdMediaKeysManager *manager,
}
static void
+update_custom_binding_command (GsdMediaKeysManager *manager,
+ GSettings *settings,
+ char *path)
+{
+ MediaKey *key;
+ int i;
+
+ for (i = 0; i < manager->priv->keys->len; i++) {
+ key = g_ptr_array_index (manager->priv->keys, i);
+
+ if (key->custom_path == NULL)
+ continue;
+ if (strcmp (key->custom_path, path) == 0) {
+ g_free (key->custom_command);
+ key->custom_command = g_settings_get_string (settings, "command");
+ break;
+ }
+ }
+}
+
+static void
custom_binding_changed (GSettings *settings,
const char *settings_key,
GsdMediaKeysManager *manager)
{
char *path;
- if (strcmp (settings_key, "binding") != 0)
- return; /* we don't care */
-
g_object_get (settings, "path", &path, NULL);
- update_custom_binding (manager, path);
+
+ if (strcmp (settings_key, "binding") == 0)
+ update_custom_binding (manager, path);
+ else if (strcmp (settings_key, "command") == 0)
+ update_custom_binding_command (manager, settings, path);
+
g_free (path);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]