diff options
author | Damon Chaplin <damon@ximian.com> | 2001-06-20 12:01:22 +0800 |
---|---|---|
committer | Damon Chaplin <damon@src.gnome.org> | 2001-06-20 12:01:22 +0800 |
commit | 5c82a04a9a305e70b2b156b7bf9a4f23b070eb29 (patch) | |
tree | 1ca02b72092fea178dc1e96d1c429205bb90a185 | |
parent | a5ae0a3c3d35bfde94385942a18c6026109cd648 (diff) | |
download | gsoc2013-evolution-5c82a04a9a305e70b2b156b7bf9a4f23b070eb29.tar gsoc2013-evolution-5c82a04a9a305e70b2b156b7bf9a4f23b070eb29.tar.gz gsoc2013-evolution-5c82a04a9a305e70b2b156b7bf9a4f23b070eb29.tar.bz2 gsoc2013-evolution-5c82a04a9a305e70b2b156b7bf9a4f23b070eb29.tar.lz gsoc2013-evolution-5c82a04a9a305e70b2b156b7bf9a4f23b070eb29.tar.xz gsoc2013-evolution-5c82a04a9a305e70b2b156b7bf9a4f23b070eb29.tar.zst gsoc2013-evolution-5c82a04a9a305e70b2b156b7bf9a4f23b070eb29.zip |
if the timezones of the start and end of the event are the same, then if
2001-06-19 Damon Chaplin <damon@ximian.com>
* gui/dialogs/event-page.c: if the timezones of the start and end of
the event are the same, then if the start timezone is changed we
change the end timezone as well, since that is what most users will
want.
svn path=/trunk/; revision=10323
-rw-r--r-- | calendar/ChangeLog | 7 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-page.c | 56 |
2 files changed, 63 insertions, 0 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index b44bd6f9e5..e6cd1fc7f2 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,5 +1,12 @@ 2001-06-19 Damon Chaplin <damon@ximian.com> + * gui/dialogs/event-page.c: if the timezones of the start and end of + the event are the same, then if the start timezone is changed we + change the end timezone as well, since that is what most users will + want. + +2001-06-19 Damon Chaplin <damon@ximian.com> + * pcs/cal.c: * idl/evolution-calendar.idl: * cal-client/cal-client.[hc]: removed stuff to get builtin timezone diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index f653e469ef..93d9b65e14 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -71,6 +71,11 @@ struct _EventPagePrivate { GtkWidget *categories; gboolean updating; + + /* This is TRUE if both the start & end timezone are the same. If the + start timezone is then changed, we updated the end timezone to the + same value, since 99% of events start and end in one timezone. */ + gboolean sync_timezones; }; @@ -170,6 +175,7 @@ event_page_init (EventPage *epage) priv->categories = NULL; priv->updating = FALSE; + priv->sync_timezones = FALSE; } /* Destroy handler for the event page */ @@ -358,6 +364,11 @@ event_page_fill_widgets (CompEditorPage *page, CalComponent *comp) check_all_day (epage); + /* FIXME: Get the timezones from the event and put them in the + widgets. Set sync_timezones to TRUE if both timezones are the same. + */ + priv->sync_timezones = TRUE; + /* Classification */ cal_component_get_classification (comp, &cl); @@ -664,6 +675,46 @@ date_changed_cb (EDateEdit *dedit, gpointer data) &dates); } +/* Callback used when the start timezone is changed. If sync_timezones is set, + * we set the end timezone to the same value. It also updates the start time + * labels on the other notebook pages. + */ +static void +start_timezone_changed_cb (GtkWidget *widget, gpointer data) +{ + EventPage *epage; + EventPagePrivate *priv; + char *zone; + + epage = EVENT_PAGE (data); + priv = epage->priv; + + if (priv->sync_timezones) { + zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone)); + e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (priv->end_timezone), zone); + } +} + + +/* Callback used when the end timezone is changed. It checks if the end + * timezone is the same as the start timezone and sets sync_timezones if so. + */ +static void +end_timezone_changed_cb (GtkWidget *widget, gpointer data) +{ + EventPage *epage; + EventPagePrivate *priv; + char *start_zone, *end_zone; + + epage = EVENT_PAGE (data); + priv = epage->priv; + + start_zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone)); + end_zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->end_timezone)); + + priv->sync_timezones = (strcmp (start_zone, end_zone)) ? FALSE : TRUE; +} + /* Callback: all day event button toggled. * Note that this should only be called when the user explicitly toggles the * button. Be sure to block this handler when the toggle button's state is set @@ -842,6 +893,11 @@ init_widgets (EventPage *epage) gtk_signal_connect (GTK_OBJECT (priv->end_time), "changed", GTK_SIGNAL_FUNC (date_changed_cb), epage); + gtk_signal_connect (GTK_OBJECT (priv->start_timezone), "changed", + GTK_SIGNAL_FUNC (start_timezone_changed_cb), epage); + gtk_signal_connect (GTK_OBJECT (priv->end_timezone), "changed", + GTK_SIGNAL_FUNC (end_timezone_changed_cb), epage); + gtk_signal_connect (GTK_OBJECT (priv->all_day_event), "toggled", GTK_SIGNAL_FUNC (all_day_event_toggled_cb), epage); |