[gnome-settings-daemon] Fixed some issues found by Bastien's review
- From: Rodrigo Moya <rodrigo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] Fixed some issues found by Bastien's review
- Date: Thu, 7 Oct 2010 09:57:47 +0000 (UTC)
commit 2cbdac7670d658d042f66ae11ccf2c38e42f7bc0
Author: Rodrigo Moya <rodrigo gnome-db org>
Date: Thu Oct 7 11:56:21 2010 +0200
Fixed some issues found by Bastien's review
plugins/housekeeping/gsd-ldsm-dialog.c | 52 ++++++++++++--------------
plugins/media-keys/gsd-media-keys-manager.c | 2 +-
plugins/mouse/gsd-mouse-manager.c | 23 ++++++------
plugins/xrandr/gsd-xrandr-manager.c | 2 +-
4 files changed, 38 insertions(+), 41 deletions(-)
---
diff --git a/plugins/housekeeping/gsd-ldsm-dialog.c b/plugins/housekeeping/gsd-ldsm-dialog.c
index 1c26898..8fa0527 100644
--- a/plugins/housekeeping/gsd-ldsm-dialog.c
+++ b/plugins/housekeeping/gsd-ldsm-dialog.c
@@ -152,44 +152,40 @@ ignore_check_button_toggled_cb (GtkToggleButton *button,
GSettings *settings;
gchar **settings_list;
gboolean ignore, updated;
-
+ gint i;
+ GSList *ignore_paths = NULL;
+
settings = g_settings_new (SETTINGS_HOUSEKEEPING_DIR);
- if (settings != NULL) {
- gint i;
- GSList *ignore_paths = NULL;
- settings_list = g_settings_get_strv (settings, "ignore-paths");
+ settings_list = g_settings_get_strv (settings, "ignore-paths");
- for (i = 0; i < G_N_ELEMENTS (settings_list); i++) {
- if (settings_list[i] != NULL)
- ignore_paths = g_slist_append (ignore_paths, g_strdup (settings_list[i]));
- }
+ for (i = 0; i < G_N_ELEMENTS (settings_list); i++) {
+ if (settings_list[i] != NULL)
+ ignore_paths = g_slist_append (ignore_paths, g_strdup (settings_list[i]));
+ }
- ignore = gtk_toggle_button_get_active (button);
- updated = update_ignore_paths (&ignore_paths, dialog->priv->mount_path, ignore);
+ ignore = gtk_toggle_button_get_active (button);
+ updated = update_ignore_paths (&ignore_paths, dialog->priv->mount_path, ignore);
- g_strfreev (settings_list);
-
- if (updated) {
- GSList *l;
- GPtrArray *array = g_ptr_array_new ();
+ g_strfreev (settings_list);
- for (l = ignore_paths; l != NULL; l = l->next)
- g_ptr_array_add (array, l->data);
+ if (updated) {
+ GSList *l;
+ GPtrArray *array = g_ptr_array_new ();
- if (!g_settings_set_strv (settings, "ignore-paths", (const gchar **) array->pdata)) {
- g_warning ("Cannot change ignore preference - failed to commit changes");
- }
+ for (l = ignore_paths; l != NULL; l = l->next)
+ g_ptr_array_add (array, l->data);
- g_ptr_array_free (array, FALSE);
+ if (!g_settings_set_strv (settings, "ignore-paths", (const gchar **) array->pdata)) {
+ g_warning ("Cannot change ignore preference - failed to commit changes");
}
- g_slist_foreach (ignore_paths, (GFunc) g_free, NULL);
- g_slist_free (ignore_paths);
- g_object_unref (settings);
- } else {
- g_warning ("Cannot change ignore preference - failed to get settings client");
- }
+ g_ptr_array_free (array, FALSE);
+ }
+
+ g_slist_foreach (ignore_paths, (GFunc) g_free, NULL);
+ g_slist_free (ignore_paths);
+ g_object_unref (settings);
}
static void
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index fbad5e1..b6e0edf 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -157,7 +157,7 @@ get_term_command (GsdMediaKeysManager *manager)
settings = g_settings_new ("org.gnome.desktop.applications.terminal");
cmd_term = g_settings_get_string (settings, "exec");
- if (strcmp (cmd_term, "") == 0)
+ if (cmd_term[0] == '\0')
cmd_term = g_strdup ("gnome-terminal");
cmd_args = g_settings_get_string (settings, "exec-arg");
diff --git a/plugins/mouse/gsd-mouse-manager.c b/plugins/mouse/gsd-mouse-manager.c
index a0853c6..904c498 100644
--- a/plugins/mouse/gsd-mouse-manager.c
+++ b/plugins/mouse/gsd-mouse-manager.c
@@ -924,29 +924,29 @@ mouse_callback (GConfClient *client,
GConfEntry *entry,
GsdMouseManager *manager)
{
- if (! strcmp (entry->key, KEY_LEFT_HANDED)) {
+ if (g_str_equal (entry->key, KEY_LEFT_HANDED)) {
if (entry->value->type == GCONF_VALUE_BOOL) {
set_left_handed (manager, gconf_value_get_bool (entry->value));
}
- } else if (! strcmp (entry->key, KEY_MOTION_ACCELERATION)) {
+ } else if (g_str_equal (entry->key, KEY_MOTION_ACCELERATION)) {
if (entry->value->type == GCONF_VALUE_FLOAT) {
set_motion_acceleration (manager, gconf_value_get_float (entry->value));
}
- } else if (! strcmp (entry->key, KEY_MOTION_THRESHOLD)) {
+ } else if (g_str_equal (entry->key, KEY_MOTION_THRESHOLD)) {
if (entry->value->type == GCONF_VALUE_INT) {
set_motion_threshold (manager, gconf_value_get_int (entry->value));
}
- } else if (! strcmp (entry->key, KEY_LOCATE_POINTER)) {
+ } else if (g_str_equal (entry->key, KEY_LOCATE_POINTER)) {
if (entry->value->type == GCONF_VALUE_BOOL) {
set_locate_pointer (manager, gconf_value_get_bool (entry->value));
}
- } else if (! strcmp (entry->key, KEY_DWELL_ENABLE)) {
+ } else if (g_str_equal (entry->key, KEY_DWELL_ENABLE)) {
if (entry->value->type == GCONF_VALUE_BOOL) {
set_mousetweaks_daemon (manager,
gconf_value_get_bool (entry->value),
gconf_client_get_bool (client, KEY_DELAY_ENABLE, NULL));
}
- } else if (! strcmp (entry->key, KEY_DELAY_ENABLE)) {
+ } else if (g_str_equal (entry->key, KEY_DELAY_ENABLE)) {
if (entry->value->type == GCONF_VALUE_BOOL) {
set_mousetweaks_daemon (manager,
gconf_client_get_bool (client, KEY_DWELL_ENABLE, NULL),
@@ -962,18 +962,18 @@ touchpad_callback (GSettings *settings,
{
GConfClient *client = gconf_client_get_default ();
- if (! strcmp (key, KEY_TOUCHPAD_DISABLE_W_TYPING)) {
+ if (g_str_equal (key, KEY_TOUCHPAD_DISABLE_W_TYPING)) {
set_disable_w_typing (manager, g_settings_get_boolean (manager->priv->touchpad_settings, key));
#ifdef HAVE_X11_EXTENSIONS_XINPUT_H
- } else if (! strcmp (key, KEY_TAP_TO_CLICK)) {
+ } else if (g_str_equal (key, KEY_TAP_TO_CLICK)) {
set_tap_to_click (g_settings_get_boolean (settings, key),
gconf_client_get_bool (client, KEY_LEFT_HANDED, NULL));
- } else if (! strcmp (key, KEY_SCROLL_METHOD)) {
+ } else if (g_str_equal (key, KEY_SCROLL_METHOD)) {
set_edge_scroll (g_settings_get_int (settings, key));
set_horiz_scroll (g_settings_get_boolean (settings, KEY_PAD_HORIZ_SCROLL));
- } else if (! strcmp (key, KEY_PAD_HORIZ_SCROLL)) {
+ } else if (g_str_equal (key, KEY_PAD_HORIZ_SCROLL)) {
set_horiz_scroll (g_settings_get_boolean (settings, key));
- } else if (! strcmp (key, KEY_TOUCHPAD_ENABLED)) {
+ } else if (g_str_equal (key, KEY_TOUCHPAD_ENABLED)) {
set_touchpad_enabled (g_settings_get_boolean (settings, key));
}
#endif
@@ -1086,6 +1086,7 @@ gsd_mouse_manager_stop (GsdMouseManager *manager)
g_object_unref (client);
g_object_unref (manager->priv->touchpad_settings);
+ manager->priv->touchpad_settings = NULL;
set_locate_pointer (manager, FALSE);
diff --git a/plugins/xrandr/gsd-xrandr-manager.c b/plugins/xrandr/gsd-xrandr-manager.c
index 1d6f6bb..e900452 100644
--- a/plugins/xrandr/gsd-xrandr-manager.c
+++ b/plugins/xrandr/gsd-xrandr-manager.c
@@ -2154,7 +2154,7 @@ on_config_changed (GSettings *settings,
const gchar *key,
GsdXrandrManager *manager)
{
- if (strcmp (key, CONF_KEY_SHOW_NOTIFICATION_ICON) == 0)
+ if (g_str_equal (key, CONF_KEY_SHOW_NOTIFICATION_ICON))
start_or_stop_icon (manager);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]