[nautilus-actions] nact_tree_view_get_type(): add interface after having registered the type



commit 09cd8280e9d77123adfc0732865d820cd55bcf5e
Author: Pierre Wieser <pwieser trychlos org>
Date:   Sun Jan 8 14:11:55 2012 +0100

    nact_tree_view_get_type(): add interface after having registered the type

 ChangeLog                 |    4 ++++
 src/nact/nact-tree-view.c |   15 +++++++--------
 2 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f3c71ef..da5c196 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2012-01-08 Pierre Wieser <pwieser trychlos org>
 
+	* src/nact/nact-tree-view.c (nact_tree_view_get_type):
+	Register the interface after the type so that the interface is able to
+	require the type.
+
 	A program to test a class which implements an interface, this same
 	interface itself requiring the class...
 
diff --git a/src/nact/nact-tree-view.c b/src/nact/nact-tree-view.c
index 02657df..cdecb12 100644
--- a/src/nact/nact-tree-view.c
+++ b/src/nact/nact-tree-view.c
@@ -170,8 +170,15 @@ nact_tree_view_get_type( void )
 {
 	static GType type = 0;
 
+	static const GInterfaceInfo tree_ieditable_iface_info = {
+		( GInterfaceInitFunc ) tree_ieditable_iface_init,
+		NULL,
+		NULL
+	};
+
 	if( !type ){
 		type = register_type();
+		g_type_add_interface_static( type, NACT_TREE_IEDITABLE_TYPE, &tree_ieditable_iface_info );
 	}
 
 	return( type );
@@ -195,18 +202,10 @@ register_type( void )
 		( GInstanceInitFunc ) instance_init
 	};
 
-	static const GInterfaceInfo tree_ieditable_iface_info = {
-		( GInterfaceInitFunc ) tree_ieditable_iface_init,
-		NULL,
-		NULL
-	};
-
 	g_debug( "%s", thisfn );
 
 	type = g_type_register_static( G_TYPE_OBJECT, "NactTreeView", &info, 0 );
 
-	g_type_add_interface_static( type, NACT_TREE_IEDITABLE_TYPE, &tree_ieditable_iface_info );
-
 	return( type );
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]