diff options
author | Damon Chaplin <damon@ximian.com> | 2001-08-17 07:37:38 +0800 |
---|---|---|
committer | Damon Chaplin <damon@src.gnome.org> | 2001-08-17 07:37:38 +0800 |
commit | b9b5aa0a0e5bbe9b7ed4eb45e37109ecf90d38c4 (patch) | |
tree | 3f8511620831134e115b24e08440ca5f1711d2d9 /calendar | |
parent | d103befa6dce296f571319c0b69700b1f06d4a83 (diff) | |
download | gsoc2013-evolution-b9b5aa0a0e5bbe9b7ed4eb45e37109ecf90d38c4.tar gsoc2013-evolution-b9b5aa0a0e5bbe9b7ed4eb45e37109ecf90d38c4.tar.gz gsoc2013-evolution-b9b5aa0a0e5bbe9b7ed4eb45e37109ecf90d38c4.tar.bz2 gsoc2013-evolution-b9b5aa0a0e5bbe9b7ed4eb45e37109ecf90d38c4.tar.lz gsoc2013-evolution-b9b5aa0a0e5bbe9b7ed4eb45e37109ecf90d38c4.tar.xz gsoc2013-evolution-b9b5aa0a0e5bbe9b7ed4eb45e37109ecf90d38c4.tar.zst gsoc2013-evolution-b9b5aa0a0e5bbe9b7ed4eb45e37109ecf90d38c4.zip |
hide the timezone fields for all-day events. We will use DATE values for
2001-08-16 Damon Chaplin <damon@ximian.com>
* gui/dialogs/event-page.c: hide the timezone fields for all-day
events. We will use DATE values for these eventually, and these
don't have timezones associated with them. Currently we just use the
default timezone for all-day events, as a workaround until we have
DATE values working.
* gui/dialogs/comp-editor-util.c (comp_editor_new_date_edit): added
make_time_insensitive flag. Though we may not use it.
* gui/dialogs/event-page.glade: made the 'All day event' toggle
right-aligned, so it doesn't move when the other widgets are shown
and hidden.
* gui/e-timezone-entry.c (e_timezone_entry_set_default_timezone): new
function to set the default timezone of the widget. If the current
timezone setting matches the default then the entry field is hidden.
Most people won't use timezones so this makes the GUI simpler.
* gui/dialogs/event-page.c (init_widgets):
* gui/dialogs/task-page.c (init_widgets): set the default timezone
using the above function.
* gui/dialogs/task-page.c (task_page_fill_widgets): if the start date
or due date is not set, we use the default timezone, so the user
doesn't have to set this each time they set the date.
svn path=/trunk/; revision=12137
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 28 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor-util.c | 12 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor-util.h | 3 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-page.c | 56 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-page.glade | 4 | ||||
-rw-r--r-- | calendar/gui/dialogs/recurrence-page.c | 13 | ||||
-rw-r--r-- | calendar/gui/dialogs/recurrence-page.glade | 2 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-details-page.c | 2 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-page.c | 35 | ||||
-rw-r--r-- | calendar/gui/e-calendar-table.c | 1 | ||||
-rw-r--r-- | calendar/gui/e-timezone-entry.c | 68 | ||||
-rw-r--r-- | calendar/gui/e-timezone-entry.h | 6 |
12 files changed, 210 insertions, 20 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index fc10362c73..1ffc006d12 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,31 @@ +2001-08-16 Damon Chaplin <damon@ximian.com> + + * gui/dialogs/event-page.c: hide the timezone fields for all-day + events. We will use DATE values for these eventually, and these + don't have timezones associated with them. Currently we just use the + default timezone for all-day events, as a workaround until we have + DATE values working. + + * gui/dialogs/comp-editor-util.c (comp_editor_new_date_edit): added + make_time_insensitive flag. Though we may not use it. + + * gui/dialogs/event-page.glade: made the 'All day event' toggle + right-aligned, so it doesn't move when the other widgets are shown + and hidden. + + * gui/e-timezone-entry.c (e_timezone_entry_set_default_timezone): new + function to set the default timezone of the widget. If the current + timezone setting matches the default then the entry field is hidden. + Most people won't use timezones so this makes the GUI simpler. + + * gui/dialogs/event-page.c (init_widgets): + * gui/dialogs/task-page.c (init_widgets): set the default timezone + using the above function. + + * gui/dialogs/task-page.c (task_page_fill_widgets): if the start date + or due date is not set, we use the default timezone, so the user + doesn't have to set this each time they set the date. + 2001-08-16 Federico Mena Quintero <federico@ximian.com> * gui/dialogs/alarm-page.c (alarm_page_fill_widgets): If the diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c index df682f6880..5d575c8957 100644 --- a/calendar/gui/dialogs/comp-editor-util.c +++ b/calendar/gui/dialogs/comp-editor-util.c @@ -179,13 +179,17 @@ comp_editor_date_label (CompEditorPageDates *dates, GtkWidget *label) * comp_editor_new_date_edit: * @show_date: Whether to show a date picker in the widget. * @show_time: Whether to show a time picker in the widget. + * @make_time_insensitive: Whether the time field is made insensitive rather + * than hiding it. This is useful if you want to preserve the layout of the + * widgets. * * Creates a new #EDateEdit widget, configured using the calendar's preferences. * * Return value: A newly-created #EDateEdit widget. **/ GtkWidget * -comp_editor_new_date_edit (gboolean show_date, gboolean show_time) +comp_editor_new_date_edit (gboolean show_date, gboolean show_time, + gboolean make_time_insensitive) { EDateEdit *dedit; @@ -193,7 +197,11 @@ comp_editor_new_date_edit (gboolean show_date, gboolean show_time) e_date_edit_set_show_date (dedit, show_date); e_date_edit_set_show_time (dedit, show_time); - +#if 0 + e_date_edit_set_make_time_insensitive (dedit, make_time_insensitive); +#else + e_date_edit_set_make_time_insensitive (dedit, FALSE); +#endif calendar_config_configure_e_date_edit (dedit); return GTK_WIDGET (dedit); diff --git a/calendar/gui/dialogs/comp-editor-util.h b/calendar/gui/dialogs/comp-editor-util.h index 0654289698..23f3937a9a 100644 --- a/calendar/gui/dialogs/comp-editor-util.h +++ b/calendar/gui/dialogs/comp-editor-util.h @@ -30,7 +30,8 @@ void comp_editor_dates (CompEditorPageDates *date, CalComponent *comp); void comp_editor_date_label (CompEditorPageDates *dates, GtkWidget *label); -GtkWidget *comp_editor_new_date_edit (gboolean show_date, gboolean show_time); +GtkWidget *comp_editor_new_date_edit (gboolean show_date, gboolean show_time, + gboolean make_time_insensitive); struct tm comp_editor_get_current_time (GtkObject *object, gpointer data); diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index 8f9d974178..e20822e088 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -299,6 +299,16 @@ check_all_day (EventPage *epage) e_date_edit_set_show_time (E_DATE_EDIT (priv->start_time), !all_day); e_date_edit_set_show_time (E_DATE_EDIT (priv->end_time), !all_day); + + /* We will use DATE values for all-day events eventually, in which + case timezones can't be used. */ + if (all_day) { + gtk_widget_hide (priv->start_timezone); + gtk_widget_hide (priv->end_timezone); + } else { + gtk_widget_show (priv->start_timezone); + gtk_widget_show (priv->end_timezone); + } } /* Fills the widgets with default values */ @@ -602,6 +612,20 @@ event_page_fill_component (CompEditorPage *page, CalComponent *comp) /* FIXME: We should use is_date at some point. */ + /* If the all_day toggle is set, the end date is inclusive of the + entire day on which it points to. Also, we will use DATE values + eventually, which can't have timezones. So for now we just use + the default timezone. */ + all_day_event = e_dialog_toggle_get (priv->all_day_event); + + if (all_day_event) { + char *location; + + location = calendar_config_get_timezone (); + zone = icaltimezone_get_builtin_timezone (location); + } + + date_set = e_date_edit_get_date (E_DATE_EDIT (priv->start_time), &icaltime.year, &icaltime.month, @@ -610,15 +634,12 @@ event_page_fill_component (CompEditorPage *page, CalComponent *comp) &icaltime.hour, &icaltime.minute); g_assert (date_set); - zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone)); + if (!all_day_event) + zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone)); if (zone) date.tzid = icaltimezone_get_tzid (zone); cal_component_set_dtstart (comp, &date); - /* If the all_day toggle is set, the end date is inclusive of the - entire day on which it points to. */ - all_day_event = e_dialog_toggle_get (priv->all_day_event); - date_set = e_date_edit_get_date (E_DATE_EDIT (priv->end_time), &icaltime.year, &icaltime.month, @@ -635,9 +656,10 @@ event_page_fill_component (CompEditorPage *page, CalComponent *comp) icaltime_adjust (&icaltime, 1, 0, 0, 0); } - zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->end_timezone)); + if (!all_day_event) + zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->end_timezone)); if (zone) - date.tzid = icaltimezone_get_tzid (zone); + date.tzid = icaltimezone_get_tzid (zone); cal_component_set_dtend (comp, &date); @@ -1036,6 +1058,16 @@ all_day_event_toggled_cb (GtkWidget *toggle, gpointer data) e_date_edit_set_show_time (E_DATE_EDIT (priv->start_time), !all_day); e_date_edit_set_show_time (E_DATE_EDIT (priv->end_time), !all_day); + /* We will use DATE values for all-day events eventually, in which + case timezones can't be used. */ + if (all_day) { + gtk_widget_hide (priv->start_timezone); + gtk_widget_hide (priv->end_timezone); + } else { + gtk_widget_show (priv->start_timezone); + gtk_widget_show (priv->end_timezone); + } + /* Notify upstream */ dates.start = &start_tt; dates.end = &end_tt; @@ -1097,6 +1129,8 @@ static gboolean init_widgets (EventPage *epage) { EventPagePrivate *priv; + char *location; + icaltimezone *zone; priv = epage->priv; @@ -1186,6 +1220,12 @@ init_widgets (EventPage *epage) gtk_container_add (GTK_CONTAINER (priv->contacts_box), priv->contacts_entry); + /* Set the default timezone, so the timezone entry may be hidden. */ + location = calendar_config_get_timezone (); + zone = icaltimezone_get_builtin_timezone (location); + e_timezone_entry_set_default_timezone (E_TIMEZONE_ENTRY (priv->start_timezone), zone); + e_timezone_entry_set_default_timezone (E_TIMEZONE_ENTRY (priv->end_timezone), zone); + return TRUE; } @@ -1257,7 +1297,7 @@ GtkWidget *make_date_edit (void); GtkWidget * make_date_edit (void) { - return comp_editor_new_date_edit (TRUE, TRUE); + return comp_editor_new_date_edit (TRUE, TRUE, TRUE); } GtkWidget *make_timezone_entry (void); diff --git a/calendar/gui/dialogs/event-page.glade b/calendar/gui/dialogs/event-page.glade index 0c3abcfc5f..e90490dd03 100644 --- a/calendar/gui/dialogs/event-page.glade +++ b/calendar/gui/dialogs/event-page.glade @@ -271,9 +271,9 @@ <widget> <class>GtkAlignment</class> <name>alignment1</name> - <xalign>0.5</xalign> + <xalign>1</xalign> <yalign>7.45058e-09</yalign> - <xscale>1</xscale> + <xscale>0</xscale> <yscale>0</yscale> <child> <left_attach>3</left_attach> diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index 20310f6433..f06d8f76ec 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -1213,7 +1213,8 @@ make_ending_until_special (RecurrencePage *rpage) /* Create the widget */ - priv->ending_date_edit = comp_editor_new_date_edit (TRUE, FALSE); + priv->ending_date_edit = comp_editor_new_date_edit (TRUE, FALSE, + FALSE); de = E_DATE_EDIT (priv->ending_date_edit); gtk_container_add (GTK_CONTAINER (priv->ending_special), @@ -2237,3 +2238,13 @@ recurrence_page_new (void) return rpage; } + + +GtkWidget *make_exdate_date_edit (void); + +GtkWidget * +make_exdate_date_edit (void) +{ + return comp_editor_new_date_edit (TRUE, TRUE, FALSE); +} + diff --git a/calendar/gui/dialogs/recurrence-page.glade b/calendar/gui/dialogs/recurrence-page.glade index 747f89bccb..2858f3a9d6 100644 --- a/calendar/gui/dialogs/recurrence-page.glade +++ b/calendar/gui/dialogs/recurrence-page.glade @@ -494,7 +494,7 @@ forever <widget> <class>Custom</class> <name>exception-date</name> - <creation_function>make_date_edit</creation_function> + <creation_function>make_exdate_date_edit</creation_function> <int1>0</int1> <int2>0</int2> <last_modification_time>Tue, 16 May 2000 01:42:29 GMT</last_modification_time> diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c index 3955abc182..ff7223362a 100644 --- a/calendar/gui/dialogs/task-details-page.c +++ b/calendar/gui/dialogs/task-details-page.c @@ -709,7 +709,7 @@ task_details_page_create_date_edit (void) { GtkWidget *dedit; - dedit = comp_editor_new_date_edit (TRUE, TRUE); + dedit = comp_editor_new_date_edit (TRUE, TRUE, FALSE); e_date_edit_set_allow_no_date_set (E_DATE_EDIT (dedit), TRUE); return dedit; diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 84eb1017d4..8e10ae7383 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -39,6 +39,7 @@ #include "e-util/e-dialog-widgets.h" #include "e-util/e-categories-config.h" #include "../e-timezone-entry.h" +#include "../calendar-config.h" #include "comp-editor-util.h" #include "task-page.h" @@ -335,6 +336,7 @@ task_page_fill_widgets (CompEditorPage *page, CalComponent *comp) /* Due Date. */ cal_component_get_due (comp, &d); + zone = NULL; if (d.value) { struct icaltimetype *due_tt = d.value; e_date_edit_set_date (E_DATE_EDIT (priv->due_date), @@ -343,13 +345,22 @@ task_page_fill_widgets (CompEditorPage *page, CalComponent *comp) e_date_edit_set_time_of_day (E_DATE_EDIT (priv->due_date), due_tt->hour, due_tt->minute); } else { + char *location; + e_date_edit_set_time (E_DATE_EDIT (priv->due_date), -1); + + /* If no time is set, we use the default timezone, so the + user usually doesn't have to set this when they set the + date. */ + location = calendar_config_get_timezone (); + zone = icaltimezone_get_builtin_timezone (location); } /* 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) + zone = icaltimezone_get_builtin_timezone_from_tzid (d.tzid); if (!zone) { get_tz_status = cal_client_get_timezone (page->client, d.tzid, &zone); @@ -366,6 +377,7 @@ task_page_fill_widgets (CompEditorPage *page, CalComponent *comp) /* Start Date. */ cal_component_get_dtstart (comp, &d); + zone = NULL; if (d.value) { struct icaltimetype *start_tt = d.value; e_date_edit_set_date (E_DATE_EDIT (priv->start_date), @@ -374,10 +386,19 @@ task_page_fill_widgets (CompEditorPage *page, CalComponent *comp) e_date_edit_set_time_of_day (E_DATE_EDIT (priv->start_date), start_tt->hour, start_tt->minute); } else { + char *location; + e_date_edit_set_time (E_DATE_EDIT (priv->start_date), -1); + + /* If no time is set, we use the default timezone, so the + user usually doesn't have to set this when they set the + date. */ + location = calendar_config_get_timezone (); + zone = icaltimezone_get_builtin_timezone (location); } - zone = icaltimezone_get_builtin_timezone_from_tzid (d.tzid); + if (!zone) + zone = icaltimezone_get_builtin_timezone_from_tzid (d.tzid); if (!zone) { get_tz_status = cal_client_get_timezone (page->client, d.tzid, &zone); @@ -754,6 +775,8 @@ static gboolean init_widgets (TaskPage *tpage) { TaskPagePrivate *priv; + char *location; + icaltimezone *zone; priv = tpage->priv; @@ -825,6 +848,12 @@ init_widgets (TaskPage *tpage) gtk_container_add (GTK_CONTAINER (priv->contacts_box), priv->contacts_entry); + /* Set the default timezone, so the timezone entry may be hidden. */ + location = calendar_config_get_timezone (); + zone = icaltimezone_get_builtin_timezone (location); + e_timezone_entry_set_default_timezone (E_TIMEZONE_ENTRY (priv->start_timezone), zone); + e_timezone_entry_set_default_timezone (E_TIMEZONE_ENTRY (priv->due_timezone), zone); + return TRUE; } @@ -898,7 +927,7 @@ task_page_create_date_edit (void) { GtkWidget *dedit; - dedit = comp_editor_new_date_edit (TRUE, TRUE); + dedit = comp_editor_new_date_edit (TRUE, TRUE, TRUE); e_date_edit_set_allow_no_date_set (E_DATE_EDIT (dedit), TRUE); return dedit; diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c index 8bca2db755..1b37c8662e 100644 --- a/calendar/gui/e-calendar-table.c +++ b/calendar/gui/e-calendar-table.c @@ -802,6 +802,7 @@ e_calendar_table_on_double_click (ETable *table, GdkEvent *event, ECalendarTable *cal_table) { + g_print ("In e_calendar_table_on_double_click\n"); open_task_by_row (cal_table, row); } diff --git a/calendar/gui/e-timezone-entry.c b/calendar/gui/e-timezone-entry.c index 2b4f06af6d..1cc1e83676 100644 --- a/calendar/gui/e-timezone-entry.c +++ b/calendar/gui/e-timezone-entry.c @@ -38,6 +38,8 @@ #include "dialogs/e-timezone-dialog.h" #include "e-timezone-entry.h" +/* The timezone icon for the button. */ +#include "art/timezone-16.xpm" struct _ETimezoneEntryPrivate { /* This is the timezone set in e_timezone_entry_set_timezone(). @@ -53,6 +55,11 @@ struct _ETimezoneEntryPrivate { GtkWidget *entry; GtkWidget *button; + + /* This can be set to the default timezone. If the current timezone + setting in the ETimezoneEntry matches this, then the entry field + is hidden. This makes the user interface simpler. */ + icaltimezone *default_zone; }; @@ -73,6 +80,8 @@ static void on_button_clicked (GtkWidget *widget, static char* e_timezone_entry_get_display_name (icaltimezone *zone); +static void e_timezone_entry_set_entry_visibility (ETimezoneEntry *tentry); + static GtkHBoxClass *parent_class; static guint timezone_entry_signals[LAST_SIGNAL] = { 0 }; @@ -137,11 +146,16 @@ static void e_timezone_entry_init (ETimezoneEntry *tentry) { ETimezoneEntryPrivate *priv; + GdkColormap *colormap; + GdkPixmap *timezone_icon; + GdkBitmap *timezone_mask; + GtkWidget *pixmap; tentry->priv = priv = g_new0 (ETimezoneEntryPrivate, 1); priv->zone = NULL; priv->changed = FALSE; + priv->default_zone = NULL; priv->entry = gtk_entry_new (); gtk_entry_set_editable (GTK_ENTRY (priv->entry), FALSE); @@ -151,11 +165,18 @@ e_timezone_entry_init (ETimezoneEntry *tentry) gtk_signal_connect (GTK_OBJECT (priv->entry), "changed", GTK_SIGNAL_FUNC (on_entry_changed), tentry); - priv->button = gtk_button_new_with_label ("..."); + priv->button = gtk_button_new (); gtk_signal_connect (GTK_OBJECT (priv->button), "clicked", GTK_SIGNAL_FUNC (on_button_clicked), tentry); gtk_box_pack_start (GTK_BOX (tentry), priv->button, FALSE, FALSE, 0); gtk_widget_show (priv->button); + + colormap = gtk_widget_get_colormap (priv->button); + timezone_icon = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap, &timezone_mask, NULL, timezone_16_xpm); + + pixmap = gtk_pixmap_new (timezone_icon, timezone_mask); + gtk_container_add (GTK_CONTAINER (priv->button), pixmap); + gtk_widget_show (pixmap); } @@ -233,6 +254,7 @@ on_button_clicked (GtkWidget *widget, } gtk_entry_set_text (GTK_ENTRY (priv->entry), display_name); + e_timezone_entry_set_entry_visibility (tentry); } gtk_object_unref (GTK_OBJECT (timezone_dialog)); @@ -287,6 +309,8 @@ e_timezone_entry_set_timezone (ETimezoneEntry *tentry, gtk_entry_set_text (GTK_ENTRY (priv->entry), zone ? e_timezone_entry_get_display_name (zone) : ""); + + e_timezone_entry_set_entry_visibility (tentry); } @@ -306,3 +330,45 @@ e_timezone_entry_get_display_name (icaltimezone *zone) return display_name; } + + +/* Sets the default timezone. If the current timezone matches this, then the + entry field is hidden. This is useful since most people do not use timezones + so it makes the user interface simpler. */ +void +e_timezone_entry_set_default_timezone (ETimezoneEntry *tentry, + icaltimezone *zone) +{ + ETimezoneEntryPrivate *priv; + + g_return_if_fail (E_IS_TIMEZONE_ENTRY (tentry)); + + priv = tentry->priv; + + priv->default_zone = zone; + + e_timezone_entry_set_entry_visibility (tentry); +} + + +static void +e_timezone_entry_set_entry_visibility (ETimezoneEntry *tentry) +{ + ETimezoneEntryPrivate *priv; + icaltimezone *zone; + gboolean show_entry = TRUE; + + priv = tentry->priv; + + if (priv->default_zone) { + zone = e_timezone_entry_get_timezone (tentry); + if (zone == priv->default_zone) + show_entry = FALSE; + } + + if (show_entry) + gtk_widget_show (priv->entry); + else + gtk_widget_hide (priv->entry); +} + diff --git a/calendar/gui/e-timezone-entry.h b/calendar/gui/e-timezone-entry.h index bfc8525f64..61bae2b7b4 100644 --- a/calendar/gui/e-timezone-entry.h +++ b/calendar/gui/e-timezone-entry.h @@ -71,6 +71,12 @@ icaltimezone* e_timezone_entry_get_timezone (ETimezoneEntry *tentry); void e_timezone_entry_set_timezone (ETimezoneEntry *tentry, icaltimezone *zone); +/* Sets the default timezone. If the current timezone matches this, then the + entry field is hidden. This is useful since most people do not use timezones + so it makes the user interface simpler. */ +void e_timezone_entry_set_default_timezone(ETimezoneEntry *tentry, + icaltimezone *zone); + END_GNOME_DECLS #endif /* __E_TIMEZONE_ENTRY_H_ */ |