[nautilus-actions] New na_core_utils_slist_to_array() function



commit c1e7136f5b3342b8ee9f9931f137b8218c2ba293
Author: Pierre Wieser <pwieser trychlos org>
Date:   Sun Mar 28 11:57:46 2010 +0200

    New na_core_utils_slist_to_array() function

 ChangeLog                |    4 ++++
 src/api/na-core-utils.h  |    1 +
 src/core/na-core-utils.c |   19 +++++++++++++++++++
 3 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index de6f50c..a046b73 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -131,6 +131,10 @@
 	* src/core/na-factory-object.c (set_defaults_iter):
 	Only set a default value when the box has not been yet allocated.
 
+	* src/api/na-core-utils.h:
+	* src/core/na-core-utils.c (na_core_utils_slist_to_array):
+	New function.
+
 2009-03-26 Pierre Wieser <pwieser trychlos org>
 
 	* src/api/na-data-def.h:
diff --git a/src/api/na-core-utils.h b/src/api/na-core-utils.h
index 7827b3e..a6f0104 100644
--- a/src/api/na-core-utils.h
+++ b/src/api/na-core-utils.h
@@ -62,6 +62,7 @@ GSList  *na_core_utils_slist_from_array( const gchar **str_array );
 gchar   *na_core_utils_slist_join_at_end( GSList *list, const gchar *link );
 GSList  *na_core_utils_slist_remove_ascii( GSList *list, const gchar *text );
 GSList  *na_core_utils_slist_remove_utf8( GSList *list, const gchar *string );
+gchar  **na_core_utils_slist_to_array( GSList *slist );
 gchar   *na_core_utils_slist_to_text( GSList *list );
 gboolean na_core_utils_slist_find( GSList *list, const gchar *str );
 gboolean na_core_utils_slist_are_equal( GSList *a, GSList *b );
diff --git a/src/core/na-core-utils.c b/src/core/na-core-utils.c
index f987ae8..a2b3ee8 100644
--- a/src/core/na-core-utils.c
+++ b/src/core/na-core-utils.c
@@ -388,6 +388,25 @@ na_core_utils_slist_remove_utf8( GSList *list, const gchar *str )
 }
 
 /**
+ * na_core_utils_slist_to_array:
+ * @slist: a list of strings.
+ *
+ * Returns: a newly allocated array of strings, which should be
+ * g_strfreev() by the caller.
+ */
+gchar **
+na_core_utils_slist_to_array( GSList *slist )
+{
+	gchar **array;
+	gchar *text;
+
+	text = na_core_utils_slist_to_text( slist );
+	array = g_strsplit( text, ";", -1 );
+
+	return( array );
+}
+
+/**
  * na_core_utils_slist_to_text:
  * @strlist: a list of strings.
  *



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