[nautilus-actions] Review NactISchemesTab interface



commit 347a2145b3f48c73c822e6a3f00415baf7078054
Author: Pierre Wieser <pwieser trychlos org>
Date:   Wed Jan 4 21:43:31 2012 +0100

    Review NactISchemesTab interface

 ChangeLog                    |    2 +
 src/nact/nact-ischemes-tab.c |   86 +++++++++++++++++++-----------------------
 2 files changed, 41 insertions(+), 47 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c5beddb..d559024 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2012-01-04 Pierre Wieser <pwieser trychlos org>
 
+	* src/nact/nact-ischemes-tab.c: Review NactISchemesTab interface.
+
 	* src/nact/nact-iproperties-tab.c: Review NactIPropertiesTab interface.
 
 	* src/nact/nact-imimetypes-tab.c: Review NactIMimetypesTab interface.
diff --git a/src/nact/nact-ischemes-tab.c b/src/nact/nact-ischemes-tab.c
index 147e298..f404101 100644
--- a/src/nact/nact-ischemes-tab.c
+++ b/src/nact/nact-ischemes-tab.c
@@ -51,8 +51,7 @@ struct _NactISchemesTabInterfacePrivate {
 
 #define ITAB_NAME						"schemes"
 
-static gboolean st_initialized = FALSE;
-static gboolean st_finalized = FALSE;
+static guint st_initializations = 0;	/* interface initialization count */
 
 static GType   register_type( void );
 static void    interface_base_init( NactISchemesTabInterface *klass );
@@ -108,14 +107,14 @@ interface_base_init( NactISchemesTabInterface *klass )
 {
 	static const gchar *thisfn = "nact_ischemes_tab_interface_base_init";
 
-	if( !st_initialized ){
+	if( !st_initializations ){
 
 		g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
 
 		klass->private = g_new0( NactISchemesTabInterfacePrivate, 1 );
-
-		st_initialized = TRUE;
 	}
+
+	st_initializations += 1;
 }
 
 static void
@@ -123,11 +122,11 @@ interface_base_finalize( NactISchemesTabInterface *klass )
 {
 	static const gchar *thisfn = "nact_ischemes_tab_interface_base_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 );
 	}
@@ -141,25 +140,22 @@ nact_ischemes_tab_initial_load_toplevel( NactISchemesTab *instance )
 
 	g_return_if_fail( NACT_IS_ISCHEMES_TAB( instance ));
 
-	if( st_initialized && !st_finalized ){
-
-		g_debug( "%s: instance=%p", thisfn, ( void * ) instance );
-
-		list = base_window_get_widget( BASE_WINDOW( instance ), "SchemesTreeView" );
-		add = base_window_get_widget( BASE_WINDOW( instance ), "AddSchemeButton" );
-		remove = base_window_get_widget( BASE_WINDOW( instance ), "RemoveSchemeButton" );
-
-		nact_match_list_create_model(
-				BASE_WINDOW( instance ),
-				ITAB_NAME,
-				TAB_SCHEMES,
-				list, add, remove,
-				( pget_filters ) get_schemes,
-				( pset_filters ) set_schemes,
-				NULL,
-				MATCH_LIST_MUST_MATCH_ONE_OF,
-				_( "Scheme filter" ), TRUE );
-	}
+	g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
+
+	list = base_window_get_widget( BASE_WINDOW( instance ), "SchemesTreeView" );
+	add = base_window_get_widget( BASE_WINDOW( instance ), "AddSchemeButton" );
+	remove = base_window_get_widget( BASE_WINDOW( instance ), "RemoveSchemeButton" );
+
+	nact_match_list_create_model(
+			BASE_WINDOW( instance ),
+			ITAB_NAME,
+			TAB_SCHEMES,
+			list, add, remove,
+			( pget_filters ) get_schemes,
+			( pset_filters ) set_schemes,
+			NULL,
+			MATCH_LIST_MUST_MATCH_ONE_OF,
+			_( "Scheme filter" ), TRUE );
 }
 
 void
@@ -170,22 +166,22 @@ nact_ischemes_tab_runtime_init_toplevel( NactISchemesTab *instance )
 
 	g_return_if_fail( NACT_IS_ISCHEMES_TAB( instance ));
 
-	if( st_initialized && !st_finalized ){
-
-		g_debug( "%s: instance=%p", thisfn, ( void * ) instance );
+	g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
 
-		base_window_signal_connect( BASE_WINDOW( instance ),
-				G_OBJECT( instance ), MAIN_SIGNAL_SELECTION_CHANGED, G_CALLBACK( on_main_selection_changed ));
+	base_window_signal_connect(
+			BASE_WINDOW( instance ),
+			G_OBJECT( instance ),
+			MAIN_SIGNAL_SELECTION_CHANGED,
+			G_CALLBACK( on_main_selection_changed ));
 
-		nact_match_list_init_view( BASE_WINDOW( instance ), ITAB_NAME );
+	nact_match_list_init_view( BASE_WINDOW( instance ), ITAB_NAME );
 
-		button = base_window_get_widget( BASE_WINDOW( instance ), "AddFromDefaultButton" );
-		base_window_signal_connect(
-				BASE_WINDOW( instance ),
-				G_OBJECT( button ),
-				"clicked",
-				G_CALLBACK( on_add_from_defaults ));
-	}
+	button = base_window_get_widget( BASE_WINDOW( instance ), "AddFromDefaultButton" );
+	base_window_signal_connect(
+			BASE_WINDOW( instance ),
+			G_OBJECT( button ),
+			"clicked",
+			G_CALLBACK( on_add_from_defaults ));
 }
 
 void
@@ -195,9 +191,7 @@ nact_ischemes_tab_all_widgets_showed( NactISchemesTab *instance )
 
 	g_return_if_fail( NACT_IS_ISCHEMES_TAB( instance ));
 
-	if( st_initialized && !st_finalized ){
-		g_debug( "%s: instance=%p", thisfn, ( void * ) instance );
-	}
+	g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
 }
 
 void
@@ -207,11 +201,9 @@ nact_ischemes_tab_dispose( NactISchemesTab *instance )
 
 	g_return_if_fail( NACT_IS_ISCHEMES_TAB( instance ));
 
-	if( st_initialized && !st_finalized ){
-		g_debug( "%s: instance=%p", thisfn, ( void * ) instance );
+	g_debug( "%s: instance=%p (%s)", thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ));
 
-		nact_match_list_dispose( BASE_WINDOW( instance ), ITAB_NAME );
-	}
+	nact_match_list_dispose( BASE_WINDOW( instance ), ITAB_NAME );
 }
 
 static void



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