[nautilus-actions] NautilusActions: call parent_class::constructed() method at the beginning of the function



commit 42eed956bc0752d40d1b67af091703d83efff712
Author: Pierre Wieser <pwieser trychlos org>
Date:   Sun Jan 8 11:55:55 2012 +0100

    NautilusActions: call parent_class::constructed() method at the beginning of the function

 ChangeLog                          |    6 ++++
 src/plugin-menu/nautilus-actions.c |   59 +++++++++++++++++++++++-------------
 2 files changed, 44 insertions(+), 21 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ddb941d..0cfad94 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2012-01-08 Pierre Wieser <pwieser trychlos org>
 
+	Rather call parent_class::instance_constructed() method before executing
+	the derived class one.
+
+	* src/plugin-menu/nautilus-actions.c (instance_constructed):
+	Call parent class on the beginning of the function.
+
 	* src/nact/base-iunique.c:
 	* src/nact/base-iunique.h: New BaseIUnique interface.
 
diff --git a/src/plugin-menu/nautilus-actions.c b/src/plugin-menu/nautilus-actions.c
index 021e4ca..16dd173 100644
--- a/src/plugin-menu/nautilus-actions.c
+++ b/src/plugin-menu/nautilus-actions.c
@@ -201,48 +201,65 @@ static void
 instance_constructed( GObject *object )
 {
 	static const gchar *thisfn = "nautilus_actions_instance_constructed";
-	NautilusActions *self;
+	NautilusActionsPrivate *priv;
 
 	g_return_if_fail( NAUTILUS_IS_ACTIONS( object ));
 
-	self = NAUTILUS_ACTIONS( object );
+	priv = NAUTILUS_ACTIONS( object )->private;
 
-	if( !self->private->dispose_has_run ){
-		g_debug( "%s: object=%p", thisfn, ( void * ) object );
+	if( !priv->dispose_has_run ){
+
+		/* chain up to the parent class */
+		if( G_OBJECT_CLASS( st_parent_class )->constructed ){
+			G_OBJECT_CLASS( st_parent_class )->constructed( object );
+		}
+
+		g_debug( "%s: object=%p (%s)", thisfn, ( void * ) object, G_OBJECT_TYPE_NAME( object ));
 
-		self->private->pivot = na_pivot_new();
+		priv->pivot = na_pivot_new();
 
 		/* setup NAPivot properties before loading items
 		 */
-		na_pivot_set_loadable( self->private->pivot, !PIVOT_LOAD_DISABLED & !PIVOT_LOAD_INVALID );
-		na_pivot_load_items( self->private->pivot );
+		na_pivot_set_loadable( priv->pivot, !PIVOT_LOAD_DISABLED & !PIVOT_LOAD_INVALID );
+		na_pivot_load_items( priv->pivot );
 
 		/* register against NAPivot to be notified of items changes
 		 */
-		self->private->items_changed_handler =
-				g_signal_connect( self->private->pivot,
-						PIVOT_SIGNAL_ITEMS_CHANGED, G_CALLBACK( on_pivot_items_changed_handler ), self );
+		priv->items_changed_handler =
+				g_signal_connect( priv->pivot,
+						PIVOT_SIGNAL_ITEMS_CHANGED,
+						G_CALLBACK( on_pivot_items_changed_handler ),
+						object );
 
 		/* register against NASettings to be notified of changes on
 		 *  our runtime preferences
-		 * because we only monitor here four runtime keys, we prefer the
+		 * because we only monitor here a few runtime keys, we prefer the
 		 * callback way that the signal one
 		 */
 		na_settings_register_key_callback(
-				NA_IPREFS_IO_PROVIDERS_READ_STATUS, G_CALLBACK( on_settings_key_changed_handler ), self );
-		na_settings_register_key_callback(
-				NA_IPREFS_ITEMS_ADD_ABOUT_ITEM, G_CALLBACK( on_settings_key_changed_handler ), self );
+				NA_IPREFS_IO_PROVIDERS_READ_STATUS,
+				G_CALLBACK( on_settings_key_changed_handler ),
+				object );
+
 		na_settings_register_key_callback(
-				NA_IPREFS_ITEMS_CREATE_ROOT_MENU, G_CALLBACK( on_settings_key_changed_handler ), self );
+				NA_IPREFS_ITEMS_ADD_ABOUT_ITEM,
+				G_CALLBACK( on_settings_key_changed_handler ),
+				object );
+
 		na_settings_register_key_callback(
-				NA_IPREFS_ITEMS_LEVEL_ZERO_ORDER, G_CALLBACK( on_settings_key_changed_handler ), self );
+				NA_IPREFS_ITEMS_CREATE_ROOT_MENU,
+				G_CALLBACK( on_settings_key_changed_handler ),
+				object );
+
 		na_settings_register_key_callback(
-				NA_IPREFS_ITEMS_LIST_ORDER_MODE, G_CALLBACK( on_settings_key_changed_handler ), self );
+				NA_IPREFS_ITEMS_LEVEL_ZERO_ORDER,
+				G_CALLBACK( on_settings_key_changed_handler ),
+				object );
 
-		/* chain up to the parent class */
-		if( G_OBJECT_CLASS( st_parent_class )->constructed ){
-			G_OBJECT_CLASS( st_parent_class )->constructed( object );
-		}
+		na_settings_register_key_callback(
+				NA_IPREFS_ITEMS_LIST_ORDER_MODE,
+				G_CALLBACK( on_settings_key_changed_handler ),
+				object );
 	}
 }
 



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