mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-07 01:00:28 +00:00
widget: Add a GtkWidgetClassPrivate
As long as glib doesn't provide class privates, we'll have to ship our own...
This commit is contained in:
parent
dfe5459437
commit
9ebcd66d43
@ -406,6 +406,11 @@ struct _GtkWidgetPrivate
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
};
|
||||
|
||||
struct _GtkWidgetClassPrivate
|
||||
{
|
||||
int dummy;
|
||||
};
|
||||
|
||||
enum {
|
||||
DESTROY,
|
||||
SHOW,
|
||||
@ -532,6 +537,7 @@ struct _GtkStateData
|
||||
};
|
||||
|
||||
/* --- prototypes --- */
|
||||
static void gtk_widget_base_class_init (gpointer g_class);
|
||||
static void gtk_widget_class_init (GtkWidgetClass *klass);
|
||||
static void gtk_widget_base_class_finalize (GtkWidgetClass *klass);
|
||||
static void gtk_widget_init (GtkWidget *widget);
|
||||
@ -738,7 +744,7 @@ gtk_widget_get_type (void)
|
||||
const GTypeInfo widget_info =
|
||||
{
|
||||
sizeof (GtkWidgetClass),
|
||||
NULL, /* base_init */
|
||||
gtk_widget_base_class_init,
|
||||
(GBaseFinalizeFunc) gtk_widget_base_class_finalize,
|
||||
(GClassInitFunc) gtk_widget_class_init,
|
||||
NULL, /* class_finalize */
|
||||
@ -775,6 +781,18 @@ gtk_widget_get_type (void)
|
||||
return widget_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_widget_base_class_init (gpointer g_class)
|
||||
{
|
||||
GtkWidgetClass *klass = g_class;
|
||||
|
||||
if (GTK_IS_WIDGET_CLASS (g_type_class_peek_parent (klass)))
|
||||
klass->priv = g_slice_dup (GtkWidgetClassPrivate,
|
||||
GTK_WIDGET_CLASS (g_type_class_peek_parent (klass))->priv);
|
||||
else
|
||||
klass->priv = g_slice_new0 (GtkWidgetClassPrivate);
|
||||
}
|
||||
|
||||
static void
|
||||
child_property_notify_dispatcher (GObject *object,
|
||||
guint n_pspecs,
|
||||
@ -3177,6 +3195,8 @@ gtk_widget_base_class_finalize (GtkWidgetClass *klass)
|
||||
g_param_spec_unref (pspec);
|
||||
}
|
||||
g_list_free (list);
|
||||
|
||||
g_slice_free (GtkWidgetClassPrivate, klass->priv);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -64,14 +64,15 @@ typedef enum
|
||||
|
||||
/* forward declaration to avoid excessive includes (and concurrent includes)
|
||||
*/
|
||||
typedef struct _GtkRequisition GtkRequisition;
|
||||
typedef struct _GtkSelectionData GtkSelectionData;
|
||||
typedef struct _GtkWidgetPrivate GtkWidgetPrivate;
|
||||
typedef struct _GtkWidgetClass GtkWidgetClass;
|
||||
typedef struct _GtkWidgetAuxInfo GtkWidgetAuxInfo;
|
||||
typedef struct _GtkClipboard GtkClipboard;
|
||||
typedef struct _GtkTooltip GtkTooltip;
|
||||
typedef struct _GtkWindow GtkWindow;
|
||||
typedef struct _GtkRequisition GtkRequisition;
|
||||
typedef struct _GtkSelectionData GtkSelectionData;
|
||||
typedef struct _GtkWidgetPrivate GtkWidgetPrivate;
|
||||
typedef struct _GtkWidgetClass GtkWidgetClass;
|
||||
typedef struct _GtkWidgetClassPrivate GtkWidgetClassPrivate;
|
||||
typedef struct _GtkWidgetAuxInfo GtkWidgetAuxInfo;
|
||||
typedef struct _GtkClipboard GtkClipboard;
|
||||
typedef struct _GtkTooltip GtkTooltip;
|
||||
typedef struct _GtkWindow GtkWindow;
|
||||
|
||||
|
||||
/**
|
||||
@ -428,8 +429,9 @@ struct _GtkWidgetClass
|
||||
|
||||
/*< private >*/
|
||||
|
||||
GtkWidgetClassPrivate *priv;
|
||||
|
||||
/* Padding for future expansion */
|
||||
void (*_gtk_reserved1) (void);
|
||||
void (*_gtk_reserved2) (void);
|
||||
void (*_gtk_reserved3) (void);
|
||||
void (*_gtk_reserved4) (void);
|
||||
|
Loading…
Reference in New Issue
Block a user