diff options
author | Ted Gould <ted@gould.cx> | 2011-07-07 16:17:58 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-07-07 16:17:58 -0500 |
commit | b64854473ee9226bc11f5b27b0057fab82a2f098 (patch) | |
tree | a64aabc5e071d3d04671fca285b13356b2c345fd /src/utils.c | |
parent | 62a1ba2b91d2e916c9bfc99eda0793f67af6e820 (diff) | |
parent | 5d36567ca57ebd73e7a759c83542d19b2aa8814d (diff) | |
download | ayatana-indicator-datetime-b64854473ee9226bc11f5b27b0057fab82a2f098.tar.gz ayatana-indicator-datetime-b64854473ee9226bc11f5b27b0057fab82a2f098.tar.bz2 ayatana-indicator-datetime-b64854473ee9226bc11f5b27b0057fab82a2f098.zip |
Making the preferences a gnome-control-center plugin instead of a stand alone app
Diffstat (limited to 'src/utils.c')
-rw-r--r-- | src/utils.c | 24 |
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) |