gplugin/gplugin

041fbe100c2f
Parents 6208c125120e
Children 148ef37b20d5
Clean up some missed bits about private instance data
--- a/gplugin-gtk/gplugin-gtk-view.c Mon Oct 08 20:27:16 2018 -0500
+++ b/gplugin-gtk/gplugin-gtk-view.c Sun Oct 14 04:45:05 2018 -0500
@@ -26,9 +26,6 @@
* #GPluginGtkView is a display widget for a list of GPlugins.
*/
-#define GPLUGIN_GTK_VIEW_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE((obj), GPLUGIN_GTK_TYPE_VIEW, GPluginGtkViewPrivate))
-
/******************************************************************************
* Structs
*****************************************************************************/
@@ -44,15 +41,12 @@
PROP_SHOW_INTERNAL,
N_PROPERTIES,
};
-
-/******************************************************************************
- * Globals
- *****************************************************************************/
+static GParamSpec *properties[N_PROPERTIES] = {NULL,};
/******************************************************************************
* GObject Stuff
*****************************************************************************/
-G_DEFINE_TYPE(GPluginGtkView, gplugin_gtk_view, GTK_TYPE_TREE_VIEW);
+G_DEFINE_TYPE_WITH_PRIVATE(GPluginGtkView, gplugin_gtk_view, GTK_TYPE_TREE_VIEW);
static void
gplugin_gtk_view_set_property(GObject *obj, guint prop_id, const GValue *value,
@@ -136,8 +130,6 @@
gplugin_gtk_view_class_init(GPluginGtkViewClass *klass) {
GObjectClass *obj_class = G_OBJECT_CLASS(klass);
- g_type_class_add_private(obj_class, sizeof(GPluginGtkViewPrivate));
-
obj_class->get_property = gplugin_gtk_view_get_property;
obj_class->set_property = gplugin_gtk_view_set_property;
obj_class->constructed = gplugin_gtk_view_constructed;
@@ -150,12 +142,14 @@
*
* Whether or not to show internal plugins.
*/
- g_object_class_install_property(obj_class, PROP_SHOW_INTERNAL,
- g_param_spec_boolean("show-internal",
- "show-internal",
- "Whether or not to show internal plugins",
- FALSE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ properties[PROP_SHOW_INTERNAL] = g_param_spec_boolean(
+ "show-internal", "show-internal",
+ "Whether or not to show internal plugins",
+ FALSE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS
+ );
+
+ g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
}
/******************************************************************************
@@ -197,7 +191,7 @@
g_return_if_fail(GPLUGIN_GTK_IS_VIEW(view));
- priv = GPLUGIN_GTK_VIEW_GET_PRIVATE(view);
+ priv = gplugin_gtk_view_get_instance_private(view);
priv->show_internal = show_internal;
@@ -211,12 +205,12 @@
* Returns whether or not @view is showing internal plugins.
*/
gboolean
-gplugin_gtk_view_get_show_internal(const GPluginGtkView *view) {
+gplugin_gtk_view_get_show_internal(GPluginGtkView *view) {
GPluginGtkViewPrivate *priv = NULL;
g_return_val_if_fail(GPLUGIN_GTK_IS_VIEW(view), FALSE);
- priv = GPLUGIN_GTK_VIEW_GET_PRIVATE(view);
+ priv = gplugin_gtk_view_get_instance_private(view);
return priv->show_internal;
}
--- a/gplugin-gtk/gplugin-gtk-view.h Mon Oct 08 20:27:16 2018 -0500
+++ b/gplugin-gtk/gplugin-gtk-view.h Sun Oct 14 04:45:05 2018 -0500
@@ -42,19 +42,13 @@
struct _GPluginGtkView {
GtkTreeView parent;
- void (*_gplugin_reserved1)(void);
- void (*_gplugin_reserved2)(void);
- void (*_gplugin_reserved3)(void);
- void (*_gplugin_reserved4)(void);
+ gpointer reserved[4];
};
struct _GPluginGtkViewClass {
GtkTreeViewClass parent;
- void (*_gplugin_reserved1)(void);
- void (*_gplugin_reserved2)(void);
- void (*_gplugin_reserved3)(void);
- void (*_gplugin_reserved4)(void);
+ gpointer reserved[4];
};
G_BEGIN_DECLS
@@ -64,7 +58,7 @@
GtkWidget *gplugin_gtk_view_new(void);
void gplugin_gtk_view_set_show_internal(GPluginGtkView *view, gboolean show_internal);
-gboolean gplugin_gtk_view_get_show_internal(const GPluginGtkView *view);
+gboolean gplugin_gtk_view_get_show_internal(GPluginGtkView *view);
G_END_DECLS