diff options
author | Rodrigo Moya <rodrigo@ximian.com> | 2004-03-04 19:17:56 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2004-03-04 19:17:56 +0800 |
commit | 8e8fcea05d20217a19285cb7599d1d0b96de4b3b (patch) | |
tree | 50c5066b2c59d2009dbd71e9abcb852de3eec9ad /calendar/gui | |
parent | 51cf52e71b6425a742adfef0c01e81299426c50d (diff) | |
download | gsoc2013-evolution-8e8fcea05d20217a19285cb7599d1d0b96de4b3b.tar.gz gsoc2013-evolution-8e8fcea05d20217a19285cb7599d1d0b96de4b3b.tar.zst gsoc2013-evolution-8e8fcea05d20217a19285cb7599d1d0b96de4b3b.zip |
Fixes #53137
2004-03-04 Rodrigo Moya <rodrigo@ximian.com>
Fixes #53137
* gui/dialogs/comp-editor-page.[ch]: made fill_widgets virtual
method return a gboolean.
(comp_editor_page_fill_widgets): return value from virtual method
implementation.
* gui/dialogs/event-page.c (event_page_fill_widgets):
* gui/dialogs/meeting-page.c (meeting_page_fill_widgets):
* gui/dialogs/recurrence-page.c (recurrence_page_fill_widgets):
* gui/dialogs/schedule-page.c (schedule_page_fill_widgets):
* gui/dialogs/task-details-page.c (task_details_page_fill_widgets):
* gui/dialogs/task-page.c (task_page_fill_widgets):
* gui/dialogs/alarm-page.c (alarm_page_fill_widgets): return value,
as expected from the virtual method signature.
* gui/dialogs/comp-editor.c (comp_editor_append_page): dont add the
page if there was an error calling the fill_widgets method.
svn path=/trunk/; revision=24960
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/dialogs/alarm-page.c | 6 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor-page.c | 4 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor-page.h | 4 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor.c | 6 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-page.c | 17 | ||||
-rw-r--r-- | calendar/gui/dialogs/meeting-page.c | 6 | ||||
-rw-r--r-- | calendar/gui/dialogs/recurrence-page.c | 8 | ||||
-rw-r--r-- | calendar/gui/dialogs/schedule-page.c | 6 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-details-page.c | 6 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-page.c | 6 |
10 files changed, 48 insertions, 21 deletions
diff --git a/calendar/gui/dialogs/alarm-page.c b/calendar/gui/dialogs/alarm-page.c index 603cd5c8b6..c3fec99683 100644 --- a/calendar/gui/dialogs/alarm-page.c +++ b/calendar/gui/dialogs/alarm-page.c @@ -141,7 +141,7 @@ static void alarm_page_finalize (GObject *object); static GtkWidget *alarm_page_get_widget (CompEditorPage *page); static void alarm_page_focus_main_widget (CompEditorPage *page); -static void alarm_page_fill_widgets (CompEditorPage *page, ECalComponent *comp); +static gboolean alarm_page_fill_widgets (CompEditorPage *page, ECalComponent *comp); static gboolean alarm_page_fill_component (CompEditorPage *page, ECalComponent *comp); static void alarm_page_set_summary (CompEditorPage *page, const char *summary); static void alarm_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates); @@ -358,7 +358,7 @@ append_reminder (AlarmPage *apage, ECalComponentAlarm *alarm) } /* fill_widgets handler for the alarm page */ -static void +static gboolean alarm_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) { AlarmPage *apage; @@ -422,6 +422,8 @@ alarm_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) sensitize_buttons (apage); priv->updating = FALSE; + + return TRUE; } /* fill_component handler for the alarm page */ diff --git a/calendar/gui/dialogs/comp-editor-page.c b/calendar/gui/dialogs/comp-editor-page.c index db51481f62..40cff1b0f2 100644 --- a/calendar/gui/dialogs/comp-editor-page.c +++ b/calendar/gui/dialogs/comp-editor-page.c @@ -234,7 +234,7 @@ comp_editor_page_focus_main_widget (CompEditorPage *page) * * Fills the widgets of an editor page with the data from a calendar component. **/ -void +gboolean comp_editor_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) { g_return_if_fail (page != NULL); @@ -242,7 +242,7 @@ comp_editor_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) g_return_if_fail (comp != NULL); g_assert (CLASS (page)->fill_widgets != NULL); - (* CLASS (page)->fill_widgets) (page, comp); + return (* CLASS (page)->fill_widgets) (page, comp); } /** diff --git a/calendar/gui/dialogs/comp-editor-page.h b/calendar/gui/dialogs/comp-editor-page.h index 84d7d9d196..a6d938984d 100644 --- a/calendar/gui/dialogs/comp-editor-page.h +++ b/calendar/gui/dialogs/comp-editor-page.h @@ -74,7 +74,7 @@ typedef struct { GtkWidget *(* get_widget) (CompEditorPage *page); void (* focus_main_widget) (CompEditorPage *page); - void (* fill_widgets) (CompEditorPage *page, ECalComponent *comp); + gboolean (* fill_widgets) (CompEditorPage *page, ECalComponent *comp); gboolean (* fill_component) (CompEditorPage *page, ECalComponent *comp); void (* set_summary) (CompEditorPage *page, const char *summary); @@ -85,7 +85,7 @@ typedef struct { GtkType comp_editor_page_get_type (void); GtkWidget *comp_editor_page_get_widget (CompEditorPage *page); void comp_editor_page_focus_main_widget (CompEditorPage *page); -void comp_editor_page_fill_widgets (CompEditorPage *page, +gboolean comp_editor_page_fill_widgets (CompEditorPage *page, ECalComponent *comp); gboolean comp_editor_page_fill_component (CompEditorPage *page, ECalComponent *comp); diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index d204de56e8..b298952a6e 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -722,7 +722,11 @@ comp_editor_append_page (CompEditor *editor, ECalComponent *comp; comp = comp_editor_get_current_comp (editor); - comp_editor_page_fill_widgets (page, comp); + if (!comp_editor_page_fill_widgets (page, comp)) { + /* dont add the pagge if there is an error */ + g_object_unref (comp); + return; + } g_object_unref (comp); } diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index cffa9f2e9a..129acd1a2a 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -95,7 +95,7 @@ static void event_page_finalize (GObject *object); static GtkWidget *event_page_get_widget (CompEditorPage *page); static void event_page_focus_main_widget (CompEditorPage *page); -static void event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp); +static gboolean event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp); static gboolean event_page_fill_component (CompEditorPage *page, ECalComponent *comp); static void event_page_set_summary (CompEditorPage *page, const char *summary); static void event_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates); @@ -408,7 +408,7 @@ clear_widgets (EventPage *epage) /* fill_widgets handler for the event page */ -static void +static gboolean event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) { EventPage *epage; @@ -422,7 +422,7 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) ESource *source; GSList *l; - g_return_if_fail (page->client != NULL); + g_return_val_if_fail (page->client != NULL, FALSE); epage = EVENT_PAGE (page); priv = epage->priv; @@ -452,7 +452,16 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) /* Start and end times */ e_cal_component_get_dtstart (comp, &start_date); + if (!start_date.value) { + comp_editor_page_display_validation_error (page, _("Event with no start time"), priv->start_time); + return FALSE; + } + e_cal_component_get_dtend (comp, &end_date); + if (!end_date.value) { + comp_editor_page_display_validation_error (page, _("Event with no end time"), priv->end_time); + return FALSE; + } update_time (epage, &start_date, &end_date); @@ -520,6 +529,8 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) e_source_option_menu_select (E_SOURCE_OPTION_MENU (priv->source_selector), source); priv->updating = FALSE; + + return TRUE; } /* fill_component handler for the event page */ diff --git a/calendar/gui/dialogs/meeting-page.c b/calendar/gui/dialogs/meeting-page.c index d8b951e263..32209ccd0a 100644 --- a/calendar/gui/dialogs/meeting-page.c +++ b/calendar/gui/dialogs/meeting-page.c @@ -96,7 +96,7 @@ static void meeting_page_finalize (GObject *object); static GtkWidget *meeting_page_get_widget (CompEditorPage *page); static void meeting_page_focus_main_widget (CompEditorPage *page); -static void meeting_page_fill_widgets (CompEditorPage *page, ECalComponent *comp); +static gboolean meeting_page_fill_widgets (CompEditorPage *page, ECalComponent *comp); static gboolean meeting_page_fill_component (CompEditorPage *page, ECalComponent *comp); static CompEditorPageClass *parent_class = NULL; @@ -317,7 +317,7 @@ clear_widgets (MeetingPage *mpage) } /* fill_widgets handler for the meeting page */ -static void +static gboolean meeting_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) { MeetingPage *mpage; @@ -390,6 +390,8 @@ meeting_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) } priv->updating = FALSE; + + return TRUE; } /* fill_component handler for the meeting page */ diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index aa42fca322..0868ed5cca 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -207,7 +207,7 @@ static void recurrence_page_finalize (GObject *object); static GtkWidget *recurrence_page_get_widget (CompEditorPage *page); static void recurrence_page_focus_main_widget (CompEditorPage *page); -static void recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp); +static gboolean recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp); static gboolean recurrence_page_fill_component (CompEditorPage *page, ECalComponent *comp); static void recurrence_page_set_summary (CompEditorPage *page, const char *summary); static void recurrence_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates); @@ -1494,7 +1494,7 @@ fill_ending_date (RecurrencePage *rpage, struct icalrecurrencetype *r) * editing and the ones we don't. We only support at most one recurrence rule; * no rdates or exrules (exdates are handled just fine elsewhere). */ -static void +static gboolean recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) { RecurrencePage *rpage; @@ -1568,7 +1568,7 @@ recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) preview_recur (rpage); priv->updating = FALSE; - return; + return TRUE; } /* See if it is a custom set we don't support */ @@ -1863,6 +1863,8 @@ recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) preview_recur (rpage); priv->updating = FALSE; + + return TRUE; } /* fill_component handler for the recurrence page */ diff --git a/calendar/gui/dialogs/schedule-page.c b/calendar/gui/dialogs/schedule-page.c index fc91916345..97126f7bbd 100644 --- a/calendar/gui/dialogs/schedule-page.c +++ b/calendar/gui/dialogs/schedule-page.c @@ -74,7 +74,7 @@ static void schedule_page_finalize (GObject *object); static GtkWidget *schedule_page_get_widget (CompEditorPage *page); static void schedule_page_focus_main_widget (CompEditorPage *page); -static void schedule_page_fill_widgets (CompEditorPage *page, ECalComponent *comp); +static gboolean schedule_page_fill_widgets (CompEditorPage *page, ECalComponent *comp); static gboolean schedule_page_fill_component (CompEditorPage *page, ECalComponent *comp); static void schedule_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates); @@ -278,7 +278,7 @@ clear_widgets (SchedulePage *spage) } /* fill_widgets handler for the schedule page */ -static void +static gboolean schedule_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) { SchedulePage *spage; @@ -302,6 +302,8 @@ schedule_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) e_cal_component_free_datetime (&end_date); priv->updating = FALSE; + + return TRUE; } /* fill_component handler for the schedule page */ diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c index 729275a4ef..0d657fe59e 100644 --- a/calendar/gui/dialogs/task-details-page.c +++ b/calendar/gui/dialogs/task-details-page.c @@ -93,7 +93,7 @@ static void task_details_page_finalize (GObject *object); static GtkWidget *task_details_page_get_widget (CompEditorPage *page); static void task_details_page_focus_main_widget (CompEditorPage *page); -static void task_details_page_fill_widgets (CompEditorPage *page, ECalComponent *comp); +static gboolean task_details_page_fill_widgets (CompEditorPage *page, ECalComponent *comp); static gboolean task_details_page_fill_component (CompEditorPage *page, ECalComponent *comp); static CompEditorPageClass *parent_class = NULL; @@ -276,7 +276,7 @@ clear_widgets (TaskDetailsPage *tdpage) } /* fill_widgets handler for the task page */ -static void +static gboolean task_details_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) { TaskDetailsPage *tdpage; @@ -360,6 +360,8 @@ task_details_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) e_dialog_editable_set (priv->url, url); priv->updating = FALSE; + + return TRUE; } /* fill_component handler for the task page */ diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index e42b1fdd42..9b0efc6967 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -91,7 +91,7 @@ static void task_page_finalize (GObject *object); static GtkWidget *task_page_get_widget (CompEditorPage *page); static void task_page_focus_main_widget (CompEditorPage *page); -static void task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp); +static gboolean task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp); static gboolean task_page_fill_component (CompEditorPage *page, ECalComponent *comp); static void task_page_set_summary (CompEditorPage *page, const char *summary); static void task_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates); @@ -249,7 +249,7 @@ classification_get (GtkWidget *widget) } /* fill_widgets handler for the task page */ -static void +static gboolean task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) { TaskPage *tpage; @@ -408,6 +408,8 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) e_source_option_menu_select (E_SOURCE_OPTION_MENU (priv->source_selector), source); priv->updating = FALSE; + + return TRUE; } /* fill_component handler for the task page */ |