diff options
| author | Alex Valavanis <valavanisalex@gmail.com> | 2014-08-24 13:44:13 +0000 |
|---|---|---|
| committer | Alex Valavanis <valavanisalex@gmail.com> | 2014-08-24 13:44:13 +0000 |
| commit | 4acd1d8939d4810eb23222638f4db0471f91b386 (patch) | |
| tree | 6560091f3bdf80435205f00c31263a7d3ecd0de5 /src/widgets/sp-xmlview-tree.cpp | |
| parent | desktop-widget: GObject boilerplate reduction (diff) | |
| download | inkscape-4acd1d8939d4810eb23222638f4db0471f91b386.tar.gz inkscape-4acd1d8939d4810eb23222638f4db0471f91b386.zip | |
More GObject boilerplate reduction
(bzr r13341.1.174)
Diffstat (limited to 'src/widgets/sp-xmlview-tree.cpp')
| -rw-r--r-- | src/widgets/sp-xmlview-tree.cpp | 34 |
1 files changed, 3 insertions, 31 deletions
diff --git a/src/widgets/sp-xmlview-tree.cpp b/src/widgets/sp-xmlview-tree.cpp index 9b3775a34..5dff9adf3 100644 --- a/src/widgets/sp-xmlview-tree.cpp +++ b/src/widgets/sp-xmlview-tree.cpp @@ -23,9 +23,6 @@ struct NodeData { enum { STORE_TEXT_COL = 0, STORE_DATA_COL, STORE_REPR_COL, STORE_N_COLS }; -static void sp_xmlview_tree_class_init (SPXMLViewTreeClass * klass); -static void sp_xmlview_tree_init (SPXMLViewTree * tree); - #if GTK_CHECK_VERSION(3,0,0) static void sp_xmlview_tree_destroy(GtkWidget * object); #else @@ -90,8 +87,6 @@ static const Inkscape::XML::NodeEventVector pi_repr_events = { NULL /* order_changed */ }; -static GtkTreeViewClass * parent_class = NULL; - GtkWidget *sp_xmlview_tree_new(Inkscape::XML::Node * repr, void * /*factory*/, void * /*data*/) { SPXMLViewTree *tree = SP_XMLVIEW_TREE(g_object_new (SP_TYPE_XMLVIEW_TREE, NULL)); @@ -122,28 +117,7 @@ GtkWidget *sp_xmlview_tree_new(Inkscape::XML::Node * repr, void * /*factory*/, v return GTK_WIDGET(tree); } -GType -sp_xmlview_tree_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (SPXMLViewTreeClass), - NULL, NULL, - (GClassInitFunc) sp_xmlview_tree_class_init, - NULL, NULL, - sizeof (SPXMLViewTree), - 0, - (GInstanceInitFunc) sp_xmlview_tree_init, - NULL - }; - type = g_type_register_static (GTK_TYPE_TREE_VIEW, "SPXMLViewTree", &info, (GTypeFlags)0); - } - - - return type; -} +G_DEFINE_TYPE(SPXMLViewTree, sp_xmlview_tree, GTK_TYPE_TREE_VIEW); void sp_xmlview_tree_class_init(SPXMLViewTreeClass * klass) { @@ -155,8 +129,6 @@ void sp_xmlview_tree_class_init(SPXMLViewTreeClass * klass) object_class->destroy = sp_xmlview_tree_destroy; #endif - parent_class = GTK_TREE_VIEW_CLASS(g_type_class_peek_parent (klass)); - // Signal for when a tree drag and drop has completed g_signal_new ( "tree_move", G_TYPE_FROM_CLASS(klass), @@ -188,9 +160,9 @@ void sp_xmlview_tree_destroy(GtkObject * object) sp_xmlview_tree_set_repr (tree, NULL); #if GTK_CHECK_VERSION(3,0,0) - GTK_WIDGET_CLASS(parent_class)->destroy (object); + GTK_WIDGET_CLASS(sp_xmlview_tree_parent_class)->destroy (object); #else - GTK_OBJECT_CLASS(parent_class)->destroy (object); + GTK_OBJECT_CLASS(sp_xmlview_tree_parent_class)->destroy (object); #endif } |
