gnome-panel r11252 - trunk/applets/clock



Author: vuntz
Date: Mon Sep  1 22:58:25 2008
New Revision: 11252
URL: http://svn.gnome.org/viewvc/gnome-panel?rev=11252&view=rev

Log:
2008-09-02  Vincent Untz  <vuntz gnome org>

	* calendar-window.c: (calendar_day_activated): really open the calendar
	on the right day. Timezones make this harder.
	Patch by Matthias Drochner <M Drochner fz-juelich de>
	Fix bug #372155 again.


Modified:
   trunk/applets/clock/ChangeLog
   trunk/applets/clock/calendar-window.c

Modified: trunk/applets/clock/calendar-window.c
==============================================================================
--- trunk/applets/clock/calendar-window.c	(original)
+++ trunk/applets/clock/calendar-window.c	Mon Sep  1 22:58:25 2008
@@ -1165,24 +1165,31 @@
 	unsigned int  day;
 	unsigned int  month;
 	unsigned int  year;
-	time_t        now;
-	struct tm     utc_tm;
-	struct tm     local_tm;
+	time_t        date;
+	struct tm     utc_date_tm;
+	struct tm     local_date_tm = { 0, };
 	char         *argument;
 
 	gtk_calendar_get_date (calendar, &year, &month, &day);
 
-	time (&now);
-	gmtime_r (&now, &utc_tm);
-	localtime_r (&now, &local_tm);
+	local_date_tm.tm_mday  = (int) day;
+	local_date_tm.tm_mon   = (int) month;
+	local_date_tm.tm_year  = (int) year - 1900;
+	local_date_tm.tm_isdst = -1;
+
+	/* convert the local date picked in the calendar to broken-down UTC */
+	date = mktime (&local_date_tm);
+	gmtime_r (&date, &utc_date_tm);
 
 	/* FIXME: once bug 409200 is fixed, we'll have to make this hh:mm:ss
 	 * instead of hhmmss */
 	argument = g_strdup_printf ("calendar:///?startdate="
 				    "%.4d%.2d%.2dT%.2d%.2d%.2dZ",
-				    year, month + 1, day,
-				    12 + utc_tm.tm_hour - local_tm.tm_hour,
-				    0  + utc_tm.tm_min  - local_tm.tm_min,
+				    utc_date_tm.tm_year + 1900,
+				    utc_date_tm.tm_mon + 1,
+				    utc_date_tm.tm_mday,
+				    utc_date_tm.tm_hour,
+				    utc_date_tm.tm_min,
 				    0);
 
 	clock_launch_evolution (calwin, argument);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]