? 333423.diff
? 335276.diff
? 344927.diff
? calendar.error
? core.15809
? core.15918
? daylight_evo.diff
? dialogs.diff
? temp
? tt
? conduits/memo/Makefile
? conduits/memo/Makefile.in
? gui/344927.diff
? gui/a.out
? gui/apps_evolution_calendar-2.8.schemas
? gui/core.19451
? gui/core.6854
? gui/tt
? gui/dialogs/cal-prefs-dialog.gladep
? gui/dialogs/event-page.gladep
? gui/dialogs/tt
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.3065
diff -u -p -r1.3065 ChangeLog
--- ChangeLog	30 Jun 2006 09:46:08 -0000	1.3065
+++ ChangeLog	1 Jul 2006 13:59:06 -0000
@@ -1,3 +1,21 @@
+2006-07-01  Chenthill Palanisamy  <pchenthill@novell.com>
+
+	* gui/apps_evolution_calendar.schemas.in.in:
+	* gui/calendar-config-keys.h:
+	* gui/calendar-config.c: (set_standard_offsets),
+	(calendar_config_get_icaltimezone),
+	(calendar_config_add_notification_timezone),
+	(calendar_config_get_daylight_saving),
+	(calendar_config_set_daylight_saving),
+	(calendar_config_add_notification_daylight_saving):
+	* gui/calendar-config.h:
+	* 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/dialogs/cal-prefs-dialog.h: Added the support
+	for optional daylight savings time with timezones.
+
 2006-06-30  Johnny Jacob  <jjohnny@novell.com>
 	* gui/cal-search-bar.c: (get_current_category),
 	(get_category_sexp), (notify_e_cal_view_contains),
Index: gui/apps_evolution_calendar.schemas.in.in
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/apps_evolution_calendar.schemas.in.in,v
retrieving revision 1.20
diff -u -p -r1.20 apps_evolution_calendar.schemas.in.in
--- gui/apps_evolution_calendar.schemas.in.in	12 Jun 2006 11:54:28 -0000	1.20
+++ gui/apps_evolution_calendar.schemas.in.in	1 Jul 2006 13:59:07 -0000
@@ -16,6 +16,18 @@
     </schema>
 
     <schema>
+      <key>/schemas/apps/evolution/calendar/display/use_daylight_saving</key>
+      <applyto>/apps/evolution/calendar/display/use_daylight_saving</applyto>
+      <owner>evolution-calendar</owner>
+      <type>bool</type>
+      <default>false</default>
+      <locale name="C">
+        <short>daylight savings time</short>
+        <long>Whether to use daylight savings time while displaying events.</long>
+      </locale>
+    </schema>
+
+    <schema>
       <key>/schemas/apps/evolution/calendar/display/use_24hour_format</key>
       <applyto>/apps/evolution/calendar/display/use_24hour_format</applyto>
       <owner>evolution-calendar</owner>
Index: gui/calendar-config-keys.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-config-keys.h,v
retrieving revision 1.14
diff -u -p -r1.14 calendar-config-keys.h
--- gui/calendar-config-keys.h	13 Jan 2006 11:02:20 -0000	1.14
+++ gui/calendar-config-keys.h	1 Jul 2006 13:59:07 -0000
@@ -29,6 +29,7 @@ G_BEGIN_DECLS
 
 /* Display settings */
 #define CALENDAR_CONFIG_TIMEZONE CALENDAR_CONFIG_PREFIX "/display/timezone"
+#define CALENDAR_CONFIG_DAYLIGHT_SAVING CALENDAR_CONFIG_PREFIX "/display/use_daylight_saving"
 #define CALENDAR_CONFIG_SELECTED_CALENDARS CALENDAR_CONFIG_PREFIX "/display/selected_calendars"
 #define CALENDAR_CONFIG_PRIMARY_CALENDAR CALENDAR_CONFIG_PREFIX "/display/primary_calendar"
 #define CALENDAR_CONFIG_24HOUR CALENDAR_CONFIG_PREFIX "/display/use_24hour_format"
Index: gui/calendar-config.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-config.c,v
retrieving revision 1.87
diff -u -p -r1.87 calendar-config.c
--- gui/calendar-config.c	4 Mar 2006 11:25:18 -0000	1.87
+++ gui/calendar-config.c	1 Jul 2006 13:59:07 -0000
@@ -44,6 +44,9 @@
 
 static GConfClient *config = NULL;
 
+/* Store the zones here, this is not destroyed as the ical timezones */
+static GHashTable *custom_zones = NULL;
+
 static void on_timezone_set		(GnomeDialog	*dialog,
 					 int		 button,
 					 ETimezoneDialog *etd);
@@ -187,6 +190,27 @@ 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)
 {
@@ -197,12 +221,66 @@ 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 (!(dl_comp = icalcomponent_get_first_component (icalcomp, ICAL_XDAYLIGHT_COMPONENT))) {
+			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;
+			char *n_tzid, *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);
+
+				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);
+				
+				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);
 	}
-	if (!zone)
-		zone = icaltimezone_get_utc_timezone ();
-	
 	return zone;
 }
 
@@ -228,6 +306,35 @@ calendar_config_add_notification_timezon
 	calendar_config_init ();
 	
 	id = gconf_client_notify_add (config, CALENDAR_CONFIG_TIMEZONE, func, data, NULL, NULL);
+	
+	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;
 }
Index: gui/calendar-config.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-config.h,v
retrieving revision 1.46
diff -u -p -r1.46 calendar-config.h
--- gui/calendar-config.h	3 Mar 2006 13:24:39 -0000	1.46
+++ gui/calendar-config.h	1 Jul 2006 13:59:07 -0000
@@ -255,4 +255,8 @@ gboolean  calendar_config_locale_support
 void	  calendar_config_set_dir_path (const char *);
 char *	  calendar_config_get_dir_path (void);
 
+gboolean calendar_config_get_daylight_saving (void);
+void calendar_config_set_daylight_saving (gboolean daylight_saving);
+guint calendar_config_add_notification_daylight_saving (GConfClientNotifyFunc func, gpointer data);
+
 #endif /* _CALENDAR_CONFIG_H_ */
Index: gui/dialogs/cal-prefs-dialog.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/cal-prefs-dialog.c,v
retrieving revision 1.55
diff -u -p -r1.55 cal-prefs-dialog.c
--- gui/dialogs/cal-prefs-dialog.c	8 Feb 2006 13:06:24 -0000	1.55
+++ gui/dialogs/cal-prefs-dialog.c	1 Jul 2006 13:59:07 -0000
@@ -130,12 +130,28 @@ static void
 timezone_changed (GtkWidget *widget, CalendarPrefsDialog *prefs)
 {
 	icaltimezone *zone;
+	icalcomponent *icalcomp, *dl_comp;
 
 	zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (prefs->timezone));
+	icalcomp = icaltimezone_get_component (zone);
+
+	if (!(dl_comp = icalcomponent_get_first_component (icalcomp, ICAL_XDAYLIGHT_COMPONENT))) 
+		gtk_widget_set_sensitive ((GtkWidget *) prefs->daylight_saving, FALSE);
+	else 
+		gtk_widget_set_sensitive ((GtkWidget *) prefs->daylight_saving, TRUE);
+	 	
 	calendar_config_set_timezone (icaltimezone_get_location (zone));
 }
 
 static void
+daylight_saving_changed (GtkWidget *widget, CalendarPrefsDialog *prefs)
+{
+	gboolean set = gtk_toggle_button_get_active ((GtkToggleButton *) prefs->daylight_saving);
+	calendar_config_set_daylight_saving (set);
+	timezone_changed (widget, prefs);
+}
+
+static void
 start_of_day_changed (GtkWidget *widget, CalendarPrefsDialog *prefs)
 {
 	int start_hour, start_minute, end_hour, end_minute;
@@ -351,6 +367,7 @@ setup_changes (CalendarPrefsDialog *pref
 		g_signal_connect (G_OBJECT (prefs->working_days[i]), "toggled", G_CALLBACK (working_days_changed), prefs);
 
 	g_signal_connect (G_OBJECT (prefs->timezone), "changed", G_CALLBACK (timezone_changed), prefs);
+	g_signal_connect (G_OBJECT (prefs->daylight_saving), "toggled", G_CALLBACK (daylight_saving_changed), prefs);
 
 	g_signal_connect (G_OBJECT (prefs->start_of_day), "changed", G_CALLBACK (start_of_day_changed), prefs);
 	g_signal_connect (G_OBJECT (prefs->end_of_day), "changed", G_CALLBACK (end_of_day_changed), prefs);
@@ -479,12 +496,25 @@ show_config (CalendarPrefsDialog *prefs)
 	CalWeekdays working_days;
 	gint mask, day, week_start_day, time_divisions;
 	icaltimezone *zone;
-	gboolean sensitive;
+	gboolean sensitive, set = FALSE;
+	icalcomponent *icalcomp, *dl_comp;
+	char *location;
 
 	/* Timezone. */
-	zone = calendar_config_get_icaltimezone ();
+	location = calendar_config_get_timezone ();
+	zone = icaltimezone_get_builtin_timezone (location);
 	e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (prefs->timezone), zone);
+	g_free (location);
 
+	icalcomp = icaltimezone_get_component (zone);
+	if (!(dl_comp = icalcomponent_get_first_component (icalcomp, ICAL_XDAYLIGHT_COMPONENT))) 
+		gtk_widget_set_sensitive ((GtkWidget *) prefs->daylight_saving, FALSE);
+	else 
+		gtk_widget_set_sensitive ((GtkWidget *) prefs->daylight_saving, TRUE);
+	
+	set = calendar_config_get_daylight_saving ();
+	gtk_toggle_button_set_active ((GtkToggleButton *) prefs->daylight_saving, set);
+		
 	/* Working Days. */
 	working_days = calendar_config_get_working_days ();
 	mask = 1 << 0;
@@ -609,6 +639,7 @@ calendar_prefs_dialog_construct (Calenda
 
 	/* General tab */
 	prefs->timezone = glade_xml_get_widget (gui, "timezone");
+	prefs->daylight_saving = glade_xml_get_widget (gui, "daylight_cb");
 	for (i = 0; i < 7; i++)
 		prefs->working_days[i] = glade_xml_get_widget (gui, working_day_names[i]);
 	prefs->week_start_day = glade_xml_get_widget (gui, "week_start_day");
Index: gui/dialogs/cal-prefs-dialog.glade
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/cal-prefs-dialog.glade,v
retrieving revision 1.38
diff -u -p -r1.38 cal-prefs-dialog.glade
--- gui/dialogs/cal-prefs-dialog.glade	14 Jun 2006 11:14:05 -0000	1.38
+++ gui/dialogs/cal-prefs-dialog.glade	1 Jul 2006 13:59:07 -0000
@@ -96,7 +96,7 @@
 	      <child>
 		<widget class="GtkTable" id="time">
 		  <property name="visible">True</property>
-		  <property name="n_rows">2</property>
+		  <property name="n_rows">3</property>
 		  <property name="n_columns">2</property>
 		  <property name="homogeneous">False</property>
 		  <property name="row_spacing">6</property>
@@ -151,8 +151,8 @@
 		    <packing>
 		      <property name="left_attach">0</property>
 		      <property name="right_attach">1</property>
-		      <property name="top_attach">1</property>
-		      <property name="bottom_attach">2</property>
+		      <property name="top_attach">2</property>
+		      <property name="bottom_attach">3</property>
 		      <property name="x_options">fill</property>
 		      <property name="y_options"></property>
 		    </packing>
@@ -226,10 +226,32 @@
 		    <packing>
 		      <property name="left_attach">1</property>
 		      <property name="right_attach">2</property>
+		      <property name="top_attach">2</property>
+		      <property name="bottom_attach">3</property>
+		      <property name="x_options">fill</property>
+		      <property name="y_options">fill</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkCheckButton" id="daylight_cb">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="label" translatable="yes">Adjust for daylight sa_ving time</property>
+		      <property name="use_underline">True</property>
+		      <property name="relief">GTK_RELIEF_NORMAL</property>
+		      <property name="focus_on_click">True</property>
+		      <property name="active">False</property>
+		      <property name="inconsistent">False</property>
+		      <property name="draw_indicator">True</property>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">1</property>
+		      <property name="right_attach">2</property>
 		      <property name="top_attach">1</property>
 		      <property name="bottom_attach">2</property>
 		      <property name="x_options">fill</property>
-		      <property name="y_options">fill</property>
+		      <property name="y_options"></property>
 		    </packing>
 		  </child>
 		</widget>
Index: gui/dialogs/cal-prefs-dialog.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/cal-prefs-dialog.h,v
retrieving revision 1.13
diff -u -p -r1.13 cal-prefs-dialog.h
--- gui/dialogs/cal-prefs-dialog.h	25 Jan 2006 10:48:16 -0000	1.13
+++ gui/dialogs/cal-prefs-dialog.h	1 Jul 2006 13:59:07 -0000
@@ -45,6 +45,7 @@ struct _CalendarPrefsDialog {
 
 	/* General tab */
 	GtkWidget *timezone;
+	GtkWidget *daylight_saving;
 	GtkWidget *working_days[7];
 	GtkWidget *week_start_day;
 	GtkWidget *start_of_day;
