[nautilus-actions] Review NAIIOProvider interface



commit d454462fca6ce3d12bdb0bb66f299210ff5b8b59
Author: Pierre Wieser <pwieser trychlos org>
Date:   Tue Jan 3 23:19:38 2012 +0100

    Review NAIIOProvider interface

 ChangeLog                  |    2 ++
 src/core/na-iio-provider.c |   33 ++++++++++++++++-----------------
 2 files changed, 18 insertions(+), 17 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index eabb155..4370876 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2012-01-03 Pierre Wieser <pwieser trychlos org>
 
+	* src/core/na-iio-provider.c: Review NAIIOProvider interface.
+
 	* src/core/na-iimporter.c:
 	* src/core/na-importer.c: Review NAIImporterInterface.
 
diff --git a/src/core/na-iio-provider.c b/src/core/na-iio-provider.c
index 0400166..0d88d6e 100644
--- a/src/core/na-iio-provider.c
+++ b/src/core/na-iio-provider.c
@@ -49,13 +49,12 @@ enum {
 	LAST_SIGNAL
 };
 
-static gboolean st_initialized            = FALSE;
-static gboolean st_finalized              = FALSE;
-static gint     st_signals[ LAST_SIGNAL ] = { 0 };
+static guint st_initializations = 0;	/* interface initialization count */
+static gint  st_signals[ LAST_SIGNAL ] = { 0 };
 
 static GType    register_type( void );
-static void     interface_base_init( NAIIOProviderInterface *klass );
-static void     interface_base_finalize( NAIIOProviderInterface *klass );
+static void     interface_init( NAIIOProviderInterface *klass );
+static void     interface_finalize( NAIIOProviderInterface *klass );
 
 static gboolean do_is_willing_to_write( const NAIIOProvider *instance );
 static gboolean do_is_able_to_write( const NAIIOProvider *instance );
@@ -90,8 +89,8 @@ register_type( void )
 
 	static const GTypeInfo info = {
 		sizeof( NAIIOProviderInterface ),
-		( GBaseInitFunc ) interface_base_init,
-		( GBaseFinalizeFunc ) interface_base_finalize,
+		( GBaseInitFunc ) interface_init,
+		( GBaseFinalizeFunc ) interface_finalize,
 		NULL,
 		NULL,
 		NULL,
@@ -110,11 +109,11 @@ register_type( void )
 }
 
 static void
-interface_base_init( NAIIOProviderInterface *klass )
+interface_init( NAIIOProviderInterface *klass )
 {
-	static const gchar *thisfn = "na_iio_provider_interface_base_init";
+	static const gchar *thisfn = "na_iio_provider_interface_init";
 
-	if( !st_initialized ){
+	if( !st_initializations ){
 
 		g_debug( "%s: klass%p (%s)", thisfn, ( void * ) klass, G_OBJECT_CLASS_NAME( klass ));
 
@@ -151,21 +150,21 @@ interface_base_init( NAIIOProviderInterface *klass )
 					g_cclosure_marshal_VOID__VOID,
 					G_TYPE_NONE,
 					0 );
-
-		st_initialized = TRUE;
 	}
+
+	st_initializations += 1;
 }
 
 static void
-interface_base_finalize( NAIIOProviderInterface *klass )
+interface_finalize( NAIIOProviderInterface *klass )
 {
-	static const gchar *thisfn = "na_iio_provider_interface_base_finalize";
+	static const gchar *thisfn = "na_iio_provider_interface_finalize";
 
-	if( st_initialized && !st_finalized ){
+	st_initializations -= 1;
 
-		g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
+	if( !st_initializations ){
 
-		st_finalized = TRUE;
+		g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
 
 		g_free( klass->private );
 	}



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