From cd7d56412544379c877ff0808357cdada3ce4c2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 24 Sep 2015 18:04:48 +0200 Subject: [PATCH] st: Use G_DEFINE_TYPE_WITH_PRIVATE() and friends --- src/st/st-adjustment.c | 10 +++------- src/st/st-bin.c | 7 ++----- src/st/st-box-layout-child.c | 3 --- src/st/st-box-layout.c | 20 ++++++++------------ src/st/st-button.c | 9 ++------- src/st/st-clipboard.c | 11 +++-------- src/st/st-drawing-area.c | 9 +++------ src/st/st-entry.c | 7 ++----- src/st/st-focus-manager.c | 8 ++------ src/st/st-icon.c | 11 +++-------- src/st/st-im-text.c | 9 ++------- src/st/st-label.c | 8 ++------ src/st/st-scroll-bar.c | 10 +++------- src/st/st-scroll-view.c | 17 ++++++----------- src/st/st-theme-node-transition.c | 8 ++------ src/st/st-widget.c | 19 ++++--------------- 16 files changed, 47 insertions(+), 119 deletions(-) diff --git a/src/st/st-adjustment.c b/src/st/st-adjustment.c index 08690a918..baac36990 100644 --- a/src/st/st-adjustment.c +++ b/src/st/st-adjustment.c @@ -37,10 +37,6 @@ #include "st-adjustment.h" #include "st-private.h" -G_DEFINE_TYPE (StAdjustment, st_adjustment, G_TYPE_OBJECT) - -#define ADJUSTMENT_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ST_TYPE_ADJUSTMENT, StAdjustmentPrivate)) - struct _StAdjustmentPrivate { /* Do not sanity-check values while constructing, @@ -55,6 +51,8 @@ struct _StAdjustmentPrivate gdouble page_size; }; +G_DEFINE_TYPE_WITH_PRIVATE (StAdjustment, st_adjustment, G_TYPE_OBJECT) + enum { PROP_0, @@ -191,8 +189,6 @@ st_adjustment_class_init (StAdjustmentClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (StAdjustmentPrivate)); - object_class->constructed = st_adjustment_constructed; object_class->get_property = st_adjustment_get_property; object_class->set_property = st_adjustment_set_property; @@ -275,7 +271,7 @@ st_adjustment_class_init (StAdjustmentClass *klass) static void st_adjustment_init (StAdjustment *self) { - self->priv = ADJUSTMENT_PRIVATE (self); + self->priv = st_adjustment_get_instance_private (self); self->priv->is_constructing = TRUE; } diff --git a/src/st/st-bin.c b/src/st/st-bin.c index 95a689c2f..6f9a4e6ca 100644 --- a/src/st/st-bin.c +++ b/src/st/st-bin.c @@ -38,8 +38,6 @@ #include "st-enum-types.h" #include "st-private.h" -#define ST_BIN_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ST_TYPE_BIN, StBinPrivate)) - struct _StBinPrivate { ClutterActor *child; @@ -65,6 +63,7 @@ enum static void clutter_container_iface_init (ClutterContainerIface *iface); G_DEFINE_TYPE_WITH_CODE (StBin, st_bin, ST_TYPE_WIDGET, + G_ADD_PRIVATE (StBin) G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTAINER, clutter_container_iface_init)); @@ -311,8 +310,6 @@ st_bin_class_init (StBinClass *klass) StWidgetClass *widget_class = ST_WIDGET_CLASS (klass); GParamSpec *pspec; - g_type_class_add_private (klass, sizeof (StBinPrivate)); - gobject_class->set_property = st_bin_set_property; gobject_class->get_property = st_bin_get_property; gobject_class->dispose = st_bin_dispose; @@ -392,7 +389,7 @@ st_bin_class_init (StBinClass *klass) static void st_bin_init (StBin *bin) { - bin->priv = ST_BIN_GET_PRIVATE (bin); + bin->priv = st_bin_get_instance_private (bin); bin->priv->x_align = ST_ALIGN_MIDDLE; bin->priv->y_align = ST_ALIGN_MIDDLE; diff --git a/src/st/st-box-layout-child.c b/src/st/st-box-layout-child.c index dab684a15..e2c7332d2 100644 --- a/src/st/st-box-layout-child.c +++ b/src/st/st-box-layout-child.c @@ -30,9 +30,6 @@ G_DEFINE_TYPE (StBoxLayoutChild, st_box_layout_child, CLUTTER_TYPE_CHILD_META) -#define BOX_LAYOUT_CHILD_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((o), ST_TYPE_BOX_LAYOUT_CHILD, StBoxLayoutChildPrivate)) - enum { diff --git a/src/st/st-box-layout.c b/src/st/st-box-layout.c index 8f01b296c..ffb74770c 100644 --- a/src/st/st-box-layout.c +++ b/src/st/st-box-layout.c @@ -59,15 +59,6 @@ static void st_box_container_iface_init (ClutterContainerIface *iface); static void st_box_scrollable_interface_init (StScrollableInterface *iface); -G_DEFINE_TYPE_WITH_CODE (StBoxLayout, st_box_layout, ST_TYPE_WIDGET, - G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTAINER, - st_box_container_iface_init) - G_IMPLEMENT_INTERFACE (ST_TYPE_SCROLLABLE, - st_box_scrollable_interface_init)); - -#define BOX_LAYOUT_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((o), ST_TYPE_BOX_LAYOUT, StBoxLayoutPrivate)) - enum { PROP_0, @@ -84,6 +75,13 @@ struct _StBoxLayoutPrivate StAdjustment *vadjustment; }; +G_DEFINE_TYPE_WITH_CODE (StBoxLayout, st_box_layout, ST_TYPE_WIDGET, + G_ADD_PRIVATE (StBoxLayout) + G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTAINER, + st_box_container_iface_init) + G_IMPLEMENT_INTERFACE (ST_TYPE_SCROLLABLE, + st_box_scrollable_interface_init)); + /* * StScrollable Interface Implementation */ @@ -588,8 +586,6 @@ st_box_layout_class_init (StBoxLayoutClass *klass) StWidgetClass *widget_class = ST_WIDGET_CLASS (klass); GParamSpec *pspec; - g_type_class_add_private (klass, sizeof (StBoxLayoutPrivate)); - object_class->get_property = st_box_layout_get_property; object_class->set_property = st_box_layout_set_property; object_class->dispose = st_box_layout_dispose; @@ -632,7 +628,7 @@ st_box_layout_class_init (StBoxLayoutClass *klass) static void st_box_layout_init (StBoxLayout *self) { - self->priv = BOX_LAYOUT_PRIVATE (self); + self->priv = st_box_layout_get_instance_private (self); g_signal_connect (self, "notify::layout-manager", G_CALLBACK (on_layout_manager_notify), NULL); diff --git a/src/st/st-button.c b/src/st/st-button.c index 78a931f31..b3886c74c 100644 --- a/src/st/st-button.c +++ b/src/st/st-button.c @@ -64,9 +64,6 @@ enum LAST_SIGNAL }; -#define ST_BUTTON_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ST_TYPE_BUTTON, StButtonPrivate)) - struct _StButtonPrivate { gchar *text; @@ -86,7 +83,7 @@ struct _StButtonPrivate static guint button_signals[LAST_SIGNAL] = { 0, }; -G_DEFINE_TYPE (StButton, st_button, ST_TYPE_BIN); +G_DEFINE_TYPE_WITH_PRIVATE (StButton, st_button, ST_TYPE_BIN); static GType st_button_accessible_get_type (void) G_GNUC_CONST; @@ -440,8 +437,6 @@ st_button_class_init (StButtonClass *klass) StWidgetClass *widget_class = ST_WIDGET_CLASS (klass); GParamSpec *pspec; - g_type_class_add_private (klass, sizeof (StButtonPrivate)); - gobject_class->set_property = st_button_set_property; gobject_class->get_property = st_button_get_property; gobject_class->finalize = st_button_finalize; @@ -512,7 +507,7 @@ st_button_class_init (StButtonClass *klass) static void st_button_init (StButton *button) { - button->priv = ST_BUTTON_GET_PRIVATE (button); + button->priv = st_button_get_instance_private (button); button->priv->spacing = 6; button->priv->button_mask = ST_BUTTON_ONE; diff --git a/src/st/st-clipboard.c b/src/st/st-clipboard.c index 32da14236..556721d7f 100644 --- a/src/st/st-clipboard.c +++ b/src/st/st-clipboard.c @@ -34,11 +34,6 @@ #include #include -G_DEFINE_TYPE (StClipboard, st_clipboard, G_TYPE_OBJECT) - -#define CLIPBOARD_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((o), ST_TYPE_CLIPBOARD, StClipboardPrivate)) - struct _StClipboardPrivate { Window clipboard_window; @@ -48,6 +43,8 @@ struct _StClipboardPrivate gint n_targets; }; +G_DEFINE_TYPE_WITH_PRIVATE (StClipboard, st_clipboard, G_TYPE_OBJECT) + typedef struct _EventFilterData EventFilterData; struct _EventFilterData { @@ -182,8 +179,6 @@ st_clipboard_class_init (StClipboardClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (StClipboardPrivate)); - object_class->get_property = st_clipboard_get_property; object_class->set_property = st_clipboard_set_property; object_class->dispose = st_clipboard_dispose; @@ -197,7 +192,7 @@ st_clipboard_init (StClipboard *self) Display *dpy; StClipboardPrivate *priv; - priv = self->priv = CLIPBOARD_PRIVATE (self); + priv = self->priv = st_clipboard_get_instance_private (self); gdk_display = gdk_display_get_default (); dpy = GDK_DISPLAY_XDISPLAY (gdk_display); diff --git a/src/st/st-drawing-area.c b/src/st/st-drawing-area.c index f64a5354f..ea9942a62 100644 --- a/src/st/st-drawing-area.c +++ b/src/st/st-drawing-area.c @@ -36,8 +36,6 @@ #include -G_DEFINE_TYPE(StDrawingArea, st_drawing_area, ST_TYPE_WIDGET); - struct _StDrawingAreaPrivate { CoglTexture *texture; CoglPipeline *pipeline; @@ -46,6 +44,8 @@ struct _StDrawingAreaPrivate { guint in_repaint : 1; }; +G_DEFINE_TYPE_WITH_PRIVATE (StDrawingArea, st_drawing_area, ST_TYPE_WIDGET); + /* Signals */ enum { @@ -182,15 +182,12 @@ st_drawing_area_class_init (StDrawingAreaClass *klass) G_STRUCT_OFFSET (StDrawingAreaClass, repaint), NULL, NULL, NULL, G_TYPE_NONE, 0); - - g_type_class_add_private (gobject_class, sizeof (StDrawingAreaPrivate)); } static void st_drawing_area_init (StDrawingArea *area) { - area->priv = G_TYPE_INSTANCE_GET_PRIVATE (area, ST_TYPE_DRAWING_AREA, - StDrawingAreaPrivate); + area->priv = st_drawing_area_get_instance_private (area); area->priv->texture = NULL; } diff --git a/src/st/st-entry.c b/src/st/st-entry.c index af78f453e..8752538ea 100644 --- a/src/st/st-entry.c +++ b/src/st/st-entry.c @@ -87,7 +87,6 @@ enum LAST_SIGNAL }; -#define ST_ENTRY_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ST_TYPE_ENTRY, StEntryPrivate)) #define ST_ENTRY_PRIV(x) ((StEntry *) x)->priv @@ -108,7 +107,7 @@ struct _StEntryPrivate static guint entry_signals[LAST_SIGNAL] = { 0, }; -G_DEFINE_TYPE (StEntry, st_entry, ST_TYPE_WIDGET); +G_DEFINE_TYPE_WITH_PRIVATE (StEntry, st_entry, ST_TYPE_WIDGET); static GType st_entry_accessible_get_type (void) G_GNUC_CONST; @@ -761,8 +760,6 @@ st_entry_class_init (StEntryClass *klass) StWidgetClass *widget_class = ST_WIDGET_CLASS (klass); GParamSpec *pspec; - g_type_class_add_private (klass, sizeof (StEntryPrivate)); - gobject_class->set_property = st_entry_set_property; gobject_class->get_property = st_entry_get_property; gobject_class->finalize = st_entry_finalize; @@ -858,7 +855,7 @@ st_entry_init (StEntry *entry) { StEntryPrivate *priv; - priv = entry->priv = ST_ENTRY_GET_PRIVATE (entry); + priv = entry->priv = st_entry_get_instance_private (entry); priv->entry = g_object_new (ST_TYPE_IM_TEXT, "line-alignment", PANGO_ALIGN_LEFT, diff --git a/src/st/st-focus-manager.c b/src/st/st-focus-manager.c index 2fe431b75..93f74157e 100644 --- a/src/st/st-focus-manager.c +++ b/src/st/st-focus-manager.c @@ -33,14 +33,12 @@ #include "st-focus-manager.h" -#define ST_FOCUS_MANAGER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ST_TYPE_FOCUS_MANAGER, StFocusManagerPrivate)) - struct _StFocusManagerPrivate { GHashTable *groups; }; -G_DEFINE_TYPE (StFocusManager, st_focus_manager, G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE (StFocusManager, st_focus_manager, G_TYPE_OBJECT) static void st_focus_manager_dispose (GObject *object) @@ -61,15 +59,13 @@ st_focus_manager_class_init (StFocusManagerClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (StFocusManagerPrivate)); - object_class->dispose = st_focus_manager_dispose; } static void st_focus_manager_init (StFocusManager *manager) { - manager->priv = ST_FOCUS_MANAGER_GET_PRIVATE (manager); + manager->priv = st_focus_manager_get_instance_private (manager); manager->priv->groups = g_hash_table_new (NULL, NULL); } diff --git a/src/st/st-icon.c b/src/st/st-icon.c index bc5e98e83..5fc91a4f6 100644 --- a/src/st/st-icon.c +++ b/src/st/st-icon.c @@ -42,11 +42,6 @@ enum PROP_FALLBACK_ICON_NAME }; -G_DEFINE_TYPE (StIcon, st_icon, ST_TYPE_WIDGET) - -#define ST_ICON_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ST_TYPE_ICON, StIconPrivate)) - struct _StIconPrivate { ClutterActor *icon_texture; @@ -65,6 +60,8 @@ struct _StIconPrivate StShadow *shadow_spec; }; +G_DEFINE_TYPE_WITH_PRIVATE (StIcon, st_icon, ST_TYPE_WIDGET) + static void st_icon_update (StIcon *icon); static gboolean st_icon_update_icon_size (StIcon *icon); @@ -220,8 +217,6 @@ st_icon_class_init (StIconClass *klass) ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); StWidgetClass *widget_class = ST_WIDGET_CLASS (klass); - g_type_class_add_private (klass, sizeof (StIconPrivate)); - object_class->get_property = st_icon_get_property; object_class->set_property = st_icon_set_property; object_class->dispose = st_icon_dispose; @@ -262,7 +257,7 @@ st_icon_init (StIcon *self) { ClutterLayoutManager *layout_manager; - self->priv = ST_ICON_GET_PRIVATE (self); + self->priv = st_icon_get_instance_private (self); layout_manager = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_FILL, CLUTTER_BIN_ALIGNMENT_FILL); diff --git a/src/st/st-im-text.c b/src/st/st-im-text.c index 12b7e3fe4..5f86f88b9 100644 --- a/src/st/st-im-text.c +++ b/src/st/st-im-text.c @@ -58,9 +58,6 @@ enum PROP_INPUT_HINTS, }; -#define ST_IM_TEXT_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ST_TYPE_IM_TEXT, StIMTextPrivate)) - struct _StIMTextPrivate { GtkIMContext *im_context; @@ -70,7 +67,7 @@ struct _StIMTextPrivate guint has_preedit : 1; }; -G_DEFINE_TYPE (StIMText, st_im_text, CLUTTER_TYPE_TEXT) +G_DEFINE_TYPE_WITH_PRIVATE (StIMText, st_im_text, CLUTTER_TYPE_TEXT) static void st_im_text_dispose (GObject *object) @@ -461,8 +458,6 @@ st_im_text_class_init (StIMTextClass *klass) ClutterTextClass *text_class = CLUTTER_TEXT_CLASS (klass); GParamSpec *pspec; - g_type_class_add_private (klass, sizeof (StIMTextPrivate)); - object_class->dispose = st_im_text_dispose; object_class->set_property = st_im_text_set_property; object_class->get_property = st_im_text_get_property; @@ -504,7 +499,7 @@ st_im_text_init (StIMText *self) { StIMTextPrivate *priv; - self->priv = priv = ST_IM_TEXT_GET_PRIVATE (self); + self->priv = priv = st_im_text_get_instance_private (self); priv->im_context = gtk_im_multicontext_new (); g_signal_connect (priv->im_context, "commit", diff --git a/src/st/st-label.c b/src/st/st-label.c index 6c1fd2412..95ba895b7 100644 --- a/src/st/st-label.c +++ b/src/st/st-label.c @@ -54,8 +54,6 @@ enum PROP_TEXT }; -#define ST_LABEL_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ST_TYPE_LABEL, StLabelPrivate)) - struct _StLabelPrivate { ClutterActor *label; @@ -65,7 +63,7 @@ struct _StLabelPrivate float shadow_height; }; -G_DEFINE_TYPE (StLabel, st_label, ST_TYPE_WIDGET); +G_DEFINE_TYPE_WITH_PRIVATE (StLabel, st_label, ST_TYPE_WIDGET); static GType st_label_accessible_get_type (void) G_GNUC_CONST; @@ -239,8 +237,6 @@ st_label_class_init (StLabelClass *klass) StWidgetClass *widget_class = ST_WIDGET_CLASS (klass); GParamSpec *pspec; - g_type_class_add_private (klass, sizeof (StLabelPrivate)); - gobject_class->set_property = st_label_set_property; gobject_class->get_property = st_label_get_property; gobject_class->dispose = st_label_dispose; @@ -273,7 +269,7 @@ st_label_init (StLabel *label) { StLabelPrivate *priv; - label->priv = priv = ST_LABEL_GET_PRIVATE (label); + label->priv = priv = st_label_get_instance_private (label); label->priv->label = g_object_new (CLUTTER_TYPE_TEXT, "ellipsize", PANGO_ELLIPSIZE_END, diff --git a/src/st/st-scroll-bar.c b/src/st/st-scroll-bar.c index 050c6e78b..9e4fdd2db 100644 --- a/src/st/st-scroll-bar.c +++ b/src/st/st-scroll-bar.c @@ -41,10 +41,6 @@ #include "st-private.h" #include "st-button.h" -G_DEFINE_TYPE (StScrollBar, st_scroll_bar, ST_TYPE_WIDGET) - -#define ST_SCROLL_BAR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ST_TYPE_SCROLL_BAR, StScrollBarPrivate)) - #define PAGING_INITIAL_REPEAT_TIMEOUT 500 #define PAGING_SUBSEQUENT_REPEAT_TIMEOUT 200 @@ -72,6 +68,8 @@ struct _StScrollBarPrivate guint vertical : 1; }; +G_DEFINE_TYPE_WITH_PRIVATE (StScrollBar, st_scroll_bar, ST_TYPE_WIDGET) + enum { PROP_0, @@ -502,8 +500,6 @@ st_scroll_bar_class_init (StScrollBarClass *klass) StWidgetClass *widget_class = ST_WIDGET_CLASS (klass); GParamSpec *pspec; - g_type_class_add_private (klass, sizeof (StScrollBarPrivate)); - object_class->get_property = st_scroll_bar_get_property; object_class->set_property = st_scroll_bar_set_property; object_class->dispose = st_scroll_bar_dispose; @@ -858,7 +854,7 @@ st_scroll_bar_notify_reactive (StScrollBar *self) static void st_scroll_bar_init (StScrollBar *self) { - self->priv = ST_SCROLL_BAR_GET_PRIVATE (self); + self->priv = st_scroll_bar_get_instance_private (self); self->priv->trough = (ClutterActor *) st_bin_new (); clutter_actor_set_reactive ((ClutterActor *) self->priv->trough, TRUE); diff --git a/src/st/st-scroll-view.c b/src/st/st-scroll-view.c index 302f6a756..bb26f540b 100644 --- a/src/st/st-scroll-view.c +++ b/src/st/st-scroll-view.c @@ -69,14 +69,6 @@ static void clutter_container_iface_init (ClutterContainerIface *iface); static ClutterContainerIface *st_scroll_view_parent_iface = NULL; -G_DEFINE_TYPE_WITH_CODE (StScrollView, st_scroll_view, ST_TYPE_BIN, - G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTAINER, - clutter_container_iface_init)) - -#define SCROLL_VIEW_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \ - ST_TYPE_SCROLL_VIEW, \ - StScrollViewPrivate)) - struct _StScrollViewPrivate { /* a pointer to the child; this is actually stored @@ -106,6 +98,11 @@ struct _StScrollViewPrivate guint vscrollbar_visible : 1; }; +G_DEFINE_TYPE_WITH_CODE (StScrollView, st_scroll_view, ST_TYPE_BIN, + G_ADD_PRIVATE (StScrollView) + G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTAINER, + clutter_container_iface_init)) + enum { PROP_0, @@ -790,8 +787,6 @@ st_scroll_view_class_init (StScrollViewClass *klass) ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); StWidgetClass *widget_class = ST_WIDGET_CLASS (klass); - g_type_class_add_private (klass, sizeof (StScrollViewPrivate)); - object_class->get_property = st_scroll_view_get_property; object_class->set_property = st_scroll_view_set_property; object_class->dispose = st_scroll_view_dispose; @@ -874,7 +869,7 @@ st_scroll_view_class_init (StScrollViewClass *klass) static void st_scroll_view_init (StScrollView *self) { - StScrollViewPrivate *priv = self->priv = SCROLL_VIEW_PRIVATE (self); + StScrollViewPrivate *priv = self->priv = st_scroll_view_get_instance_private (self); priv->hscrollbar_policy = GTK_POLICY_AUTOMATIC; priv->vscrollbar_policy = GTK_POLICY_AUTOMATIC; diff --git a/src/st/st-theme-node-transition.c b/src/st/st-theme-node-transition.c index a84c8871d..22a021ffa 100644 --- a/src/st/st-theme-node-transition.c +++ b/src/st/st-theme-node-transition.c @@ -27,8 +27,6 @@ enum { LAST_SIGNAL }; -#define ST_THEME_NODE_TRANSITION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ST_TYPE_THEME_NODE_TRANSITION, StThemeNodeTransitionPrivate)) - struct _StThemeNodeTransitionPrivate { StThemeNode *old_theme_node; StThemeNode *new_theme_node; @@ -57,7 +55,7 @@ struct _StThemeNodeTransitionPrivate { static guint signals[LAST_SIGNAL] = { 0 }; -G_DEFINE_TYPE (StThemeNodeTransition, st_theme_node_transition, G_TYPE_OBJECT); +G_DEFINE_TYPE_WITH_PRIVATE (StThemeNodeTransition, st_theme_node_transition, G_TYPE_OBJECT); static void @@ -435,7 +433,7 @@ st_theme_node_transition_dispose (GObject *object) static void st_theme_node_transition_init (StThemeNodeTransition *transition) { - transition->priv = ST_THEME_NODE_TRANSITION_GET_PRIVATE (transition); + transition->priv = st_theme_node_transition_get_instance_private (transition); transition->priv->old_theme_node = NULL; transition->priv->new_theme_node = NULL; @@ -457,8 +455,6 @@ st_theme_node_transition_class_init (StThemeNodeTransitionClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (StThemeNodeTransitionPrivate)); - object_class->dispose = st_theme_node_transition_dispose; signals[COMPLETED] = diff --git a/src/st/st-widget.c b/src/st/st-widget.c index fedcd145e..2aa6e4c78 100644 --- a/src/st/st-widget.c +++ b/src/st/st-widget.c @@ -128,9 +128,7 @@ static guint signals[LAST_SIGNAL] = { 0, }; gfloat st_slow_down_factor = 1.0; -G_DEFINE_TYPE (StWidget, st_widget, CLUTTER_TYPE_ACTOR); - -#define ST_WIDGET_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ST_TYPE_WIDGET, StWidgetPrivate)) +G_DEFINE_TYPE_WITH_PRIVATE (StWidget, st_widget, CLUTTER_TYPE_ACTOR); static void st_widget_recompute_style (StWidget *widget, StThemeNode *old_theme_node); @@ -822,8 +820,6 @@ st_widget_class_init (StWidgetClass *klass) ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); GParamSpec *pspec; - g_type_class_add_private (klass, sizeof (StWidgetPrivate)); - gobject_class->set_property = st_widget_set_property; gobject_class->get_property = st_widget_get_property; gobject_class->dispose = st_widget_dispose; @@ -1497,7 +1493,7 @@ st_widget_init (StWidget *actor) StWidgetPrivate *priv; guint i; - actor->priv = priv = ST_WIDGET_GET_PRIVATE (actor); + actor->priv = priv = st_widget_get_instance_private (actor); priv->transition_animation = NULL; priv->local_state_set = atk_state_set_new (); @@ -2457,12 +2453,6 @@ static void check_pseudo_class (StWidgetAccessible *self, static void check_labels (StWidgetAccessible *self, StWidget *widget); -G_DEFINE_TYPE (StWidgetAccessible, st_widget_accessible, CALLY_TYPE_ACTOR) - -#define ST_WIDGET_ACCESSIBLE_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ST_TYPE_WIDGET_ACCESSIBLE, \ - StWidgetAccessiblePrivate)) - struct _StWidgetAccessiblePrivate { /* Cached values (used to avoid extra notifications) */ @@ -2475,6 +2465,7 @@ struct _StWidgetAccessiblePrivate AtkObject *current_label; }; +G_DEFINE_TYPE_WITH_PRIVATE (StWidgetAccessible, st_widget_accessible, CALLY_TYPE_ACTOR) static AtkObject * st_widget_get_accessible (ClutterActor *actor) @@ -2591,14 +2582,12 @@ st_widget_accessible_class_init (StWidgetAccessibleClass *klass) atk_class->initialize = st_widget_accessible_initialize; atk_class->get_role = st_widget_accessible_get_role; atk_class->get_name = st_widget_accessible_get_name; - - g_type_class_add_private (gobject_class, sizeof (StWidgetAccessiblePrivate)); } static void st_widget_accessible_init (StWidgetAccessible *self) { - StWidgetAccessiblePrivate *priv = ST_WIDGET_ACCESSIBLE_GET_PRIVATE (self); + StWidgetAccessiblePrivate *priv = st_widget_accessible_get_instance_private (self); self->priv = priv; }