diff options
author | Srinivasa Ragavan <sragavan@src.gnome.org> | 2007-09-03 02:44:00 +0800 |
---|---|---|
committer | Srinivasa Ragavan <sragavan@src.gnome.org> | 2007-09-03 02:44:00 +0800 |
commit | f8374109ac06f8c0528dcf27f214f26c5d2aaf8d (patch) | |
tree | 6f433c6f52d6f71cc54e4852c0866c8982e1ecb8 /calendar/gui/dialogs | |
parent | 8c122d342656c0cad8babf4cb26796256b636fb4 (diff) | |
download | gsoc2013-evolution-f8374109ac06f8c0528dcf27f214f26c5d2aaf8d.tar.gz gsoc2013-evolution-f8374109ac06f8c0528dcf27f214f26c5d2aaf8d.tar.zst gsoc2013-evolution-f8374109ac06f8c0528dcf27f214f26c5d2aaf8d.zip |
** Fix for bug #471791 (Move away from asserts to g_ret*)
svn path=/trunk/; revision=34156
Diffstat (limited to 'calendar/gui/dialogs')
-rw-r--r-- | calendar/gui/dialogs/alarm-dialog.c | 10 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor-page.c | 6 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor-util.c | 4 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor.c | 4 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-page.c | 22 | ||||
-rw-r--r-- | calendar/gui/dialogs/recurrence-page.c | 58 |
6 files changed, 55 insertions, 49 deletions
diff --git a/calendar/gui/dialogs/alarm-dialog.c b/calendar/gui/dialogs/alarm-dialog.c index fe622369c5..7755cc3b17 100644 --- a/calendar/gui/dialogs/alarm-dialog.c +++ b/calendar/gui/dialogs/alarm-dialog.c @@ -311,7 +311,7 @@ repeat_widgets_to_alarm (Dialog *dialog, ECalComponentAlarm *alarm) break; default: - g_assert_not_reached (); + g_return_if_reached (); } e_cal_component_alarm_set_repeat (alarm, repeat); @@ -709,7 +709,7 @@ dialog_to_alarm (Dialog *dialog) break; default: - g_assert_not_reached (); + g_return_if_reached (); } e_cal_component_alarm_set_trigger (dialog->alarm, trigger); @@ -722,7 +722,7 @@ dialog_to_alarm (Dialog *dialog) /* Options */ switch (action) { case E_CAL_COMPONENT_ALARM_NONE: - g_assert_not_reached (); + g_return_if_reached (); break; case E_CAL_COMPONENT_ALARM_AUDIO: @@ -745,7 +745,7 @@ dialog_to_alarm (Dialog *dialog) break; default: - g_assert_not_reached (); + g_return_if_reached (); } } @@ -1099,7 +1099,7 @@ action_selection_done_cb (GtkMenuShell *menu_shell, gpointer data) check_custom_program (dialog); break; default: - g_assert_not_reached (); + g_return_if_reached (); return; } } diff --git a/calendar/gui/dialogs/comp-editor-page.c b/calendar/gui/dialogs/comp-editor-page.c index 1d512e7d0b..897764dfa8 100644 --- a/calendar/gui/dialogs/comp-editor-page.c +++ b/calendar/gui/dialogs/comp-editor-page.c @@ -224,8 +224,8 @@ comp_editor_page_get_widget (CompEditorPage *page) { g_return_val_if_fail (page != NULL, NULL); g_return_val_if_fail (IS_COMP_EDITOR_PAGE (page), NULL); + g_return_val_if_fail (CLASS (page)->get_widget != NULL, NULL); - g_assert (CLASS (page)->get_widget != NULL); return (* CLASS (page)->get_widget) (page); } @@ -242,8 +242,8 @@ comp_editor_page_focus_main_widget (CompEditorPage *page) { g_return_if_fail (page != NULL); g_return_if_fail (IS_COMP_EDITOR_PAGE (page)); + g_return_if_fail (CLASS (page)->focus_main_widget != NULL); - g_assert (CLASS (page)->focus_main_widget != NULL); (* CLASS (page)->focus_main_widget) (page); } @@ -259,8 +259,8 @@ comp_editor_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) { g_return_val_if_fail (IS_COMP_EDITOR_PAGE (page), FALSE); g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), FALSE); + g_return_val_if_fail (CLASS (page)->fill_widgets != NULL, FALSE); - g_assert (CLASS (page)->fill_widgets != NULL); return (* CLASS (page)->fill_widgets) (page, comp); } diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c index dba2d5fda7..8aa7bbd734 100644 --- a/calendar/gui/dialogs/comp-editor-util.c +++ b/calendar/gui/dialogs/comp-editor-util.c @@ -316,7 +316,7 @@ comp_editor_strip_categories (const char *categories) if (!start) continue; - g_assert (start <= end); + g_return_val_if_fail (start <= end, NULL); len = end - start + 1; strncpy (new_p, start, len); @@ -336,7 +336,7 @@ comp_editor_strip_categories (const char *categories) if (start) { int len; - g_assert (start <= end); + g_return_val_if_fail (start <= end, NULL); len = end - start + 1; strncpy (new_p, start, len); diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 6a8981daa7..4ff5055110 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -2006,7 +2006,7 @@ comp_editor_append_page (CompEditor *editor, } page_widget = comp_editor_page_get_widget (page); - g_assert (page_widget != NULL); + g_return_if_fail (page_widget != NULL); if (label) label_widget = gtk_label_new_with_mnemonic (label); @@ -2811,7 +2811,7 @@ comp_editor_get_mime_attach_list (CompEditor *editor) static void raise_and_focus (GtkWidget *widget) { - g_assert (GTK_WIDGET_REALIZED (widget)); + g_return_if_fail (GTK_WIDGET_REALIZED (widget)); gdk_window_show (widget->window); gtk_widget_grab_focus (widget); } diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index c2aaf2b1cf..6f760ba096 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -1316,7 +1316,7 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp) &start_tt.year, &start_tt.month, &start_tt.day); - g_assert (start_date_set); + g_return_val_if_fail (start_date_set, FALSE); if (!e_date_edit_date_is_valid (E_DATE_EDIT (priv->end_time))) { comp_editor_page_display_validation_error (page, _("End date is wrong"), priv->end_time); @@ -1326,7 +1326,7 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp) &end_tt.year, &end_tt.month, &end_tt.day); - g_assert (end_date_set); + g_return_val_if_fail (end_date_set, FALSE); /* If the all_day toggle is set, we use DATE values for DTSTART and DTEND. If not, we fetch the hour & minute from the widgets. */ @@ -1404,7 +1404,10 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp) icalproperty *icalprop; alarm = (ECalComponentAlarm *) e_alarm_list_get_alarm (priv->alarm_list_store, &iter); - g_assert (alarm != NULL); + if (!alarm) { + g_warning ("alarm is NULL\n"); + continue; + } /* We set the description of the alarm if it's got * the X-EVOLUTION-NEEDS-DESCRIPTION property. @@ -2098,7 +2101,7 @@ event_page_set_all_day_event (EventPage *epage, gboolean all_day) e_date_edit_get_time_of_day (E_DATE_EDIT (priv->start_time), &start_tt.hour, &start_tt.minute); - g_assert (date_set); + g_return_if_fail (date_set); date_set = e_date_edit_get_date (E_DATE_EDIT (priv->end_time), &end_tt.year, @@ -2107,7 +2110,7 @@ event_page_set_all_day_event (EventPage *epage, gboolean all_day) e_date_edit_get_time_of_day (E_DATE_EDIT (priv->end_time), &end_tt.hour, &end_tt.minute); - g_assert (date_set); + g_return_if_fail (date_set); /* TODO implement the for portion in end time selector */ gtk_widget_set_sensitive (priv->end_time_selector, !all_day); @@ -2509,13 +2512,13 @@ times_updated (EventPage *epage, gboolean adjust_end_time) &start_tt.year, &start_tt.month, &start_tt.day); - g_assert (date_set); + g_return_if_fail (date_set); date_set = e_date_edit_get_date (E_DATE_EDIT (priv->end_time), &end_tt.year, &end_tt.month, &end_tt.day); - g_assert (date_set); + g_return_if_fail (date_set); if (all_day_event) { /* All Day Events are simple. We just compare the dates and if @@ -2905,7 +2908,10 @@ alarm_custom_clicked_cb (GtkWidget *widget, gpointer data) ECalComponentAlarm *alarm; alarm = (ECalComponentAlarm *) e_alarm_list_get_alarm (priv->alarm_list_store, &iter); - g_assert (alarm != NULL); + if (alarm == NULL) { + g_warning ("alarm is NULL\n"); + continue; + } e_alarm_list_append (temp_list_store, NULL, alarm); } diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index 46dcdb58b5..d24374991c 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -611,9 +611,9 @@ simple_recur_to_comp (RecurrencePage *rpage, ECalComponent *comp) guint8 day_mask; int i; - g_assert (GTK_BIN (priv->special)->child != NULL); - g_assert (priv->weekday_picker != NULL); - g_assert (IS_WEEKDAY_PICKER (priv->weekday_picker)); + g_return_if_fail (GTK_BIN (priv->special)->child != NULL); + g_return_if_fail (priv->weekday_picker != NULL); + g_return_if_fail (IS_WEEKDAY_PICKER (priv->weekday_picker)); day_mask = weekday_picker_get_days (WEEKDAY_PICKER (priv->weekday_picker)); @@ -647,11 +647,11 @@ simple_recur_to_comp (RecurrencePage *rpage, ECalComponent *comp) enum month_num_options month_num; enum month_day_options month_day; - g_assert (GTK_BIN (priv->special)->child != NULL); - g_assert (priv->month_day_menu != NULL); - g_assert (GTK_IS_OPTION_MENU (priv->month_day_menu)); - g_assert (priv->month_num_menu != NULL); - g_assert (GTK_IS_OPTION_MENU (priv->month_num_menu)); + g_return_if_fail (GTK_BIN (priv->special)->child != NULL); + g_return_if_fail (priv->month_day_menu != NULL); + g_return_if_fail (GTK_IS_OPTION_MENU (priv->month_day_menu)); + g_return_if_fail (priv->month_num_menu != NULL); + g_return_if_fail (GTK_IS_OPTION_MENU (priv->month_num_menu)); month_num = e_dialog_option_menu_get (priv->month_num_menu, month_num_options_map ); @@ -710,7 +710,7 @@ simple_recur_to_comp (RecurrencePage *rpage, ECalComponent *comp) break; default: - g_assert_not_reached (); + g_return_if_reached (); } break; @@ -721,7 +721,7 @@ simple_recur_to_comp (RecurrencePage *rpage, ECalComponent *comp) break; default: - g_assert_not_reached (); + g_return_if_reached (); } /* Ending date */ @@ -731,15 +731,15 @@ simple_recur_to_comp (RecurrencePage *rpage, ECalComponent *comp) switch (ending_type) { case ENDING_FOR: - g_assert (priv->ending_count_spin != NULL); - g_assert (GTK_IS_SPIN_BUTTON (priv->ending_count_spin)); + g_return_if_fail (priv->ending_count_spin != NULL); + g_return_if_fail (GTK_IS_SPIN_BUTTON (priv->ending_count_spin)); r.count = e_dialog_spin_get_int (priv->ending_count_spin); break; case ENDING_UNTIL: - g_assert (priv->ending_date_edit != NULL); - g_assert (E_IS_DATE_EDIT (priv->ending_date_edit)); + g_return_if_fail (priv->ending_date_edit != NULL); + g_return_if_fail (E_IS_DATE_EDIT (priv->ending_date_edit)); /* We only allow a DATE value to be set for the UNTIL property, since we don't support sub-day recurrences. */ @@ -747,7 +747,7 @@ simple_recur_to_comp (RecurrencePage *rpage, ECalComponent *comp) &r.until.year, &r.until.month, &r.until.day); - g_assert (date_set); + g_return_if_fail (date_set); r.until.is_date = 1; @@ -758,7 +758,7 @@ simple_recur_to_comp (RecurrencePage *rpage, ECalComponent *comp) break; default: - g_assert_not_reached (); + g_return_if_reached (); } /* Set the recurrence */ @@ -812,7 +812,7 @@ fill_component (RecurrencePage *rpage, ECalComponent *comp) cdt->value = g_new (struct icaltimetype, 1); dt = e_date_time_list_get_date_time (E_DATE_TIME_LIST (model), &iter); - g_assert (dt != NULL); + g_return_val_if_fail (dt != NULL, FALSE); if (!icaltime_is_valid_time (*dt->value)) { comp_editor_page_display_validation_error (COMP_EDITOR_PAGE (rpage), @@ -919,8 +919,8 @@ make_weekly_special (RecurrencePage *rpage) priv = rpage->priv; - g_assert (GTK_BIN (priv->special)->child == NULL); - g_assert (priv->weekday_picker == NULL); + g_return_if_fail (GTK_BIN (priv->special)->child == NULL); + g_return_if_fail (priv->weekday_picker == NULL); /* Create the widgets */ @@ -1212,8 +1212,8 @@ make_monthly_special (RecurrencePage *rpage) priv = rpage->priv; - g_assert (GTK_BIN (priv->special)->child == NULL); - g_assert (priv->month_day_menu == NULL); + g_return_if_fail (GTK_BIN (priv->special)->child == NULL); + g_return_if_fail (priv->month_day_menu == NULL); /* Create the widgets */ @@ -1307,7 +1307,7 @@ make_recurrence_special (RecurrencePage *rpage) break; default: - g_assert_not_reached (); + g_return_if_reached (); } } @@ -1345,8 +1345,8 @@ make_ending_until_special (RecurrencePage *rpage) priv = rpage->priv; - g_assert (GTK_BIN (priv->ending_special)->child == NULL); - g_assert (priv->ending_date_edit == NULL); + g_return_if_fail (GTK_BIN (priv->ending_special)->child == NULL); + g_return_if_fail (priv->ending_date_edit == NULL); /* Create the widget */ @@ -1402,8 +1402,8 @@ make_ending_count_special (RecurrencePage *rpage) priv = rpage->priv; - g_assert (GTK_BIN (priv->ending_special)->child == NULL); - g_assert (priv->ending_count_spin == NULL); + g_return_if_fail (GTK_BIN (priv->ending_special)->child == NULL); + g_return_if_fail (priv->ending_count_spin == NULL); /* Create the widgets */ @@ -1470,7 +1470,7 @@ make_ending_special (RecurrencePage *rpage) break; default: - g_assert_not_reached (); + g_return_if_reached (); } } @@ -1625,7 +1625,7 @@ recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) /* Down to one rule, so test that one */ - g_assert (len == 1); + g_return_val_if_fail (len == 1, TRUE); r = rrule_list->data; /* Any funky frequency? */ @@ -2172,7 +2172,7 @@ exception_add_cb (GtkWidget *widget, gpointer data) &icaltime.year, &icaltime.month, &icaltime.day); - g_assert (date_set); + g_return_if_fail (date_set); append_exception (rpage, &dt); preview_recur (rpage); |