mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
use GNC_DEFINE_TYPE_WITH_CODE to replace g_type_class_add_private
gnc_tree_view_get_type is being replaced by that provided by GNC_DEFINE_TYPE_WITH_CODE. GNC_DEFINE_TYPE_WITH_CODE preserves 2nd init parameter.
This commit is contained in:
parent
114142766f
commit
e841a00a21
@ -77,7 +77,8 @@ static QofLogModule log_module = GNC_MOD_GUI;
|
||||
|
||||
/**** Declarations ******************************************************/
|
||||
static void gnc_tree_view_class_init (GncTreeViewClass *klass);
|
||||
static void gnc_tree_view_init (GncTreeView *view, GncTreeViewClass *klass);
|
||||
static void gnc_tree_view_init (GncTreeView *view,
|
||||
void *data);
|
||||
static void gnc_tree_view_finalize (GObject *object);
|
||||
static void gnc_tree_view_destroy (GtkWidget *widget);
|
||||
static void gnc_tree_view_set_property (GObject *object,
|
||||
@ -130,6 +131,9 @@ typedef struct GncTreeViewPrivate
|
||||
gulong size_allocate_cb_id;
|
||||
} GncTreeViewPrivate;
|
||||
|
||||
GNC_DEFINE_TYPE_WITH_CODE(GncTreeView, gnc_tree_view, GTK_TYPE_TREE_VIEW,
|
||||
G_ADD_PRIVATE(GncTreeView))
|
||||
|
||||
#define GNC_TREE_VIEW_GET_PRIVATE(o) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_TREE_VIEW, GncTreeViewPrivate))
|
||||
|
||||
@ -143,40 +147,6 @@ typedef struct GncTreeViewPrivate
|
||||
|
||||
static GObjectClass *parent_class = NULL;
|
||||
|
||||
/** Create a new glib type for the base gnucash tree view.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return The new type value.
|
||||
*/
|
||||
GType
|
||||
gnc_tree_view_get_type (void)
|
||||
{
|
||||
static GType gnc_tree_view_type = 0;
|
||||
|
||||
if (gnc_tree_view_type == 0)
|
||||
{
|
||||
static const GTypeInfo our_info =
|
||||
{
|
||||
sizeof (GncTreeViewClass),
|
||||
NULL,
|
||||
NULL,
|
||||
(GClassInitFunc) gnc_tree_view_class_init,
|
||||
NULL,
|
||||
NULL,
|
||||
sizeof (GncTreeView),
|
||||
0,
|
||||
(GInstanceInitFunc) gnc_tree_view_init
|
||||
};
|
||||
|
||||
gnc_tree_view_type = g_type_register_static (GTK_TYPE_TREE_VIEW,
|
||||
GNC_TREE_VIEW_NAME,
|
||||
&our_info, 0);
|
||||
}
|
||||
|
||||
return gnc_tree_view_type;
|
||||
}
|
||||
|
||||
/** Initialize the class for the new base gnucash tree view. This
|
||||
* will set up any function pointers that override functions in the
|
||||
* parent class, and also installs the properties that are unique to
|
||||
@ -200,8 +170,6 @@ gnc_tree_view_class_init (GncTreeViewClass *klass)
|
||||
gobject_class->set_property = gnc_tree_view_set_property;
|
||||
gobject_class->get_property = gnc_tree_view_get_property;
|
||||
|
||||
g_type_class_add_private(klass, sizeof(GncTreeViewPrivate));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_STATE_SECTION,
|
||||
g_param_spec_string ("state-section",
|
||||
@ -241,14 +209,17 @@ gnc_tree_view_update_grid_lines (gpointer prefs, gchar* pref, gpointer user_data
|
||||
* @internal
|
||||
*/
|
||||
static void
|
||||
gnc_tree_view_init (GncTreeView *view, GncTreeViewClass *klass)
|
||||
gnc_tree_view_init (GncTreeView *view, void *data)
|
||||
{
|
||||
GncTreeViewPrivate *priv;
|
||||
GtkTreeViewColumn *column;
|
||||
GtkWidget *icon;
|
||||
GtkRequisition requisition;
|
||||
|
||||
gnc_gobject_tracking_remember(G_OBJECT(view), G_OBJECT_CLASS(klass));
|
||||
GncTreeViewClass *klass = (GncTreeViewClass*)data;
|
||||
|
||||
gnc_gobject_tracking_remember(G_OBJECT(view),
|
||||
G_OBJECT_CLASS(klass));
|
||||
|
||||
priv = GNC_TREE_VIEW_GET_PRIVATE(view);
|
||||
priv->column_menu = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user