aboutsummaryrefslogtreecommitdiff
path: root/src/datetime-service.c
diff options
context:
space:
mode:
authorMichael Terry <michael.terry@canonical.com>2011-06-28 15:32:04 +0100
committerMichael Terry <michael.terry@canonical.com>2011-06-28 15:32:04 +0100
commitf57128cae925df888e1e0cafb9ba988c665ecff8 (patch)
tree2badc6eec3bf64e8e5e650bce5064ed5aec5b095 /src/datetime-service.c
parent3c5f6a06ff0e44945f788254c44ede18f4061724 (diff)
downloadayatana-indicator-datetime-f57128cae925df888e1e0cafb9ba988c665ecff8.tar.gz
ayatana-indicator-datetime-f57128cae925df888e1e0cafb9ba988c665ecff8.tar.bz2
ayatana-indicator-datetime-f57128cae925df888e1e0cafb9ba988c665ecff8.zip
update to handle latest gnome-settings-daemon dbus API for setting timezones; be more fool-proof when looking up current timezone in indicator
Diffstat (limited to 'src/datetime-service.c')
-rw-r--r--src/datetime-service.c22
1 files changed, 3 insertions, 19 deletions
diff --git a/src/datetime-service.c b/src/datetime-service.c
index 08ff9ad..30bf9eb 100644
--- a/src/datetime-service.c
+++ b/src/datetime-service.c
@@ -221,29 +221,15 @@ update_current_timezone (void) {
current_timezone = NULL;
}
- 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);
+ current_timezone = read_timezone ();
+ if (current_timezone == NULL) {
return;
}
- /* This shouldn't happen, so let's make it a big boom! */
- g_return_if_fail(tempzone != 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. */
- current_timezone = g_strdup(g_strstrip(tempzone));
- g_free(tempzone);
-
g_debug("System timezone is: %s", current_timezone);
check_timezone_sync();
- if (error != NULL) g_error_free(error);
return;
}
@@ -276,10 +262,8 @@ quick_set_tz_proxy_cb (GObject *object, GAsyncResult *res, gpointer zone)
return;
}
- gchar * file = g_build_filename ("/usr/share/zoneinfo", (char *)zone, NULL);
- g_dbus_proxy_call (proxy, "SetTimezone", g_variant_new ("(s)", file),
+ g_dbus_proxy_call (proxy, "SetTimezone", g_variant_new ("(s)", zone),
G_DBUS_CALL_FLAGS_NONE, -1, NULL, quick_set_tz_cb, NULL);
- g_free (file);
g_free (zone);
g_object_unref (proxy);
}