From 550afcd67e9842114e344be88bcd3388f5d6293f Mon Sep 17 00:00:00 2001 From: Chenthill Palanisamy Date: Mon, 5 Mar 2007 18:44:04 +0000 Subject: Query for freebusy information only when the window is clicked. svn path=/trunk/; revision=33283 --- calendar/ChangeLog | 14 ++++++++ calendar/gui/dialogs/event-editor.c | 66 +++++++++++++++++++++++------------- calendar/gui/dialogs/event-page.c | 4 ++- calendar/gui/dialogs/schedule-page.c | 13 +++++++ calendar/gui/dialogs/schedule-page.h | 1 + calendar/gui/e-meeting-time-sel.c | 6 ++-- calendar/gui/e-meeting-time-sel.h | 1 + 7 files changed, 78 insertions(+), 27 deletions(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index d03bee1a42..cfdf9bfb10 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,17 @@ +2007-03-05 Chenthill Palanisamy + + * gui/dialogs/event-page.c: (event_page_fill_component): Set the + description only if summary has some value. + * gui/dialogs/schedule-page.c: (schedule_page_update_free_busy): + * gui/dialogs/schedule-page.h: + * gui/e-meeting-time-sel.[ch]: exposed e_meeting_time_selector_refresh_free_busy. + * gui/dialogs/event-editor.c: (menu_action_freebusy_cb), + (create_schedule_page), (menu_action_freebusy_cmd), + (event_editor_construct): Form the FreeBusy dialog only when the button is + clicked. The FreeBusy queries would not start until the button is clicked. So + the users can choose the appropriate dates in the editor before the clicking + the button. + 2007-02-12 Kjartan Maraas * gui/e-meeting-list-view.c: (e_meeting_list_view_init): diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 4869f8887a..39a6cb2789 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -63,6 +63,8 @@ static void event_editor_finalize (GObject *object); static void model_row_change_insert_cb (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data); static void model_row_delete_cb (GtkTreeModel *model, GtkTreePath *path, gpointer data); +static gboolean window_delete_event (GtkWidget *widget, GdkEvent *event, gpointer user_data); +static void create_schedule_page (EventEditor *ee); G_DEFINE_TYPE (EventEditor, event_editor, TYPE_COMP_EDITOR) @@ -307,7 +309,10 @@ menu_action_freebusy_cb (BonoboUIComponent *ui_component, { EventEditor *ee = (EventEditor *) user_data; - gtk_widget_show (ee->priv->sched_window); + if (!ee->priv->sched_window) + create_schedule_page (ee); + else + gtk_widget_show (ee->priv->sched_window); } static void @@ -353,6 +358,38 @@ menu_action_recurrence_cmd (BonoboUIComponent *uic, gtk_widget_show (ee->priv->recur_window); } +static void +create_schedule_page (EventEditor *ee) +{ + ENameSelector *name_selector; + EventEditorPrivate *priv; + ECal *ecal = NULL; + + priv = ee->priv; + + priv->sched_window = gtk_dialog_new_with_buttons (_("Free/Busy"), + (GtkWindow *) ee, GTK_DIALOG_MODAL, + "gtk-close", GTK_RESPONSE_CLOSE, + NULL); + priv->sched_page = schedule_page_new (priv->model); + g_object_ref (priv->sched_page); + gtk_object_sink (GTK_OBJECT (priv->sched_page)); + gtk_container_add (GTK_CONTAINER (GTK_DIALOG(priv->sched_window)->vbox), comp_editor_page_get_widget (COMP_EDITOR_PAGE (priv->sched_page))); + + g_signal_connect (priv->sched_window, "response", G_CALLBACK(gtk_widget_hide), NULL); + g_signal_connect ((GtkWidget *) priv->sched_window, "delete-event", G_CALLBACK(window_delete_event), NULL); + name_selector = event_page_get_name_selector (priv->event_page); + schedule_page_set_name_selector (priv->sched_page, name_selector); + + ecal = comp_editor_get_e_cal (COMP_EDITOR (ee)); + comp_editor_page_set_e_cal (COMP_EDITOR_PAGE (priv->sched_page), ecal); + comp_editor_append_page (COMP_EDITOR (ee), COMP_EDITOR_PAGE (priv->sched_page), NULL, FALSE); + schedule_page_update_free_busy (priv->sched_page); + + gtk_widget_show_all (priv->sched_window); + +} + static void menu_action_freebusy_cmd (BonoboUIComponent *uic, void *data, @@ -360,7 +397,10 @@ menu_action_freebusy_cmd (BonoboUIComponent *uic, { EventEditor *ee = (EventEditor *) data; - gtk_widget_show (ee->priv->sched_window); + if (!ee->priv->sched_window) + create_schedule_page (ee); + else + gtk_widget_show (ee->priv->sched_window); } static void @@ -585,27 +625,7 @@ event_editor_construct (EventEditor *ee, ECal *client) event_page_show_options (priv->event_page); comp_editor_set_group_item (COMP_EDITOR (ee), TRUE); - if ((flags & COMP_EDITOR_USER_ORG) || (flags & COMP_EDITOR_DELEGATE)|| (flags & COMP_EDITOR_NEW_ITEM)) { - ENameSelector *name_selector; - - priv->sched_window = gtk_dialog_new_with_buttons (_("Free/Busy"), - (GtkWindow *) ee, GTK_DIALOG_MODAL, - "gtk-close", GTK_RESPONSE_CLOSE, - NULL); - priv->sched_page = schedule_page_new (priv->model); - g_object_ref (priv->sched_page); - gtk_object_sink (GTK_OBJECT (priv->sched_page)); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG(priv->sched_window)->vbox), comp_editor_page_get_widget (COMP_EDITOR_PAGE (priv->sched_page))); - gtk_widget_show_all (priv->sched_window); - gtk_widget_hide (priv->sched_window); - - g_signal_connect (priv->sched_window, "response", G_CALLBACK(gtk_widget_hide), NULL); - g_signal_connect ((GtkWidget *) priv->sched_window, "delete-event", G_CALLBACK(window_delete_event), NULL); - name_selector = event_page_get_name_selector (priv->event_page); - schedule_page_set_name_selector (priv->sched_page, name_selector); - comp_editor_append_page (COMP_EDITOR (ee), COMP_EDITOR_PAGE (priv->sched_page), NULL, FALSE); - - } else + if (!((flags & COMP_EDITOR_USER_ORG) || (flags & COMP_EDITOR_DELEGATE)|| (flags & COMP_EDITOR_NEW_ITEM))) bonobo_ui_component_set_prop (editor->uic, "/commands/ActionFreeBusy", "hidden", "1", NULL); event_page_set_meeting (priv->event_page, TRUE); diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index e0d27f5a35..aa20384f93 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -1391,7 +1391,9 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp) ca = e_cal_component_alarm_new (); e_cal_component_get_summary (comp, &summary); - e_cal_component_alarm_set_description (ca, &summary); + + if (summary.value) + e_cal_component_alarm_set_description (ca, &summary); e_cal_component_alarm_set_action (ca, E_CAL_COMPONENT_ALARM_DISPLAY); diff --git a/calendar/gui/dialogs/schedule-page.c b/calendar/gui/dialogs/schedule-page.c index 7a8afc6cfa..8faabbee44 100644 --- a/calendar/gui/dialogs/schedule-page.c +++ b/calendar/gui/dialogs/schedule-page.c @@ -490,6 +490,19 @@ schedule_page_new (EMeetingStore *ems) return spage; } +void +schedule_page_update_free_busy (SchedulePage *spage) +{ + SchedulePagePrivate *priv; + + g_return_if_fail (spage != NULL); + g_return_if_fail (IS_SCHEDULE_PAGE (spage)); + + priv = spage->priv; + + e_meeting_time_selector_refresh_free_busy (priv->sel, 0, TRUE); +} + void schedule_page_set_name_selector (SchedulePage *spage, ENameSelector *name_selector) { diff --git a/calendar/gui/dialogs/schedule-page.h b/calendar/gui/dialogs/schedule-page.h index 8f0496c8b4..ea1bc8eed9 100644 --- a/calendar/gui/dialogs/schedule-page.h +++ b/calendar/gui/dialogs/schedule-page.h @@ -54,6 +54,7 @@ SchedulePage *schedule_page_construct (SchedulePage *mpage, EMeetingStore *ems); SchedulePage *schedule_page_new (EMeetingStore *ems); void schedule_page_set_name_selector (SchedulePage *spage, ENameSelector *name_selector); void schedule_page_set_meeting_time (SchedulePage *spage, icaltimetype *start_tt, icaltimetype *end_tt); +void schedule_page_update_free_busy (SchedulePage *spage); G_END_DECLS diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c index e0d261b1aa..c8fed9e2e6 100644 --- a/calendar/gui/e-meeting-time-sel.c +++ b/calendar/gui/e-meeting-time-sel.c @@ -1206,8 +1206,8 @@ e_meeting_time_selector_refresh_cb (gpointer data) mts->last_cursor_set = GDK_LEFT_PTR; e_meeting_time_selector_item_set_normal_cursor (E_MEETING_TIME_SELECTOR_ITEM (mts->item_top)); e_meeting_time_selector_item_set_normal_cursor (E_MEETING_TIME_SELECTOR_ITEM (mts->item_main)); - } - + } + if (mts->display_top != NULL) gtk_widget_queue_draw (mts->display_top); if (mts->display_main != NULL) @@ -1218,7 +1218,7 @@ e_meeting_time_selector_refresh_cb (gpointer data) return FALSE; } -static void +void e_meeting_time_selector_refresh_free_busy (EMeetingTimeSelector *mts, int row, gboolean all) { EMeetingTime start, end; diff --git a/calendar/gui/e-meeting-time-sel.h b/calendar/gui/e-meeting-time-sel.h index 8697950e06..04352b9af4 100644 --- a/calendar/gui/e-meeting-time-sel.h +++ b/calendar/gui/e-meeting-time-sel.h @@ -383,6 +383,7 @@ void e_meeting_time_selector_calculate_time (EMeetingTimeSelector *mts, EMeetingTime*time); gint e_meeting_time_selector_calculate_time_position (EMeetingTimeSelector *mts, EMeetingTime *mtstime); +void e_meeting_time_selector_refresh_free_busy (EMeetingTimeSelector *mts, int row, gboolean all); /* Debugging function to dump information on all attendees. */ #ifdef E_MEETING_TIME_SELECTOR_DEBUG -- cgit