diff options
author | Ted Gould <ted@gould.cx> | 2011-04-07 13:22:08 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-04-07 13:22:08 -0500 |
commit | 8028b594369055a3d6ca6577009993d4cf2e58c1 (patch) | |
tree | 405542900c5ba445ad68550a145a4823e68c206a /src/utils.c | |
parent | 27c56bd90ab38a79d5eca970b7ba4dca2652c01a (diff) | |
parent | ab9c66b70627b1ed5843fabd7259d631acb8d116 (diff) | |
download | ayatana-indicator-datetime-8028b594369055a3d6ca6577009993d4cf2e58c1.tar.gz ayatana-indicator-datetime-8028b594369055a3d6ca6577009993d4cf2e58c1.tar.bz2 ayatana-indicator-datetime-8028b594369055a3d6ca6577009993d4cf2e58c1.zip |
New upstream release.
∘ Add language and proper distro version to geonames URL to allow
for proper server side fixes
∘ Give full day events the day name instead of a time
∘ Make sure the calendar follows the user setting (LP: #748772)
∘ Ensure that events handle month boundaries correctly (LP: #746713)
∘ Only show calendars the user has configured (LP: #729033)
∘ Reenable clicking on the timezone in the menu to set it.
Diffstat (limited to 'src/utils.c')
-rw-r--r-- | src/utils.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c index d8851aa..ab93ecf 100644 --- a/src/utils.c +++ b/src/utils.c @@ -81,6 +81,42 @@ split_settings_location (const gchar * location, gchar ** zone, gchar ** name) } } +gchar * +get_current_zone_name (const gchar * location) +{ + gchar * new_zone, * new_name; + gchar * old_zone, * old_name; + gchar * rv; + + split_settings_location (location, &new_zone, &new_name); + + GSettings * conf = g_settings_new (SETTINGS_INTERFACE); + gchar * tz_name = g_settings_get_string (conf, SETTINGS_TIMEZONE_NAME_S); + split_settings_location (tz_name, &old_zone, &old_name); + g_free (tz_name); + g_object_unref (conf); + + // new_name is always just a sanitized version of a timezone. + // old_name is potentially a saved "pretty" version of a timezone name from + // geonames. So we prefer to use it if available and the zones match. + + if (g_strcmp0 (old_zone, new_zone) == 0) { + rv = old_name; + old_name = NULL; + } + else { + rv = new_name; + new_name = NULL; + } + + g_free (new_zone); + g_free (old_zone); + g_free (new_name); + g_free (old_name); + + return rv; +} + /* Translate msg according to the locale specified by LC_TIME */ static char * T_(const char *msg) |