From 979feab18eb378b4623f2edc6a357407e95e3493 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Thu, 14 Oct 2004 14:56:18 +0000 Subject: convert to G_DEFINE_TYPE 2004-10-14 JP Rosevear * gui/e-week-view-config.c: convert to G_DEFINE_TYPE * gui/e-week-view-event-item.c: ditto * gui/e-week-view-main-item.c: ditto * gui/e-week-view-titles-item.c: ditto * gui/e-week-view.c: ditto svn path=/trunk/; revision=27578 --- calendar/gui/e-week-view-config.c | 19 +++++++------------ calendar/gui/e-week-view-event-item.c | 17 +++++------------ calendar/gui/e-week-view-main-item.c | 18 +++++------------- calendar/gui/e-week-view-titles-item.c | 19 ++++++------------- calendar/gui/e-week-view.c | 32 ++++++++++++-------------------- 5 files changed, 35 insertions(+), 70 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/e-week-view-config.c b/calendar/gui/e-week-view-config.c index 21a1eca5c7..e93f44373e 100644 --- a/calendar/gui/e-week-view-config.c +++ b/calendar/gui/e-week-view-config.c @@ -30,14 +30,14 @@ struct _EWeekViewConfigPrivate { GList *notifications; }; -static GObjectClass *parent_class = NULL; - /* Property IDs */ enum props { PROP_0, PROP_VIEW, }; +G_DEFINE_TYPE (EWeekViewConfig, e_week_view_config, G_TYPE_OBJECT); + static void e_week_view_config_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { @@ -86,8 +86,8 @@ e_week_view_config_dispose (GObject *object) e_week_view_config_set_view (view_config, NULL); - if (G_OBJECT_CLASS (parent_class)->dispose) - G_OBJECT_CLASS (parent_class)->dispose (object); + if (G_OBJECT_CLASS (e_week_view_config_parent_class)->dispose) + G_OBJECT_CLASS (e_week_view_config_parent_class)->dispose (object); } static void @@ -100,8 +100,8 @@ e_week_view_config_finalize (GObject *object) g_free (priv); - if (G_OBJECT_CLASS (parent_class)->finalize) - G_OBJECT_CLASS (parent_class)->finalize (object); + if (G_OBJECT_CLASS (e_week_view_config_parent_class)->finalize) + G_OBJECT_CLASS (e_week_view_config_parent_class)->finalize (object); } static void @@ -110,8 +110,6 @@ e_week_view_config_class_init (EWeekViewConfigClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GParamSpec *spec; - parent_class = g_type_class_peek_parent (klass); - /* Method override */ gobject_class->set_property = e_week_view_config_set_property; gobject_class->get_property = e_week_view_config_get_property; @@ -124,15 +122,12 @@ e_week_view_config_class_init (EWeekViewConfigClass *klass) } static void -e_week_view_config_init (EWeekViewConfig *view_config, EWeekViewConfigClass *klass) +e_week_view_config_init (EWeekViewConfig *view_config) { view_config->priv = g_new0 (EWeekViewConfigPrivate, 1); } -E_MAKE_TYPE (e_week_view_config, "EWeekViewConfig", EWeekViewConfig, e_week_view_config_class_init, - e_week_view_config_init, G_TYPE_OBJECT); - EWeekViewConfig * e_week_view_config_new (EWeekView *week_view) { diff --git a/calendar/gui/e-week-view-event-item.c b/calendar/gui/e-week-view-event-item.c index ff07eea6ba..300945aa03 100644 --- a/calendar/gui/e-week-view-event-item.c +++ b/calendar/gui/e-week-view-event-item.c @@ -28,7 +28,9 @@ * edit the text. */ +#ifdef HAVE_CONFIG_H #include +#endif #include "e-util/e-categories-config.h" #include "e-week-view-event-item.h" @@ -36,9 +38,6 @@ #include #include -static void e_week_view_event_item_class_init (EWeekViewEventItemClass *class); -static void e_week_view_event_item_init (EWeekViewEventItem *wveitem); - static void e_week_view_event_item_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); @@ -89,8 +88,6 @@ static ECalendarViewPosition e_week_view_event_item_get_position (EWeekViewEvent gdouble y); -static GnomeCanvasItemClass *parent_class; - /* The arguments we take */ enum { ARG_0, @@ -98,9 +95,7 @@ enum { ARG_SPAN_NUM }; -E_MAKE_TYPE (e_week_view_event_item, "EWeekViewEventItem", EWeekViewEventItem, - e_week_view_event_item_class_init, e_week_view_event_item_init, - GNOME_TYPE_CANVAS_ITEM); +G_DEFINE_TYPE (EWeekViewEventItem, e_week_view_event_item, GNOME_TYPE_CANVAS_ITEM); static void e_week_view_event_item_class_init (EWeekViewEventItemClass *class) @@ -108,8 +103,6 @@ e_week_view_event_item_class_init (EWeekViewEventItemClass *class) GtkObjectClass *object_class; GnomeCanvasItemClass *item_class; - parent_class = g_type_class_peek_parent (class); - object_class = (GtkObjectClass *) class; item_class = (GnomeCanvasItemClass *) class; @@ -182,8 +175,8 @@ e_week_view_event_item_update (GnomeCanvasItem *item, week_view = E_WEEK_VIEW (GTK_WIDGET (item->canvas)->parent); g_return_if_fail (E_IS_WEEK_VIEW (week_view)); - if (GNOME_CANVAS_ITEM_CLASS (parent_class)->update) - (* GNOME_CANVAS_ITEM_CLASS (parent_class)->update) (item, affine, clip_path, flags); + if (GNOME_CANVAS_ITEM_CLASS (e_week_view_event_item_parent_class)->update) + (* GNOME_CANVAS_ITEM_CLASS (e_week_view_event_item_parent_class)->update) (item, affine, clip_path, flags); item->x1 = 0; item->y1 = 0; diff --git a/calendar/gui/e-week-view-main-item.c b/calendar/gui/e-week-view-main-item.c index 3dbeb3f5f5..e33ec66e3f 100644 --- a/calendar/gui/e-week-view-main-item.c +++ b/calendar/gui/e-week-view-main-item.c @@ -26,16 +26,15 @@ * Month calendar views. */ +#ifdef HAVE_CONFIG_H #include +#endif #include #include #include "e-week-view-main-item.h" #include "ea-calendar.h" -static void e_week_view_main_item_class_init (EWeekViewMainItemClass *class); -static void e_week_view_main_item_init (EWeekViewMainItem *wvmitem); - static void e_week_view_main_item_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); @@ -64,18 +63,13 @@ static double e_week_view_main_item_point (GnomeCanvasItem *item, int cy, GnomeCanvasItem **actual_item); - -static GnomeCanvasItemClass *parent_class; - /* The arguments we take */ enum { ARG_0, ARG_WEEK_VIEW }; -E_MAKE_TYPE (e_week_view_main_item, "EWeekViewMainItem", EWeekViewMainItem, - e_week_view_main_item_class_init, e_week_view_main_item_init, - GNOME_TYPE_CANVAS_ITEM); +G_DEFINE_TYPE (EWeekViewMainItem, e_week_view_main_item, GNOME_TYPE_CANVAS_ITEM); static void e_week_view_main_item_class_init (EWeekViewMainItemClass *class) @@ -83,8 +77,6 @@ e_week_view_main_item_class_init (EWeekViewMainItemClass *class) GtkObjectClass *object_class; GnomeCanvasItemClass *item_class; - parent_class = g_type_class_peek_parent (class); - object_class = (GtkObjectClass *) class; item_class = (GnomeCanvasItemClass *) class; @@ -134,8 +126,8 @@ e_week_view_main_item_update (GnomeCanvasItem *item, ArtSVP *clip_path, int flags) { - if (GNOME_CANVAS_ITEM_CLASS (parent_class)->update) - (* GNOME_CANVAS_ITEM_CLASS (parent_class)->update) (item, affine, clip_path, flags); + if (GNOME_CANVAS_ITEM_CLASS (e_week_view_main_item_parent_class)->update) + (* GNOME_CANVAS_ITEM_CLASS (e_week_view_main_item_parent_class)->update) (item, affine, clip_path, flags); /* The item covers the entire canvas area. */ item->x1 = 0; diff --git a/calendar/gui/e-week-view-titles-item.c b/calendar/gui/e-week-view-titles-item.c index 733bec9a81..c688cb9025 100644 --- a/calendar/gui/e-week-view-titles-item.c +++ b/calendar/gui/e-week-view-titles-item.c @@ -26,13 +26,13 @@ * the Month calendar view. */ +#ifdef HAVE_CONFIG_H #include +#endif + #include #include "e-week-view-titles-item.h" -static void e_week_view_titles_item_class_init (EWeekViewTitlesItemClass *class); -static void e_week_view_titles_item_init (EWeekViewTitlesItem *wvtitem); - static void e_week_view_titles_item_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); @@ -53,18 +53,13 @@ static double e_week_view_titles_item_point (GnomeCanvasItem *item, int cy, GnomeCanvasItem **actual_item); - -static GnomeCanvasItemClass *parent_class; - /* The arguments we take */ enum { ARG_0, ARG_WEEK_VIEW }; -E_MAKE_TYPE (e_week_view_titles_item, "EWeekViewTitlesItem", EWeekViewTitlesItem, - e_week_view_titles_item_class_init, e_week_view_titles_item_init, - GNOME_TYPE_CANVAS_ITEM); +G_DEFINE_TYPE (EWeekViewTitlesItem, e_week_view_titles_item, GNOME_TYPE_CANVAS_ITEM); static void e_week_view_titles_item_class_init (EWeekViewTitlesItemClass *class) @@ -72,8 +67,6 @@ e_week_view_titles_item_class_init (EWeekViewTitlesItemClass *class) GtkObjectClass *object_class; GnomeCanvasItemClass *item_class; - parent_class = g_type_class_peek_parent (class); - object_class = (GtkObjectClass *) class; item_class = (GnomeCanvasItemClass *) class; @@ -120,8 +113,8 @@ e_week_view_titles_item_update (GnomeCanvasItem *item, ArtSVP *clip_path, int flags) { - if (GNOME_CANVAS_ITEM_CLASS (parent_class)->update) - (* GNOME_CANVAS_ITEM_CLASS (parent_class)->update) (item, affine, clip_path, flags); + if (GNOME_CANVAS_ITEM_CLASS (e_week_view_titles_item_parent_class)->update) + (* GNOME_CANVAS_ITEM_CLASS (e_week_view_titles_item_parent_class)->update) (item, affine, clip_path, flags); /* The item covers the entire canvas area. */ item->x1 = 0; diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index bd22b7f61e..1deeb228ca 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -94,8 +94,6 @@ typedef struct { ECalModelComponent *comp_data; } AddEventData; -static void e_week_view_class_init (EWeekViewClass *class); -static void e_week_view_init (EWeekView *week_view); static void e_week_view_destroy (GtkObject *object); static void e_week_view_realize (GtkWidget *widget); static void e_week_view_unrealize (GtkWidget *widget); @@ -157,8 +155,6 @@ static void e_week_view_reshape_event_span (EWeekView *week_view, gint span_num); static void e_week_view_recalc_day_starts (EWeekView *week_view, time_t lower); -static void e_week_view_on_adjustment_changed (GtkAdjustment *adjustment, - EWeekView *week_view); static void e_week_view_on_editing_started (EWeekView *week_view, GnomeCanvasItem *item); static void e_week_view_on_editing_stopped (EWeekView *week_view, @@ -209,10 +205,7 @@ static void e_week_view_queue_layout (EWeekView *week_view); static void e_week_view_cancel_layout (EWeekView *week_view); static gboolean e_week_view_layout_timeout_cb (gpointer data); -static ECalendarViewClass *parent_class; - -E_MAKE_TYPE (e_week_view, "EWeekView", EWeekView, e_week_view_class_init, - e_week_view_init, e_calendar_view_get_type ()); +G_DEFINE_TYPE (EWeekView, e_week_view, E_TYPE_CALENDAR_VIEW); static void e_week_view_class_init (EWeekViewClass *class) @@ -221,7 +214,6 @@ e_week_view_class_init (EWeekViewClass *class) GtkWidgetClass *widget_class; ECalendarViewClass *view_class; - parent_class = g_type_class_peek_parent (class); object_class = (GtkObjectClass *) class; widget_class = (GtkWidgetClass *) class; view_class = (ECalendarViewClass *) class; @@ -741,7 +733,7 @@ e_week_view_destroy (GtkObject *object) week_view->resize_width_cursor = NULL; } - GTK_OBJECT_CLASS (parent_class)->destroy (object); + GTK_OBJECT_CLASS (e_week_view_parent_class)->destroy (object); } @@ -753,8 +745,8 @@ e_week_view_realize (GtkWidget *widget) gboolean success[E_WEEK_VIEW_COLOR_LAST]; gint nfailed; - if (GTK_WIDGET_CLASS (parent_class)->realize) - (*GTK_WIDGET_CLASS (parent_class)->realize)(widget); + if (GTK_WIDGET_CLASS (e_week_view_parent_class)->realize) + (*GTK_WIDGET_CLASS (e_week_view_parent_class)->realize)(widget); week_view = E_WEEK_VIEW (widget); week_view->main_gc = gdk_gc_new (widget->window); @@ -842,8 +834,8 @@ e_week_view_unrealize (GtkWidget *widget) g_object_unref (week_view->timezone_icon); week_view->timezone_icon = NULL; - if (GTK_WIDGET_CLASS (parent_class)->unrealize) - (*GTK_WIDGET_CLASS (parent_class)->unrealize)(widget); + if (GTK_WIDGET_CLASS (e_week_view_parent_class)->unrealize) + (*GTK_WIDGET_CLASS (e_week_view_parent_class)->unrealize)(widget); } static gint @@ -895,8 +887,8 @@ e_week_view_style_set (GtkWidget *widget, PangoFontMetrics *font_metrics; PangoLayout *layout; - if (GTK_WIDGET_CLASS (parent_class)->style_set) - (*GTK_WIDGET_CLASS (parent_class)->style_set)(widget, previous_style); + if (GTK_WIDGET_CLASS (e_week_view_parent_class)->style_set) + (*GTK_WIDGET_CLASS (e_week_view_parent_class)->style_set)(widget, previous_style); week_view = E_WEEK_VIEW (widget); style = gtk_widget_get_style (widget); @@ -998,7 +990,7 @@ e_week_view_size_allocate (GtkWidget *widget, GtkAllocation *allocation) week_view = E_WEEK_VIEW (widget); - (*GTK_WIDGET_CLASS (parent_class)->size_allocate) (widget, allocation); + (*GTK_WIDGET_CLASS (e_week_view_parent_class)->size_allocate) (widget, allocation); e_week_view_recalc_cell_sizes (week_view); @@ -1200,8 +1192,8 @@ e_week_view_expose_event (GtkWidget *widget, e_week_view_draw_shadow (week_view); - if (GTK_WIDGET_CLASS (parent_class)->expose_event) - (*GTK_WIDGET_CLASS (parent_class)->expose_event)(widget, event); + if (GTK_WIDGET_CLASS (e_week_view_parent_class)->expose_event) + (*GTK_WIDGET_CLASS (e_week_view_parent_class)->expose_event)(widget, event); return FALSE; } @@ -3913,7 +3905,7 @@ e_week_view_key_press (GtkWidget *widget, GdkEventKey *event) /* if not handled, try key bindings */ if (!handled) - handled = GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event); + handled = GTK_WIDGET_CLASS (e_week_view_parent_class)->key_press_event (widget, event); return handled; } -- cgit