[nautilus-actions] Improve debug messages



commit 12a26d0c463017532a7ee96b8c92322791773eb0
Author: Pierre Wieser <pwieser trychlos org>
Date:   Thu Mar 22 19:53:04 2012 +0100

    Improve debug messages

 ChangeLog                    |    8 ++++++++
 src/core/na-io-provider.c    |   16 ++++++++++++++++
 src/core/na-updater.c        |    7 +++++++
 src/nact/nact-menubar-file.c |    6 ++++++
 src/nact/nact-menubar.c      |    9 +++++++++
 5 files changed, 46 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index fd920e3..10dab29 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-03-22 Pierre Wieser <pwieser trychlos org>
+
+	* src/core/na-io-provider.c (io_providers_list_set_module):
+	* src/core/na-updater.c (na_updater_new):
+	* src/nact/nact-menubar-file.c (nact_menubar_file_on_update_sensitivities):
+	* src/nact/nact-menubar.c (on_base_initialize_window):
+	Improve debug messages.
+
 2012-03-12 Pierre Wieser <pwieser trychlos org>
 
 	* tools/release-tarball.sh: Fix stable attribute computing.
diff --git a/src/core/na-io-provider.c b/src/core/na-io-provider.c
index 94a8560..4b20ef8 100644
--- a/src/core/na-io-provider.c
+++ b/src/core/na-io-provider.c
@@ -926,6 +926,12 @@ io_providers_list_set_module( const NAPivot *pivot, NAIOProvider *provider_objec
 
 	provider_object->private->writable =
 			is_finally_writable( provider_object, pivot, &provider_object->private->reason );
+
+	g_debug( "na_io_provider_list_set_module: provider_module=%p (%s), writable=%s, reason=%d",
+			( void * ) provider_module,
+			provider_object->private->id,
+			provider_object->private->writable ? "True":"False",
+			provider_object->private->reason );
 }
 
 static gboolean
@@ -948,6 +954,7 @@ is_conf_writable( const NAIOProvider *provider, const NAPivot *pivot, gboolean *
 static gboolean
 is_finally_writable( const NAIOProvider *provider, const NAPivot *pivot, guint *reason )
 {
+	static const gchar *thisfn = "na_io_provider_is_finally_writable";
 	gboolean writable;
 	gboolean is_writable, mandatory;
 
@@ -968,16 +975,22 @@ is_finally_writable( const NAIOProvider *provider, const NAPivot *pivot, guint *
 
 				writable = FALSE;
 				*reason = NA_IIO_PROVIDER_STATUS_INCOMPLETE_API;
+				g_debug( "%s: provider_module=%p (%s), writable=False, reason=NA_IIO_PROVIDER_STATUS_INCOMPLETE_API",
+						thisfn, ( void * ) provider->private->provider, provider->private->id );
 
 		} else if( !NA_IIO_PROVIDER_GET_INTERFACE( provider->private->provider )->is_willing_to_write( provider->private->provider )){
 
 				writable = FALSE;
 				*reason = NA_IIO_PROVIDER_STATUS_NOT_WILLING_TO;
+				g_debug( "%s: provider_module=%p (%s), writable=False, reason=NA_IIO_PROVIDER_STATUS_NOT_WILLING_TO",
+						thisfn, ( void * ) provider->private->provider, provider->private->id );
 
 		} else if( !NA_IIO_PROVIDER_GET_INTERFACE( provider->private->provider )->is_able_to_write( provider->private->provider )){
 
 				writable = FALSE;
 				*reason = NA_IIO_PROVIDER_STATUS_NOT_ABLE_TO;
+				g_debug( "%s: provider_module=%p (%s), writable=False, reason=NA_IIO_PROVIDER_STATUS_NOT_ABLE_TO",
+						thisfn, ( void * ) provider->private->provider, provider->private->id );
 
 		} else {
 			is_writable = is_conf_writable( provider, pivot, &mandatory );
@@ -988,6 +1001,9 @@ is_finally_writable( const NAIOProvider *provider, const NAPivot *pivot, guint *
 				} else {
 					*reason = NA_IIO_PROVIDER_STATUS_LOCKED_BY_USER;
 				}
+				g_debug( "%s: provider_module=%p (%s), writable=False, reason=NA_IIO_PROVIDER_STATUS_LOCKED_BY_someone, mandatory=%s",
+						thisfn, ( void * ) provider->private->provider, provider->private->id,
+						mandatory ? "True":"False" );
 			}
 		}
 	}
diff --git a/src/core/na-updater.c b/src/core/na-updater.c
index 9c35b94..dc736fd 100644
--- a/src/core/na-updater.c
+++ b/src/core/na-updater.c
@@ -198,6 +198,10 @@ na_updater_new( void )
 	updater->private->are_preferences_locked = are_preferences_locked( updater );
 	updater->private->is_level_zero_writable = is_level_zero_writable( updater );
 
+	g_debug( "%s: is_level_zero_writable=%s",
+			thisfn,
+			updater->private->is_level_zero_writable ? "True":"False" );
+
 	return( updater );
 }
 
@@ -222,6 +226,9 @@ is_level_zero_writable( const NAUpdater *updater )
 
 	na_core_utils_slist_free( level_zero );
 
+	g_debug( "na_updater_is_level_zero_writable: NA_IPREFS_ITEMS_LEVEL_ZERO_ORDER is mandatory=%s",
+			mandatory ? "True":"False" );
+
 	return( !mandatory );
 }
 
diff --git a/src/nact/nact-menubar-file.c b/src/nact/nact-menubar-file.c
index 8e4a939..9ff393d 100644
--- a/src/nact/nact-menubar-file.c
+++ b/src/nact/nact-menubar-file.c
@@ -80,6 +80,7 @@ nact_menubar_file_initialize( NactMenubar *bar )
 void
 nact_menubar_file_on_update_sensitivities( const NactMenubar *bar )
 {
+	static const gchar *thisfn = "nact_menubar_file_on_update_sensitivities";
 	gboolean new_item_enabled;
 
 	/* new menu / new action
@@ -88,6 +89,11 @@ nact_menubar_file_on_update_sensitivities( const NactMenubar *bar )
 	 * we must have at least one writable provider
 	 */
 	new_item_enabled = bar->private->is_parent_writable && bar->private->has_writable_providers;
+	g_debug( "%s: is_parent_writable=%s, has_writable_providers=%s, new_item_enabled=%s",
+			thisfn,
+			bar->private->is_parent_writable ? "True":"False",
+			bar->private->has_writable_providers ? "True":"False",
+			new_item_enabled ? "True":"False" );
 	nact_menubar_enable_item( bar, "NewMenuItem", new_item_enabled );
 	nact_menubar_enable_item( bar, "NewActionItem", new_item_enabled );
 
diff --git a/src/nact/nact-menubar.c b/src/nact/nact-menubar.c
index cd1ac59..a0cdbbc 100644
--- a/src/nact/nact-menubar.c
+++ b/src/nact/nact-menubar.c
@@ -523,6 +523,11 @@ on_base_initialize_window( BaseWindow *window, gpointer user_data )
 		bar->private->has_writable_providers =
 				( na_io_provider_find_writable_io_provider( NA_PIVOT( bar->private->updater )) != NULL );
 
+		g_debug( "%s: na_updater_is_level_zero_writable=%s, na_io_provider_find_writable_io_provider=%s",
+				thisfn,
+				bar->private->is_level_zero_writable ? "True":"False",
+				bar->private->has_writable_providers ? "True":"False" );
+
 		/* connect to all signal which may have an influence on the menu
 		 * items sensitivity
 		 */
@@ -817,8 +822,12 @@ on_tree_view_selection_changed( BaseWindow *window, GList *selected, gpointer us
 	}
 	if( first ){
 		bar->private->is_parent_writable = na_object_is_finally_writable( first, NULL );
+		g_debug( "%s: parent of first selected is not null: is_parent_writable=%s",
+				thisfn, bar->private->is_parent_writable ? "True":"False" );
 	} else {
 		bar->private->is_parent_writable = bar->private->is_level_zero_writable;
+		g_debug( "%s: first selected is at level zero: is_level_zero_writable=%s",
+				thisfn, bar->private->is_level_zero_writable ? "True":"False" );
 	}
 
 	/* check is only an action is selected, or only profile(s) of a same action



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