aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/alarm-notify/alarm-queue.c17
-rw-r--r--calendar/gui/alarm-notify/notify-main.c4
-rw-r--r--calendar/gui/cal-search-bar.c11
-rw-r--r--calendar/gui/calendar-commands.c19
-rw-r--r--calendar/gui/calendar-component.c2
-rw-r--r--calendar/gui/calendar-config.c5
-rw-r--r--calendar/gui/calendar-view-factory.c6
-rw-r--r--calendar/gui/calendar-view.c3
-rw-r--r--calendar/gui/comp-editor-factory.c14
-rw-r--r--calendar/gui/comp-util.c2
-rw-r--r--calendar/gui/dialogs/alarm-dialog.c10
-rw-r--r--calendar/gui/dialogs/comp-editor-page.c6
-rw-r--r--calendar/gui/dialogs/comp-editor-util.c4
-rw-r--r--calendar/gui/dialogs/comp-editor.c4
-rw-r--r--calendar/gui/dialogs/event-page.c22
-rw-r--r--calendar/gui/dialogs/recurrence-page.c58
-rw-r--r--calendar/gui/e-cal-model.c25
-rw-r--r--calendar/gui/e-calendar-table.c2
-rw-r--r--calendar/gui/e-calendar-view.c3
-rw-r--r--calendar/gui/e-day-view.c18
-rw-r--r--calendar/gui/e-itip-control.c11
-rw-r--r--calendar/gui/e-meeting-list-view.c5
-rw-r--r--calendar/gui/e-meeting-store.c2
-rw-r--r--calendar/gui/e-memo-table.c2
-rw-r--r--calendar/gui/e-memos.c8
-rw-r--r--calendar/gui/e-tasks.c8
-rw-r--r--calendar/gui/e-week-view-event-item.c4
-rw-r--r--calendar/gui/e-week-view-layout.c3
-rw-r--r--calendar/gui/e-week-view.c24
-rw-r--r--calendar/gui/gnome-cal.c38
-rw-r--r--calendar/gui/memos-control.c6
-rw-r--r--calendar/gui/print.c2
-rw-r--r--calendar/gui/tasks-control.c12
-rw-r--r--calendar/gui/weekday-picker.c2
34 files changed, 186 insertions, 176 deletions
diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c
index ef2136a24d..28550d55f7 100644
--- a/calendar/gui/alarm-notify/alarm-queue.c
+++ b/calendar/gui/alarm-notify/alarm-queue.c
@@ -431,8 +431,7 @@ alarm_trigger_cb (gpointer alarm_id, time_t trigger, gpointer data)
break;
default:
- g_assert_not_reached ();
- break;
+ g_return_if_reached ();
}
d(printf("%s:%d (alarm_trigger_cb) - Notification sent:%d\n",__FILE__, __LINE__, action));
}
@@ -648,7 +647,7 @@ remove_comp (ClientAlarms *ca, ECalComponentId *id)
/* If a component is present, then it means we must have alarms queued
* for it.
*/
- g_assert (cqa->queued_alarms != NULL);
+ g_return_if_fail (cqa->queued_alarms != NULL);
d(printf("%s:%d (remove_comp) - Removing CQA %p\n",__FILE__, __LINE__, cqa));
remove_alarms (cqa, TRUE);
@@ -1284,7 +1283,7 @@ notify_dialog_cb (AlarmNotifyResult result, int snooze_mins, gpointer data)
break;
default:
- g_assert_not_reached ();
+ g_return_if_reached ();
}
return;
@@ -1657,7 +1656,7 @@ audio_notification (time_t trigger, CompQueuedAlarms *cqa,
return;
alarm = e_cal_component_get_alarm (comp, qa->instance->auid);
- g_assert (alarm != NULL);
+ g_return_if_fail (alarm != NULL);
e_cal_component_alarm_get_attach (alarm, &attach);
e_cal_component_alarm_free (alarm);
@@ -1778,7 +1777,7 @@ procedure_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id
return;
alarm = e_cal_component_get_alarm (comp, qa->instance->auid);
- g_assert (alarm != NULL);
+ g_return_if_fail (alarm != NULL);
e_cal_component_alarm_get_attach (alarm, &attach);
e_cal_component_alarm_get_description (alarm, &description);
@@ -1794,7 +1793,7 @@ procedure_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id
}
url = icalattach_get_url (attach);
- g_assert (url != NULL);
+ g_return_if_fail (url != NULL);
/* Ask for confirmation before executing the stuff */
if (description.value)
@@ -2062,7 +2061,7 @@ remove_cqa (ClientAlarms *ca, ECalComponentId *id, CompQueuedAlarms *cqa)
/* If a component is present, then it means we must have alarms queued
* for it.
*/
- g_assert (cqa->queued_alarms != NULL);
+ g_return_if_fail (cqa->queued_alarms != NULL);
d(printf("%s:%d (remove_cqa) - removing %d alarms\n",__FILE__, __LINE__, g_slist_length(cqa->queued_alarms)));
remove_alarms (cqa, TRUE);
@@ -2093,7 +2092,7 @@ remove_client_alarms (ClientAlarms *ca)
g_hash_table_foreach_remove (ca->uid_alarms_hash, (GHRFunc)remove_comp_by_id, ca);
/* The hash table should be empty now */
- g_assert (g_hash_table_size (ca->uid_alarms_hash) == 0);
+ g_return_if_fail (g_hash_table_size (ca->uid_alarms_hash) == 0);
}
/**
diff --git a/calendar/gui/alarm-notify/notify-main.c b/calendar/gui/alarm-notify/notify-main.c
index 367370aa0c..3a87002c65 100644
--- a/calendar/gui/alarm-notify/notify-main.c
+++ b/calendar/gui/alarm-notify/notify-main.c
@@ -111,7 +111,7 @@ init_session (void)
static BonoboObject *
alarm_notify_factory_fn (BonoboGenericFactory *factory, const char *component_id, void *data)
{
- g_assert (alarm_notify_service != NULL);
+ g_return_val_if_fail (alarm_notify_service != NULL, NULL);
bonobo_object_ref (BONOBO_OBJECT (alarm_notify_service));
return BONOBO_OBJECT (alarm_notify_service);
@@ -122,7 +122,7 @@ static gboolean
init_alarm_service (gpointer user_data)
{
alarm_notify_service = alarm_notify_new ();
- g_assert (alarm_notify_service != NULL);
+ g_return_val_if_fail (alarm_notify_service != NULL, FALSE);
return FALSE;
}
diff --git a/calendar/gui/cal-search-bar.c b/calendar/gui/cal-search-bar.c
index de7d582c0e..4d0f50201c 100644
--- a/calendar/gui/cal-search-bar.c
+++ b/calendar/gui/cal-search-bar.c
@@ -191,7 +191,8 @@ free_categories (GPtrArray *categories)
int i;
for (i = 0; i < categories->len; i++) {
- g_assert (categories->pdata[i] != NULL);
+ if (categories->pdata[i] == NULL)
+ continue;
g_free (categories->pdata[i]);
}
@@ -256,7 +257,7 @@ get_current_category (CalSearchBar *cal_search)
priv = cal_search->priv;
- g_assert (priv->categories != NULL);
+ g_return_val_if_fail (priv->categories != NULL, NULL);
viewid = e_search_bar_get_viewitem_id (E_SEARCH_BAR (cal_search));
@@ -504,7 +505,7 @@ regen_query (CalSearchBar *cal_search)
break;
default:
- g_assert_not_reached ();
+ g_return_if_reached ();
}
g_free (show_option_sexp);
@@ -606,7 +607,7 @@ make_suboptions (CalSearchBar *cal_search)
priv = cal_search->priv;
- g_assert (priv->categories != NULL);
+ g_return_if_fail (priv->categories != NULL);
/* Categories plus "all", "unmatched", separator, terminator */
@@ -869,7 +870,7 @@ cal_search_bar_set_categories (CalSearchBar *cal_search, GPtrArray *categories)
priv = cal_search->priv;
- g_assert (priv->categories != NULL);
+ g_return_if_fail (priv->categories != NULL);
free_categories (priv->categories);
priv->categories = sort_categories (categories);
diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c
index 4b60ba19f2..640c0fc096 100644
--- a/calendar/gui/calendar-commands.c
+++ b/calendar/gui/calendar-commands.c
@@ -364,7 +364,10 @@ sensitize_items(BonoboUIComponent *uic, struct _sensitize_item *items, guint32 m
while (items->command) {
char command[32];
- g_assert(strlen(items->command)<21);
+ if (strlen(items->command)>=21) {
+ g_warning ("items->command >= 21: %s\n", items->command);
+ continue;
+ }
sprintf(command, "/commands/%s", items->command);
bonobo_ui_component_set_prop (uic, command, "sensitive",
@@ -402,7 +405,7 @@ calendar_control_sensitize_calendar_commands (BonoboControl *control, GnomeCalen
ECalMenuTargetSelect *t;
uic = bonobo_control_get_ui_component (control);
- g_assert (uic != NULL);
+ g_return_if_fail (uic != NULL);
if (bonobo_ui_component_get_container (uic) == CORBA_OBJECT_NIL)
return;
@@ -461,7 +464,7 @@ sensitize_taskpad_commands (GnomeCalendar *gcal, BonoboControl *control, gboolea
ECalMenuTargetSelect *t;
uic = bonobo_control_get_ui_component (control);
- g_assert (uic != NULL);
+ g_return_if_fail (uic != NULL);
menu = gnome_calendar_get_calendar_menu (gcal);
task_pad = gnome_calendar_get_task_pad(gcal);
@@ -513,7 +516,7 @@ gcal_calendar_focus_change_cb (GnomeCalendar *gcal, gboolean in, gpointer data)
control = BONOBO_CONTROL (data);
focus = g_object_get_data (G_OBJECT (control), "focus_data");
- g_assert (focus != NULL);
+ g_return_if_fail (focus != NULL);
if (in) {
g_signal_connect (gcal, "calendar_selection_changed",
@@ -539,7 +542,7 @@ gcal_taskpad_focus_change_cb (GnomeCalendar *gcal, gboolean in, gpointer data)
control = BONOBO_CONTROL (data);
focus = g_object_get_data (G_OBJECT (control), "focus_data");
- g_assert (focus != NULL);
+ g_return_if_fail (focus != NULL);
if (in) {
g_signal_connect (gcal, "taskpad_selection_changed",
@@ -613,7 +616,7 @@ calendar_control_activate (BonoboControl *control,
gchar *xmlfile;
uic = bonobo_control_get_ui_component (control);
- g_assert (uic != NULL);
+ g_return_if_fail (uic != NULL);
remote_uih = bonobo_control_get_remote_ui_container (control, NULL);
bonobo_ui_component_set_container (uic, remote_uih, NULL);
@@ -665,7 +668,7 @@ calendar_control_deactivate (BonoboControl *control, GnomeCalendar *gcal)
BonoboUIComponent *uic;
uic = bonobo_control_get_ui_component (control);
- g_assert (uic != NULL);
+ g_return_if_fail (uic != NULL);
e_menu_activate((EMenu *)gnome_calendar_get_calendar_menu (gcal), uic, 0);
e_menu_activate((EMenu *)gnome_calendar_get_taskpad_menu (gcal), uic, 0);
@@ -673,7 +676,7 @@ calendar_control_deactivate (BonoboControl *control, GnomeCalendar *gcal)
gnome_calendar_set_ui_component (gcal, NULL);
focus = g_object_get_data (G_OBJECT (control), "focus_data");
- g_assert (focus != NULL);
+ g_return_if_fail (focus != NULL);
g_object_set_data (G_OBJECT (control), "focus_data", NULL);
g_free (focus);
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c
index b2eb840663..2e8d07d28d 100644
--- a/calendar/gui/calendar-component.c
+++ b/calendar/gui/calendar-component.c
@@ -782,7 +782,7 @@ set_info (CalendarComponentView *component_view)
}
break;
default:
- g_assert_not_reached ();
+ g_return_if_reached ();
}
e_info_label_set_info (component_view->info_label, _("Calendar"), buffer);
diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c
index 141a44a57e..ab007bfa2d 100644
--- a/calendar/gui/calendar-config.c
+++ b/calendar/gui/calendar-config.c
@@ -110,8 +110,7 @@ units_to_string (CalUnits units)
return "minutes";
default:
- g_assert_not_reached ();
- return NULL;
+ g_return_val_if_reached (NULL);
}
}
@@ -1561,7 +1560,7 @@ calendar_config_get_hide_completed_tasks_sexp (gboolean get_completed)
icaltime_adjust (&tt, 0, 0, -value, 0);
break;
default:
- g_assert_not_reached ();
+ g_return_val_if_reached (NULL);
}
t = icaltime_as_timet_with_zone (tt, zone);
diff --git a/calendar/gui/calendar-view-factory.c b/calendar/gui/calendar-view-factory.c
index 09a4ad9e4f..563803ae5d 100644
--- a/calendar/gui/calendar-view-factory.c
+++ b/calendar/gui/calendar-view-factory.c
@@ -118,8 +118,7 @@ calendar_view_factory_get_title (GalViewFactory *factory)
return _("Month View");
default:
- g_assert_not_reached ();
- return NULL;
+ g_return_val_if_reached (NULL);
}
}
@@ -147,8 +146,7 @@ calendar_view_factory_get_type_code (GalViewFactory *factory)
return "month_view";
default:
- g_assert_not_reached ();
- return NULL;
+ g_return_val_if_reached (NULL);
}
}
diff --git a/calendar/gui/calendar-view.c b/calendar/gui/calendar-view.c
index ab2e92aa82..e75a81052b 100644
--- a/calendar/gui/calendar-view.c
+++ b/calendar/gui/calendar-view.c
@@ -175,8 +175,7 @@ calendar_view_get_type_code (GalView *view)
return "month_view";
default:
- g_assert_not_reached ();
- return NULL;
+ g_return_val_if_reached (NULL);
}
}
diff --git a/calendar/gui/comp-editor-factory.c b/calendar/gui/comp-editor-factory.c
index 148f1093c0..95216604c8 100644
--- a/calendar/gui/comp-editor-factory.c
+++ b/calendar/gui/comp-editor-factory.c
@@ -145,10 +145,8 @@ comp_editor_factory_init (CompEditorFactory *factory)
static void
free_request (Request *r)
{
- if (r->type == REQUEST_EXISTING) {
- g_assert (r->u.existing.uid != NULL);
+ if (r->type == REQUEST_EXISTING)
g_free (r->u.existing.uid);
- }
g_free (r);
}
@@ -228,7 +226,7 @@ editor_destroy_cb (GtkObject *object, gpointer data)
oc->editor_count--;
/* See if we need to free the client */
- g_assert (oc->pending == NULL);
+ g_return_if_fail (oc->pending == NULL);
if (oc->editor_count != 0)
return;
@@ -247,7 +245,7 @@ edit_existing (OpenClient *oc, const char *uid)
ECalComponentVType vtype;
CompEditorFlags flags = { 0, };
- g_assert (oc->open);
+ g_return_if_fail (oc->open);
/* Get the object */
if (!e_cal_get_object (oc->client, uid, NULL, &icalcomp, NULL)) {
@@ -334,7 +332,7 @@ edit_new (OpenClient *oc, const GNOME_Evolution_Calendar_CompEditorFactory_CompE
comp = get_default_task (oc->client);
break;
default:
- g_assert_not_reached ();
+ g_return_if_reached ();
return;
}
@@ -531,7 +529,7 @@ queue_edit_existing (OpenClient *oc, const char *uid)
{
Request *request;
- g_assert (!oc->open);
+ g_return_if_fail (!oc->open);
request = g_new (Request, 1);
request->type = REQUEST_EXISTING;
@@ -587,7 +585,7 @@ queue_edit_new (OpenClient *oc, const GNOME_Evolution_Calendar_CompEditorFactory
{
Request *request;
- g_assert (!oc->open);
+ g_return_if_fail (!oc->open);
request = g_new (Request, 1);
request->type = REQUEST_NEW;
diff --git a/calendar/gui/comp-util.c b/calendar/gui/comp-util.c
index 67b90ab70b..61f2260949 100644
--- a/calendar/gui/comp-util.c
+++ b/calendar/gui/comp-util.c
@@ -310,7 +310,7 @@ cal_comp_event_new_with_defaults (ECal *client)
break;
default:
- g_assert_not_reached ();
+ g_warning ("wrong units %d\n", units);
}
e_cal_component_alarm_set_trigger (alarm, trigger);
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);
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index eb069760d4..a86c893cc6 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -202,7 +202,10 @@ clear_objects_array (ECalModelPrivate *priv)
ECalModelComponent *comp_data;
comp_data = g_ptr_array_index (priv->objects, i);
- g_assert (comp_data != NULL);
+ if (comp_data == NULL) {
+ g_warning ("comp_data is null\n");
+ continue;
+ }
e_cal_model_free_component_data (comp_data);
}
@@ -441,7 +444,7 @@ ecm_value_at (ETableModel *etm, int col, int row)
g_return_val_if_fail (row >= 0 && row < priv->objects->len, NULL);
comp_data = g_ptr_array_index (priv->objects, row);
- g_assert (comp_data != NULL);
+ g_return_val_if_fail (comp_data != NULL, NULL);
switch (col) {
case E_CAL_MODEL_FIELD_CATEGORIES :
@@ -679,7 +682,7 @@ ecm_set_value_at (ETableModel *etm, int col, int row, const void *value)
g_return_if_fail (row >= 0 && row < priv->objects->len);
comp_data = g_ptr_array_index (priv->objects, row);
- g_assert (comp_data != NULL);
+ g_return_if_fail (comp_data != NULL);
switch (col) {
case E_CAL_MODEL_FIELD_CATEGORIES :
@@ -1171,10 +1174,12 @@ e_cal_model_set_default_client (ECalModel *model, ECal *client)
if (priv->default_client) {
client_data = find_client_data (model, priv->default_client);
- g_assert (client_data);
-
- if (!client_data->do_query)
- remove_client (model, client_data);
+ if (!client_data) {
+ g_warning ("client_data is NULL\n");
+ } else {
+ if (!client_data->do_query)
+ remove_client (model, client_data);
+ }
}
/* Make sure its in the model */
@@ -1499,7 +1504,7 @@ update_e_cal_view_for_client (ECalModel *model, ECalModelClient *client_data)
}
/* prepare the query */
- g_assert (priv->full_sexp != NULL);
+ g_return_if_fail (priv->full_sexp != NULL);
/* Don't create the new query if we won't use it */
if (!client_data->do_query)
@@ -1551,7 +1556,7 @@ cal_opened_cb (ECal *client, ECalendarStatus status, gpointer user_data)
g_signal_handlers_disconnect_matched (client, G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, 0, 0, NULL, cal_opened_cb, model);
client_data = find_client_data (model, client);
- g_assert (client_data);
+ g_return_if_fail (client_data);
update_e_cal_view_for_client (model, client_data);
}
@@ -1620,7 +1625,7 @@ remove_client_objects (ECalModel *model, ECalModelClient *client_data)
for (i = model->priv->objects->len; i > 0; i--) {
ECalModelComponent *comp_data = (ECalModelComponent *) g_ptr_array_index (model->priv->objects, i - 1);
- g_assert (comp_data != NULL);
+ g_return_if_fail (comp_data != NULL);
if (comp_data->client == client_data->client) {
e_table_model_pre_change (E_TABLE_MODEL (model));
diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c
index a7f22c1125..64c8c5660f 100644
--- a/calendar/gui/e-calendar-table.c
+++ b/calendar/gui/e-calendar-table.c
@@ -666,7 +666,7 @@ e_calendar_table_get_selected_comp (ECalendarTable *cal_table)
e_table_selected_row_foreach (etable,
get_selected_row_cb,
&row);
- g_assert (row != -1);
+ g_return_val_if_fail (row != -1, NULL);
return e_cal_model_get_component_at (cal_table->model, row);
}
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index b0cdb92204..f52d05d4d6 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -339,8 +339,7 @@ e_calendar_view_add_event (ECalendarView *cal_view, ECal *client, time_t dtstart
}
break;
default:
- g_assert_not_reached ();
- return;
+ g_return_if_reached ();
}
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 044686db7d..7aeed7e4eb 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -544,7 +544,7 @@ update_row (EDayView *day_view, int row)
model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view));
comp_data = e_cal_model_get_component_at (model, row);
- g_assert (comp_data != NULL);
+ g_return_if_fail (comp_data != NULL);
process_component (day_view, comp_data);
gtk_widget_queue_draw (day_view->top_canvas);
@@ -582,7 +582,10 @@ model_rows_inserted_cb (ETableModel *etm, int row, int count, gpointer user_data
ECalModelComponent *comp_data;
comp_data = e_cal_model_get_component_at (model, row + i);
- g_assert (comp_data != NULL);
+ if (comp_data == NULL) {
+ g_warning ("comp_data is NULL\n");
+ continue;
+ }
process_component (day_view, comp_data);
}
@@ -3488,8 +3491,7 @@ e_day_view_convert_event_coords (EDayView *day_view,
break;
default:
/* Shouldn't get here. */
- g_assert_not_reached ();
- return FALSE;
+ g_return_val_if_reached (FALSE);
}
while (event_window && event_window != window
@@ -4185,7 +4187,7 @@ e_day_view_update_query (EDayView *day_view)
ECalModelComponent *comp_data;
comp_data = e_cal_model_get_component_at (e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)), r);
- g_assert (comp_data != NULL);
+ g_return_if_fail (comp_data != NULL);
process_component (day_view, comp_data);
}
}
@@ -7010,7 +7012,7 @@ cancel_editing (EDayView *day_view)
day = day_view->editing_event_day;
event_num = day_view->editing_event_num;
- g_assert (day != -1);
+ g_return_if_fail (day != -1);
if (day == E_DAY_VIEW_LONG_EVENT)
event = &g_array_index (day_view->long_events, EDayViewEvent, event_num);
@@ -7613,7 +7615,7 @@ e_day_view_on_editing_stopped (EDayView *day_view,
g_object_get (G_OBJECT (event->canvas_item),
"text", &text,
NULL);
- g_assert (text != NULL);
+ g_return_if_fail (text != NULL);
comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
@@ -7770,7 +7772,7 @@ e_day_view_on_editing_stopped (EDayView *day_view,
g_object_get (G_OBJECT (event->canvas_item),
"text", &text,
NULL);
- g_assert (text != NULL);
+ g_return_if_fail (text != NULL);
comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c
index 002b7d92bf..aac6beebcf 100644
--- a/calendar/gui/e-itip-control.c
+++ b/calendar/gui/e-itip-control.c
@@ -285,7 +285,7 @@ find_cal_opened_cb (ECal *ecal, ECalendarStatus status, gpointer data)
break;
default:
uid = NULL;
- g_assert_not_reached ();
+ g_return_if_reached ();
}
if (uid) {
@@ -844,7 +844,7 @@ write_recurrence_piece (EItipControl *itip, ECalComponent *comp,
break;
default:
- g_assert_not_reached ();
+ g_return_if_reached ();
}
len = strlen (buffer);
@@ -1257,8 +1257,7 @@ get_cancel_options (gboolean found, icalcomponent_kind kind)
case ICAL_VTODO_COMPONENT:
return g_strdup_printf ("<i>%s</i>", _("The task has been canceled, however it could not be found in your task lists"));
default:
- g_assert_not_reached ();
- return NULL;
+ g_return_val_if_reached (NULL);
}
}
@@ -1612,7 +1611,7 @@ show_current (EItipControl *itip)
trigger.u.rel_duration.days = interval;
break;
default:
- g_assert_not_reached ();
+ g_return_if_reached ();
}
e_cal_component_alarm_set_trigger (acomp, trigger);
@@ -2541,7 +2540,7 @@ ok_clicked_cb (GtkWidget *widget, gpointer data)
if (priv->my_address == NULL)
find_my_address (itip, priv->ical_comp, NULL);
- g_assert (priv->my_address != NULL);
+ g_return_if_fail (priv->my_address != NULL);
ical_comp = e_cal_component_get_icalcomponent (comp);
diff --git a/calendar/gui/e-meeting-list-view.c b/calendar/gui/e-meeting-list-view.c
index f36d5b9485..b645c70c21 100644
--- a/calendar/gui/e-meeting-list-view.c
+++ b/calendar/gui/e-meeting-list-view.c
@@ -850,7 +850,10 @@ name_selector_dialog_close_cb (ENameSelectorDialog *dialog, gint response, gpoin
e_name_selector_model_peek_section (name_selector_model, sections [i],
NULL, &destination_store);
- g_assert (destination_store);
+ if (!destination_store) {
+ g_warning ("destination store is NULL\n");
+ continue;
+ }
destinations = e_destination_store_list_destinations (destination_store);
process_section (view, destinations, roles [i], &la);
diff --git a/calendar/gui/e-meeting-store.c b/calendar/gui/e-meeting-store.c
index 30326012e5..90c29b7159 100644
--- a/calendar/gui/e-meeting-store.c
+++ b/calendar/gui/e-meeting-store.c
@@ -1242,7 +1242,7 @@ refresh_busy_periods (gpointer data)
/* Check to see if there are any remaining attendees in the queue */
for (i = 0; i < priv->refresh_queue->len; i++) {
attendee = g_ptr_array_index (priv->refresh_queue, i);
- g_assert (attendee != NULL);
+ g_return_val_if_fail (attendee != NULL, FALSE);
qdata = g_hash_table_lookup (priv->refresh_data, itip_strip_mailto (e_meeting_attendee_get_address (attendee)));
if (!qdata)
diff --git a/calendar/gui/e-memo-table.c b/calendar/gui/e-memo-table.c
index 02eef44364..eb7ce3c879 100644
--- a/calendar/gui/e-memo-table.c
+++ b/calendar/gui/e-memo-table.c
@@ -444,7 +444,7 @@ get_selected_comp (EMemoTable *memo_table)
e_table_selected_row_foreach (etable,
get_selected_row_cb,
&row);
- g_assert (row != -1);
+ g_return_val_if_fail (row != -1, NULL);
return e_cal_model_get_component_at (memo_table->model, row);
}
diff --git a/calendar/gui/e-memos.c b/calendar/gui/e-memos.c
index a9955442e1..c04453d5d5 100644
--- a/calendar/gui/e-memos.c
+++ b/calendar/gui/e-memos.c
@@ -1082,8 +1082,8 @@ e_memos_setup_view_menus (EMemos *memos, BonoboUIComponent *uic)
g_return_if_fail (priv->view_instance == NULL);
- g_assert (priv->view_instance == NULL);
- g_assert (priv->view_menus == NULL);
+ g_return_if_fail (priv->view_instance == NULL);
+ g_return_if_fail (priv->view_menus == NULL);
/* Create the view instance */
@@ -1152,8 +1152,8 @@ e_memos_discard_view_menus (EMemos *memos)
g_return_if_fail (priv->view_instance != NULL);
- g_assert (priv->view_instance != NULL);
- g_assert (priv->view_menus != NULL);
+ g_return_if_fail (priv->view_instance != NULL);
+ g_return_if_fail (priv->view_menus != NULL);
g_object_unref (priv->view_instance);
priv->view_instance = NULL;
diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c
index a1f8cecd99..235f8cb9d9 100644
--- a/calendar/gui/e-tasks.c
+++ b/calendar/gui/e-tasks.c
@@ -1346,8 +1346,8 @@ e_tasks_setup_view_menus (ETasks *tasks, BonoboUIComponent *uic)
g_return_if_fail (priv->view_instance == NULL);
- g_assert (priv->view_instance == NULL);
- g_assert (priv->view_menus == NULL);
+ g_return_if_fail (priv->view_instance == NULL);
+ g_return_if_fail (priv->view_menus == NULL);
/* Create the view instance */
@@ -1415,9 +1415,7 @@ e_tasks_discard_view_menus (ETasks *tasks)
priv = tasks->priv;
g_return_if_fail (priv->view_instance != NULL);
-
- g_assert (priv->view_instance != NULL);
- g_assert (priv->view_menus != NULL);
+ g_return_if_fail (priv->view_menus != NULL);
g_object_unref (priv->view_instance);
priv->view_instance = NULL;
diff --git a/calendar/gui/e-week-view-event-item.c b/calendar/gui/e-week-view-event-item.c
index 8a7bbb860a..e786d5a741 100644
--- a/calendar/gui/e-week-view-event-item.c
+++ b/calendar/gui/e-week-view-event-item.c
@@ -325,7 +325,7 @@ e_week_view_event_item_draw (GnomeCanvasItem *canvas_item,
draw_end = FALSE;
break;
default:
- g_assert_not_reached();
+ g_return_if_reached();
draw_start = FALSE;
draw_end = FALSE;
break;
@@ -981,7 +981,7 @@ e_week_view_event_item_draw (GnomeCanvasItem *canvas_item,
draw_end = FALSE;
break;
default:
- g_assert_not_reached();
+ g_return_if_reached ();
draw_start = FALSE;
draw_end = FALSE;
break;
diff --git a/calendar/gui/e-week-view-layout.c b/calendar/gui/e-week-view-layout.c
index c2089a7f91..3f7ee03011 100644
--- a/calendar/gui/e-week-view-layout.c
+++ b/calendar/gui/e-week-view-layout.c
@@ -243,8 +243,7 @@ e_week_view_find_day (time_t time_to_find,
}
}
- g_assert_not_reached ();
- return days_shown;
+ g_return_val_if_reached (days_shown);
}
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 0454008a4f..b054130e4a 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -338,7 +338,7 @@ update_row (EWeekView *week_view, int row)
model = e_calendar_view_get_model (E_CALENDAR_VIEW (week_view));
comp_data = e_cal_model_get_component_at (model, row);
- g_assert (comp_data != NULL);
+ g_return_if_fail (comp_data != NULL);
process_component (week_view, comp_data);
gtk_widget_queue_draw (week_view->main_canvas);
@@ -374,7 +374,10 @@ model_rows_inserted_cb (ETableModel *etm, int row, int count, gpointer user_data
ECalModelComponent *comp_data;
comp_data = e_cal_model_get_component_at (model, row + i);
- g_assert (comp_data != NULL);
+ if (comp_data == NULL) {
+ g_warning ("comp_data is NULL\n");
+ continue;
+ }
process_component (week_view, comp_data);
}
@@ -1323,7 +1326,10 @@ e_week_view_update_query (EWeekView *week_view)
ECalModelComponent *comp_data;
comp_data = e_cal_model_get_component_at (e_calendar_view_get_model (E_CALENDAR_VIEW (week_view)), r);
- g_assert (comp_data != NULL);
+ if (comp_data == NULL) {
+ g_warning ("comp_data is NULL\n");
+ continue;
+ }
process_component (week_view, comp_data);
}
}
@@ -2971,7 +2977,7 @@ e_week_view_start_editing_event (EWeekView *week_view,
if (event->comp_data == comp_data)
break;
}
- g_assert (event_num >= 0);
+ g_return_val_if_fail (event_num >= 0, FALSE);
}
span = &g_array_index (week_view->spans, EWeekViewEventSpan, event->spans_index + span_num);
@@ -3017,7 +3023,7 @@ cancel_editing (EWeekView *week_view)
event_num = week_view->editing_event_num;
span_num = week_view->editing_span_num;
- g_assert (event_num != -1);
+ g_return_if_fail (event_num != -1);
event = &g_array_index (week_view->events, EWeekViewEvent, event_num);
span = &g_array_index (week_view->spans, EWeekViewEventSpan, event->spans_index + span_num);
@@ -3798,7 +3804,7 @@ e_week_view_cursor_key_up (EWeekView *week_view, GnomeCalendarViewType view_type
e_month_view_do_cursor_key_up (week_view);
break;
default:
- g_assert_not_reached ();
+ g_return_if_reached ();
}
}
@@ -3813,7 +3819,7 @@ e_week_view_cursor_key_down (EWeekView *week_view, GnomeCalendarViewType view_ty
e_month_view_do_cursor_key_down (week_view);
break;
default:
- g_assert_not_reached ();
+ g_return_if_reached ();
}
}
@@ -3828,7 +3834,7 @@ e_week_view_cursor_key_left (EWeekView *week_view, GnomeCalendarViewType view_ty
e_month_view_do_cursor_key_left (week_view);
break;
default:
- g_assert_not_reached ();
+ g_return_if_reached ();
}
}
@@ -3843,7 +3849,7 @@ e_week_view_cursor_key_right (EWeekView *week_view, GnomeCalendarViewType view_t
e_month_view_do_cursor_key_right (week_view);
break;
default:
- g_assert_not_reached ();
+ g_return_if_reached ();
}
}
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 29af350e96..81b8893bfa 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -675,8 +675,7 @@ get_times_for_views (GnomeCalendar *gcal, GnomeCalendarViewType view_type, time_
*end_time = time_add_month_with_zone (*start_time, 1, priv->zone);
break;
default:
- g_assert_not_reached ();
- return;
+ g_return_if_reached ();
}
}
@@ -738,8 +737,7 @@ get_focus_location (GnomeCalendar *gcal)
return FOCUS_OTHER;
default:
- g_assert_not_reached ();
- return FOCUS_OTHER;
+ g_return_val_if_reached (FOCUS_OTHER);
}
}
}
@@ -839,7 +837,7 @@ update_query (GnomeCalendar *gcal)
g_list_free (priv->dn_queries);
priv->dn_queries = NULL;
- g_assert (priv->sexp != NULL);
+ g_return_if_fail (priv->sexp != NULL);
real_sexp = adjust_e_cal_view_sexp (gcal, priv->sexp);
if (!real_sexp) {
@@ -2058,8 +2056,7 @@ gnome_calendar_direction (GnomeCalendar *gcal, int direction)
priv->base_view_time = time_add_month_with_zone (priv->base_view_time, direction, priv->zone);
break;
default:
- g_assert_not_reached ();
- return;
+ g_return_if_reached ();
}
update_view_times (gcal, priv->base_view_time);
@@ -2170,8 +2167,7 @@ set_view (GnomeCalendar *gcal, GnomeCalendarViewType view_type, gboolean range_s
break;
default:
- g_assert_not_reached ();
- return;
+ g_return_if_reached ();
}
priv->range_selected = range_selected;
@@ -2249,8 +2245,7 @@ display_view (GnomeCalendar *gcal, GnomeCalendarViewType view_type, gboolean gra
break;
default:
- g_assert_not_reached ();
- return;
+ g_return_if_reached ();
}
priv->current_view_type = view_type;
@@ -2342,8 +2337,8 @@ gnome_calendar_setup_view_menus (GnomeCalendar *gcal, BonoboUIComponent *uic)
priv = gcal->priv;
- g_assert (priv->view_instance == NULL);
- g_assert (priv->view_menus == NULL);
+ g_return_if_fail (priv->view_instance == NULL);
+ g_return_if_fail (priv->view_menus == NULL);
/* Create the view instance */
if (collection == NULL) {
@@ -2426,8 +2421,8 @@ gnome_calendar_discard_view_menus (GnomeCalendar *gcal)
priv = gcal->priv;
- g_assert (priv->view_instance != NULL);
- g_assert (priv->view_menus != NULL);
+ g_return_if_fail (priv->view_instance != NULL);
+ g_return_if_fail (priv->view_menus != NULL);
g_object_unref (priv->view_instance);
priv->view_instance = NULL;
@@ -2683,8 +2678,7 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal)
e_memo_table_set_status_message (E_MEMO_TABLE (priv->memo), NULL);
break;
default:
- g_assert_not_reached ();
- return;
+ g_return_if_reached ();
}
}
@@ -2796,8 +2790,8 @@ open_ecal (GnomeCalendar *gcal, ECal *cal, gboolean only_if_exists, open_func of
e_memo_table_set_status_message (E_MEMO_TABLE (priv->memo), msg);
break;
default:
- g_assert_not_reached ();
- break;
+ g_free (msg);
+ g_return_val_if_reached (FALSE);
}
g_free (msg);
@@ -2880,8 +2874,7 @@ backend_died_cb (ECal *ecal, gpointer data)
gtk_signal_emit (GTK_OBJECT (gcal), gnome_calendar_signals[SOURCE_REMOVED], source_type, source);
break;
default:
- g_assert_not_reached ();
- return;
+ g_return_if_reached ();
}
g_object_unref (source);
@@ -3128,8 +3121,7 @@ gnome_calendar_remove_source_by_uid (GnomeCalendar *gcal, ECalSourceType source_
break;
default:
- g_assert_not_reached ();
- break;
+ g_return_val_if_reached (TRUE);
}
g_hash_table_remove (priv->clients[source_type], uid);
diff --git a/calendar/gui/memos-control.c b/calendar/gui/memos-control.c
index 90b7fba3ad..1ecdf82127 100644
--- a/calendar/gui/memos-control.c
+++ b/calendar/gui/memos-control.c
@@ -132,7 +132,7 @@ memos_control_sensitize_commands (BonoboControl *control, EMemos *memos, int n_s
ECalModel *model;
uic = bonobo_control_get_ui_component (control);
- g_assert (uic != NULL);
+ g_return_if_fail (uic != NULL);
if (bonobo_ui_component_get_container (uic) == CORBA_OBJECT_NIL)
return;
@@ -194,7 +194,7 @@ memos_control_activate (BonoboControl *control, EMemos *memos)
char *xmlfile;
uic = bonobo_control_get_ui_component (control);
- g_assert (uic != NULL);
+ g_return_if_fail (uic != NULL);
remote_uih = bonobo_control_get_remote_ui_container (control, NULL);
bonobo_ui_component_set_container (uic, remote_uih, NULL);
@@ -236,7 +236,7 @@ memos_control_deactivate (BonoboControl *control, EMemos *memos)
{
BonoboUIComponent *uic = bonobo_control_get_ui_component (control);
- g_assert (uic != NULL);
+ g_return_if_fail (uic != NULL);
e_memos_set_ui_component (memos, NULL);
diff --git a/calendar/gui/print.c b/calendar/gui/print.c
index 7819a40953..ccdc894f7f 100644
--- a/calendar/gui/print.c
+++ b/calendar/gui/print.c
@@ -2214,7 +2214,7 @@ print_calendar_draw_page (GtkPrintOperation *operation,
print_month_view (context, pcali->gcal, pcali->start);
break;
default:
- g_assert_not_reached ();
+ g_return_if_reached ();
}
}
diff --git a/calendar/gui/tasks-control.c b/calendar/gui/tasks-control.c
index 8a49dacca6..53637048c6 100644
--- a/calendar/gui/tasks-control.c
+++ b/calendar/gui/tasks-control.c
@@ -153,7 +153,11 @@ sensitize_items(BonoboUIComponent *uic, struct _tasks_sensitize_item *items, gui
while (items->command) {
char command[32];
- g_assert(strlen(items->command)<21);
+ if (strlen(items->command)>=21) {
+ g_warning ("Size more than 21: %s\n", items->command);
+ continue;
+ }
+
sprintf(command, "/commands/%s", items->command);
bonobo_ui_component_set_prop (uic, command, "sensitive",
@@ -193,7 +197,7 @@ tasks_control_sensitize_commands (BonoboControl *control, ETasks *tasks, int n_s
ECalendarTable *cal_table;
uic = bonobo_control_get_ui_component (control);
- g_assert (uic != NULL);
+ g_return_if_fail (uic != NULL);
if (bonobo_ui_component_get_container (uic) == CORBA_OBJECT_NIL)
return;
@@ -265,7 +269,7 @@ tasks_control_activate (BonoboControl *control, ETasks *tasks)
char *xmlfile;
uic = bonobo_control_get_ui_component (control);
- g_assert (uic != NULL);
+ g_return_if_fail (uic != NULL);
remote_uih = bonobo_control_get_remote_ui_container (control, NULL);
bonobo_ui_component_set_container (uic, remote_uih, NULL);
@@ -321,7 +325,7 @@ tasks_control_deactivate (BonoboControl *control, ETasks *tasks)
{
BonoboUIComponent *uic = bonobo_control_get_ui_component (control);
- g_assert (uic != NULL);
+ g_return_if_fail (uic != NULL);
e_menu_activate ((EMenu *)e_tasks_get_tasks_menu (tasks), uic, 0);
e_tasks_set_ui_component (tasks, NULL);
diff --git a/calendar/gui/weekday-picker.c b/calendar/gui/weekday-picker.c
index 54e204c493..cab6f9977d 100644
--- a/calendar/gui/weekday-picker.c
+++ b/calendar/gui/weekday-picker.c
@@ -185,7 +185,7 @@ day_event_cb (GnomeCanvasItem *item, GdkEvent *event, gpointer data)
if (priv->boxes[i] == item || priv->labels[i] == item)
break;
- g_assert (i != 7);
+ g_return_val_if_fail (i != 7, TRUE);
i += priv->week_start_day;
if (i >= 7)