aboutsummaryrefslogtreecommitdiff
path: root/src/utils.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-07-07 16:24:09 -0500
committerTed Gould <ted@gould.cx>2011-07-07 16:24:09 -0500
commit732b5f6b4eb81a4b36481b14646ef0bd049922ec (patch)
treeb281871bdc8f2f66825ed97f2539f8458f1abb95 /src/utils.c
parent64b442893f7ae6d4201f72535175a2956f448ddf (diff)
parent1819f029c3f3af6922e095e959e80b1ce446148b (diff)
downloadayatana-indicator-datetime-732b5f6b4eb81a4b36481b14646ef0bd049922ec.tar.gz
ayatana-indicator-datetime-732b5f6b4eb81a4b36481b14646ef0bd049922ec.tar.bz2
ayatana-indicator-datetime-732b5f6b4eb81a4b36481b14646ef0bd049922ec.zip
* New upstream release.
* libindicator 0.4 transition * Making preferences a gnome-control-center plugin * Calling gnome-control-center from the menu * Fixing timezone setting with new gsd
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c
index ab93ecf..73c8ab2 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -117,6 +117,30 @@ get_current_zone_name (const gchar * location)
return rv;
}
+gchar *
+read_timezone ()
+{
+ GError * error = NULL;
+ gchar * tempzone = NULL;
+ if (!g_file_get_contents(TIMEZONE_FILE, &tempzone, NULL, &error)) {
+ g_warning("Unable to read timezone file '" TIMEZONE_FILE "': %s", error->message);
+ g_error_free(error);
+ return NULL;
+ }
+
+ /* This shouldn't happen, so let's make it a big boom! */
+ g_return_val_if_fail(tempzone != NULL, NULL);
+
+ /* Note: this really makes sense as strstrip works in place
+ so we end up with something a little odd without the dup
+ so we have the dup to make sure everything is as expected
+ for everyone else. */
+ gchar * rv = g_strdup(g_strstrip(tempzone));
+ g_free(tempzone);
+
+ return rv;
+}
+
/* Translate msg according to the locale specified by LC_TIME */
static char *
T_(const char *msg)