[tracker/collation-gconf-locale: 8/24] tracker-locale: Make sure locale is not an empty string
- From: Aleksander Morgado <aleksm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/collation-gconf-locale: 8/24] tracker-locale: Make sure locale is not an empty string
- Date: Mon, 15 Nov 2010 13:53:37 +0000 (UTC)
commit cfe725f3d7e4f4a3e1aa51c50803c73a299d45b6
Author: Aleksander Morgado <aleksander lanedo com>
Date: Thu Oct 28 13:12:25 2010 +0200
tracker-locale: Make sure locale is not an empty string
src/libtracker-common/tracker-locale.c | 22 ++++++++++++++++++----
1 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/src/libtracker-common/tracker-locale.c b/src/libtracker-common/tracker-locale.c
index 3a78789..88cc2a6 100644
--- a/src/libtracker-common/tracker-locale.c
+++ b/src/libtracker-common/tracker-locale.c
@@ -149,6 +149,7 @@ tracker_locale_gconf_notify_cb (GConfClient *client,
guint i;
GConfValue *value;
GSList *li;
+ const gchar *string_value;
/* Find the proper locale to change */
for (i = 0; i < TRACKER_LOCALE_LAST; i++) {
@@ -167,15 +168,28 @@ tracker_locale_gconf_notify_cb (GConfClient *client,
/* Ensure a proper value was set */
value = gconf_entry_get_value (entry);
if (!value) {
- g_warning ("Locale value for '%s' cannot be NULL, not changing locale",
- gconf_entry_get_key (entry));
+ g_warning ("Locale value for '%s' cannot be NULL, not changing %s",
+ gconf_locales[i],
+ locale_names[i]);
return;
}
/* It must be a string */
if (value->type != GCONF_VALUE_STRING) {
- g_warning ("Locale value for '%s' must be a string, not changing locale",
- gconf_entry_get_key (entry));
+ g_warning ("Locale value for '%s' must be a string, not changing %s",
+ gconf_locales[i],
+ locale_names[i]);
+ return;
+ }
+
+ string_value = gconf_value_get_string (value);
+
+ /* String must have a length > 0 */
+ if (!string_value ||
+ strlen (string_value) == 0) {
+ g_warning ("Locale value for '%s' must not be empty, not changing %s",
+ gconf_locales[i],
+ locale_names[i]);
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]