aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamon Chaplin <damon@ximian.com>2001-07-17 09:34:49 +0800
committerDamon Chaplin <damon@src.gnome.org>2001-07-17 09:34:49 +0800
commit65f2e3d2a3de395977fbd39af0baac0b61504ee5 (patch)
treeca20ac10a7083865305fd7dcfa15fd3b050950ce
parent3b8e07c5b87acbda0f09155aa30bf9cc5e0ae8fc (diff)
downloadgsoc2013-evolution-65f2e3d2a3de395977fbd39af0baac0b61504ee5.tar
gsoc2013-evolution-65f2e3d2a3de395977fbd39af0baac0b61504ee5.tar.gz
gsoc2013-evolution-65f2e3d2a3de395977fbd39af0baac0b61504ee5.tar.bz2
gsoc2013-evolution-65f2e3d2a3de395977fbd39af0baac0b61504ee5.tar.lz
gsoc2013-evolution-65f2e3d2a3de395977fbd39af0baac0b61504ee5.tar.xz
gsoc2013-evolution-65f2e3d2a3de395977fbd39af0baac0b61504ee5.tar.zst
gsoc2013-evolution-65f2e3d2a3de395977fbd39af0baac0b61504ee5.zip
try to use builtin timezones before getting them from the server. When
2001-07-16 Damon Chaplin <damon@ximian.com> * gui/dialogs/task-page.c (task_page_fill_widgets): * gui/dialogs/event-page.c (event_page_fill_widgets): try to use builtin timezones before getting them from the server. When creating new events/tasks the timezones may not be on the server. * gui/dialogs/event-page.c (event_page_fill_widgets): for all-day events we subtract a day from the end date rather than add it. * gui/dialogs/e-timezone-dialog.c (on_map_leave): ignore the event if it isn't a GDK_CROSSING_NORMAL event. For some reason we are getting leave events when the button is pressed, which meant that selecting timezones in the map didn't work. * gui/dialogs/comp-editor-util.c (comp_editor_dates): * gui/print.c (print_date_label): only free icaltimetype if not NULL. svn path=/trunk/; revision=11144
-rw-r--r--calendar/ChangeLog18
-rw-r--r--calendar/gui/dialogs/comp-editor-util.c2
-rw-r--r--calendar/gui/dialogs/e-timezone-dialog.c10
-rw-r--r--calendar/gui/dialogs/event-page.c37
-rw-r--r--calendar/gui/dialogs/task-page.c31
-rw-r--r--calendar/gui/print.c5
6 files changed, 77 insertions, 26 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 081b75dd37..de95f977df 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,21 @@
+2001-07-16 Damon Chaplin <damon@ximian.com>
+
+ * gui/dialogs/task-page.c (task_page_fill_widgets):
+ * gui/dialogs/event-page.c (event_page_fill_widgets): try to use
+ builtin timezones before getting them from the server. When creating
+ new events/tasks the timezones may not be on the server.
+
+ * gui/dialogs/event-page.c (event_page_fill_widgets): for all-day
+ events we subtract a day from the end date rather than add it.
+
+ * gui/dialogs/e-timezone-dialog.c (on_map_leave): ignore the event
+ if it isn't a GDK_CROSSING_NORMAL event. For some reason we are getting
+ leave events when the button is pressed, which meant that selecting
+ timezones in the map didn't work.
+
+ * gui/dialogs/comp-editor-util.c (comp_editor_dates):
+ * gui/print.c (print_date_label): only free icaltimetype if not NULL.
+
2001-07-12 Taylor Hayward <taylorhayward@yahoo.com>
* gui/goto-dialog.glade:
diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c
index 63dd407677..0e4384dca4 100644
--- a/calendar/gui/dialogs/comp-editor-util.c
+++ b/calendar/gui/dialogs/comp-editor-util.c
@@ -86,8 +86,8 @@ comp_editor_dates (CompEditorPageDates *dates, CalComponent *comp)
if (comp_complete) {
complete = *comp_complete;
dates->complete = &complete;
+ cal_component_free_icaltimetype (comp_complete);
}
- cal_component_free_icaltimetype (comp_complete);
}
static void
diff --git a/calendar/gui/dialogs/e-timezone-dialog.c b/calendar/gui/dialogs/e-timezone-dialog.c
index 70061addd6..0f7ba65404 100644
--- a/calendar/gui/dialogs/e-timezone-dialog.c
+++ b/calendar/gui/dialogs/e-timezone-dialog.c
@@ -399,6 +399,12 @@ on_map_leave (GtkWidget *widget, GdkEventCrossing *event, gpointer data)
etd = E_TIMEZONE_DIALOG (data);
priv = etd->priv;
+ /* We only want to reset the hover point and the preview text if this
+ is a normal leave event. For some reason we are getting leave events
+ when the button is pressed in the map, which causes problems. */
+ if (event->mode != GDK_CROSSING_NORMAL)
+ return FALSE;
+
if (priv->point_hover && priv->point_hover != priv->point_selected)
e_map_point_set_color_rgba (priv->map, priv->point_hover,
E_TIMEZONE_DIALOG_MAP_POINT_NORMAL_RGBA);
@@ -447,6 +453,7 @@ on_map_button_pressed (GtkWidget *w, GdkEventButton *event, gpointer data)
ETimezoneDialog *etd;
ETimezoneDialogPrivate *priv;
double longitude, latitude;
+ char *location;
etd = E_TIMEZONE_DIALOG (data);
priv = etd->priv;
@@ -467,8 +474,9 @@ on_map_button_pressed (GtkWidget *w, GdkEventButton *event, gpointer data)
E_TIMEZONE_DIALOG_MAP_POINT_NORMAL_RGBA);
priv->point_selected = priv->point_hover;
+ location = get_zone_from_point (etd, priv->point_selected);
gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (priv->timezone_combo)->entry),
- get_zone_from_point (etd, priv->point_selected));
+ location);
g_free (priv->tzid);
priv->tzid = NULL;
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index 367412cbab..76b5df5b3d 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -350,19 +350,32 @@ event_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
/* Start and end times */
cal_component_get_dtstart (comp, &start_date);
- status = cal_client_get_timezone (page->client, start_date.tzid,
- &start_zone);
- /* FIXME: Handle error better. */
- if (status != CAL_CLIENT_GET_SUCCESS)
- g_warning ("Couldn't get timezone from server: %s",
- start_date.tzid ? start_date.tzid : "");
+
+ /* Note that if we are creating a new event, the timezones may not be
+ on the server, so we try to get the builtin timezone with the TZID
+ first. */
+ start_zone = icaltimezone_get_builtin_timezone_from_tzid (start_date.tzid);
+ if (!start_zone) {
+ status = cal_client_get_timezone (page->client,
+ start_date.tzid,
+ &start_zone);
+ /* FIXME: Handle error better. */
+ if (status != CAL_CLIENT_GET_SUCCESS)
+ g_warning ("Couldn't get timezone from server: %s",
+ start_date.tzid ? start_date.tzid : "");
+ }
cal_component_get_dtend (comp, &end_date);
- status = cal_client_get_timezone (page->client, end_date.tzid, &end_zone);
- /* FIXME: Handle error better. */
- if (status != CAL_CLIENT_GET_SUCCESS)
- g_warning ("Couldn't get timezone from server: %s",
- end_date.tzid ? end_date.tzid : "");
+ end_zone = icaltimezone_get_builtin_timezone_from_tzid (end_date.tzid);
+ if (!end_zone) {
+ status = cal_client_get_timezone (page->client,
+ end_date.tzid,
+ &end_zone);
+ /* FIXME: Handle error better. */
+ if (status != CAL_CLIENT_GET_SUCCESS)
+ g_warning ("Couldn't get timezone from server: %s",
+ end_date.tzid ? end_date.tzid : "");
+ }
/* All-day events are inclusive, i.e. if the end date shown is 2nd Feb
then the event includes all of the 2nd Feb. We would normally show
@@ -372,7 +385,7 @@ event_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
end_tt = end_date.value;
if (start_tt->hour == 0 && start_tt->minute == 0 && start_tt->second == 0
&& end_tt->hour == 0 && end_tt->minute == 0 && end_tt->second == 0)
- icaltime_adjust (end_tt, 1, 0, 0, 0);
+ icaltime_adjust (end_tt, -1, 0, 0, 0);
gtk_signal_handler_block_by_data (GTK_OBJECT (priv->start_time),
epage);
diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c
index 2ba37b7c6a..e50f9f9681 100644
--- a/calendar/gui/dialogs/task-page.c
+++ b/calendar/gui/dialogs/task-page.c
@@ -395,11 +395,18 @@ task_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
e_date_edit_set_time (E_DATE_EDIT (priv->due_date), -1);
}
- get_tz_status = cal_client_get_timezone (page->client, d.tzid, &zone);
- /* FIXME: Handle error better. */
- if (get_tz_status != CAL_CLIENT_GET_SUCCESS)
- g_warning ("Couldn't get timezone from server: %s",
- d.tzid ? d.tzid : "");
+ /* Note that if we are creating a new task, the timezones may not be
+ on the server, so we try to get the builtin timezone with the TZID
+ first. */
+ zone = icaltimezone_get_builtin_timezone_from_tzid (d.tzid);
+ if (!zone) {
+ get_tz_status = cal_client_get_timezone (page->client, d.tzid,
+ &zone);
+ /* FIXME: Handle error better. */
+ if (get_tz_status != CAL_CLIENT_GET_SUCCESS)
+ g_warning ("Couldn't get timezone from server: %s",
+ d.tzid ? d.tzid : "");
+ }
e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (priv->due_timezone),
zone);
@@ -419,11 +426,15 @@ task_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
e_date_edit_set_time (E_DATE_EDIT (priv->start_date), -1);
}
- get_tz_status = cal_client_get_timezone (page->client, d.tzid, &zone);
- /* FIXME: Handle error better. */
- if (get_tz_status != CAL_CLIENT_GET_SUCCESS)
- g_warning ("Couldn't get timezone from server: %s",
- d.tzid ? d.tzid : "");
+ zone = icaltimezone_get_builtin_timezone_from_tzid (d.tzid);
+ if (!zone) {
+ get_tz_status = cal_client_get_timezone (page->client, d.tzid,
+ &zone);
+ /* FIXME: Handle error better. */
+ if (get_tz_status != CAL_CLIENT_GET_SUCCESS)
+ g_warning ("Couldn't get timezone from server: %s",
+ d.tzid ? d.tzid : "");
+ }
e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (priv->start_timezone),
zone);
diff --git a/calendar/gui/print.c b/calendar/gui/print.c
index 9a290fdf09..fcf3bcecfe 100644
--- a/calendar/gui/print.c
+++ b/calendar/gui/print.c
@@ -2102,9 +2102,10 @@ print_date_label (GnomePrintContext *pc, CalComponent *comp,
cal_component_free_datetime (&datetime);
cal_component_get_completed (comp, &datetime.value);
- if (datetime.value)
+ if (datetime.value) {
complete = icaltime_as_timet_with_zone (*datetime.value, zone);
- cal_component_free_icaltimetype (datetime.value);
+ cal_component_free_icaltimetype (datetime.value);
+ }
buffer[0] = '\0';