From 501da8aa29d496ef765a3afb5ac1b3fc1361c7e2 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 24 Apr 2009 16:58:15 +0200 Subject: Get rid of "Adjust for daylight saving time" option ** Fix for bug #577615 * gui/dialogs/cal-prefs-dialog.h: (struct _CalendarPrefsDialog): * gui/dialogs/cal-prefs-dialog.c: (timezone_changed), (daylight_saving_changed), (setup_changes), (show_config), (calendar_prefs_dialog_construct): * gui/dialogs/cal-prefs-dialog.glade: * gui/apps_evolution_calendar.schemas.in: * gui/calendar-config-keys.h: * gui/calendar-config.h: * gui/calendar-config.c: (set_standard_offsets), (calendar_config_get_icaltimezone), (calendar_config_get_daylight_saving), (calendar_config_set_daylight_saving), (calendar_config_add_notification_daylight_saving): Get rid of "Adjust for daylight saving time" option. --- calendar/gui/calendar-config.c | 111 ----------------------------------------- 1 file changed, 111 deletions(-) (limited to 'calendar/gui/calendar-config.c') diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c index 6a7cf94ee7..103d92f640 100644 --- a/calendar/gui/calendar-config.c +++ b/calendar/gui/calendar-config.c @@ -43,9 +43,6 @@ static GConfClient *config = NULL; -/* Store the zones here, this is not destroyed as the ical timezones */ -static GHashTable *custom_zones = NULL; - static void do_cleanup (void) { @@ -197,27 +194,6 @@ calendar_config_get_timezone (void) return gconf_client_get_string (config, CALENDAR_CONFIG_TIMEZONE, NULL); } -static void -set_standard_offsets (icalcomponent *zone_comp, int offset) -{ - icalcomponent *dl_comp, *s_comp; - icalproperty *offset_from, *offset_to; - - /* Set the offset of the standard component to all the daylight components also */ - for (dl_comp = icalcomponent_get_first_component (zone_comp, ICAL_XDAYLIGHT_COMPONENT); dl_comp != NULL; - dl_comp = icalcomponent_get_next_component (zone_comp, ICAL_XDAYLIGHT_COMPONENT)) { - offset_to = icalcomponent_get_first_property (dl_comp, ICAL_TZOFFSETTO_PROPERTY); - icalproperty_set_tzoffsetto (offset_to, offset); - } - - /* Set the tzto offset of the standard component to tzfrom */ - for (s_comp = icalcomponent_get_first_component (zone_comp, ICAL_XSTANDARD_COMPONENT); s_comp != NULL; - s_comp = icalcomponent_get_next_component (zone_comp, ICAL_XSTANDARD_COMPONENT)) { - offset_from = icalcomponent_get_first_property (s_comp, ICAL_TZOFFSETFROM_PROPERTY); - icalproperty_set_tzoffsetfrom (offset_from, offset); - } -} - icaltimezone * calendar_config_get_icaltimezone (void) { @@ -228,71 +204,13 @@ calendar_config_get_icaltimezone (void) location = calendar_config_get_timezone (); if (location) { - icalcomponent *icalcomp, *dl_comp; - zone = icaltimezone_get_builtin_timezone (location); - icalcomp = icaltimezone_get_component (zone); - - if (!icalcomp || !(dl_comp = icalcomponent_get_first_component (icalcomp, ICAL_XDAYLIGHT_COMPONENT))) { - g_free (location); - return zone; - } - - if (!calendar_config_get_daylight_saving () && zone) { - icalcomponent *zone_comp, *s_comp; - icalproperty *tz_prop, *offset_to; - icaltimezone *st_zone = NULL; - int offset; - const char *tzid; - char *n_tzid; - - tzid = icaltimezone_get_tzid (zone); - n_tzid = g_strconcat (tzid, "-(Standard)", NULL); - - if (!custom_zones) { - custom_zones = g_hash_table_new (g_str_hash, g_str_equal); - } else if ((st_zone = g_hash_table_lookup (custom_zones, n_tzid))) { - g_free (n_tzid); - g_free (location); - return st_zone; - } - - zone_comp = icalcomponent_new_clone (icalcomp); - s_comp = icalcomponent_get_first_component (zone_comp, ICAL_XSTANDARD_COMPONENT); - - if (!s_comp) { - g_free (n_tzid); - icalcomponent_free (zone_comp); - g_free (location); - return zone; - } - - offset_to = icalcomponent_get_first_property (s_comp, ICAL_TZOFFSETTO_PROPERTY); - offset = icalproperty_get_tzoffsetto (offset_to); - - set_standard_offsets (zone_comp, offset); - - tz_prop = icalcomponent_get_first_property (zone_comp, ICAL_TZID_PROPERTY); - if (tz_prop) { - icalcomponent_remove_property (zone_comp, tz_prop); - } - - tz_prop = icalproperty_new_tzid (n_tzid); - icalcomponent_add_property (zone_comp, tz_prop); - - st_zone = icaltimezone_new (); - icaltimezone_set_component (st_zone, zone_comp); - - zone = st_zone; - g_hash_table_insert (custom_zones, n_tzid, zone); - } g_free (location); } return zone; } - /* Sets the timezone. If set to NULL it defaults to UTC. FIXME: Should check it is being set to a valid timezone. */ void @@ -318,35 +236,6 @@ calendar_config_add_notification_timezone (GConfClientNotifyFunc func, gpointer return id; } -gboolean -calendar_config_get_daylight_saving (void) -{ - calendar_config_init (); - - return gconf_client_get_bool (config, CALENDAR_CONFIG_DAYLIGHT_SAVING, NULL); - -} - -void -calendar_config_set_daylight_saving (gboolean daylight_saving) -{ - calendar_config_init (); - - gconf_client_set_bool (config, CALENDAR_CONFIG_DAYLIGHT_SAVING, daylight_saving, NULL); -} - -guint -calendar_config_add_notification_daylight_saving (GConfClientNotifyFunc func, gpointer data) -{ - guint id; - - calendar_config_init (); - - id = gconf_client_notify_add (config, CALENDAR_CONFIG_DAYLIGHT_SAVING, func, data, NULL, NULL); - - return id; -} - /* Whether we use 24-hour format or 12-hour format (AM/PM). */ gboolean calendar_config_get_24_hour_format (void) -- cgit