aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/goto.c
diff options
context:
space:
mode:
authorDamon Chaplin <damon@ximian.com>2001-07-03 12:21:37 +0800
committerDamon Chaplin <damon@src.gnome.org>2001-07-03 12:21:37 +0800
commit642d32d63f226cd1ba049a9d979132e1a1cef94d (patch)
treebe4ef8fb72ca41391007554a6cbe97af41533555 /calendar/gui/goto.c
parentbacd3a85a434032316b3e63b95282175ce2b0659 (diff)
downloadgsoc2013-evolution-642d32d63f226cd1ba049a9d979132e1a1cef94d.tar
gsoc2013-evolution-642d32d63f226cd1ba049a9d979132e1a1cef94d.tar.gz
gsoc2013-evolution-642d32d63f226cd1ba049a9d979132e1a1cef94d.tar.bz2
gsoc2013-evolution-642d32d63f226cd1ba049a9d979132e1a1cef94d.tar.lz
gsoc2013-evolution-642d32d63f226cd1ba049a9d979132e1a1cef94d.tar.xz
gsoc2013-evolution-642d32d63f226cd1ba049a9d979132e1a1cef94d.tar.zst
gsoc2013-evolution-642d32d63f226cd1ba049a9d979132e1a1cef94d.zip
cal-client/cal-client.[hc] cal-util/cal-component.c
2001-07-03 Damon Chaplin <damon@ximian.com> * cal-client/cal-client.[hc] * cal-util/cal-component.c * cal-util/cal-recur.[hc] * cal-util/test-recur.c * cal-util/timeutil.c * gui/calendar-config.c * gui/calendar-model.[hc] * gui/comp-util.[hc] * gui/e-calendar-table.c * gui/e-day-view-main-item.c * gui/e-day-view-top-item.c * gui/e-day-view.[hc] * gui/e-itip-control.c * gui/e-timezone-entry.[hc] * gui/e-week-view.[hc] * gui/gnome-cal.[hc] * gui/goto.c * gui/tag-calendar.[hc] * gui/dialogs/cal-prefs-dialog.c * gui/dialogs/comp-editor-page.[hc] * gui/dialogs/comp-editor-util.[hc] * gui/dialogs/comp-editor.c * gui/dialogs/e-timezone-dialog.[hc] * gui/dialogs/event-page.c * gui/dialogs/meeting-page.c * gui/dialogs/recurrence-page.c * gui/dialogs/task-details-page.c * gui/dialogs/task-details-page.glade * gui/dialogs/task-page.c * idl/evolution-calendar.idl * pcs/cal-backend-file.c * pcs/cal-backend.c * pcs/cal-backend.h * pcs/cal.c * pcs/query.c: timezone changes everywhere. There's still quite a few things to update, and its not working well at present. svn path=/trunk/; revision=10729
Diffstat (limited to 'calendar/gui/goto.c')
-rw-r--r--calendar/gui/goto.c53
1 files changed, 44 insertions, 9 deletions
diff --git a/calendar/gui/goto.c b/calendar/gui/goto.c
index 16c1eecc9f..06250a1a70 100644
--- a/calendar/gui/goto.c
+++ b/calendar/gui/goto.c
@@ -18,6 +18,7 @@
#include <libgnomeui/gnome-dialog.h>
#include <glade/glade.h>
#include "calendar-commands.h"
+#include "calendar-config.h"
#include "tag-calendar.h"
#include "goto.h"
@@ -83,18 +84,49 @@ ecal_event (ECalendarItem *calitem, gpointer user_data)
{
GoToDialog *dlg = user_data;
GDate start_date, end_date;
- struct tm tm;
+ struct icaltimetype tt = icaltime_null_time ();
time_t et;
e_calendar_item_get_selection (calitem, &start_date, &end_date);
- g_date_to_struct_tm (&start_date, &tm);
- et = mktime (&tm);
-
+
+ tt.year = g_date_year (&start_date);
+ tt.month = g_date_month (&start_date);
+ tt.day = g_date_day (&start_date);
+
+ et = icaltime_as_timet_with_zone (tt, gnome_calendar_get_timezone (dlg->gcal));
+
gnome_calendar_goto (dlg->gcal, et);
gnome_dialog_close (GNOME_DIALOG (dlg->dialog));
}
+/* Returns the current time, for the ECalendarItem. */
+static struct tm
+get_current_time (ECalendarItem *calitem, gpointer data)
+{
+ char *location;
+ icaltimezone *zone;
+ struct tm tmp_tm = { 0 };
+ struct icaltimetype tt;
+
+ /* Get the current timezone. */
+ location = calendar_config_get_timezone ();
+ zone = icaltimezone_get_builtin_timezone (location);
+
+ tt = icaltime_from_timet_with_zone (time (NULL), FALSE, zone);
+
+ /* Now copy it to the struct tm and return it. */
+ tmp_tm.tm_year = tt.year - 1900;
+ tmp_tm.tm_mon = tt.month - 1;
+ tmp_tm.tm_mday = tt.day;
+ tmp_tm.tm_hour = tt.hour;
+ tmp_tm.tm_min = tt.minute;
+ tmp_tm.tm_sec = tt.second;
+ tmp_tm.tm_isdst = -1;
+
+ return tmp_tm;
+}
+
/* Creates the ecalendar */
static void
create_ecal (GoToDialog *dlg)
@@ -109,6 +141,9 @@ create_ecal (GoToDialog *dlg)
gtk_box_pack_start (GTK_BOX (dlg->vbox), GTK_WIDGET (dlg->ecal), TRUE, TRUE, 0);
e_calendar_item_set_first_month (calitem, dlg->year_val, dlg->month_val);
+ e_calendar_item_set_get_time_callback (calitem,
+ get_current_time,
+ dlg, NULL);
ecal_date_range_changed (calitem, dlg);
}
@@ -171,7 +206,7 @@ goto_dialog (GnomeCalendar *gcal)
{
GtkWidget *menu;
time_t start_time;
- struct tm tm;
+ struct icaltimetype tt;
int b;
if (dlg) {
@@ -196,10 +231,10 @@ goto_dialog (GnomeCalendar *gcal)
dlg->gcal = gcal;
gnome_calendar_get_selected_time_range (dlg->gcal, &start_time, NULL);
- tm = *localtime (&start_time);
- dlg->year_val = tm.tm_year + 1900;
- dlg->month_val = tm.tm_mon;
- dlg->day_val = tm.tm_mday;
+ tt = icaltime_from_timet_with_zone (start_time, FALSE, gnome_calendar_get_timezone (gcal));
+ dlg->year_val = tt.year;
+ dlg->month_val = tt.month - 1;
+ dlg->day_val = tt.day;
menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (dlg->month));
gtk_option_menu_set_history (GTK_OPTION_MENU (dlg->month), dlg->month_val);