st: Use G_DEFINE_TYPE_WITH_PRIVATE() and friends

This commit is contained in:
Florian Müllner 2015-09-24 18:04:48 +02:00
parent ede81017ec
commit cd7d564125
16 changed files with 47 additions and 119 deletions

View File

@ -37,10 +37,6 @@
#include "st-adjustment.h" #include "st-adjustment.h"
#include "st-private.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 struct _StAdjustmentPrivate
{ {
/* Do not sanity-check values while constructing, /* Do not sanity-check values while constructing,
@ -55,6 +51,8 @@ struct _StAdjustmentPrivate
gdouble page_size; gdouble page_size;
}; };
G_DEFINE_TYPE_WITH_PRIVATE (StAdjustment, st_adjustment, G_TYPE_OBJECT)
enum enum
{ {
PROP_0, PROP_0,
@ -191,8 +189,6 @@ st_adjustment_class_init (StAdjustmentClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (StAdjustmentPrivate));
object_class->constructed = st_adjustment_constructed; object_class->constructed = st_adjustment_constructed;
object_class->get_property = st_adjustment_get_property; object_class->get_property = st_adjustment_get_property;
object_class->set_property = st_adjustment_set_property; object_class->set_property = st_adjustment_set_property;
@ -275,7 +271,7 @@ st_adjustment_class_init (StAdjustmentClass *klass)
static void static void
st_adjustment_init (StAdjustment *self) st_adjustment_init (StAdjustment *self)
{ {
self->priv = ADJUSTMENT_PRIVATE (self); self->priv = st_adjustment_get_instance_private (self);
self->priv->is_constructing = TRUE; self->priv->is_constructing = TRUE;
} }

View File

@ -38,8 +38,6 @@
#include "st-enum-types.h" #include "st-enum-types.h"
#include "st-private.h" #include "st-private.h"
#define ST_BIN_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ST_TYPE_BIN, StBinPrivate))
struct _StBinPrivate struct _StBinPrivate
{ {
ClutterActor *child; ClutterActor *child;
@ -65,6 +63,7 @@ enum
static void clutter_container_iface_init (ClutterContainerIface *iface); static void clutter_container_iface_init (ClutterContainerIface *iface);
G_DEFINE_TYPE_WITH_CODE (StBin, st_bin, ST_TYPE_WIDGET, G_DEFINE_TYPE_WITH_CODE (StBin, st_bin, ST_TYPE_WIDGET,
G_ADD_PRIVATE (StBin)
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTAINER, G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTAINER,
clutter_container_iface_init)); clutter_container_iface_init));
@ -311,8 +310,6 @@ st_bin_class_init (StBinClass *klass)
StWidgetClass *widget_class = ST_WIDGET_CLASS (klass); StWidgetClass *widget_class = ST_WIDGET_CLASS (klass);
GParamSpec *pspec; GParamSpec *pspec;
g_type_class_add_private (klass, sizeof (StBinPrivate));
gobject_class->set_property = st_bin_set_property; gobject_class->set_property = st_bin_set_property;
gobject_class->get_property = st_bin_get_property; gobject_class->get_property = st_bin_get_property;
gobject_class->dispose = st_bin_dispose; gobject_class->dispose = st_bin_dispose;
@ -392,7 +389,7 @@ st_bin_class_init (StBinClass *klass)
static void static void
st_bin_init (StBin *bin) 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->x_align = ST_ALIGN_MIDDLE;
bin->priv->y_align = ST_ALIGN_MIDDLE; bin->priv->y_align = ST_ALIGN_MIDDLE;

View File

@ -30,9 +30,6 @@
G_DEFINE_TYPE (StBoxLayoutChild, st_box_layout_child, CLUTTER_TYPE_CHILD_META) 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 enum
{ {

View File

@ -59,15 +59,6 @@
static void st_box_container_iface_init (ClutterContainerIface *iface); static void st_box_container_iface_init (ClutterContainerIface *iface);
static void st_box_scrollable_interface_init (StScrollableInterface *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 { enum {
PROP_0, PROP_0,
@ -84,6 +75,13 @@ struct _StBoxLayoutPrivate
StAdjustment *vadjustment; 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 * StScrollable Interface Implementation
*/ */
@ -588,8 +586,6 @@ st_box_layout_class_init (StBoxLayoutClass *klass)
StWidgetClass *widget_class = ST_WIDGET_CLASS (klass); StWidgetClass *widget_class = ST_WIDGET_CLASS (klass);
GParamSpec *pspec; GParamSpec *pspec;
g_type_class_add_private (klass, sizeof (StBoxLayoutPrivate));
object_class->get_property = st_box_layout_get_property; object_class->get_property = st_box_layout_get_property;
object_class->set_property = st_box_layout_set_property; object_class->set_property = st_box_layout_set_property;
object_class->dispose = st_box_layout_dispose; object_class->dispose = st_box_layout_dispose;
@ -632,7 +628,7 @@ st_box_layout_class_init (StBoxLayoutClass *klass)
static void static void
st_box_layout_init (StBoxLayout *self) 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_signal_connect (self, "notify::layout-manager",
G_CALLBACK (on_layout_manager_notify), NULL); G_CALLBACK (on_layout_manager_notify), NULL);

View File

@ -64,9 +64,6 @@ enum
LAST_SIGNAL LAST_SIGNAL
}; };
#define ST_BUTTON_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), ST_TYPE_BUTTON, StButtonPrivate))
struct _StButtonPrivate struct _StButtonPrivate
{ {
gchar *text; gchar *text;
@ -86,7 +83,7 @@ struct _StButtonPrivate
static guint button_signals[LAST_SIGNAL] = { 0, }; 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; 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); StWidgetClass *widget_class = ST_WIDGET_CLASS (klass);
GParamSpec *pspec; GParamSpec *pspec;
g_type_class_add_private (klass, sizeof (StButtonPrivate));
gobject_class->set_property = st_button_set_property; gobject_class->set_property = st_button_set_property;
gobject_class->get_property = st_button_get_property; gobject_class->get_property = st_button_get_property;
gobject_class->finalize = st_button_finalize; gobject_class->finalize = st_button_finalize;
@ -512,7 +507,7 @@ st_button_class_init (StButtonClass *klass)
static void static void
st_button_init (StButton *button) 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->spacing = 6;
button->priv->button_mask = ST_BUTTON_ONE; button->priv->button_mask = ST_BUTTON_ONE;

View File

@ -34,11 +34,6 @@
#include <gdk/gdkx.h> #include <gdk/gdkx.h>
#include <string.h> #include <string.h>
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 struct _StClipboardPrivate
{ {
Window clipboard_window; Window clipboard_window;
@ -48,6 +43,8 @@ struct _StClipboardPrivate
gint n_targets; gint n_targets;
}; };
G_DEFINE_TYPE_WITH_PRIVATE (StClipboard, st_clipboard, G_TYPE_OBJECT)
typedef struct _EventFilterData EventFilterData; typedef struct _EventFilterData EventFilterData;
struct _EventFilterData struct _EventFilterData
{ {
@ -182,8 +179,6 @@ st_clipboard_class_init (StClipboardClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (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->get_property = st_clipboard_get_property;
object_class->set_property = st_clipboard_set_property; object_class->set_property = st_clipboard_set_property;
object_class->dispose = st_clipboard_dispose; object_class->dispose = st_clipboard_dispose;
@ -197,7 +192,7 @@ st_clipboard_init (StClipboard *self)
Display *dpy; Display *dpy;
StClipboardPrivate *priv; StClipboardPrivate *priv;
priv = self->priv = CLIPBOARD_PRIVATE (self); priv = self->priv = st_clipboard_get_instance_private (self);
gdk_display = gdk_display_get_default (); gdk_display = gdk_display_get_default ();
dpy = GDK_DISPLAY_XDISPLAY (gdk_display); dpy = GDK_DISPLAY_XDISPLAY (gdk_display);

View File

@ -36,8 +36,6 @@
#include <cairo.h> #include <cairo.h>
G_DEFINE_TYPE(StDrawingArea, st_drawing_area, ST_TYPE_WIDGET);
struct _StDrawingAreaPrivate { struct _StDrawingAreaPrivate {
CoglTexture *texture; CoglTexture *texture;
CoglPipeline *pipeline; CoglPipeline *pipeline;
@ -46,6 +44,8 @@ struct _StDrawingAreaPrivate {
guint in_repaint : 1; guint in_repaint : 1;
}; };
G_DEFINE_TYPE_WITH_PRIVATE (StDrawingArea, st_drawing_area, ST_TYPE_WIDGET);
/* Signals */ /* Signals */
enum enum
{ {
@ -182,15 +182,12 @@ st_drawing_area_class_init (StDrawingAreaClass *klass)
G_STRUCT_OFFSET (StDrawingAreaClass, repaint), G_STRUCT_OFFSET (StDrawingAreaClass, repaint),
NULL, NULL, NULL, NULL, NULL, NULL,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
g_type_class_add_private (gobject_class, sizeof (StDrawingAreaPrivate));
} }
static void static void
st_drawing_area_init (StDrawingArea *area) st_drawing_area_init (StDrawingArea *area)
{ {
area->priv = G_TYPE_INSTANCE_GET_PRIVATE (area, ST_TYPE_DRAWING_AREA, area->priv = st_drawing_area_get_instance_private (area);
StDrawingAreaPrivate);
area->priv->texture = NULL; area->priv->texture = NULL;
} }

View File

@ -87,7 +87,6 @@ enum
LAST_SIGNAL 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 #define ST_ENTRY_PRIV(x) ((StEntry *) x)->priv
@ -108,7 +107,7 @@ struct _StEntryPrivate
static guint entry_signals[LAST_SIGNAL] = { 0, }; 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; 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); StWidgetClass *widget_class = ST_WIDGET_CLASS (klass);
GParamSpec *pspec; GParamSpec *pspec;
g_type_class_add_private (klass, sizeof (StEntryPrivate));
gobject_class->set_property = st_entry_set_property; gobject_class->set_property = st_entry_set_property;
gobject_class->get_property = st_entry_get_property; gobject_class->get_property = st_entry_get_property;
gobject_class->finalize = st_entry_finalize; gobject_class->finalize = st_entry_finalize;
@ -858,7 +855,7 @@ st_entry_init (StEntry *entry)
{ {
StEntryPrivate *priv; 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, priv->entry = g_object_new (ST_TYPE_IM_TEXT,
"line-alignment", PANGO_ALIGN_LEFT, "line-alignment", PANGO_ALIGN_LEFT,

View File

@ -33,14 +33,12 @@
#include "st-focus-manager.h" #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 struct _StFocusManagerPrivate
{ {
GHashTable *groups; 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 static void
st_focus_manager_dispose (GObject *object) st_focus_manager_dispose (GObject *object)
@ -61,15 +59,13 @@ st_focus_manager_class_init (StFocusManagerClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (StFocusManagerPrivate));
object_class->dispose = st_focus_manager_dispose; object_class->dispose = st_focus_manager_dispose;
} }
static void static void
st_focus_manager_init (StFocusManager *manager) 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); manager->priv->groups = g_hash_table_new (NULL, NULL);
} }

View File

@ -42,11 +42,6 @@ enum
PROP_FALLBACK_ICON_NAME 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 struct _StIconPrivate
{ {
ClutterActor *icon_texture; ClutterActor *icon_texture;
@ -65,6 +60,8 @@ struct _StIconPrivate
StShadow *shadow_spec; StShadow *shadow_spec;
}; };
G_DEFINE_TYPE_WITH_PRIVATE (StIcon, st_icon, ST_TYPE_WIDGET)
static void st_icon_update (StIcon *icon); static void st_icon_update (StIcon *icon);
static gboolean st_icon_update_icon_size (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); ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
StWidgetClass *widget_class = ST_WIDGET_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->get_property = st_icon_get_property;
object_class->set_property = st_icon_set_property; object_class->set_property = st_icon_set_property;
object_class->dispose = st_icon_dispose; object_class->dispose = st_icon_dispose;
@ -262,7 +257,7 @@ st_icon_init (StIcon *self)
{ {
ClutterLayoutManager *layout_manager; 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, layout_manager = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_FILL,
CLUTTER_BIN_ALIGNMENT_FILL); CLUTTER_BIN_ALIGNMENT_FILL);

View File

@ -58,9 +58,6 @@ enum
PROP_INPUT_HINTS, PROP_INPUT_HINTS,
}; };
#define ST_IM_TEXT_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), ST_TYPE_IM_TEXT, StIMTextPrivate))
struct _StIMTextPrivate struct _StIMTextPrivate
{ {
GtkIMContext *im_context; GtkIMContext *im_context;
@ -70,7 +67,7 @@ struct _StIMTextPrivate
guint has_preedit : 1; 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 static void
st_im_text_dispose (GObject *object) st_im_text_dispose (GObject *object)
@ -461,8 +458,6 @@ st_im_text_class_init (StIMTextClass *klass)
ClutterTextClass *text_class = CLUTTER_TEXT_CLASS (klass); ClutterTextClass *text_class = CLUTTER_TEXT_CLASS (klass);
GParamSpec *pspec; GParamSpec *pspec;
g_type_class_add_private (klass, sizeof (StIMTextPrivate));
object_class->dispose = st_im_text_dispose; object_class->dispose = st_im_text_dispose;
object_class->set_property = st_im_text_set_property; object_class->set_property = st_im_text_set_property;
object_class->get_property = st_im_text_get_property; object_class->get_property = st_im_text_get_property;
@ -504,7 +499,7 @@ st_im_text_init (StIMText *self)
{ {
StIMTextPrivate *priv; 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 (); priv->im_context = gtk_im_multicontext_new ();
g_signal_connect (priv->im_context, "commit", g_signal_connect (priv->im_context, "commit",

View File

@ -54,8 +54,6 @@ enum
PROP_TEXT PROP_TEXT
}; };
#define ST_LABEL_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ST_TYPE_LABEL, StLabelPrivate))
struct _StLabelPrivate struct _StLabelPrivate
{ {
ClutterActor *label; ClutterActor *label;
@ -65,7 +63,7 @@ struct _StLabelPrivate
float shadow_height; 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; 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); StWidgetClass *widget_class = ST_WIDGET_CLASS (klass);
GParamSpec *pspec; GParamSpec *pspec;
g_type_class_add_private (klass, sizeof (StLabelPrivate));
gobject_class->set_property = st_label_set_property; gobject_class->set_property = st_label_set_property;
gobject_class->get_property = st_label_get_property; gobject_class->get_property = st_label_get_property;
gobject_class->dispose = st_label_dispose; gobject_class->dispose = st_label_dispose;
@ -273,7 +269,7 @@ st_label_init (StLabel *label)
{ {
StLabelPrivate *priv; 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, label->priv->label = g_object_new (CLUTTER_TYPE_TEXT,
"ellipsize", PANGO_ELLIPSIZE_END, "ellipsize", PANGO_ELLIPSIZE_END,

View File

@ -41,10 +41,6 @@
#include "st-private.h" #include "st-private.h"
#include "st-button.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_INITIAL_REPEAT_TIMEOUT 500
#define PAGING_SUBSEQUENT_REPEAT_TIMEOUT 200 #define PAGING_SUBSEQUENT_REPEAT_TIMEOUT 200
@ -72,6 +68,8 @@ struct _StScrollBarPrivate
guint vertical : 1; guint vertical : 1;
}; };
G_DEFINE_TYPE_WITH_PRIVATE (StScrollBar, st_scroll_bar, ST_TYPE_WIDGET)
enum enum
{ {
PROP_0, PROP_0,
@ -502,8 +500,6 @@ st_scroll_bar_class_init (StScrollBarClass *klass)
StWidgetClass *widget_class = ST_WIDGET_CLASS (klass); StWidgetClass *widget_class = ST_WIDGET_CLASS (klass);
GParamSpec *pspec; GParamSpec *pspec;
g_type_class_add_private (klass, sizeof (StScrollBarPrivate));
object_class->get_property = st_scroll_bar_get_property; object_class->get_property = st_scroll_bar_get_property;
object_class->set_property = st_scroll_bar_set_property; object_class->set_property = st_scroll_bar_set_property;
object_class->dispose = st_scroll_bar_dispose; object_class->dispose = st_scroll_bar_dispose;
@ -858,7 +854,7 @@ st_scroll_bar_notify_reactive (StScrollBar *self)
static void static void
st_scroll_bar_init (StScrollBar *self) 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 (); self->priv->trough = (ClutterActor *) st_bin_new ();
clutter_actor_set_reactive ((ClutterActor *) self->priv->trough, TRUE); clutter_actor_set_reactive ((ClutterActor *) self->priv->trough, TRUE);

View File

@ -69,14 +69,6 @@ static void clutter_container_iface_init (ClutterContainerIface *iface);
static ClutterContainerIface *st_scroll_view_parent_iface = NULL; 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 struct _StScrollViewPrivate
{ {
/* a pointer to the child; this is actually stored /* a pointer to the child; this is actually stored
@ -106,6 +98,11 @@ struct _StScrollViewPrivate
guint vscrollbar_visible : 1; 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 { enum {
PROP_0, PROP_0,
@ -790,8 +787,6 @@ st_scroll_view_class_init (StScrollViewClass *klass)
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
StWidgetClass *widget_class = ST_WIDGET_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->get_property = st_scroll_view_get_property;
object_class->set_property = st_scroll_view_set_property; object_class->set_property = st_scroll_view_set_property;
object_class->dispose = st_scroll_view_dispose; object_class->dispose = st_scroll_view_dispose;
@ -874,7 +869,7 @@ st_scroll_view_class_init (StScrollViewClass *klass)
static void static void
st_scroll_view_init (StScrollView *self) 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->hscrollbar_policy = GTK_POLICY_AUTOMATIC;
priv->vscrollbar_policy = GTK_POLICY_AUTOMATIC; priv->vscrollbar_policy = GTK_POLICY_AUTOMATIC;

View File

@ -27,8 +27,6 @@ enum {
LAST_SIGNAL LAST_SIGNAL
}; };
#define ST_THEME_NODE_TRANSITION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ST_TYPE_THEME_NODE_TRANSITION, StThemeNodeTransitionPrivate))
struct _StThemeNodeTransitionPrivate { struct _StThemeNodeTransitionPrivate {
StThemeNode *old_theme_node; StThemeNode *old_theme_node;
StThemeNode *new_theme_node; StThemeNode *new_theme_node;
@ -57,7 +55,7 @@ struct _StThemeNodeTransitionPrivate {
static guint signals[LAST_SIGNAL] = { 0 }; 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 static void
@ -435,7 +433,7 @@ st_theme_node_transition_dispose (GObject *object)
static void static void
st_theme_node_transition_init (StThemeNodeTransition *transition) 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->old_theme_node = NULL;
transition->priv->new_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); GObjectClass *object_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (StThemeNodeTransitionPrivate));
object_class->dispose = st_theme_node_transition_dispose; object_class->dispose = st_theme_node_transition_dispose;
signals[COMPLETED] = signals[COMPLETED] =

View File

@ -128,9 +128,7 @@ static guint signals[LAST_SIGNAL] = { 0, };
gfloat st_slow_down_factor = 1.0; gfloat st_slow_down_factor = 1.0;
G_DEFINE_TYPE (StWidget, st_widget, CLUTTER_TYPE_ACTOR); G_DEFINE_TYPE_WITH_PRIVATE (StWidget, st_widget, CLUTTER_TYPE_ACTOR);
#define ST_WIDGET_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ST_TYPE_WIDGET, StWidgetPrivate))
static void st_widget_recompute_style (StWidget *widget, static void st_widget_recompute_style (StWidget *widget,
StThemeNode *old_theme_node); StThemeNode *old_theme_node);
@ -822,8 +820,6 @@ st_widget_class_init (StWidgetClass *klass)
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
GParamSpec *pspec; GParamSpec *pspec;
g_type_class_add_private (klass, sizeof (StWidgetPrivate));
gobject_class->set_property = st_widget_set_property; gobject_class->set_property = st_widget_set_property;
gobject_class->get_property = st_widget_get_property; gobject_class->get_property = st_widget_get_property;
gobject_class->dispose = st_widget_dispose; gobject_class->dispose = st_widget_dispose;
@ -1497,7 +1493,7 @@ st_widget_init (StWidget *actor)
StWidgetPrivate *priv; StWidgetPrivate *priv;
guint i; guint i;
actor->priv = priv = ST_WIDGET_GET_PRIVATE (actor); actor->priv = priv = st_widget_get_instance_private (actor);
priv->transition_animation = NULL; priv->transition_animation = NULL;
priv->local_state_set = atk_state_set_new (); 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, static void check_labels (StWidgetAccessible *self,
StWidget *widget); 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 struct _StWidgetAccessiblePrivate
{ {
/* Cached values (used to avoid extra notifications) */ /* Cached values (used to avoid extra notifications) */
@ -2475,6 +2465,7 @@ struct _StWidgetAccessiblePrivate
AtkObject *current_label; AtkObject *current_label;
}; };
G_DEFINE_TYPE_WITH_PRIVATE (StWidgetAccessible, st_widget_accessible, CALLY_TYPE_ACTOR)
static AtkObject * static AtkObject *
st_widget_get_accessible (ClutterActor *actor) 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->initialize = st_widget_accessible_initialize;
atk_class->get_role = st_widget_accessible_get_role; atk_class->get_role = st_widget_accessible_get_role;
atk_class->get_name = st_widget_accessible_get_name; atk_class->get_name = st_widget_accessible_get_name;
g_type_class_add_private (gobject_class, sizeof (StWidgetAccessiblePrivate));
} }
static void static void
st_widget_accessible_init (StWidgetAccessible *self) 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; self->priv = priv;
} }