diff options
author | Milan Crha <mcrha@redhat.com> | 2009-04-25 01:11:03 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2009-04-25 01:11:03 +0800 |
commit | c33335bc72d9db97248ea5c5dc6da9cbfdb16e2c (patch) | |
tree | 4d447c8f1a02d8bc9021f6bbf1c1bf63d74fbb9e /calendar/gui/calendar-config.c | |
parent | f171b15d926480a4199d74f14356b7aa37b16f20 (diff) | |
download | gsoc2013-evolution-c33335bc72d9db97248ea5c5dc6da9cbfdb16e2c.tar.gz gsoc2013-evolution-c33335bc72d9db97248ea5c5dc6da9cbfdb16e2c.tar.zst gsoc2013-evolution-c33335bc72d9db97248ea5c5dc6da9cbfdb16e2c.zip |
Use system timezone in Evolution
** Fix for bug #381132
Diffstat (limited to 'calendar/gui/calendar-config.c')
-rw-r--r-- | calendar/gui/calendar-config.c | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c index 103d92f640..65864ea272 100644 --- a/calendar/gui/calendar-config.c +++ b/calendar/gui/calendar-config.c @@ -39,8 +39,6 @@ #include "calendar-config-keys.h" #include "calendar-config.h" - - static GConfClient *config = NULL; static void @@ -182,6 +180,35 @@ calendar_config_add_notification_primary_calendar (GConfClientNotifyFunc func, g return id; } +gboolean +calendar_config_get_use_system_timezone (void) +{ + calendar_config_init (); + + return gconf_client_get_bool (config, CALENDAR_CONFIG_USE_SYSTEM_TIMEZONE, NULL); +} + +void +calendar_config_set_use_system_timezone (gboolean use) +{ + calendar_config_init (); + + if (calendar_config_get_use_system_timezone () != use) { + gconf_client_set_bool (config, CALENDAR_CONFIG_USE_SYSTEM_TIMEZONE, use, NULL); + gconf_client_notify (config, CALENDAR_CONFIG_TIMEZONE); + + /* FIXME: notify CALENDAR_CONFIG_TIMEZONE change on system timezone change + itself too, when using system timezone. How to receive such change? */ + } +} + +guint +calendar_config_add_notification_use_system_timezone (GConfClientNotifyFunc func, gpointer data) +{ + calendar_config_init (); + + return gconf_client_notify_add (config, CALENDAR_CONFIG_USE_SYSTEM_TIMEZONE, func, data, NULL, NULL); +} /* The current timezone, e.g. "Europe/London". It may be NULL, in which case you should assume UTC (though Evolution will show the timezone-setting @@ -189,6 +216,15 @@ calendar_config_add_notification_primary_calendar (GConfClientNotifyFunc func, g gchar * calendar_config_get_timezone (void) { + if (calendar_config_get_use_system_timezone ()) + return e_cal_util_get_system_timezone_location (); + + return calendar_config_get_timezone_stored (); +} + +gchar * +calendar_config_get_timezone_stored (void) +{ calendar_config_init (); return gconf_client_get_string (config, CALENDAR_CONFIG_TIMEZONE, NULL); |