summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Wimpress <[email protected]>2015-06-09 22:16:27 +0100
committerMartin Wimpress <[email protected]>2015-06-09 22:16:27 +0100
commit77adc6244e90fa97f29317e487db0d8ba07d7796 (patch)
tree8d1a572a625aeeb03fa946777949802b2ec522da
parentfeef50f626b98dc6d5ada94f0b3adf4606ce4dd7 (diff)
parent401d1e249bef56722973a18964ea6d2f3eebe9fe (diff)
downloadmarco-77adc6244e90fa97f29317e487db0d8ba07d7796.tar.bz2
marco-77adc6244e90fa97f29317e487db0d8ba07d7796.tar.xz
Merge pull request #190 from monsta/keybindings-fix-1.8
[1.8] prefs: make keybindings change notifications work with GLib >= 2.43
-rw-r--r--src/core/prefs.c45
1 files changed, 25 insertions, 20 deletions
diff --git a/src/core/prefs.c b/src/core/prefs.c
index 7f747a20..07483f74 100644
--- a/src/core/prefs.c
+++ b/src/core/prefs.c
@@ -160,7 +160,9 @@ static void button_layout_handler (MetaPreference, const gchar*, gboolean*);
static gboolean update_binding (MetaKeyPref *binding,
gchar *value);
-static void init_bindings (void);
+static void init_bindings (GSettings *);
+static void init_screen_bindings (void);
+static void init_window_bindings (void);
static void init_commands (void);
static void init_workspace_names (void);
@@ -907,7 +909,8 @@ meta_prefs_init (void)
handle_preference_init_string ();
handle_preference_init_int ();
- init_bindings ();
+ init_screen_bindings ();
+ init_window_bindings ();
init_commands ();
init_workspace_names ();
}
@@ -1584,32 +1587,32 @@ static MetaKeyPref key_bindings[] = {
#undef keybind
static void
-init_bindings (void)
+init_bindings (GSettings *settings)
{
- const char *prefix[] = {
- KEY_WINDOW_BINDINGS_SCHEMA,
- KEY_SCREEN_BINDINGS_SCHEMA,
- NULL
- };
- int i;
gchar **list = NULL;
gchar *str_val = NULL;
- GSettings *bindings_settings = NULL;
- for (i = 0; prefix[i]; i++)
+ list = g_settings_list_keys (settings);
+ while (*list != NULL)
{
- bindings_settings = g_settings_new (prefix [i]);
- list = g_settings_list_keys (bindings_settings);
- while (*list != NULL)
- {
- str_val = g_settings_get_string (bindings_settings, *list);
- update_key_binding (*list, str_val);
- list++;
- }
+ str_val = g_settings_get_string (settings, *list);
+ update_key_binding (*list, str_val);
+ list++;
}
+
g_free (str_val);
- g_object_unref (bindings_settings);
+}
+static void
+init_screen_bindings (void)
+{
+ init_bindings (settings_screen_bindings);
+}
+
+static void
+init_window_bindings (void)
+{
+ init_bindings (settings_window_bindings);
}
static void
@@ -1625,6 +1628,7 @@ init_commands (void)
update_command (*list, str_val);
list++;
}
+
g_free (str_val);
}
@@ -1641,6 +1645,7 @@ init_workspace_names (void)
update_workspace_name (*list, str_val);
list++;
}
+
g_free (str_val);
}