[nautilus-actions] Update Desktop I/O provider



commit 5e18ed31347ba27c83790662a50491c0e1157b60
Author: Pierre Wieser <pwieser trychlos org>
Date:   Mon Feb 15 18:20:09 2010 +0100

    Update Desktop I/O provider

 ChangeLog                              |    5 +
 src/io-desktop/Makefile.am             |    2 +
 src/io-desktop/nadp-desktop-file.c     |  365 +++++++++++++++++++++++++-------
 src/io-desktop/nadp-desktop-file.h     |   32 ++-
 src/io-desktop/nadp-desktop-provider.c |  207 +++++++++++++++---
 src/io-desktop/nadp-desktop-provider.h |   31 ++--
 src/io-desktop/nadp-keys.c             |   75 +++++++
 src/io-desktop/nadp-keys.h             |  106 +++++++++
 src/io-desktop/nadp-utils.c            |  206 ------------------
 src/io-desktop/nadp-utils.h            |   13 --
 10 files changed, 694 insertions(+), 348 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e83a37e..30b3334 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2009-02-15 Pierre Wieser <pwieser trychlos org>
 
+	Update I/O desktop provider.
+
+	* src/io-desktop/nadp-keys.c:
+	* src/io-desktop/nadp-keys.h: New files.
+
 	Rename src/io-desktop/nadp-xdg-data-dirs.{c,h} to src/io-desktop/nadp-xdg-dirs.{c,h}
 	Rename src/io-desktop/nadp-write.{c,h} to src/io-desktop/nadp-writer.{c,h}
 	Rename src/io-desktop/nadp-read.{c,h} to src/io-desktop/nadp-reader.{c,h}
diff --git a/src/io-desktop/Makefile.am b/src/io-desktop/Makefile.am
index 308f133..3390092 100644
--- a/src/io-desktop/Makefile.am
+++ b/src/io-desktop/Makefile.am
@@ -39,6 +39,8 @@ libna_io_desktop_la_SOURCES = \
 	nadp-desktop-file.h									\
 	nadp-desktop-provider.c								\
 	nadp-desktop-provider.h								\
+	nadp-keys.c											\
+	nadp-keys.h											\
 	nadp-module.c										\
 	nadp-reader.c										\
 	nadp-reader.h										\
diff --git a/src/io-desktop/nadp-desktop-file.c b/src/io-desktop/nadp-desktop-file.c
index 22ff6ad..579f562 100644
--- a/src/io-desktop/nadp-desktop-file.c
+++ b/src/io-desktop/nadp-desktop-file.c
@@ -32,11 +32,14 @@
 #include <config.h>
 #endif
 
-#include <gio/gio.h>
 #include <string.h>
 
+#include <gio/gio.h>
+
+#include <api/na-core-utils.h>
+
 #include "nadp-desktop-file.h"
-#include "nadp-utils.h"
+#include "nadp-keys.h"
 
 /* private class data
  */
@@ -53,18 +56,6 @@ struct NadpDesktopFilePrivate {
 	GKeyFile  *key_file;
 };
 
-#define NADP_KEY_TOOLTIP				"Tooltip"
-#define NADP_KEY_ITEMS_LIST				"ItemsList"
-#define NADP_KEY_TARGET_CONTEXT			"TargetContext"
-#define NADP_KEY_TARGET_TOOLBAR			"TargetToolbar"
-#define NADP_KEY_TOOLBAR_LABEL			"ToolbarLabel"
-#define NADP_KEY_PROFILES				"Profiles"
-#define NADP_KEY_PROFILE_GROUP			"X-Action-Profile"
-#define NADP_KEY_BASENAMES				"Basenames"
-#define NADP_KEY_MIMETYPES				"Mimetypes"
-#define NADP_KEY_SCHEMES				"Schemes"
-#define NADP_KEY_FOLDERS				"Folders"
-
 static GObjectClass *st_parent_class = NULL;
 
 static GType            register_type( void );
@@ -74,14 +65,15 @@ static void             instance_dispose( GObject *object );
 static void             instance_finalize( GObject *object );
 
 static NadpDesktopFile *ndf_new( const gchar *path );
+static gchar           *path2id( const gchar *path );
 static gboolean         check_key_file( NadpDesktopFile *ndf );
 #if 0
 static gboolean         ndf_has_entry( const NadpDesktopFile *ndf, const gchar *group, const gchar *entry );
-#endif
 static gboolean         ndf_read_bool( const NadpDesktopFile *ndf, const gchar *group, const gchar *entry, gboolean default_value );
 static gchar           *ndf_read_profile_string( const NadpDesktopFile *ndf, const gchar *profile_id, const gchar *entry );
 static GSList          *ndf_read_profile_string_list( const NadpDesktopFile *ndf, const gchar *profile_id, const gchar *entry );
 static gchar           *group_name_to_profile_id( const gchar *group_name );
+#endif
 
 GType
 nadp_desktop_file_get_type( void )
@@ -183,19 +175,11 @@ instance_finalize( GObject *object )
 	g_assert( NADP_IS_DESKTOP_FILE( object ));
 	self = NADP_DESKTOP_FILE( object );
 
-	if( self->private->id ){
-		g_free( self->private->id );
-		self->private->id = NULL;
-	}
-
-	if( self->private->path ){
-		g_free( self->private->path );
-		self->private->path = NULL;
-	}
+	g_free( self->private->id );
+	g_free( self->private->path );
 
 	if( self->private->key_file ){
 		g_key_file_free( self->private->key_file );
-		self->private->key_file = NULL;
 	}
 
 	g_free( self->private );
@@ -206,21 +190,40 @@ instance_finalize( GObject *object )
 	}
 }
 
-/*
- * ndf_new:
+/**
+ * nadp_desktop_file_new_from_path:
  * @path: the full pathname of a .desktop file.
  *
  * Retuns: a newly allocated #NadpDesktopFile object.
+ *
+ * Key file has been loaded, and first validity checks made.
  */
-static NadpDesktopFile *
-ndf_new( const gchar *path )
+NadpDesktopFile *
+nadp_desktop_file_new_from_path( const gchar *path )
 {
+	static const gchar *thisfn = "nadp_desktop_file_new_from_path";
 	NadpDesktopFile *ndf;
+	GError *error;
 
-	ndf = g_object_new( NADP_DESKTOP_FILE_TYPE, NULL );
+	ndf = NULL;
+	g_debug( "%s: path=%s", thisfn, path );
+	g_return_val_if_fail( path && g_utf8_strlen( path, -1 ) && g_path_is_absolute( path ), ndf );
 
-	ndf->private->id = nadp_utils_path2id( path );
-	ndf->private->path = g_strdup( path );
+	ndf = ndf_new( path );
+
+	error = NULL;
+	g_key_file_load_from_file( ndf->private->key_file, path, G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS, &error );
+	if( error ){
+		g_warning( "%s: %s: %s", thisfn, path, error->message );
+		g_error_free( error );
+		g_object_unref( ndf );
+		return( NULL );
+	}
+
+	if( !check_key_file( ndf )){
+		g_object_unref( ndf );
+		return( NULL );
+	}
 
 	return( ndf );
 }
@@ -243,47 +246,48 @@ nadp_desktop_file_new_for_write( const gchar *path )
 
 	ndf = ndf_new( path );
 
-	g_key_file_set_string( ndf->private->key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_TYPE, G_KEY_FILE_DESKTOP_TYPE_APPLICATION );
-
 	return( ndf );
 }
 
-/**
- * nadp_desktop_file_new_from_path:
+/*
+ * ndf_new:
  * @path: the full pathname of a .desktop file.
  *
  * Retuns: a newly allocated #NadpDesktopFile object.
- *
- * Key file has been loaded, and first validity checks made.
  */
-NadpDesktopFile *
-nadp_desktop_file_new_from_path( const gchar *path )
+static NadpDesktopFile *
+ndf_new( const gchar *path )
 {
-	static const gchar *thisfn = "nadp_desktop_file_new_from_path";
 	NadpDesktopFile *ndf;
-	GError *error;
 
-	ndf = NULL;
-	g_debug( "%s: path=%s", thisfn, path );
-	g_return_val_if_fail( path && g_utf8_strlen( path, -1 ) && g_path_is_absolute( path ), ndf );
+	ndf = g_object_new( NADP_DESKTOP_FILE_TYPE, NULL );
 
-	ndf = ndf_new( path );
+	ndf->private->id = path2id( path );
+	ndf->private->path = g_strdup( path );
 
-	error = NULL;
-	g_key_file_load_from_file( ndf->private->key_file, path, G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS, &error );
-	if( error ){
-		g_warning( "%s: %s: %s", thisfn, path, error->message );
-		g_error_free( error );
-		g_object_unref( ndf );
-		return( NULL );
-	}
+	return( ndf );
+}
 
-	if( !check_key_file( ndf )){
-		g_object_unref( ndf );
-		return( NULL );
-	}
+/*
+ * path2id:
+ * @path: a full pathname.
+ *
+ * Returns: the id of the file, as a newly allocated string which
+ * should be g_free() by the caller.
+ *
+ * The id of the file is equal to the basename, minus the suffix.
+ */
+static gchar *
+path2id( const gchar *path )
+{
+	gchar *bname;
+	gchar *id;
 
-	return( ndf );
+	bname = g_path_get_basename( path );
+	id = na_core_utils_str_remove_suffix( bname, NADP_DESKTOP_FILE_SUFFIX );
+	g_free( bname );
+
+	return( id );
 }
 
 static gboolean
@@ -292,39 +296,245 @@ check_key_file( NadpDesktopFile *ndf )
 	static const gchar *thisfn = "nadp_desktop_file_check_key_file";
 	gboolean ret;
 	gchar *start_group;
-	gchar *type;
-	GError *error;
 
 	ret = TRUE;
 
 	/* start group must be 'Desktop Entry' */
 	start_group = g_key_file_get_start_group( ndf->private->key_file );
-	if( strcmp( start_group, G_KEY_FILE_DESKTOP_GROUP )){
+	if( strcmp( start_group, NADP_GROUP_DESKTOP )){
+
 		g_warning( "%s: %s: invalid start group, found %s, waited for %s",
-				thisfn, ndf->private->path, start_group, G_KEY_FILE_DESKTOP_GROUP );
+				thisfn, ndf->private->path, start_group, NADP_GROUP_DESKTOP );
 		ret = FALSE;
 	}
+
 	g_free( start_group );
 
-	/* Type is required
-	 * only deal with 'Application' type */
-	if( ret ){
+	return( ret );
+}
+
+/**
+ * nadp_desktop_file_get_type:
+ * @ndf: the #NadpDesktopFile instance.
+ *
+ * Returns: the value for the Type entry as a newly allocated string which
+ * should be g_free() by the caller.
+ */
+gchar *
+nadp_desktop_file_get_file_type( const NadpDesktopFile *ndf )
+{
+	static const gchar *thisfn = "nadp_desktop_file_get_type";
+	gchar *type;
+	GError *error;
+
+	type = NULL;
+	error = NULL;
+	g_return_val_if_fail( NADP_IS_DESKTOP_FILE( ndf ), NULL );
+
+	if( !ndf->private->dispose_has_run ){
+
+		type = g_key_file_get_string( ndf->private->key_file, NADP_GROUP_DESKTOP, NADP_KEY_TYPE, &error );
+
+		if( error ){
+			g_warning( "%s: %s", thisfn, error->message );
+			g_error_free( error );
+			g_free( type );
+			type = NULL;
+		}
+	}
+
+	return( type );
+}
+
+/**
+ * nadp_desktop_file_get_id:
+ * @ndf: the #NadpDesktopFile instance.
+ *
+ * Returns: a newly allocated string which holds the id of the Desktop
+ * File.
+ */
+gchar *
+nadp_desktop_file_get_id( const NadpDesktopFile *ndf )
+{
+	gchar *value;
+
+	g_return_val_if_fail( NADP_IS_DESKTOP_FILE( ndf ), NULL );
+
+	value = NULL;
+
+	if( !ndf->private->dispose_has_run ){
+
+		value = g_strdup( ndf->private->id );
+	}
+
+	return( value );
+}
+
+/**
+ * nadp_desktop_file_get_boolean:
+ */
+gboolean
+nadp_desktop_file_get_boolean( const NadpDesktopFile *ndf, const gchar *group, const gchar *entry, gboolean default_value )
+{
+	static const gchar *thisfn = "nadp_desktop_file_get_boolean";
+	gboolean value;
+	gboolean read_value;
+	gboolean has_entry;
+	GError *error;
+
+	value = default_value;
+
+	g_return_val_if_fail( NADP_IS_DESKTOP_FILE( ndf ), FALSE );
+
+	if( !ndf->private->dispose_has_run ){
+
 		error = NULL;
-		type = g_key_file_get_string( ndf->private->key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_TYPE, &error );
+		has_entry = g_key_file_has_key( ndf->private->key_file, group, entry, &error );
 		if( error ){
-			g_warning( "%s: %s: %s", thisfn, ndf->private->path, error->message );
+			g_warning( "%s: %s", thisfn, error->message );
 			g_error_free( error );
-			ret = FALSE;
-		} else if( strcmp( type, G_KEY_FILE_DESKTOP_TYPE_APPLICATION )){
-			ret = FALSE;
+
+		} else if( has_entry ){
+			read_value = g_key_file_get_boolean( ndf->private->key_file, group, entry, &error );
+			if( error ){
+				g_warning( "%s: %s", thisfn, error->message );
+				g_error_free( error );
+
+			} else {
+				value = read_value;
+			}
 		}
-		g_free( type );
 	}
 
-	return( ret );
+	return( value );
+}
+
+/**
+ * nadp_desktop_file_get_locale_string:
+ */
+gchar *
+nadp_desktop_file_get_locale_string( const NadpDesktopFile *ndf, const gchar *group, const gchar *entry, const gchar *default_value )
+{
+	static const gchar *thisfn = "nadp_desktop_file_get_locale_string";
+	gchar *value;
+	gchar *read_value;
+	gboolean has_entry;
+	GError *error;
+
+	value = g_strdup( default_value );
+
+	g_return_val_if_fail( NADP_IS_DESKTOP_FILE( ndf ), NULL );
+
+	if( !ndf->private->dispose_has_run ){
+
+		error = NULL;
+		has_entry = g_key_file_has_key( ndf->private->key_file, group, entry, &error );
+		if( error ){
+			g_warning( "%s: %s", thisfn, error->message );
+			g_error_free( error );
+
+		} else if( has_entry ){
+			read_value = g_key_file_get_locale_string( ndf->private->key_file, group, entry, NULL, &error );
+			if( error ){
+				g_warning( "%s: %s", thisfn, error->message );
+				g_error_free( error );
+				g_free( read_value );
+
+			} else {
+				g_free( value );
+				value = read_value;
+			}
+		}
+	}
+
+	return( value );
+}
+
+/**
+ * nadp_desktop_file_get_string:
+ */
+gchar *
+nadp_desktop_file_get_string( const NadpDesktopFile *ndf, const gchar *group, const gchar *entry, const gchar *default_value )
+{
+	static const gchar *thisfn = "nadp_desktop_file_get_string";
+	gchar *value;
+	gchar *read_value;
+	gboolean has_entry;
+	GError *error;
+
+	value = g_strdup( default_value );
+
+	g_return_val_if_fail( NADP_IS_DESKTOP_FILE( ndf ), NULL );
+
+	if( !ndf->private->dispose_has_run ){
+
+		error = NULL;
+		has_entry = g_key_file_has_key( ndf->private->key_file, group, entry, &error );
+		if( error ){
+			g_warning( "%s: %s", thisfn, error->message );
+			g_error_free( error );
+
+		} else if( has_entry ){
+			read_value = g_key_file_get_string( ndf->private->key_file, group, entry, &error );
+			if( error ){
+				g_warning( "%s: %s", thisfn, error->message );
+				g_error_free( error );
+				g_free( read_value );
+
+			} else {
+				g_free( value );
+				value = read_value;
+			}
+		}
+	}
+
+	return( value );
 }
 
 /**
+ * nadp_desktop_file_get_string_list:
+ */
+GSList *
+nadp_desktop_file_get_string_list( const NadpDesktopFile *ndf, const gchar *group, const gchar *entry, const gchar *default_value )
+{
+	static const gchar *thisfn = "nadp_desktop_file_get_string_list";
+	GSList *value;
+	gchar **read_array;
+	gboolean has_entry;
+	GError *error;
+
+	value = g_slist_append( NULL, g_strdup( default_value ));
+
+	g_return_val_if_fail( NADP_IS_DESKTOP_FILE( ndf ), NULL );
+
+	if( !ndf->private->dispose_has_run ){
+
+		error = NULL;
+		has_entry = g_key_file_has_key( ndf->private->key_file, group, entry, &error );
+		if( error ){
+			g_warning( "%s: %s", thisfn, error->message );
+			g_error_free( error );
+
+		} else if( has_entry ){
+			read_array = g_key_file_get_string_list( ndf->private->key_file, group, entry, NULL, &error );
+			if( error ){
+				g_warning( "%s: %s", thisfn, error->message );
+				g_error_free( error );
+
+			} else {
+				na_core_utils_slist_free( value );
+				value = na_core_utils_slist_from_str_array(( const gchar ** ) read_array );
+			}
+
+			g_strfreev( read_array );
+		}
+	}
+
+	return( value );
+}
+
+#if 0
+/**
  * nadp_desktop_file_get_key_file_path:
  * @ndf: the #NadpDesktopFile instance.
  *
@@ -380,7 +590,7 @@ nadp_desktop_file_get_file_type( const NadpDesktopFile *ndf )
  * be g_free() by the caller.
  */
 gchar *
-nadp_desktop_file_get_id( const NadpDesktopFile *ndf )
+nadp_desktop_file_get_id2( const NadpDesktopFile *ndf )
 {
 	gchar *id;
 
@@ -905,7 +1115,7 @@ ndf_read_profile_string( const NadpDesktopFile *ndf, const gchar *profile_id, co
 	gchar *string;
 	gchar *group_name;
 
-	group_name = g_strdup_printf( "%s %s", NADP_KEY_PROFILE_GROUP, profile_id );
+	group_name = g_strdup_printf( "%s %s", NADP_GROUP_PROFILE, profile_id );
 
 	string = g_key_file_get_locale_string( ndf->private->key_file, group_name, entry, NULL, NULL );
 
@@ -922,7 +1132,7 @@ ndf_read_profile_string_list( const NadpDesktopFile *ndf, const gchar *profile_i
 	gchar *group_name;
 
 	strlist = NULL;
-	group_name = g_strdup_printf( "%s %s", NADP_KEY_PROFILE_GROUP, profile_id );
+	group_name = g_strdup_printf( "%s %s", NADP_GROUP_PROFILE, profile_id );
 
 	string_list = g_key_file_get_string_list( ndf->private->key_file, group_name, entry, NULL, NULL );
 	if( string_list ){
@@ -942,7 +1152,7 @@ group_name_to_profile_id( const gchar *group_name )
 
 	profile_id = NULL;
 
-	if( g_str_has_prefix( group_name, NADP_KEY_PROFILE_GROUP )){
+	if( g_str_has_prefix( group_name, NADP_GROUP_PROFILE )){
 
 		gchar **tokens, **iter;
 		gchar *tmp;
@@ -1051,6 +1261,7 @@ nadp_desktop_file_set_enabled( NadpDesktopFile *ndf, gboolean enabled )
 				ndf->private->key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY, !enabled );
 	}
 }
+#endif
 
 /**
  * nadp_desktop_file_write:
diff --git a/src/io-desktop/nadp-desktop-file.h b/src/io-desktop/nadp-desktop-file.h
index 07d6b83..99c029f 100644
--- a/src/io-desktop/nadp-desktop-file.h
+++ b/src/io-desktop/nadp-desktop-file.h
@@ -41,7 +41,6 @@
  * every #NAObjectItem for this provider.
  */
 
-#include <glib.h>
 #include <glib-object.h>
 
 G_BEGIN_DECLS
@@ -69,15 +68,32 @@ typedef struct {
 }
 	NadpDesktopFileClass;
 
-GType            nadp_desktop_file_get_type( void );
+/* standard suffix for desktop files
+ */
+#define NADP_DESKTOP_FILE_SUFFIX		".desktop"
+
+GType            nadp_desktop_file_get_type         ( void );
+
+NadpDesktopFile *nadp_desktop_file_new_from_path    ( const gchar *path );
+NadpDesktopFile *nadp_desktop_file_new_for_write    ( const gchar *path );
+
+gchar           *nadp_desktop_file_get_key_file_path( const NadpDesktopFile *ndf );
+gboolean         nadp_desktop_file_write            ( NadpDesktopFile *ndf );
+
+gchar           *nadp_desktop_file_get_file_type    ( const NadpDesktopFile *ndf );
+
+gchar           *nadp_desktop_file_get_id           ( const NadpDesktopFile *ndf );
+gboolean         nadp_desktop_file_get_boolean      ( const NadpDesktopFile *ndf, const gchar *group, const gchar *key, gboolean default_value );
+gchar           *nadp_desktop_file_get_locale_string( const NadpDesktopFile *ndf, const gchar *group, const gchar *key, const gchar *default_value );
+gchar           *nadp_desktop_file_get_string       ( const NadpDesktopFile *ndf, const gchar *group, const gchar *key, const gchar *default_value );
+GSList          *nadp_desktop_file_get_string_list  ( const NadpDesktopFile *ndf, const gchar *group, const gchar *key, const gchar *default_value );
 
-NadpDesktopFile *nadp_desktop_file_new_for_write( const gchar *path );
-NadpDesktopFile *nadp_desktop_file_new_from_path( const gchar *path );
+/* ... */
 
-gchar           *nadp_desktop_file_get_key_file_path     ( const NadpDesktopFile *ndf );
+#if 0
 
-gchar           *nadp_desktop_file_get_file_type         ( const NadpDesktopFile *ndf );
-gchar           *nadp_desktop_file_get_id                ( const NadpDesktopFile *ndf );
+/*gchar           *nadp_desktop_file_get_file_type         ( const NadpDesktopFile *ndf );*/
+gchar           *nadp_desktop_file_get_id2                ( const NadpDesktopFile *ndf );
 gchar           *nadp_desktop_file_get_name              ( const NadpDesktopFile *ndf );
 gchar           *nadp_desktop_file_get_tooltip           ( const NadpDesktopFile *ndf );
 gchar           *nadp_desktop_file_get_icon              ( const NadpDesktopFile *ndf );
@@ -102,7 +118,7 @@ void             nadp_desktop_file_set_tooltip( NadpDesktopFile *ndf, const gcha
 void             nadp_desktop_file_set_icon( NadpDesktopFile *ndf, const gchar *icon );
 void             nadp_desktop_file_set_enabled( NadpDesktopFile *ndf, gboolean enabled );
 
-gboolean         nadp_desktop_file_write( NadpDesktopFile *ndf );
+#endif
 
 G_END_DECLS
 
diff --git a/src/io-desktop/nadp-desktop-provider.c b/src/io-desktop/nadp-desktop-provider.c
index 33149b9..47c3809 100644
--- a/src/io-desktop/nadp-desktop-provider.c
+++ b/src/io-desktop/nadp-desktop-provider.c
@@ -35,11 +35,14 @@
 #include <glib/gi18n.h>
 #include <string.h>
 
-#include <nautilus-actions/api/na-iio-provider.h>
+#include <api/na-core-utils.h>
+#include <api/na-iio-provider.h>
+#include <api/na-iio-factory.h>
 
 #include "nadp-desktop-provider.h"
-#include "nadp-read.h"
-#include "nadp-write.h"
+#include "nadp-keys.h"
+#include "nadp-reader.h"
+#include "nadp-writer.h"
 
 /* private class data
  */
@@ -50,15 +53,20 @@ struct NadpDesktopProviderClassPrivate {
 static GType         st_module_type = 0;
 static GObjectClass *st_parent_class = NULL;
 
-static void   class_init( NadpDesktopProviderClass *klass );
-static void   iio_provider_iface_init( NAIIOProviderInterface *iface );
-static void   instance_init( GTypeInstance *instance, gpointer klass );
-static void   instance_dispose( GObject *object );
-static void   instance_finalize( GObject *object );
+static void    class_init( NadpDesktopProviderClass *klass );
+static void    instance_init( GTypeInstance *instance, gpointer klass );
+static void    instance_dispose( GObject *object );
+static void    instance_finalize( GObject *object );
 
-static gchar *get_id( const NAIIOProvider *provider );
-static gchar *get_name( const NAIIOProvider *provider );
-static guint  get_version( const NAIIOProvider *provider );
+static void    iio_provider_iface_init( NAIIOProviderInterface *iface );
+static gchar  *iio_provider_get_id( const NAIIOProvider *provider );
+static gchar  *iio_provider_get_name( const NAIIOProvider *provider );
+static guint   iio_provider_get_version( const NAIIOProvider *provider );
+
+static void    iio_factory_iface_init( NAIIOFactoryInterface *iface );
+static guint   iio_factory_get_version( const NAIIOFactory *reader );
+static GValue *iio_factory_read_value( const NAIIOFactory *reader, void *reader_data, const NadfIdType *iddef, GSList **messages );
+static void    iio_factory_read_done( const NAIIOFactory *reader, void *reader_data, NAIDataFactory *serializable, GSList **messages );
 
 GType
 nadp_desktop_provider_get_type( void )
@@ -89,11 +97,19 @@ nadp_desktop_provider_register_type( GTypeModule *module )
 		NULL
 	};
 
+	static const GInterfaceInfo iio_factory_iface_info = {
+		( GInterfaceInitFunc ) iio_factory_iface_init,
+		NULL,
+		NULL
+	};
+
 	g_debug( "%s", thisfn );
 
 	st_module_type = g_type_module_register_type( module, G_TYPE_OBJECT, "NadpDesktopProvider", &info, 0 );
 
 	g_type_module_add_interface( module, st_module_type, NA_IIO_PROVIDER_TYPE, &iio_provider_iface_info );
+
+	g_type_module_add_interface( module, st_module_type, NA_IIO_FACTORY_TYPE, &iio_factory_iface_info );
 }
 
 static void
@@ -114,23 +130,6 @@ class_init( NadpDesktopProviderClass *klass )
 }
 
 static void
-iio_provider_iface_init( NAIIOProviderInterface *iface )
-{
-	static const gchar *thisfn = "nadp_desktop_provider_iio_provider_iface_init";
-
-	g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
-
-	iface->get_id = get_id;
-	iface->get_name = get_name;
-	iface->get_version = get_version;
-	iface->read_items = nadp_iio_provider_read_items;
-	iface->is_willing_to_write = nadp_iio_provider_is_willing_to_write;
-	iface->is_able_to_write = nadp_iio_provider_is_able_to_write;
-	iface->write_item = nadp_iio_provider_write_item;
-	iface->delete_item = nadp_iio_provider_delete_item;
-}
-
-static void
 instance_init( GTypeInstance *instance, gpointer klass )
 {
 	static const gchar *thisfn = "nadp_desktop_provider_instance_init";
@@ -183,20 +182,166 @@ instance_finalize( GObject *object )
 	}
 }
 
+static void
+iio_provider_iface_init( NAIIOProviderInterface *iface )
+{
+	static const gchar *thisfn = "nadp_desktop_provider_iio_provider_iface_init";
+
+	g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
+
+	iface->get_version = iio_provider_get_version;
+	iface->get_id = iio_provider_get_id;
+	iface->get_name = iio_provider_get_name;
+	iface->read_items = nadp_iio_provider_read_items;
+	iface->is_willing_to_write = nadp_iio_provider_is_willing_to_write;
+	iface->is_able_to_write = nadp_iio_provider_is_able_to_write;
+	iface->write_item = nadp_iio_provider_write_item;
+	iface->delete_item = nadp_iio_provider_delete_item;
+}
+
+static guint
+iio_provider_get_version( const NAIIOProvider *provider )
+{
+	return( 1 );
+}
+
 static gchar *
-get_id( const NAIIOProvider *provider )
+iio_provider_get_id( const NAIIOProvider *provider )
 {
 	return( g_strdup( "na-desktop" ));
 }
 
 static gchar *
-get_name( const NAIIOProvider *provider )
+iio_provider_get_name( const NAIIOProvider *provider )
 {
 	return( g_strdup( _( "Nautilus-Actions Desktop I/O Provider" )));
 }
 
+static void
+iio_factory_iface_init( NAIIOFactoryInterface *iface )
+{
+	static const gchar *thisfn = "nadp_desktop_provider_iio_factory_iface_init";
+
+	g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
+
+	iface->get_version = iio_factory_get_version;
+	iface->read_value = iio_factory_read_value;
+	iface->read_done = iio_factory_read_done;
+	/*iface->write_value = iio_factory_write_value;
+	iface->write_done = iio_factory_write_done;*/
+}
+
 static guint
-get_version( const NAIIOProvider *provider )
+iio_factory_get_version( const NAIIOFactory *reader )
 {
 	return( 1 );
 }
+
+/*
+ * reading any data from a desktop file requires:
+ * - a NadpDesktopFile object which has been initialized with the .desktop file
+ *   -> has been attached to the NAObjectItem in get_item() above
+ * - the data type (+ reading default value)
+ * - group and key names
+ */
+static GValue *
+iio_factory_read_value( const NAIIOFactory *reader, void *reader_data, const NadfIdType *iddef, GSList **messages )
+{
+	static const gchar *thisfn = "nadp_desktop_provider_iio_factory_read_value";
+	NadpReaderData *nrd;
+	GValue *value;
+	gchar *group, *key;
+	gchar *msg;
+	gchar *str_value;
+	gboolean bool_value;
+	GSList *slist_value;
+
+	/*g_debug( "%s: reader=%p (%s), reader_data=%p, iddef=%p, messages=%p",
+			thisfn,
+			( void * ) reader, G_OBJECT_TYPE_NAME( reader ),
+			( void * ) reader_data,
+			( void * ) iddef,
+			( void * ) messages );*/
+
+	g_return_val_if_fail( NA_IS_IIO_FACTORY( reader ), NULL );
+	g_return_val_if_fail( NADP_IS_DESKTOP_PROVIDER( reader ), NULL );
+	g_return_val_if_fail( iddef->serializable, NULL );
+
+	value = NULL;
+
+	if( !NADP_DESKTOP_PROVIDER( reader )->private->dispose_has_run ){
+
+		nrd = ( NadpReaderData * ) reader_data;
+		g_return_val_if_fail( NADP_IS_DESKTOP_FILE( nrd->ndf ), NULL );
+
+		if( nadp_keys_get_group_and_key( iddef, &group, &key )){
+
+			value = g_new0( GValue, 1 );
+
+			switch( iddef->type ){
+
+				case NADF_TYPE_LOCALE_STRING:
+					g_value_init( value, G_TYPE_STRING );
+					str_value = nadp_desktop_file_get_locale_string( nrd->ndf, group, key, iddef->default_value );
+					g_value_set_string( value, str_value );
+					g_free( str_value );
+					break;
+
+				case NADF_TYPE_STRING:
+					g_value_init( value, G_TYPE_STRING );
+					str_value = nadp_desktop_file_get_string( nrd->ndf, group, key, iddef->default_value );
+					g_value_set_string( value, str_value );
+					g_free( str_value );
+					break;
+
+				case NADF_TYPE_BOOLEAN:
+					g_value_init( value, G_TYPE_BOOLEAN );
+					bool_value = nadp_desktop_file_get_boolean( nrd->ndf, group, key, na_core_utils_boolean_from_string( iddef->default_value ));
+					g_value_set_boolean( value, bool_value );
+					break;
+
+				case NADF_TYPE_STRING_LIST:
+					g_value_init( value, G_TYPE_POINTER );
+					slist_value = nadp_desktop_file_get_string_list( nrd->ndf, group, key, iddef->default_value );
+					g_value_set_pointer( value, slist_value );
+					break;
+
+				default:
+					msg = g_strdup_printf( "%s: %d: unknown data type.", thisfn, iddef->type );
+					g_warning( "%s", msg );
+					*messages = g_slist_append( *messages, msg );
+			}
+
+			g_free( key );
+			g_free( group );
+		}
+	}
+
+	return( value );
+}
+
+/*
+ * called when each NAIDataFactory object has been readen
+ * nothing to do here
+ */
+static void
+iio_factory_read_done( const NAIIOFactory *reader, void *reader_data, NAIDataFactory *serializable, GSList **messages )
+{
+	static const gchar *thisfn = "nadp_desktop_provider_iio_factory_read_done";
+	/*NAObjectProfile *profile;*/
+
+	g_debug( "%s: reader=%p (%s), reader_data=%p, serializable=%p (%s), messages=%p",
+			thisfn,
+			( void * ) reader, G_OBJECT_TYPE_NAME( reader ),
+			( void * ) reader_data,
+			( void * ) serializable, G_OBJECT_TYPE_NAME( serializable ),
+			( void * ) messages );
+
+	g_return_if_fail( NA_IS_IIO_FACTORY( reader ));
+	g_return_if_fail( NADP_IS_DESKTOP_PROVIDER( reader ));
+	g_return_if_fail( NA_IS_IDATA_FACTORY( serializable ));
+
+	if( !NADP_DESKTOP_PROVIDER( reader )->private->dispose_has_run ){
+
+	}
+}
diff --git a/src/io-desktop/nadp-desktop-provider.h b/src/io-desktop/nadp-desktop-provider.h
index 61548d4..62defd8 100644
--- a/src/io-desktop/nadp-desktop-provider.h
+++ b/src/io-desktop/nadp-desktop-provider.h
@@ -34,17 +34,16 @@
 /**
  * SECTION: nadp_desktop_provider
  * @short_description: #NadpDesktopProvider class definition.
- * @include: na-gconf-provider.h
+ * @include: nadp-desktop-provider.h
  *
- * This class manages the GConf I/O storage subsystem, or, in other words,
- * the GConf subsystem as an NAIIOProvider. As this, it should only be
- * used through the NAIIOProvider interface.
- *
- * #NadpDesktopProvider uses #NAGConfMonitor to watch at the configuration
- * tree. Modifications are notified to the NAIIOProvider interface.
+ * This class manages .desktop files I/O storage subsystem, or, in
+ * other words, .desktop files as NAIIOProvider providers. As this, it
+ * should only be used through the NAIIOProvider interface.
  */
 
-#include <glib-object.h>
+#include <api/na-object-item.h>
+
+#include "nadp-desktop-file.h"
 
 G_BEGIN_DECLS
 
@@ -55,7 +54,7 @@ G_BEGIN_DECLS
 #define NADP_IS_DESKTOP_PROVIDER_CLASS( klass )		( G_TYPE_CHECK_CLASS_TYPE(( klass ), NADP_DESKTOP_PROVIDER_TYPE ))
 #define NADP_DESKTOP_PROVIDER_GET_CLASS( object )	( G_TYPE_INSTANCE_GET_CLASS(( object ), NADP_DESKTOP_PROVIDER_TYPE, NadpDesktopProviderClass ))
 
-typedef struct NadpDesktopProviderPrivate NadpDesktopProviderPrivate;
+typedef struct NadpDesktopProviderPrivate      NadpDesktopProviderPrivate;
 
 /* private instance data
  */
@@ -77,15 +76,21 @@ typedef struct {
 }
 	NadpDesktopProviderClass;
 
-/* this is a ':'-separated list of subdirs searched for actions desktop files.
+/* the structure passed as reader data to NAIDataFactory
  */
-#define NADP_DESKTOP_PROVIDER_SUBDIRS		"file-manager/actions"
+typedef struct {
+	NadpDesktopFile *ndf;
+	NAObjectItem    *action;
+}
+	NadpReaderData;
 
-/* standard suffix for action desktop files
+/* this is a ':'-separated list of XDG_DATA_DIRS/subdirs searched for
+ * menus or actions .desktop files.
  */
-#define NADP_DESKTOP_SUFFIX					".desktop"
+#define NADP_DESKTOP_PROVIDER_SUBDIRS		"file-manager/actions"
 
 GType nadp_desktop_provider_get_type     ( void );
+
 void  nadp_desktop_provider_register_type( GTypeModule *module );
 
 G_END_DECLS
diff --git a/src/io-desktop/nadp-keys.c b/src/io-desktop/nadp-keys.c
new file mode 100644
index 0000000..1c79697
--- /dev/null
+++ b/src/io-desktop/nadp-keys.c
@@ -0,0 +1,75 @@
+/*
+ * Nautilus Actions
+ * A Nautilus extension which offers configurable context menu actions.
+ *
+ * Copyright (C) 2005 The GNOME Foundation
+ * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
+ * Copyright (C) 2009, 2010 Pierre Wieser and others (see AUTHORS)
+ *
+ * This Program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this Library; see the file COPYING.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ *   Frederic Ruaudel <grumz grumz net>
+ *   Rodrigo Moya <rodrigo gnome-db org>
+ *   Pierre Wieser <pwieser trychlos org>
+ *   ... and many others (see AUTHORS)
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <api/na-idata-factory-enum.h>
+
+#include "nadp-keys.h"
+
+static NadpIdKey id_key [] = {
+	{ NADF_DATA_LABEL,   NADP_GROUP_DESKTOP, NADP_KEY_NAME },
+	{ NADF_DATA_TOOLTIP, NADP_GROUP_DESKTOP, NADP_KEY_TOOLTIP },
+	{ NADF_DATA_ICON,    NADP_GROUP_DESKTOP, NADP_KEY_ICON },
+	{ 0, NULL, NULL }
+};
+
+/**
+ * nadp_keys_get_group_and_key:
+ * @iddef:
+ *
+ * Set: the group and the key to be used for this @iddef.
+ *
+ * Returns: %TRUE if the data has been found, %FALSE else.
+ */
+gboolean
+nadp_keys_get_group_and_key( const NadfIdType *iddef, gchar **group, gchar **key )
+{
+	gboolean found;
+	int i;
+
+	found = FALSE;
+	*group = NULL;
+	*key = NULL;
+
+	for( i = 0 ; id_key[i].data_id && !found ; ++i ){
+
+		if( id_key[i].data_id == iddef->id ){
+
+			*group = g_strdup( id_key[i].group );
+			*key = g_strdup( id_key[i].key );
+			found = TRUE;
+		}
+	}
+
+	return( found );
+}
diff --git a/src/io-desktop/nadp-keys.h b/src/io-desktop/nadp-keys.h
new file mode 100644
index 0000000..7a32682
--- /dev/null
+++ b/src/io-desktop/nadp-keys.h
@@ -0,0 +1,106 @@
+/*
+ * Nautilus Actions
+ * A Nautilus extension which offers configurable context menu actions.
+ *
+ * Copyright (C) 2005 The GNOME Foundation
+ * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
+ * Copyright (C) 2009, 2010 Pierre Wieser and others (see AUTHORS)
+ *
+ * This Program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this Library; see the file COPYING.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ *   Frederic Ruaudel <grumz grumz net>
+ *   Rodrigo Moya <rodrigo gnome-db org>
+ *   Pierre Wieser <pwieser trychlos org>
+ *   ... and many others (see AUTHORS)
+ */
+
+#ifndef __NADP_KEYS_H__
+#define __NADP_KEYS_H__
+
+#include <api/na-idata-factory-str.h>
+
+G_BEGIN_DECLS
+
+#define NADP_GROUP_DESKTOP							G_KEY_FILE_DESKTOP_GROUP
+#define NADP_GROUP_PROFILE							"X-Action-Profile"
+
+#define NADP_KEY_TYPE								G_KEY_FILE_DESKTOP_KEY_TYPE
+#define NADP_VALUE_TYPE_ACTION						"Action"
+#define NADP_VALUE_TYPE_MENU						"Menu"
+#define NADP_KEY_NAME								G_KEY_FILE_DESKTOP_KEY_NAME
+#define NADP_KEY_TOOLTIP							"Tooltip"
+#define NADP_KEY_ICON								G_KEY_FILE_DESKTOP_KEY_ICON
+#define NADP_KEY_DESCRIPTION						"Description"
+#define NADP_KEY_SUGGESTED_SHORTCUT					"SuggestedShortcut"
+
+#define NADP_KEY_TARGET_SELECTION					"TargetSelection"
+#define NADP_KEY_TARGET_BACKGROUND					"TargetBackground"
+#define NADP_KEY_TARGET_CONTEXT						"TargetContext"
+#define NADP_KEY_TARGET_TOOLBAR						"TargetToolbar"
+#define NADP_KEY_TOOLBAR_LABEL						"ToolbarLabel"
+#define NADP_KEY_PROFILES							"Profiles"
+
+#define NADP_KEY_EXEC								G_KEY_FILE_DESKTOP_KEY_EXEC
+#define NADP_KEY_PATH								G_KEY_FILE_DESKTOP_KEY_PATH
+#define NADP_KEY_EXECUTION_MODE						"ExecutionMode"
+#define NADP_VALUE_EXECUTION_MODE_NORMAL			"Normal"
+#define NADP_VALUE_EXECUTION_MODE_MINIMIZED			"Minimized"
+#define NADP_VALUE_EXECUTION_MODE_MAXIMIZED			"Maximized"
+#define NADP_VALUE_EXECUTION_MODE_TERMINAL			"Terminal"
+#define NADP_VALUE_EXECUTION_MODE_EMBEDDED			"Embedded"
+#define NADP_VALUE_EXECUTION_MODE_DISPLAY_OUTPUT	"DisplayOutput"
+#define NADP_KEY_STARTUP_NOTIFY						G_KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY
+#define NADP_KEY_STARTUP_WM_CLASS					G_KEY_FILE_DESKTOP_KEY_STARTUP_WM_CLASS
+#define NADP_KEY_EXECUTE_AS							"ExecuteAs"
+#define NADP_KEY_FOR_EACH							"ForEach"
+
+#define NADP_KEY_ITEMS_LIST							"ItemsList"
+#define NADP_KEY_GET_ITEMS_LIST						"GetItemsList"
+
+#define NADP_KEY_ONLY_SHOW_IN						G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN
+#define NADP_KEY_NOT_SHOW_IN						G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN
+#define NADP_KEY_NO_DISPLAY							"NoDisplay"
+#define NADP_KEY_HIDDEN								G_KEY_FILE_DESKTOP_KEY_HIDDEN
+#define NADP_KEY_TRY_EXEC							G_KEY_FILE_DESKTOP_KEY_TRY_EXEC
+#define NADP_KEY_SHOW_IF_REGISTERED					"ShowIfRegistered"
+#define NADP_KEY_SHOW_IF_TRUE						"ShowIfTrue"
+#define NADP_KEY_SHOW_IF_RUNNING					"ShowIfRunning"
+#define NADP_KEY_MIMETYPES							"MimeTypes"
+#define NADP_KEY_BASENAMES							"Basenames"
+#define NADP_KEY_MATCHCASE							"Matchcase"
+#define NADP_KEY_SELECTION_COUNT					"SelectionCount"
+#define NADP_KEY_SCHEMES							"Schemes"
+#define NADP_KEY_FOLDERS							"Folders"
+#define NADP_KEY_CAPABILITIES						"Capabilities"
+#define NADP_VALUE_CAPABILITY_OWNER					"Owner"
+#define NADP_VALUE_CAPABILITY_READABLE				"Readable"
+#define NADP_VALUE_CAPABILITY_WRITABLE				"Writable"
+#define NADP_VALUE_CAPABILITY_EXECUTABLE			"Executable"
+#define NADP_VALUE_CAPABILITY_LOCAL					"Local"
+
+typedef struct {
+	guint  data_id;
+	gchar *group;
+	gchar *key;
+}
+	NadpIdKey;
+
+gboolean nadp_keys_get_group_and_key( const NadfIdType *iddef, gchar **group, gchar **key );
+
+G_END_DECLS
+
+#endif /* __NADP_KEYS_H__ */
diff --git a/src/io-desktop/nadp-utils.c b/src/io-desktop/nadp-utils.c
index 307978b..4820117 100644
--- a/src/io-desktop/nadp-utils.c
+++ b/src/io-desktop/nadp-utils.c
@@ -40,84 +40,6 @@
 #include "nadp-desktop-provider.h"
 #include "nadp-utils.h"
 
-static GSList *text_to_string_list( const gchar *text, const gchar *separator, const gchar *default_value );
-
-/**
- * nadp_utils_split_path_list:
- * @path_list: a ':'-separated list of paths.
- *
- * Returns: an ordered GSList of paths, as newly allocated strings.
- *
- * The returned GSList should be freed by the caller.
- */
-GSList *
-nadp_utils_split_path_list( const gchar *path_list )
-{
-	return( text_to_string_list( path_list, ":", NULL ));
-}
-
-/*
- * split a text buffer in lines
- */
-static GSList *
-text_to_string_list( const gchar *text, const gchar *separator, const gchar *default_value )
-{
-	GSList *strlist = NULL;
-	gchar **tokens;
-	gchar *tmp;
-	gchar *source = g_strdup( text );
-
-	tmp = g_strstrip( source );
-	if( !g_utf8_strlen( tmp, -1 ) && default_value ){
-		strlist = g_slist_append( strlist, g_strdup( default_value ));
-
-	} else {
-		tokens = g_strsplit( tmp, separator, -1 );
-		strlist = nadp_utils_to_slist(( const gchar ** ) tokens );
-		g_strfreev( tokens );
-	}
-
-	g_free( source );
-	return( strlist );
-}
-
-/**
- * nadp_utils_to_slist:
- * @list: a gchar ** list of strings.
- *
- * Returns: a #GSList.
- */
-GSList *
-nadp_utils_to_slist( const gchar **list )
-{
-	GSList *strlist = NULL;
-	gchar **iter;
-	gchar *tmp;
-
-	iter = ( gchar ** ) list;
-
-	while( *iter ){
-		tmp = g_strstrip( *iter );
-		strlist = g_slist_append( strlist, g_strdup( tmp ));
-		iter++;
-	}
-
-	return( strlist );
-}
-
-/**
- * nadp_utils_gslist_free:
- * @list: the GSList to be freed.
- *
- * Frees a GSList of strings.
- */
-void
-nadp_utils_gslist_free( GSList *list )
-{
-	g_slist_foreach( list, ( GFunc ) g_free, NULL );
-	g_slist_free( list );
-}
-
 /**
  * nadp_utils_gslist_remove_from:
  * @list: the #GSList from which remove the @string.
@@ -143,109 +65,6 @@ nadp_utils_gslist_remove_from( GSList *list, const gchar *string )
 }
 
 /**
- * nadp_utils_remove_suffix:
- * @string: source string.
- * @suffix: suffix to be removed from @string.
- *
- * Returns: a newly allocated string, which is a copy of the source @string,
- * minus the removed @suffix if present. If @strings doesn't terminate with
- * @suffix, then the returned string is equal to source @string.
- *
- * The returned string should be g_free() by the caller.
- */
-gchar *
-nadp_utils_remove_suffix( const gchar *string, const gchar *suffix )
-{
-	gchar *removed;
-	gchar *ptr;
-
-	removed = g_strdup( string );
-
-	if( g_str_has_suffix( string, suffix )){
-		ptr = g_strrstr( removed, suffix );
-		ptr[0] = '\0';
-	}
-
-	return( removed );
-}
-
-/**
- * nadp_utils_is_writable_dir:
- * @path: the path of the directory to be tested.
- *
- * Returns: %TRUE if the directory is writable, %FALSE else.
- *
- * Please note that this type of test is subject to race conditions,
- * as the directory may become unwritable after a successfull test,
- * but before the caller has been able to actually write into it.
- *
- * There is no "super-test". Just try...
- */
-gboolean
-nadp_utils_is_writable_dir( const gchar *path )
-{
-	static const gchar *thisfn = "nadp_utils_is_writable_dir";
-	GFile *file;
-	GError *error = NULL;
-	GFileInfo *info;
-	GFileType type;
-	gboolean writable;
-
-	if( !path || !g_utf8_strlen( path, -1 )){
-		return( FALSE );
-	}
-
-	file = g_file_new_for_path( path );
-	info = g_file_query_info( file,
-			G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE "," G_FILE_ATTRIBUTE_STANDARD_TYPE,
-			G_FILE_QUERY_INFO_NONE, NULL, &error );
-
-	if( error ){
-		g_warning( "%s: g_file_query_info error: %s", thisfn, error->message );
-		g_error_free( error );
-		g_object_unref( file );
-		return( FALSE );
-	}
-
-	type = g_file_info_get_file_type( info );
-	if( type != G_FILE_TYPE_DIRECTORY ){
-		g_debug( "%s: %s is not a directory", thisfn, path );
-		g_object_unref( info );
-		return( FALSE );
-	}
-
-	writable = g_file_info_get_attribute_boolean( info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE );
-	if( !writable ){
-		g_debug( "%s: %s is not writable", thisfn, path );
-	}
-	g_object_unref( info );
-
-	return( writable );
-}
-
-/**
- * nadp_utils_path2id:
- * @path: a full pathname.
- *
- * Returns: the id of the file, as a newly allocated string which
- * should be g_free() by the caller.
- *
- * The id of the file is equal to the basename, minus the suffix.
- */
-gchar *
-nadp_utils_path2id( const gchar *path )
-{
-	gchar *bname;
-	gchar *id;
-
-	bname = g_path_get_basename( path );
-	id = nadp_utils_remove_suffix( bname, NADP_DESKTOP_SUFFIX );
-	g_free( bname );
-
-	return( id );
-}
-
-/**
  * nadp_utils_is_writable_file:
  * @path: the path of the file to be tested.
  *
@@ -290,28 +109,3 @@ nadp_utils_is_writable_file( const gchar *path )
 
 	return( writable );
 }
-
-/**
- * nadp_utils_delete_file:
- * @path: the path of the file to be deleted.
- *
- * Returns: %TRUE if the file is successfully deleted, %FALSE else.
- */
-gboolean
-nadp_utils_delete_file( const gchar *path )
-{
-	static const gchar *thisfn = "nadp_utils_delete_file";
-	gboolean deleted = FALSE;
-
-	if( !path || !g_utf8_strlen( path, -1 )){
-		return( FALSE );
-	}
-
-	if( g_unlink( path ) == 0 ){
-		deleted = TRUE;
-	} else {
-		g_warning( "%s: %s: %s", thisfn, path, g_strerror( errno ));
-	}
-
-	return( deleted );
-}
diff --git a/src/io-desktop/nadp-utils.h b/src/io-desktop/nadp-utils.h
index 9cf8e11..6457146 100644
--- a/src/io-desktop/nadp-utils.h
+++ b/src/io-desktop/nadp-utils.h
@@ -33,23 +33,10 @@
 
 G_BEGIN_DECLS
 
-GSList  *nadp_utils_split_path_list( const gchar *path_list );
-
-GSList  *nadp_utils_to_slist( const gchar **list );
-
-void     nadp_utils_gslist_free( GSList *list );
 GSList  *nadp_utils_gslist_remove_from( GSList *list, const gchar *string );
 
-gchar   *nadp_utils_remove_suffix( const gchar *string, const gchar *suffix );
-
-gboolean nadp_utils_is_writable_dir( const gchar *path );
-
-gchar   *nadp_utils_path2id( const gchar *path );
-
 gboolean nadp_utils_is_writable_file( const gchar *path );
 
-gboolean nadp_utils_delete_file( const gchar *path );
-
 G_END_DECLS
 
 #endif /* __NADP_UTILS_H__ */



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