From 274697623e2a6749a3b173c28f4832d9e88019e3 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 12 Feb 2011 11:37:05 -0500 Subject: Remove NULL checks for GObject methods. As of GLib 2.28 all GObject virtual methods, including constructed(), are safe to chain up to unconditionally. Remove unnecessary checks. --- calendar/gui/calendar-view-factory.c | 4 ++-- calendar/gui/calendar-view.c | 4 ++-- calendar/gui/dialogs/comp-editor.c | 3 +-- calendar/gui/dialogs/e-delegate-dialog.c | 4 ++-- calendar/gui/dialogs/event-editor.c | 4 ++-- calendar/gui/dialogs/memo-editor.c | 4 ++-- calendar/gui/dialogs/task-editor.c | 4 ++-- calendar/gui/e-alarm-list.c | 13 ------------- calendar/gui/e-cal-list-view.c | 4 ++-- calendar/gui/e-cal-model-calendar.c | 4 ++-- calendar/gui/e-cal-model-memos.c | 4 ++-- calendar/gui/e-cal-model.c | 7 +++---- calendar/gui/e-calendar-view.c | 3 +-- calendar/gui/e-day-view.c | 4 ++-- calendar/gui/e-meeting-attendee.c | 4 ++-- calendar/gui/e-meeting-list-view.c | 4 ++-- calendar/gui/e-meeting-time-sel.c | 4 ++-- calendar/gui/e-memo-table.c | 4 ++-- calendar/gui/e-select-names-editable.c | 8 ++++---- calendar/gui/e-select-names-renderer.c | 8 ++++---- calendar/gui/e-task-table.c | 4 ++-- calendar/gui/e-week-view.c | 4 ++-- calendar/gui/ea-cal-view-event.c | 4 ++-- calendar/gui/gnome-cal.c | 4 ++-- calendar/gui/weekday-picker.c | 3 +-- 25 files changed, 50 insertions(+), 67 deletions(-) (limited to 'calendar') diff --git a/calendar/gui/calendar-view-factory.c b/calendar/gui/calendar-view-factory.c index 16f2790cfe..bd08d93f09 100644 --- a/calendar/gui/calendar-view-factory.c +++ b/calendar/gui/calendar-view-factory.c @@ -96,8 +96,8 @@ calendar_view_factory_finalize (GObject *object) g_free (priv); cal_view_factory->priv = NULL; - if (G_OBJECT_CLASS (calendar_view_factory_parent_class)->finalize) - (* G_OBJECT_CLASS (calendar_view_factory_parent_class)->finalize) (object); + /* Chain up to parent's finalize() method. */ + G_OBJECT_CLASS (calendar_view_factory_parent_class)->finalize (object); } diff --git a/calendar/gui/calendar-view.c b/calendar/gui/calendar-view.c index 0687fe9817..78b0b15716 100644 --- a/calendar/gui/calendar-view.c +++ b/calendar/gui/calendar-view.c @@ -106,8 +106,8 @@ calendar_view_finalize (GObject *object) g_free (priv); cal_view->priv = NULL; - if (G_OBJECT_CLASS (calendar_view_parent_class)->finalize) - (* G_OBJECT_CLASS (calendar_view_parent_class)->finalize) (object); + /* Chain up to parent's finalize() method. */ + G_OBJECT_CLASS (calendar_view_parent_class)->finalize (object); } diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index eaecd1b8e8..846be18152 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -1522,8 +1522,7 @@ comp_editor_constructed (GObject *object) e_extensible_load_extensions (E_EXTENSIBLE (object)); /* Chain up to parent's constructed() method. */ - if (G_OBJECT_CLASS (comp_editor_parent_class)->constructed) - G_OBJECT_CLASS (comp_editor_parent_class)->constructed (object); + G_OBJECT_CLASS (comp_editor_parent_class)->constructed (object); } static void diff --git a/calendar/gui/dialogs/e-delegate-dialog.c b/calendar/gui/dialogs/e-delegate-dialog.c index b45f587d57..2bca1c908b 100644 --- a/calendar/gui/dialogs/e-delegate-dialog.c +++ b/calendar/gui/dialogs/e-delegate-dialog.c @@ -108,8 +108,8 @@ e_delegate_dialog_finalize (GObject *object) g_free (priv); edd->priv = NULL; - if (G_OBJECT_CLASS (e_delegate_dialog_parent_class)->finalize) - (* G_OBJECT_CLASS (e_delegate_dialog_parent_class)->finalize) (object); + /* Chain up to parent's finalize() method. */ + G_OBJECT_CLASS (e_delegate_dialog_parent_class)->finalize (object); } EDelegateDialog * diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 260778d83a..7ee860f457 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -438,8 +438,8 @@ event_editor_constructed (GObject *object) priv->model, "client", G_BINDING_SYNC_CREATE); - if (G_OBJECT_CLASS (event_editor_parent_class)->constructed) - G_OBJECT_CLASS (event_editor_parent_class)->constructed (object); + /* Chain up to parent's constructed() method. */ + G_OBJECT_CLASS (event_editor_parent_class)->constructed (object); } static void diff --git a/calendar/gui/dialogs/memo-editor.c b/calendar/gui/dialogs/memo-editor.c index 8de1b09601..0e3cfc5dcf 100644 --- a/calendar/gui/dialogs/memo-editor.c +++ b/calendar/gui/dialogs/memo-editor.c @@ -108,8 +108,8 @@ memo_editor_constructed (GObject *object) editor, COMP_EDITOR_PAGE (priv->memo_page), _("Memo"), TRUE); - if (G_OBJECT_CLASS (memo_editor_parent_class)->constructed) - G_OBJECT_CLASS (memo_editor_parent_class)->constructed (object); + /* Chain up to parent's constructed() method. */ + G_OBJECT_CLASS (memo_editor_parent_class)->constructed (object); } static void diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 8021339c9b..933299feb0 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -214,8 +214,8 @@ task_editor_constructed (GObject *object) priv->model, "client", G_BINDING_SYNC_CREATE); - if (G_OBJECT_CLASS (task_editor_parent_class)->constructed) - G_OBJECT_CLASS (task_editor_parent_class)->constructed (object); + /* Chain up to parent's constructed() method. */ + G_OBJECT_CLASS (task_editor_parent_class)->constructed (object); } static void diff --git a/calendar/gui/e-alarm-list.c b/calendar/gui/e-alarm-list.c index c7f7ff9691..4132cb785c 100644 --- a/calendar/gui/e-alarm-list.c +++ b/calendar/gui/e-alarm-list.c @@ -40,7 +40,6 @@ static GType column_types[E_ALARM_LIST_NUM_COLUMNS]; static void e_alarm_list_init (EAlarmList *file_list); static void e_alarm_list_class_init (EAlarmListClass *class); static void e_alarm_list_tree_model_init (GtkTreeModelIface *iface); -static void e_alarm_list_finalize (GObject *object); static GtkTreeModelFlags e_alarm_list_get_flags (GtkTreeModel *tree_model); static gint e_alarm_list_get_n_columns (GtkTreeModel *tree_model); static GType e_alarm_list_get_column_type (GtkTreeModel *tree_model, @@ -114,12 +113,7 @@ e_alarm_list_get_type (void) static void e_alarm_list_class_init (EAlarmListClass *class) { - GObjectClass *object_class; - parent_class = g_type_class_peek_parent (class); - object_class = (GObjectClass *) class; - - object_class->finalize = e_alarm_list_finalize; } static void @@ -219,13 +213,6 @@ row_updated (EAlarmList *alarm_list, gint n) gtk_tree_path_free (path); } -static void -e_alarm_list_finalize (GObject *object) -{ - if (G_OBJECT_CLASS (parent_class)->finalize) - (* G_OBJECT_CLASS (parent_class)->finalize) (object); -} - /* Fulfill the GtkTreeModel requirements */ static GtkTreeModelFlags e_alarm_list_get_flags (GtkTreeModel *tree_model) diff --git a/calendar/gui/e-cal-list-view.c b/calendar/gui/e-cal-list-view.c index fc2996fcd2..010de9590b 100644 --- a/calendar/gui/e-cal-list-view.c +++ b/calendar/gui/e-cal-list-view.c @@ -350,8 +350,8 @@ e_cal_list_view_dispose (GObject *object) cal_list_view->table = NULL; } - if (G_OBJECT_CLASS (e_cal_list_view_parent_class)->dispose) - G_OBJECT_CLASS (e_cal_list_view_parent_class)->dispose (object); + /* Chain up to parent's dispose() method. */ + G_OBJECT_CLASS (e_cal_list_view_parent_class)->dispose (object); } static void diff --git a/calendar/gui/e-cal-model-calendar.c b/calendar/gui/e-cal-model-calendar.c index 778b72de21..723f5e753b 100644 --- a/calendar/gui/e-cal-model-calendar.c +++ b/calendar/gui/e-cal-model-calendar.c @@ -102,8 +102,8 @@ e_cal_model_calendar_finalize (GObject *object) model->priv = NULL; } - if (G_OBJECT_CLASS (e_cal_model_calendar_parent_class)->finalize) - G_OBJECT_CLASS (e_cal_model_calendar_parent_class)->finalize (object); + /* Chain up to parent's finalize() method. */ + G_OBJECT_CLASS (e_cal_model_calendar_parent_class)->finalize (object); } /* ETableModel methods */ diff --git a/calendar/gui/e-cal-model-memos.c b/calendar/gui/e-cal-model-memos.c index 38e55ef71a..0356dacf0c 100644 --- a/calendar/gui/e-cal-model-memos.c +++ b/calendar/gui/e-cal-model-memos.c @@ -103,8 +103,8 @@ e_cal_model_memos_finalize (GObject *object) model->priv = NULL; } - if (G_OBJECT_CLASS (e_cal_model_memos_parent_class)->finalize) - G_OBJECT_CLASS (e_cal_model_memos_parent_class)->finalize (object); + /* Chain up to parent's finalize() method. */ + G_OBJECT_CLASS (e_cal_model_memos_parent_class)->finalize (object); } /* ETableModel methods */ diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c index b6efb3e0e1..a8206d50c1 100644 --- a/calendar/gui/e-cal-model.c +++ b/calendar/gui/e-cal-model.c @@ -377,8 +377,7 @@ cal_model_constructed (GObject *object) e_extensible_load_extensions (E_EXTENSIBLE (object)); /* Chain up to parent's constructed() method. */ - if (G_OBJECT_CLASS (parent_class)->constructed) - G_OBJECT_CLASS (parent_class)->constructed (object); + G_OBJECT_CLASS (parent_class)->constructed (object); } static void @@ -3210,8 +3209,8 @@ e_cal_model_component_finalize (GObject *object) comp_data->color = NULL; } - if (G_OBJECT_CLASS (component_parent_class)->finalize) - (* G_OBJECT_CLASS (component_parent_class)->finalize) (object); + /* Chain up to parent's finalize() method. */ + G_OBJECT_CLASS (component_parent_class)->finalize (object); } /* Object initialization function for the calendar component object */ diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c index 181d4a19f4..d7aa3d8716 100644 --- a/calendar/gui/e-calendar-view.c +++ b/calendar/gui/e-calendar-view.c @@ -368,8 +368,7 @@ calendar_view_constructed (GObject *object) e_extensible_load_extensions (E_EXTENSIBLE (object)); /* Chain up to parent's constructed() method. */ - if (G_OBJECT_CLASS (e_calendar_view_parent_class)->constructed) - G_OBJECT_CLASS (e_calendar_view_parent_class)->constructed (object); + G_OBJECT_CLASS (e_calendar_view_parent_class)->constructed (object); } static void diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index 8ce7481809..3c792e6330 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -1336,8 +1336,8 @@ e_day_view_dispose (GObject *object) } } - if (G_OBJECT_CLASS (e_day_view_parent_class)->dispose) - G_OBJECT_CLASS (e_day_view_parent_class)->dispose (object); + /* Chain up to parent's dispose() method. */ + G_OBJECT_CLASS (e_day_view_parent_class)->dispose (object); } static void diff --git a/calendar/gui/e-meeting-attendee.c b/calendar/gui/e-meeting-attendee.c index 7f6709ba7a..c7c5bdfca2 100644 --- a/calendar/gui/e-meeting-attendee.c +++ b/calendar/gui/e-meeting-attendee.c @@ -182,8 +182,8 @@ e_meeting_attendee_finalize (GObject *obj) g_free (priv); - if (G_OBJECT_CLASS (e_meeting_attendee_parent_class)->finalize) - (* G_OBJECT_CLASS (e_meeting_attendee_parent_class)->finalize) (obj); + /* Chain up to parent's finalize() method. */ + G_OBJECT_CLASS (e_meeting_attendee_parent_class)->finalize (obj); } GObject * diff --git a/calendar/gui/e-meeting-list-view.c b/calendar/gui/e-meeting-list-view.c index b72662ce8f..532a06138a 100644 --- a/calendar/gui/e-meeting-list-view.c +++ b/calendar/gui/e-meeting-list-view.c @@ -93,8 +93,8 @@ e_meeting_list_view_finalize (GObject *obj) g_free (priv); - if (G_OBJECT_CLASS (e_meeting_list_view_parent_class)->finalize) - (* G_OBJECT_CLASS (e_meeting_list_view_parent_class)->finalize) (obj); + /* Chain up to parent's finalize() method. */ + G_OBJECT_CLASS (e_meeting_list_view_parent_class)->finalize (obj); } static void diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c index 7e405d1f36..1e9ddf97b6 100644 --- a/calendar/gui/e-meeting-time-sel.c +++ b/calendar/gui/e-meeting-time-sel.c @@ -297,8 +297,8 @@ meeting_time_selector_dispose (GObject *object) mts->style_change_idle_id = 0; } - if (G_OBJECT_CLASS (e_meeting_time_selector_parent_class)->dispose) - G_OBJECT_CLASS (e_meeting_time_selector_parent_class)->dispose (object); + /* Chain up to parent's dispose() method. */ + G_OBJECT_CLASS (e_meeting_time_selector_parent_class)->dispose (object); } static void diff --git a/calendar/gui/e-memo-table.c b/calendar/gui/e-memo-table.c index 9da9a2d944..24c68905b4 100644 --- a/calendar/gui/e-memo-table.c +++ b/calendar/gui/e-memo-table.c @@ -418,8 +418,8 @@ memo_table_constructed (GObject *object) if (a11y) atk_object_set_name (a11y, _("Memos")); - if (G_OBJECT_CLASS (parent_class)->constructed) - G_OBJECT_CLASS (parent_class)->constructed (object); + /* Chain up to parent's constructed() method. */ + G_OBJECT_CLASS (parent_class)->constructed (object); } static gboolean diff --git a/calendar/gui/e-select-names-editable.c b/calendar/gui/e-select-names-editable.c index c177c5231b..52d6b82ed0 100644 --- a/calendar/gui/e-select-names-editable.c +++ b/calendar/gui/e-select-names-editable.c @@ -40,14 +40,14 @@ esne_cell_editable_init (GtkCellEditableIface *iface) } static void -esne_finalize (GObject *obj) +esne_finalize (GObject *object) { - ESelectNamesEditable *esne = (ESelectNamesEditable *) obj; + ESelectNamesEditable *esne = (ESelectNamesEditable *) object; g_free (esne->priv); - if (G_OBJECT_CLASS (parent_class)->finalize) - G_OBJECT_CLASS (parent_class)->finalize (obj); + /* Chain up to parent's finalize() method. */ + G_OBJECT_CLASS (parent_class)->finalize (object); } static void diff --git a/calendar/gui/e-select-names-renderer.c b/calendar/gui/e-select-names-renderer.c index 632ff89c91..27a08f7ada 100644 --- a/calendar/gui/e-select-names-renderer.c +++ b/calendar/gui/e-select-names-renderer.c @@ -171,9 +171,9 @@ e_select_names_renderer_set_property (GObject *object, guint prop_id, const GVal } static void -e_select_names_renderer_finalize (GObject *obj) +e_select_names_renderer_finalize (GObject *object) { - ESelectNamesRenderer *cell = (ESelectNamesRenderer *) obj; + ESelectNamesRenderer *cell = (ESelectNamesRenderer *) object; if (cell->priv->editable) g_object_unref (cell->priv->editable); @@ -184,8 +184,8 @@ e_select_names_renderer_finalize (GObject *obj) g_free (cell->priv->email); g_free (cell->priv); - if (G_OBJECT_CLASS (e_select_names_renderer_parent_class)->finalize) - G_OBJECT_CLASS (e_select_names_renderer_parent_class)->finalize (obj); + /* Chain up to parent's finalize() method. */ + G_OBJECT_CLASS (e_select_names_renderer_parent_class)->finalize (object); } static void diff --git a/calendar/gui/e-task-table.c b/calendar/gui/e-task-table.c index ef64defc61..60c5d50e0c 100644 --- a/calendar/gui/e-task-table.c +++ b/calendar/gui/e-task-table.c @@ -635,8 +635,8 @@ task_table_constructed (GObject *object) if (a11y) atk_object_set_name (a11y, _("Tasks")); - if (G_OBJECT_CLASS (parent_class)->constructed) - G_OBJECT_CLASS (parent_class)->constructed (object); + /* Chain up to parent's constructed() method. */ + G_OBJECT_CLASS (parent_class)->constructed (object); } static gboolean diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index bfe7cd20e9..10f95d3463 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -905,8 +905,8 @@ e_week_view_dispose (GObject *object) week_view->scroll_by_week_notif_id = 0; } - if (G_OBJECT_CLASS (e_week_view_parent_class)->dispose) - G_OBJECT_CLASS (e_week_view_parent_class)->dispose (object); + /* Chain up to parent's dispose() method. */ + G_OBJECT_CLASS (e_week_view_parent_class)->dispose (object); } static void diff --git a/calendar/gui/ea-cal-view-event.c b/calendar/gui/ea-cal-view-event.c index b3d35c90a6..84159bb53d 100644 --- a/calendar/gui/ea-cal-view-event.c +++ b/calendar/gui/ea-cal-view-event.c @@ -253,8 +253,8 @@ ea_cal_view_event_dispose (GObject *object) a11y->state_set = NULL; } - if (G_OBJECT_CLASS (parent_class)->dispose) - G_OBJECT_CLASS (parent_class)->dispose (object); + /* Chain up to parent's dispose() method. */ + G_OBJECT_CLASS (parent_class)->dispose (object); } static G_CONST_RETURN gchar * diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 11b1e29ee5..3e478a063a 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -487,8 +487,8 @@ gnome_calendar_constructed (GObject *object) gnome_calendar_goto_today (gcal); - if (G_OBJECT_CLASS (gnome_calendar_parent_class)->constructed) - G_OBJECT_CLASS (gnome_calendar_parent_class)->constructed (object); + /* Chain up to parent's constructed() method. */ + G_OBJECT_CLASS (gnome_calendar_parent_class)->constructed (object); } /* Class initialization function for the gnome calendar */ diff --git a/calendar/gui/weekday-picker.c b/calendar/gui/weekday-picker.c index 650c2fa1e8..7183d79071 100644 --- a/calendar/gui/weekday-picker.c +++ b/calendar/gui/weekday-picker.c @@ -201,8 +201,7 @@ weekday_picker_dispose (GObject *object) wp->priv = NULL; /* Chain up to parent's dispose() method. */ - if (G_OBJECT_CLASS (weekday_picker_parent_class)->dispose) - G_OBJECT_CLASS (weekday_picker_parent_class)->dispose (object); + G_OBJECT_CLASS (weekday_picker_parent_class)->dispose (object); } static void -- cgit