diff options
author | Stefano Karapetsas <[email protected]> | 2012-10-16 11:44:49 +0200 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2012-10-16 11:44:49 +0200 |
commit | 3dcbb5a741ca16cb6db9050e5f8468e45aae8ef9 (patch) | |
tree | 9194cd9b9ecd9d1a10f21e90b0262c8c85c787c2 /plugins/keyboard/msd-xmodmap.c | |
parent | 5409696b646a7ebd80ae31417e22e730b084b222 (diff) | |
download | mate-settings-daemon-3dcbb5a741ca16cb6db9050e5f8468e45aae8ef9.tar.bz2 mate-settings-daemon-3dcbb5a741ca16cb6db9050e5f8468e45aae8ef9.tar.xz |
keyboard: fix msd_load_modmap_files
Diffstat (limited to 'plugins/keyboard/msd-xmodmap.c')
-rw-r--r-- | plugins/keyboard/msd-xmodmap.c | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/plugins/keyboard/msd-xmodmap.c b/plugins/keyboard/msd-xmodmap.c index 92e8d24..5bea2da 100644 --- a/plugins/keyboard/msd-xmodmap.c +++ b/plugins/keyboard/msd-xmodmap.c @@ -37,38 +37,35 @@ void msd_load_modmap_files (void) { GSettings *settings; - GSList *tmp; - GSList *loaded_file_list; + GSList *tmp = NULL; + GSList *loaded_file_list = NULL; + gchar **settings_list; + gint i; settings = g_settings_new (KEYBOARD_SCHEMA); - - gchar **settings_list; settings_list = g_settings_get_strv (settings, LOADED_FILES_KEY); + if (settings_list != NULL) { - gint i; - for (i = 0; i < G_N_ELEMENTS (settings_list); i++) { - if (settings_list[i] != NULL) - loaded_file_list = - g_slist_append (loaded_file_list, g_strdup (settings_list[i])); + for (i = 0; settings_list[i] != NULL; i++) { + loaded_file_list = + g_slist_append (loaded_file_list, g_strdup (settings_list[i])); } - g_strfreev (settings_list); - } - - for (tmp = loaded_file_list; tmp != NULL; tmp = tmp->next) { - gchar *file; - gchar *command; + for (tmp = loaded_file_list; tmp != NULL; tmp = tmp->next) { + gchar *file; + gchar *command; - file = g_build_filename (g_get_home_dir (), (gchar *) tmp->data, NULL); - command = g_strconcat ("xmodmap ", file, NULL); - g_free (file); + file = g_build_filename (g_get_home_dir (), (gchar *) tmp->data, NULL); + command = g_strconcat ("xmodmap ", file, NULL); + g_free (file); - g_spawn_command_line_async (command, NULL); + g_spawn_command_line_async (command, NULL); - g_free (command); - g_free (tmp->data); + g_free (command); + g_free (tmp->data); + } + g_strfreev (settings_list); + g_slist_free (loaded_file_list); } - - g_slist_free (loaded_file_list); g_object_unref (settings); } |