[nautilus-actions] Add a prefix parameter to na_core_utils_slist_dump() function



commit 4f7f9b85211b53bb893d95652617c9224c74cca9
Author: Pierre Wieser <pwieser trychlos org>
Date:   Wed Jul 28 18:58:16 2010 +0200

    Add a prefix parameter to na_core_utils_slist_dump() function

 ChangeLog                    |   12 ++++++++++++
 src/api/na-core-utils.h      |    2 +-
 src/core/na-core-utils.c     |   10 +++++++---
 src/core/na-data-boxed.c     |    6 ++++--
 src/core/na-io-provider.c    |    5 +++--
 src/io-desktop/nadp-writer.c |    7 ++++---
 src/nact/nact-match-list.c   |    2 +-
 src/test/test-reader.c       |    2 +-
 8 files changed, 33 insertions(+), 13 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e968c63..71508c4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2010-07-28 Pierre Wieser <pwieser trychlos org>
+
+	* src/api/na-core-utils.h:
+	* src/core/na-core-utils.c (na_core_utils_slist_dump):
+	Add a prefix parameter to the function.
+
+	* src/core/na-data-boxed.c (slist_dump):
+	* src/core/na-io-provider.c (na_io_provider_get_providers_list):
+	* src/io-desktop/nadp-writer.c (nadp_writer_ifactory_provider_write_done):
+	* src/nact/nact-match-list.c (nact_match_list_on_selection_changed):
+	* src/test/test-reader.c (main): Updated accordingly.
+
 2010-07-26 Pierre Wieser <pwieser trychlos org>
 
 	* src/api/na-core-utils.h:
diff --git a/src/api/na-core-utils.h b/src/api/na-core-utils.h
index 85ea1b5..07fba06 100644
--- a/src/api/na-core-utils.h
+++ b/src/api/na-core-utils.h
@@ -56,7 +56,7 @@ gchar   *na_core_utils_str_remove_suffix( const gchar *string, const gchar *suff
 /* some functions to get or set GSList list of strings
  */
 GSList  *na_core_utils_slist_duplicate( GSList *list );
-void     na_core_utils_slist_dump( GSList *list );
+void     na_core_utils_slist_dump( const gchar *prefix, GSList *list );
 GSList  *na_core_utils_slist_from_array( const gchar **str_array );
 GSList  *na_core_utils_slist_from_split( const gchar *string, const gchar *separator );
 gchar   *na_core_utils_slist_join_at_end( GSList *list, const gchar *link );
diff --git a/src/core/na-core-utils.c b/src/core/na-core-utils.c
index de89a49..f56af6a 100644
--- a/src/core/na-core-utils.c
+++ b/src/core/na-core-utils.c
@@ -235,21 +235,25 @@ na_core_utils_slist_duplicate( GSList *source_slist )
 
 /**
  * na_core_utils_slist_dump:
+ * @prefix: a string to be used as a prefix for each outputed line.
  * @list: a list of strings.
  *
  * Dumps the content of a list of strings.
  */
 void
-na_core_utils_slist_dump( GSList *list )
+na_core_utils_slist_dump( const gchar *prefix, GSList *list )
 {
 	static const gchar *thisfn = "na_core_utils_slist_dump";
 	GSList *i;
 	int c;
+	const gchar *thispfx;
 
-	g_debug( "%s: list at %p has %d element(s)", thisfn, ( void * ) list, g_slist_length( list ));
+	thispfx = ( prefix && strlen( prefix )) ? prefix : thisfn;
+
+	g_debug( "%s: list at %p has %d element(s)", thispfx, ( void * ) list, g_slist_length( list ));
 
 	for( i=list, c=0 ; i ; i=i->next ){
-		g_debug( "%s: [%2d] %s", thisfn, c++, ( gchar * ) i->data );
+		g_debug( "%s: [%2d] %s", thispfx, c++, ( gchar * ) i->data );
 	}
 }
 
diff --git a/src/core/na-data-boxed.c b/src/core/na-data-boxed.c
index 814d621..be5eb73 100644
--- a/src/core/na-data-boxed.c
+++ b/src/core/na-data-boxed.c
@@ -1004,8 +1004,10 @@ slist_free( const NADataBoxed *boxed )
 static void
 slist_dump( const NADataBoxed *boxed )
 {
-	g_debug( "na-data-boxed: %s=", boxed->private->def->name );
-	na_core_utils_slist_dump( boxed->private->u.slist );
+	static const gchar *thisfn = "na_data_boxed_slist_dump";
+
+	g_debug( "%s: %s is", thisfn, boxed->private->def->name );
+	na_core_utils_slist_dump( thisfn, boxed->private->u.slist );
 }
 
 static gboolean
diff --git a/src/core/na-io-provider.c b/src/core/na-io-provider.c
index 655262c..5c84dee 100644
--- a/src/core/na-io-provider.c
+++ b/src/core/na-io-provider.c
@@ -321,6 +321,7 @@ na_io_provider_terminate( void )
 GList *
 na_io_provider_get_providers_list( const NAPivot *pivot )
 {
+	static const gchar *thisfn = "na_io_provider_get_providers_list";
 	GSList *order;
 
 	g_return_val_if_fail( NA_IS_PIVOT( pivot ), NULL );
@@ -329,8 +330,8 @@ na_io_provider_get_providers_list( const NAPivot *pivot )
 
 		order = na_iprefs_read_string_list( NA_IPREFS( pivot ), IO_PROVIDER_KEY_ORDER, NULL );
 
-		g_debug( "na_io_provider_get_providers_list: dumping providers order" );
-		na_core_utils_slist_dump( order );
+		g_debug( "%s: dumping providers order", thisfn );
+		na_core_utils_slist_dump( thisfn, order );
 
 		setup_io_providers( pivot, order );
 		na_core_utils_slist_free( order );
diff --git a/src/io-desktop/nadp-writer.c b/src/io-desktop/nadp-writer.c
index 33525ee..ec9266a 100644
--- a/src/io-desktop/nadp-writer.c
+++ b/src/io-desktop/nadp-writer.c
@@ -473,13 +473,14 @@ guint
 nadp_writer_ifactory_provider_write_done( const NAIFactoryProvider *provider, void *writer_data,
 							const NAIFactoryObject *object, GSList **messages  )
 {
+	static const gchar *thisfn = "nadp_writer_ifactory_provider_write_done";
 	GSList *subitems;
 	GSList *profile_groups;
 	GSList *ip;
 
 	if( NA_IS_OBJECT_ITEM( object )){
 		subitems = na_object_get_items_slist( object );
-		na_core_utils_slist_dump( subitems );
+		na_core_utils_slist_dump( thisfn, subitems );
 
 		nadp_desktop_file_set_string_list(
 				NADP_DESKTOP_FILE( writer_data ),
@@ -488,11 +489,11 @@ nadp_writer_ifactory_provider_write_done( const NAIFactoryProvider *provider, vo
 				subitems );
 
 		profile_groups = nadp_desktop_file_get_profiles( NADP_DESKTOP_FILE( writer_data ));
-		na_core_utils_slist_dump( profile_groups );
+		na_core_utils_slist_dump( thisfn, profile_groups );
 
 		for( ip = profile_groups ; ip ; ip = ip->next ){
 			if( na_core_utils_slist_count( subitems, ( const gchar * ) ip->data ) == 0 ){
-				g_debug( "nadp_writer_ifactory_provider_write_done: deleting (removed) profile %s", ( const gchar * ) ip->data );
+				g_debug( "%s: deleting (removed) profile %s", thisfn, ( const gchar * ) ip->data );
 				nadp_desktop_file_remove_profile( NADP_DESKTOP_FILE( writer_data ), ( const gchar * ) ip->data );
 			}
 		}
diff --git a/src/nact/nact-match-list.c b/src/nact/nact-match-list.c
index 22405ef..e99970a 100644
--- a/src/nact/nact-match-list.c
+++ b/src/nact/nact-match-list.c
@@ -340,7 +340,7 @@ nact_match_list_on_selection_changed( BaseWindow *window, const gchar *tab_name,
 	gtk_list_store_clear( GTK_LIST_STORE( model ));
 
 	if( filters ){
-		na_core_utils_slist_dump( filters );
+		na_core_utils_slist_dump( thisfn, filters );
 		g_slist_foreach( filters, ( GFunc ) iter_for_setup, model );
 	}
 
diff --git a/src/test/test-reader.c b/src/test/test-reader.c
index a33df11..344ac77 100755
--- a/src/test/test-reader.c
+++ b/src/test/test-reader.c
@@ -96,7 +96,7 @@ main( int argc, char **argv )
 		g_object_unref( result->imported );
 	}
 
-	na_core_utils_slist_dump( result->messages );
+	na_core_utils_slist_dump( NULL, result->messages );
 	na_core_utils_slist_free( result->messages );
 
 	return( 0 );



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