[nautilus-actions/file-manager-actions] NadpDesktopFile class is renamed to FMADesktopFile
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions/file-manager-actions] NadpDesktopFile class is renamed to FMADesktopFile
- Date: Tue, 8 Sep 2015 14:45:53 +0000 (UTC)
commit 4adc4aad4ee74cd1300109de937b97e6af5ea363
Author: Pierre Wieser <pwieser trychlos org>
Date: Tue Sep 8 14:31:35 2015 +0200
NadpDesktopFile class is renamed to FMADesktopFile
.../{nadp-desktop-file.c => fma-desktop-file.c} | 294 ++++++++++----------
src/io-desktop/fma-desktop-file.h | 110 ++++++++
src/io-desktop/nadp-desktop-file.h | 110 --------
src/io-desktop/nadp-reader.c | 50 ++--
src/io-desktop/nadp-writer.c | 94 +++---
5 files changed, 329 insertions(+), 329 deletions(-)
---
diff --git a/src/io-desktop/nadp-desktop-file.c b/src/io-desktop/fma-desktop-file.c
similarity index 75%
rename from src/io-desktop/nadp-desktop-file.c
rename to src/io-desktop/fma-desktop-file.c
index 187bb52..349affd 100644
--- a/src/io-desktop/nadp-desktop-file.c
+++ b/src/io-desktop/fma-desktop-file.c
@@ -42,13 +42,13 @@
/* private class data
*/
-struct _NadpDesktopFileClassPrivate {
+struct _FMADesktopFileClassPrivate {
void *empty; /* so that gcc -pedantic is happy */
};
/* private instance data
*/
-struct _NadpDesktopFilePrivate {
+struct _FMADesktopFilePrivate {
gboolean dispose_has_run;
gchar *id;
gchar *uri;
@@ -58,20 +58,20 @@ struct _NadpDesktopFilePrivate {
static GObjectClass *st_parent_class = NULL;
-static GType register_type( void );
-static void class_init( NadpDesktopFileClass *klass );
-static void instance_init( GTypeInstance *instance, gpointer klass );
-static void instance_dispose( GObject *object );
-static void instance_finalize( GObject *object );
+static GType register_type( void );
+static void class_init( FMADesktopFileClass *klass );
+static void instance_init( GTypeInstance *instance, gpointer klass );
+static void instance_dispose( GObject *object );
+static void instance_finalize( GObject *object );
-static NadpDesktopFile *ndf_new( const gchar *uri );
-static gchar *path2id( const gchar *path );
-static gchar *uri2id( const gchar *uri );
-static gboolean check_key_file( NadpDesktopFile *ndf );
-static void remove_encoding_part( NadpDesktopFile *ndf );
+static FMADesktopFile *ndf_new( const gchar *uri );
+static gchar *path2id( const gchar *path );
+static gchar *uri2id( const gchar *uri );
+static gboolean check_key_file( FMADesktopFile *ndf );
+static void remove_encoding_part( FMADesktopFile *ndf );
GType
-nadp_desktop_file_get_type( void )
+fma_desktop_file_get_type( void )
{
static GType class_type = 0;
@@ -85,32 +85,32 @@ nadp_desktop_file_get_type( void )
static GType
register_type( void )
{
- static const gchar *thisfn = "nadp_desktop_file_register_type";
+ static const gchar *thisfn = "fma_desktop_file_register_type";
GType type;
static GTypeInfo info = {
- sizeof( NadpDesktopFileClass ),
+ sizeof( FMADesktopFileClass ),
NULL,
NULL,
( GClassInitFunc ) class_init,
NULL,
NULL,
- sizeof( NadpDesktopFile ),
+ sizeof( FMADesktopFile ),
0,
( GInstanceInitFunc ) instance_init
};
g_debug( "%s", thisfn );
- type = g_type_register_static( G_TYPE_OBJECT, "NadpDesktopFile", &info, 0 );
+ type = g_type_register_static( G_TYPE_OBJECT, "FMADesktopFile", &info, 0 );
return( type );
}
static void
-class_init( NadpDesktopFileClass *klass )
+class_init( FMADesktopFileClass *klass )
{
- static const gchar *thisfn = "nadp_desktop_file_class_init";
+ static const gchar *thisfn = "fma_desktop_file_class_init";
GObjectClass *object_class;
g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
@@ -121,21 +121,21 @@ class_init( NadpDesktopFileClass *klass )
object_class->dispose = instance_dispose;
object_class->finalize = instance_finalize;
- klass->private = g_new0( NadpDesktopFileClassPrivate, 1 );
+ klass->private = g_new0( FMADesktopFileClassPrivate, 1 );
}
static void
instance_init( GTypeInstance *instance, gpointer klass )
{
- static const gchar *thisfn = "nadp_desktop_file_instance_init";
- NadpDesktopFile *self;
+ static const gchar *thisfn = "fma_desktop_file_instance_init";
+ FMADesktopFile *self;
g_debug( "%s: instance=%p (%s), klass=%p",
thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ), ( void * ) klass );
- g_return_if_fail( NADP_IS_DESKTOP_FILE( instance ));
- self = NADP_DESKTOP_FILE( instance );
+ g_return_if_fail( FMA_IS_DESKTOP_FILE( instance ));
+ self = FMA_DESKTOP_FILE( instance );
- self->private = g_new0( NadpDesktopFilePrivate, 1 );
+ self->private = g_new0( FMADesktopFilePrivate, 1 );
self->private->dispose_has_run = FALSE;
self->private->key_file = g_key_file_new();
@@ -144,12 +144,12 @@ instance_init( GTypeInstance *instance, gpointer klass )
static void
instance_dispose( GObject *object )
{
- static const gchar *thisfn = "nadp_desktop_file_instance_dispose";
- NadpDesktopFile *self;
+ static const gchar *thisfn = "fma_desktop_file_instance_dispose";
+ FMADesktopFile *self;
- g_return_if_fail( NADP_IS_DESKTOP_FILE( object ));
+ g_return_if_fail( FMA_IS_DESKTOP_FILE( object ));
- self = NADP_DESKTOP_FILE( object );
+ self = FMA_DESKTOP_FILE( object );
if( !self->private->dispose_has_run ){
@@ -167,14 +167,14 @@ instance_dispose( GObject *object )
static void
instance_finalize( GObject *object )
{
- static const gchar *thisfn = "nadp_desktop_file_instance_finalize";
- NadpDesktopFile *self;
+ static const gchar *thisfn = "fma_desktop_file_instance_finalize";
+ FMADesktopFile *self;
- g_return_if_fail( NADP_IS_DESKTOP_FILE( object ));
+ g_return_if_fail( FMA_IS_DESKTOP_FILE( object ));
g_debug( "%s: object=%p (%s)", thisfn, ( void * ) object, G_OBJECT_TYPE_NAME( object ));
- self = NADP_DESKTOP_FILE( object );
+ self = FMA_DESKTOP_FILE( object );
g_free( self->private->id );
g_free( self->private->uri );
@@ -193,33 +193,33 @@ instance_finalize( GObject *object )
}
/**
- * nadp_desktop_file_new:
+ * fma_desktop_file_new:
*
- * Retuns: a newly allocated #NadpDesktopFile object.
+ * Retuns: a newly allocated #FMADesktopFile object.
*/
-NadpDesktopFile *
-nadp_desktop_file_new( void )
+FMADesktopFile *
+fma_desktop_file_new( void )
{
- NadpDesktopFile *ndf;
+ FMADesktopFile *ndf;
- ndf = g_object_new( NADP_TYPE_DESKTOP_FILE, NULL );
+ ndf = g_object_new( FMA_TYPE_DESKTOP_FILE, NULL );
return( ndf );
}
/**
- * nadp_desktop_file_new_from_path:
+ * fma_desktop_file_new_from_path:
* @path: the full pathname of a .desktop file.
*
- * Retuns: a newly allocated #NadpDesktopFile object.
+ * Retuns: a newly allocated #FMADesktopFile object.
*
* Key file has been loaded, and first validity checks made.
*/
-NadpDesktopFile *
-nadp_desktop_file_new_from_path( const gchar *path )
+FMADesktopFile *
+fma_desktop_file_new_from_path( const gchar *path )
{
- static const gchar *thisfn = "nadp_desktop_file_new_from_path";
- NadpDesktopFile *ndf;
+ static const gchar *thisfn = "fma_desktop_file_new_from_path";
+ FMADesktopFile *ndf;
GError *error;
gchar *uri;
@@ -257,10 +257,10 @@ nadp_desktop_file_new_from_path( const gchar *path )
}
/**
- * nadp_desktop_file_new_from_uri:
+ * fma_desktop_file_new_from_uri:
* @uri: the URI the desktop file should be loaded from.
*
- * Retuns: a newly allocated #NadpDesktopFile object, or %NULL.
+ * Retuns: a newly allocated #FMADesktopFile object, or %NULL.
*
* Key file has been loaded, and first validity checks made.
*
@@ -268,11 +268,11 @@ nadp_desktop_file_new_from_path( const gchar *path )
* So it is rather common that the file not be a .desktop one.
* Do not warns when file is malformed.
*/
-NadpDesktopFile *
-nadp_desktop_file_new_from_uri( const gchar *uri )
+FMADesktopFile *
+fma_desktop_file_new_from_uri( const gchar *uri )
{
- static const gchar *thisfn = "nadp_desktop_file_new_from_uri";
- NadpDesktopFile *ndf;
+ static const gchar *thisfn = "fma_desktop_file_new_from_uri";
+ FMADesktopFile *ndf;
GError *error;
gchar *data;
gsize length;
@@ -316,16 +316,16 @@ nadp_desktop_file_new_from_uri( const gchar *uri )
}
/**
- * nadp_desktop_file_new_for_write:
+ * fma_desktop_file_new_for_write:
* @path: the full pathname of a .desktop file.
*
- * Retuns: a newly allocated #NadpDesktopFile object.
+ * Retuns: a newly allocated #FMADesktopFile object.
*/
-NadpDesktopFile *
-nadp_desktop_file_new_for_write( const gchar *path )
+FMADesktopFile *
+fma_desktop_file_new_for_write( const gchar *path )
{
- static const gchar *thisfn = "nadp_desktop_file_new_for_write";
- NadpDesktopFile *ndf;
+ static const gchar *thisfn = "fma_desktop_file_new_for_write";
+ FMADesktopFile *ndf;
GError *error;
gchar *uri;
@@ -350,17 +350,17 @@ nadp_desktop_file_new_for_write( const gchar *path )
}
/**
- * nadp_desktop_file_get_key_file:
- * @ndf: the #NadpDesktopFile instance.
+ * fma_desktop_file_get_key_file:
+ * @ndf: the #FMADesktopFile instance.
*
* Returns: a pointer to the internal #GKeyFile.
*/
GKeyFile *
-nadp_desktop_file_get_key_file( const NadpDesktopFile *ndf )
+fma_desktop_file_get_key_file( const FMADesktopFile *ndf )
{
GKeyFile *key_file;
- g_return_val_if_fail( NADP_IS_DESKTOP_FILE( ndf ), NULL );
+ g_return_val_if_fail( FMA_IS_DESKTOP_FILE( ndf ), NULL );
key_file = NULL;
@@ -373,18 +373,18 @@ nadp_desktop_file_get_key_file( const NadpDesktopFile *ndf )
}
/**
- * nadp_desktop_file_get_key_file_uri:
- * @ndf: the #NadpDesktopFile instance.
+ * fma_desktop_file_get_key_file_uri:
+ * @ndf: the #FMADesktopFile instance.
*
* Returns: the URI of the key file, as a newly allocated
* string which should be g_free() by the caller.
*/
gchar *
-nadp_desktop_file_get_key_file_uri( const NadpDesktopFile *ndf )
+fma_desktop_file_get_key_file_uri( const FMADesktopFile *ndf )
{
gchar *uri;
- g_return_val_if_fail( NADP_IS_DESKTOP_FILE( ndf ), NULL );
+ g_return_val_if_fail( FMA_IS_DESKTOP_FILE( ndf ), NULL );
uri = NULL;
@@ -396,12 +396,12 @@ nadp_desktop_file_get_key_file_uri( const NadpDesktopFile *ndf )
return( uri );
}
-static NadpDesktopFile *
+static FMADesktopFile *
ndf_new( const gchar *uri )
{
- NadpDesktopFile *ndf;
+ FMADesktopFile *ndf;
- ndf = g_object_new( NADP_TYPE_DESKTOP_FILE, NULL );
+ ndf = g_object_new( FMA_TYPE_DESKTOP_FILE, NULL );
ndf->private->id = uri2id( uri );
ndf->private->uri = g_strdup( uri );
@@ -419,7 +419,7 @@ path2id( const gchar *path )
gchar *id;
bname = g_path_get_basename( path );
- id = fma_core_utils_str_remove_suffix( bname, NADP_DESKTOP_FILE_SUFFIX );
+ id = fma_core_utils_str_remove_suffix( bname, FMA_DESKTOP_FILE_SUFFIX );
g_free( bname );
return( id );
@@ -443,9 +443,9 @@ uri2id( const gchar *uri )
}
static gboolean
-check_key_file( NadpDesktopFile *ndf )
+check_key_file( FMADesktopFile *ndf )
{
- static const gchar *thisfn = "nadp_desktop_file_check_key_file";
+ static const gchar *thisfn = "fma_desktop_file_check_key_file";
gboolean ret;
gchar *start_group;
gboolean has_key;
@@ -526,18 +526,18 @@ check_key_file( NadpDesktopFile *ndf )
}
/**
- * nadp_desktop_file_get_type:
- * @ndf: the #NadpDesktopFile instance.
+ * fma_desktop_file_get_type:
+ * @ndf: the #FMADesktopFile 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 )
+fma_desktop_file_get_file_type( const FMADesktopFile *ndf )
{
gchar *type;
- g_return_val_if_fail( NADP_IS_DESKTOP_FILE( ndf ), NULL );
+ g_return_val_if_fail( FMA_IS_DESKTOP_FILE( ndf ), NULL );
type = NULL;
@@ -550,18 +550,18 @@ nadp_desktop_file_get_file_type( const NadpDesktopFile *ndf )
}
/**
- * nadp_desktop_file_get_id:
- * @ndf: the #NadpDesktopFile instance.
+ * fma_desktop_file_get_id:
+ * @ndf: the #FMADesktopFile instance.
*
* Returns: a newly allocated string which holds the id of the Desktop
* File.
*/
gchar *
-nadp_desktop_file_get_id( const NadpDesktopFile *ndf )
+fma_desktop_file_get_id( const FMADesktopFile *ndf )
{
gchar *value;
- g_return_val_if_fail( NADP_IS_DESKTOP_FILE( ndf ), NULL );
+ g_return_val_if_fail( FMA_IS_DESKTOP_FILE( ndf ), NULL );
value = NULL;
@@ -574,8 +574,8 @@ nadp_desktop_file_get_id( const NadpDesktopFile *ndf )
}
/**
- * nadp_desktop_file_get_profiles:
- * @ndf: the #NadpDesktopFile instance.
+ * fma_desktop_file_get_profiles:
+ * @ndf: the #FMADesktopFile instance.
*
* Returns: the list of profiles in the file, as a newly allocated GSList
* which must be fma_core_utils_slist_free() by the caller.
@@ -583,7 +583,7 @@ nadp_desktop_file_get_id( const NadpDesktopFile *ndf )
* Silently ignore unknown groups.
*/
GSList *
-nadp_desktop_file_get_profiles( const NadpDesktopFile *ndf )
+fma_desktop_file_get_profiles( const FMADesktopFile *ndf )
{
GSList *list;
gchar **groups, **ig;
@@ -591,7 +591,7 @@ nadp_desktop_file_get_profiles( const NadpDesktopFile *ndf )
gchar *profile_id;
guint pfx_len;
- g_return_val_if_fail( NADP_IS_DESKTOP_FILE( ndf ), NULL );
+ g_return_val_if_fail( FMA_IS_DESKTOP_FILE( ndf ), NULL );
list = NULL;
@@ -621,8 +621,8 @@ nadp_desktop_file_get_profiles( const NadpDesktopFile *ndf )
}
/**
- * nadp_desktop_file_has_profile:
- * @ndf: the #NadpDesktopFile instance.
+ * fma_desktop_file_has_profile:
+ * @ndf: the #FMADesktopFile instance.
* @profile_id: the identifier of the profile.
*
* Returns: %TRUE if a group can be found in the .desktop file for this profile,
@@ -631,12 +631,12 @@ nadp_desktop_file_get_profiles( const NadpDesktopFile *ndf )
* Since: 3.1
*/
gboolean
-nadp_desktop_file_has_profile( const NadpDesktopFile *ndf, const gchar *profile_id )
+fma_desktop_file_has_profile( const FMADesktopFile *ndf, const gchar *profile_id )
{
gboolean has_profile;
gchar *group_name;
- g_return_val_if_fail( NADP_IS_DESKTOP_FILE( ndf ), FALSE );
+ g_return_val_if_fail( FMA_IS_DESKTOP_FILE( ndf ), FALSE );
g_return_val_if_fail( profile_id && g_utf8_strlen( profile_id, -1 ), FALSE );
has_profile = FALSE;
@@ -652,8 +652,8 @@ nadp_desktop_file_has_profile( const NadpDesktopFile *ndf, const gchar *profile_
}
/**
- * nadp_desktop_file_remove_key:
- * @ndf: this #NadpDesktopFile instance.
+ * fma_desktop_file_remove_key:
+ * @ndf: this #FMADesktopFile instance.
* @group: the group.
* @key: the key.
*
@@ -668,13 +668,13 @@ nadp_desktop_file_has_profile( const NadpDesktopFile *ndf, const gchar *profile_
* - key[en]
*/
void
-nadp_desktop_file_remove_key( const NadpDesktopFile *ndf, const gchar *group, const gchar *key )
+fma_desktop_file_remove_key( const FMADesktopFile *ndf, const gchar *group, const gchar *key )
{
char **locales;
char **iloc;
gchar *locale_key;
- g_return_if_fail( NADP_IS_DESKTOP_FILE( ndf ));
+ g_return_if_fail( FMA_IS_DESKTOP_FILE( ndf ));
if( !ndf->private->dispose_has_run ){
@@ -693,18 +693,18 @@ nadp_desktop_file_remove_key( const NadpDesktopFile *ndf, const gchar *group, co
}
/**
- * nadp_desktop_file_remove_profile:
- * @ndf: this #NadpDesktopFile instance.
+ * fma_desktop_file_remove_profile:
+ * @ndf: this #FMADesktopFile instance.
* @profile_id: the id of the profile.
*
* Removes the group which describes the specified profile.
*/
void
-nadp_desktop_file_remove_profile( const NadpDesktopFile *ndf, const gchar *profile_id )
+fma_desktop_file_remove_profile( const FMADesktopFile *ndf, const gchar *profile_id )
{
gchar *group_name;
- g_return_if_fail( NADP_IS_DESKTOP_FILE( ndf ));
+ g_return_if_fail( FMA_IS_DESKTOP_FILE( ndf ));
if( !ndf->private->dispose_has_run ){
@@ -715,8 +715,8 @@ nadp_desktop_file_remove_profile( const NadpDesktopFile *ndf, const gchar *profi
}
/**
- * nadp_desktop_file_get_boolean:
- * @ndf: this #NadpDesktopFile instance.
+ * fma_desktop_file_get_boolean:
+ * @ndf: this #FMADesktopFile instance.
* @group: the searched group.
* @entry: the searched entry.
* @key_found: set to %TRUE if the key has been found, to %FALSE else.
@@ -726,9 +726,9 @@ nadp_desktop_file_remove_profile( const NadpDesktopFile *ndf, const gchar *profi
* been found in the given group.
*/
gboolean
-nadp_desktop_file_get_boolean( const NadpDesktopFile *ndf, const gchar *group, const gchar *entry, gboolean
*key_found, gboolean default_value )
+fma_desktop_file_get_boolean( const FMADesktopFile *ndf, const gchar *group, const gchar *entry, gboolean
*key_found, gboolean default_value )
{
- static const gchar *thisfn = "nadp_desktop_file_get_boolean";
+ static const gchar *thisfn = "fma_desktop_file_get_boolean";
gboolean value;
gboolean read_value;
gboolean has_entry;
@@ -737,7 +737,7 @@ nadp_desktop_file_get_boolean( const NadpDesktopFile *ndf, const gchar *group, c
value = default_value;
*key_found = FALSE;
- g_return_val_if_fail( NADP_IS_DESKTOP_FILE( ndf ), FALSE );
+ g_return_val_if_fail( FMA_IS_DESKTOP_FILE( ndf ), FALSE );
if( !ndf->private->dispose_has_run ){
@@ -764,8 +764,8 @@ nadp_desktop_file_get_boolean( const NadpDesktopFile *ndf, const gchar *group, c
}
/**
- * nadp_desktop_file_get_locale_string:
- * @ndf: this #NadpDesktopFile instance.
+ * fma_desktop_file_get_locale_string:
+ * @ndf: this #FMADesktopFile instance.
* @group: the searched group.
* @entry: the searched entry.
* @key_found: set to %TRUE if the key has been found, to %FALSE else.
@@ -775,9 +775,9 @@ nadp_desktop_file_get_boolean( const NadpDesktopFile *ndf, const gchar *group, c
* been found in the given group.
*/
gchar *
-nadp_desktop_file_get_locale_string( const NadpDesktopFile *ndf, const gchar *group, const gchar *entry,
gboolean *key_found, const gchar *default_value )
+fma_desktop_file_get_locale_string( const FMADesktopFile *ndf, const gchar *group, const gchar *entry,
gboolean *key_found, const gchar *default_value )
{
- static const gchar *thisfn = "nadp_desktop_file_get_locale_string";
+ static const gchar *thisfn = "fma_desktop_file_get_locale_string";
gchar *value;
gchar *read_value;
GError *error;
@@ -785,7 +785,7 @@ nadp_desktop_file_get_locale_string( const NadpDesktopFile *ndf, const gchar *gr
value = g_strdup( default_value );
*key_found = FALSE;
- g_return_val_if_fail( NADP_IS_DESKTOP_FILE( ndf ), NULL );
+ g_return_val_if_fail( FMA_IS_DESKTOP_FILE( ndf ), NULL );
if( !ndf->private->dispose_has_run ){
@@ -810,8 +810,8 @@ nadp_desktop_file_get_locale_string( const NadpDesktopFile *ndf, const gchar *gr
}
/**
- * nadp_desktop_file_get_string:
- * @ndf: this #NadpDesktopFile instance.
+ * fma_desktop_file_get_string:
+ * @ndf: this #FMADesktopFile instance.
* @group: the searched group.
* @entry: the searched entry.
* @key_found: set to %TRUE if the key has been found, to %FALSE else.
@@ -821,9 +821,9 @@ nadp_desktop_file_get_locale_string( const NadpDesktopFile *ndf, const gchar *gr
* been found in the given group.
*/
gchar *
-nadp_desktop_file_get_string( const NadpDesktopFile *ndf, const gchar *group, const gchar *entry, gboolean
*key_found, const gchar *default_value )
+fma_desktop_file_get_string( const FMADesktopFile *ndf, const gchar *group, const gchar *entry, gboolean
*key_found, const gchar *default_value )
{
- static const gchar *thisfn = "nadp_desktop_file_get_string";
+ static const gchar *thisfn = "fma_desktop_file_get_string";
gchar *value;
gchar *read_value;
gboolean has_entry;
@@ -832,7 +832,7 @@ nadp_desktop_file_get_string( const NadpDesktopFile *ndf, const gchar *group, co
value = g_strdup( default_value );
*key_found = FALSE;
- g_return_val_if_fail( NADP_IS_DESKTOP_FILE( ndf ), NULL );
+ g_return_val_if_fail( FMA_IS_DESKTOP_FILE( ndf ), NULL );
if( !ndf->private->dispose_has_run ){
@@ -861,8 +861,8 @@ nadp_desktop_file_get_string( const NadpDesktopFile *ndf, const gchar *group, co
}
/**
- * nadp_desktop_file_get_string_list:
- * @ndf: this #NadpDesktopFile instance.
+ * fma_desktop_file_get_string_list:
+ * @ndf: this #FMADesktopFile instance.
* @group: the searched group.
* @entry: the searched entry.
* @key_found: set to %TRUE if the key has been found, to %FALSE else.
@@ -872,9 +872,9 @@ nadp_desktop_file_get_string( const NadpDesktopFile *ndf, const gchar *group, co
* been found in the given group.
*/
GSList *
-nadp_desktop_file_get_string_list( const NadpDesktopFile *ndf, const gchar *group, const gchar *entry,
gboolean *key_found, const gchar *default_value )
+fma_desktop_file_get_string_list( const FMADesktopFile *ndf, const gchar *group, const gchar *entry,
gboolean *key_found, const gchar *default_value )
{
- static const gchar *thisfn = "nadp_desktop_file_get_string_list";
+ static const gchar *thisfn = "fma_desktop_file_get_string_list";
GSList *value;
gchar **read_array;
gboolean has_entry;
@@ -883,7 +883,7 @@ nadp_desktop_file_get_string_list( const NadpDesktopFile *ndf, const gchar *grou
value = g_slist_append( NULL, g_strdup( default_value ));
*key_found = FALSE;
- g_return_val_if_fail( NADP_IS_DESKTOP_FILE( ndf ), NULL );
+ g_return_val_if_fail( FMA_IS_DESKTOP_FILE( ndf ), NULL );
if( !ndf->private->dispose_has_run ){
@@ -913,8 +913,8 @@ nadp_desktop_file_get_string_list( const NadpDesktopFile *ndf, const gchar *grou
}
/**
- * nadp_desktop_file_get_uint:
- * @ndf: this #NadpDesktopFile instance.
+ * fma_desktop_file_get_uint:
+ * @ndf: this #FMADesktopFile instance.
* @group: the searched group.
* @entry: the searched entry.
* @key_found: set to %TRUE if the key has been found, to %FALSE else.
@@ -924,9 +924,9 @@ nadp_desktop_file_get_string_list( const NadpDesktopFile *ndf, const gchar *grou
* been found in the given group.
*/
guint
-nadp_desktop_file_get_uint( const NadpDesktopFile *ndf, const gchar *group, const gchar *entry, gboolean
*key_found, guint default_value )
+fma_desktop_file_get_uint( const FMADesktopFile *ndf, const gchar *group, const gchar *entry, gboolean
*key_found, guint default_value )
{
- static const gchar *thisfn = "nadp_desktop_file_get_uint";
+ static const gchar *thisfn = "fma_desktop_file_get_uint";
guint value;
gboolean has_entry;
GError *error;
@@ -934,7 +934,7 @@ nadp_desktop_file_get_uint( const NadpDesktopFile *ndf, const gchar *group, cons
value = default_value;
*key_found = FALSE;
- g_return_val_if_fail( NADP_IS_DESKTOP_FILE( ndf ), 0 );
+ g_return_val_if_fail( FMA_IS_DESKTOP_FILE( ndf ), 0 );
if( !ndf->private->dispose_has_run ){
@@ -960,8 +960,8 @@ nadp_desktop_file_get_uint( const NadpDesktopFile *ndf, const gchar *group, cons
}
/**
- * nadp_desktop_file_set_boolean:
- * @ndf: this #NadpDesktopFile object.
+ * fma_desktop_file_set_boolean:
+ * @ndf: this #FMADesktopFile object.
* @group: the name of the group.
* @key: the name of the key.
* @value: the value to be written.
@@ -969,9 +969,9 @@ nadp_desktop_file_get_uint( const NadpDesktopFile *ndf, const gchar *group, cons
* Write the given boolean value.
*/
void
-nadp_desktop_file_set_boolean( const NadpDesktopFile *ndf, const gchar *group, const gchar *key, gboolean
value )
+fma_desktop_file_set_boolean( const FMADesktopFile *ndf, const gchar *group, const gchar *key, gboolean
value )
{
- g_return_if_fail( NADP_IS_DESKTOP_FILE( ndf ));
+ g_return_if_fail( FMA_IS_DESKTOP_FILE( ndf ));
if( !ndf->private->dispose_has_run ){
@@ -980,8 +980,8 @@ nadp_desktop_file_set_boolean( const NadpDesktopFile *ndf, const gchar *group, c
}
/**
- * nadp_desktop_file_set_locale_string:
- * @ndf: this #NadpDesktopFile object.
+ * fma_desktop_file_set_locale_string:
+ * @ndf: this #FMADesktopFile object.
* @group: the name of the group.
* @key: the name of the key.
* @value: the value to be written.
@@ -1010,14 +1010,14 @@ nadp_desktop_file_set_boolean( const NadpDesktopFile *ndf, const gchar *group, c
* The locale prefix is identified by '_' or '@' character.
*/
void
-nadp_desktop_file_set_locale_string( const NadpDesktopFile *ndf, const gchar *group, const gchar *key, const
gchar *value )
+fma_desktop_file_set_locale_string( const FMADesktopFile *ndf, const gchar *group, const gchar *key, const
gchar *value )
{
char **locales;
guint i;
gchar *prefix;
gboolean write;
- g_return_if_fail( NADP_IS_DESKTOP_FILE( ndf ));
+ g_return_if_fail( FMA_IS_DESKTOP_FILE( ndf ));
if( !ndf->private->dispose_has_run ){
@@ -1074,8 +1074,8 @@ nadp_desktop_file_set_locale_string( const NadpDesktopFile *ndf, const gchar *gr
}
/**
- * nadp_desktop_file_set_string:
- * @ndf: this #NadpDesktopFile object.
+ * fma_desktop_file_set_string:
+ * @ndf: this #FMADesktopFile object.
* @group: the name of the group.
* @key: the name of the key.
* @value: the value to be written.
@@ -1083,9 +1083,9 @@ nadp_desktop_file_set_locale_string( const NadpDesktopFile *ndf, const gchar *gr
* Write the given string value.
*/
void
-nadp_desktop_file_set_string( const NadpDesktopFile *ndf, const gchar *group, const gchar *key, const gchar
*value )
+fma_desktop_file_set_string( const FMADesktopFile *ndf, const gchar *group, const gchar *key, const gchar
*value )
{
- g_return_if_fail( NADP_IS_DESKTOP_FILE( ndf ));
+ g_return_if_fail( FMA_IS_DESKTOP_FILE( ndf ));
if( !ndf->private->dispose_has_run ){
@@ -1094,8 +1094,8 @@ nadp_desktop_file_set_string( const NadpDesktopFile *ndf, const gchar *group, co
}
/**
- * nadp_desktop_file_set_string_list:
- * @ndf: this #NadpDesktopFile object.
+ * fma_desktop_file_set_string_list:
+ * @ndf: this #FMADesktopFile object.
* @group: the name of the group.
* @key: the name of the key.
* @value: the value to be written.
@@ -1103,11 +1103,11 @@ nadp_desktop_file_set_string( const NadpDesktopFile *ndf, const gchar *group, co
* Write the given list value.
*/
void
-nadp_desktop_file_set_string_list( const NadpDesktopFile *ndf, const gchar *group, const gchar *key, GSList
*value )
+fma_desktop_file_set_string_list( const FMADesktopFile *ndf, const gchar *group, const gchar *key, GSList
*value )
{
gchar **array;
- g_return_if_fail( NADP_IS_DESKTOP_FILE( ndf ));
+ g_return_if_fail( FMA_IS_DESKTOP_FILE( ndf ));
if( !ndf->private->dispose_has_run ){
@@ -1118,8 +1118,8 @@ nadp_desktop_file_set_string_list( const NadpDesktopFile *ndf, const gchar *grou
}
/**
- * nadp_desktop_file_set_uint:
- * @ndf: this #NadpDesktopFile object.
+ * fma_desktop_file_set_uint:
+ * @ndf: this #FMADesktopFile object.
* @group: the name of the group.
* @key: the name of the key.
* @value: the value to be written.
@@ -1127,9 +1127,9 @@ nadp_desktop_file_set_string_list( const NadpDesktopFile *ndf, const gchar *grou
* Write the given uint value.
*/
void
-nadp_desktop_file_set_uint( const NadpDesktopFile *ndf, const gchar *group, const gchar *key, guint value )
+fma_desktop_file_set_uint( const FMADesktopFile *ndf, const gchar *group, const gchar *key, guint value )
{
- g_return_if_fail( NADP_IS_DESKTOP_FILE( ndf ));
+ g_return_if_fail( FMA_IS_DESKTOP_FILE( ndf ));
if( !ndf->private->dispose_has_run ){
@@ -1138,8 +1138,8 @@ nadp_desktop_file_set_uint( const NadpDesktopFile *ndf, const gchar *group, cons
}
/**
- * nadp_desktop_file_write:
- * @ndf: the #NadpDesktopFile instance.
+ * fma_desktop_file_write:
+ * @ndf: the #FMADesktopFile instance.
*
* Writes the key file to the disk.
*
@@ -1150,9 +1150,9 @@ nadp_desktop_file_set_uint( const NadpDesktopFile *ndf, const gchar *group, cons
* (these were wrongly written between v 2.99 and 3.0.3).
*/
gboolean
-nadp_desktop_file_write( NadpDesktopFile *ndf )
+fma_desktop_file_write( FMADesktopFile *ndf )
{
- static const gchar *thisfn = "nadp_desktop_file_write";
+ static const gchar *thisfn = "fma_desktop_file_write";
gboolean ret;
gchar *data;
GFile *file;
@@ -1162,7 +1162,7 @@ nadp_desktop_file_write( NadpDesktopFile *ndf )
ret = FALSE;
error = NULL;
- g_return_val_if_fail( NADP_IS_DESKTOP_FILE( ndf ), ret );
+ g_return_val_if_fail( FMA_IS_DESKTOP_FILE( ndf ), ret );
if( !ndf->private->dispose_has_run ){
@@ -1217,9 +1217,9 @@ nadp_desktop_file_write( NadpDesktopFile *ndf )
}
static void
-remove_encoding_part( NadpDesktopFile *ndf )
+remove_encoding_part( FMADesktopFile *ndf )
{
- static const gchar *thisfn = "nadp_desktop_file_remove_encoding_part";
+ static const gchar *thisfn = "fma_desktop_file_remove_encoding_part";
gchar **groups;
gchar **keys;
guint ig, ik;
diff --git a/src/io-desktop/fma-desktop-file.h b/src/io-desktop/fma-desktop-file.h
new file mode 100644
index 0000000..7b6e39f
--- /dev/null
+++ b/src/io-desktop/fma-desktop-file.h
@@ -0,0 +1,110 @@
+/*
+ * FileManager-Actions
+ * A file-manager extension which offers configurable context menu actions.
+ *
+ * Copyright (C) 2005 The GNOME Foundation
+ * Copyright (C) 2006-2008 Frederic Ruaudel and others (see AUTHORS)
+ * Copyright (C) 2009-2015 Pierre Wieser and others (see AUTHORS)
+ *
+ * FileManager-Actions 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.
+ *
+ * FileManager-Actions 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 FileManager-Actions; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Frederic Ruaudel <grumz grumz net>
+ * Rodrigo Moya <rodrigo gnome-db org>
+ * Pierre Wieser <pwieser trychlos org>
+ * ... and many others (see AUTHORS)
+ */
+
+#ifndef __IO_DESKTOP_FMA_DESKTOP_FILE_H__
+#define __IO_DESKTOP_FMA_DESKTOP_FILE_H__
+
+/**
+ * SECTION: fma_desktop_file
+ * @short_description: #FMADesktopFile class definition.
+ * @include: nadp-desktop-file.h
+ *
+ * This class encapŝulates the EggDesktopFile structure, adding some
+ * private properties. An instance of this class is associated with
+ * every #FMAObjectItem for this provider.
+ */
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define FMA_TYPE_DESKTOP_FILE ( fma_desktop_file_get_type())
+#define FMA_DESKTOP_FILE( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, FMA_TYPE_DESKTOP_FILE,
FMADesktopFile ))
+#define FMA_DESKTOP_FILE_CLASS( klass ) ( G_TYPE_CHECK_CLASS_CAST( klass, FMA_TYPE_DESKTOP_FILE,
FMADesktopFileClass ))
+#define FMA_IS_DESKTOP_FILE( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, FMA_TYPE_DESKTOP_FILE ))
+#define FMA_IS_DESKTOP_FILE_CLASS( klass ) ( G_TYPE_CHECK_CLASS_TYPE(( klass ), FMA_TYPE_DESKTOP_FILE ))
+#define FMA_DESKTOP_FILE_GET_CLASS( object ) ( G_TYPE_INSTANCE_GET_CLASS(( object ), FMA_TYPE_DESKTOP_FILE,
FMADesktopFileClass ))
+
+typedef struct _FMADesktopFilePrivate FMADesktopFilePrivate;
+
+typedef struct {
+ /*< private >*/
+ GObject parent;
+ FMADesktopFilePrivate *private;
+}
+ FMADesktopFile;
+
+typedef struct _FMADesktopFileClassPrivate FMADesktopFileClassPrivate;
+
+typedef struct {
+ /*< private >*/
+ GObjectClass parent;
+ FMADesktopFileClassPrivate *private;
+}
+ FMADesktopFileClass;
+
+/* standard suffix for desktop files
+ */
+#define FMA_DESKTOP_FILE_SUFFIX ".desktop"
+
+GType fma_desktop_file_get_type ( void );
+
+FMADesktopFile *fma_desktop_file_new ( void );
+FMADesktopFile *fma_desktop_file_new_from_path ( const gchar *path );
+FMADesktopFile *fma_desktop_file_new_from_uri ( const gchar *uri );
+FMADesktopFile *fma_desktop_file_new_for_write ( const gchar *path );
+
+GKeyFile *fma_desktop_file_get_key_file ( const FMADesktopFile *ndf );
+gchar *fma_desktop_file_get_key_file_uri ( const FMADesktopFile *ndf );
+gboolean fma_desktop_file_write ( FMADesktopFile *ndf );
+
+gchar *fma_desktop_file_get_file_type ( const FMADesktopFile *ndf );
+gchar *fma_desktop_file_get_id ( const FMADesktopFile *ndf );
+GSList *fma_desktop_file_get_profiles ( const FMADesktopFile *ndf );
+
+gboolean fma_desktop_file_has_profile ( const FMADesktopFile *ndf, const gchar *profile_id );
+
+void fma_desktop_file_remove_key ( const FMADesktopFile *ndf, const gchar *group, const
gchar *key );
+void fma_desktop_file_remove_profile ( const FMADesktopFile *ndf, const gchar *profile_id );
+
+gboolean fma_desktop_file_get_boolean ( const FMADesktopFile *ndf, const gchar *group, const
gchar *key, gboolean *key_found, gboolean default_value );
+gchar *fma_desktop_file_get_locale_string( const FMADesktopFile *ndf, const gchar *group, const
gchar *key, gboolean *key_found, const gchar *default_value );
+gchar *fma_desktop_file_get_string ( const FMADesktopFile *ndf, const gchar *group, const
gchar *key, gboolean *key_found, const gchar *default_value );
+GSList *fma_desktop_file_get_string_list ( const FMADesktopFile *ndf, const gchar *group, const
gchar *key, gboolean *key_found, const gchar *default_value );
+guint fma_desktop_file_get_uint ( const FMADesktopFile *ndf, const gchar *group, const
gchar *key, gboolean *key_found, guint default_value );
+
+void fma_desktop_file_set_boolean ( const FMADesktopFile *ndf, const gchar *group, const
gchar *key, gboolean value );
+void fma_desktop_file_set_locale_string( const FMADesktopFile *ndf, const gchar *group, const
gchar *key, const gchar *value );
+void fma_desktop_file_set_string ( const FMADesktopFile *ndf, const gchar *group, const
gchar *key, const gchar *value );
+void fma_desktop_file_set_string_list ( const FMADesktopFile *ndf, const gchar *group, const
gchar *key, GSList *value );
+void fma_desktop_file_set_uint ( const FMADesktopFile *ndf, const gchar *group, const
gchar *key, guint value );
+
+G_END_DECLS
+
+#endif /* __IO_DESKTOP_FMA_DESKTOP_FILE_H__ */
diff --git a/src/io-desktop/nadp-reader.c b/src/io-desktop/nadp-reader.c
index c1d4451..9e69179 100644
--- a/src/io-desktop/nadp-reader.c
+++ b/src/io-desktop/nadp-reader.c
@@ -56,7 +56,7 @@ typedef struct {
/* the structure passed as reader data to FMAIFactoryObject
*/
typedef struct {
- NadpDesktopFile *ndf;
+ FMADesktopFile *ndf;
FMAObjectAction *action;
}
NadpReaderData;
@@ -68,8 +68,8 @@ static void get_list_of_desktop_files( const NadpDesktopProvider *p
static gboolean is_already_loaded( const NadpDesktopProvider *provider, GList *files, const gchar
*desktop_id );
static GList *desktop_path_from_id( const NadpDesktopProvider *provider, GList *files, const
gchar *dir, const gchar *id );
static FMAIFactoryObject *item_from_desktop_path( const NadpDesktopProvider *provider, DesktopPath *dps,
GSList **messages );
-static FMAIFactoryObject *item_from_desktop_file( const NadpDesktopProvider *provider, NadpDesktopFile *ndf,
GSList **messages );
-static void desktop_weak_notify( NadpDesktopFile *ndf, GObject *item );
+static FMAIFactoryObject *item_from_desktop_file( const NadpDesktopProvider *provider, FMADesktopFile *ndf,
GSList **messages );
+static void desktop_weak_notify( FMADesktopFile *ndf, GObject *item );
static void free_desktop_paths( GList *paths );
static void read_start_read_subitems_key( const FMAIFactoryProvider *provider, FMAObjectItem
*item, NadpReaderData *reader_data, GSList **messages );
@@ -194,8 +194,8 @@ get_list_of_desktop_files( const NadpDesktopProvider *provider, GList **files, c
if( dir_handle ){
while(( name = g_dir_read_name( dir_handle ))){
- if( g_str_has_suffix( name, NADP_DESKTOP_FILE_SUFFIX )){
- desktop_id = fma_core_utils_str_remove_suffix( name, NADP_DESKTOP_FILE_SUFFIX
);
+ if( g_str_has_suffix( name, FMA_DESKTOP_FILE_SUFFIX )){
+ desktop_id = fma_core_utils_str_remove_suffix( name, FMA_DESKTOP_FILE_SUFFIX
);
if( !is_already_loaded( provider, *files, desktop_id )){
*files = desktop_path_from_id( provider, *files, dir, desktop_id );
}
@@ -237,7 +237,7 @@ desktop_path_from_id( const NadpDesktopProvider *provider, GList *files, const g
dps = g_new0( DesktopPath, 1 );
- bname = g_strdup_printf( "%s%s", id, NADP_DESKTOP_FILE_SUFFIX );
+ bname = g_strdup_printf( "%s%s", id, FMA_DESKTOP_FILE_SUFFIX );
dps->path = g_build_filename( dir, bname, NULL );
g_free( bname );
@@ -255,9 +255,9 @@ desktop_path_from_id( const NadpDesktopProvider *provider, GList *files, const g
static FMAIFactoryObject *
item_from_desktop_path( const NadpDesktopProvider *provider, DesktopPath *dps, GSList **messages )
{
- NadpDesktopFile *ndf;
+ FMADesktopFile *ndf;
- ndf = nadp_desktop_file_new_from_path( dps->path );
+ ndf = fma_desktop_file_new_from_path( dps->path );
if( !ndf ){
return( NULL );
}
@@ -270,7 +270,7 @@ item_from_desktop_path( const NadpDesktopProvider *provider, DesktopPath *dps, G
* from the .desktop file
*/
static FMAIFactoryObject *
-item_from_desktop_file( const NadpDesktopProvider *provider, NadpDesktopFile *ndf, GSList **messages )
+item_from_desktop_file( const NadpDesktopProvider *provider, FMADesktopFile *ndf, GSList **messages )
{
/*static const gchar *thisfn = "nadp_reader_item_from_desktop_file";*/
FMAIFactoryObject *item;
@@ -279,7 +279,7 @@ item_from_desktop_file( const NadpDesktopProvider *provider, NadpDesktopFile *nd
gchar *id;
item = NULL;
- type = nadp_desktop_file_get_file_type( ndf );
+ type = fma_desktop_file_get_file_type( ndf );
if( !strcmp( type, NADP_VALUE_TYPE_ACTION )){
item = FMA_IFACTORY_OBJECT( fma_object_action_new());
@@ -293,7 +293,7 @@ item_from_desktop_file( const NadpDesktopProvider *provider, NadpDesktopFile *nd
}
if( item ){
- id = nadp_desktop_file_get_id( ndf );
+ id = fma_desktop_file_get_id( ndf );
fma_object_set_id( item, id );
g_free( id );
@@ -314,7 +314,7 @@ item_from_desktop_file( const NadpDesktopProvider *provider, NadpDesktopFile *nd
}
static void
-desktop_weak_notify( NadpDesktopFile *ndf, GObject *item )
+desktop_weak_notify( FMADesktopFile *ndf, GObject *item )
{
static const gchar *thisfn = "nadp_reader_desktop_weak_notify";
@@ -366,7 +366,7 @@ nadp_reader_iimporter_import_from_uri( const FMAIImporter *instance, void *parms
static const gchar *thisfn = "nadp_reader_iimporter_import_from_uri";
guint code;
FMAIImporterImportFromUriParmsv2 *parms;
- NadpDesktopFile *ndf;
+ FMADesktopFile *ndf;
g_debug( "%s: instance=%p, parms=%p", thisfn, ( void * ) instance, parms_ptr );
@@ -382,7 +382,7 @@ nadp_reader_iimporter_import_from_uri( const FMAIImporter *instance, void *parms
code = IMPORTER_CODE_NOT_WILLING_TO;
- ndf = nadp_desktop_file_new_from_uri( parms->uri );
+ ndf = fma_desktop_file_new_from_uri( parms->uri );
if( ndf ){
parms->imported = ( FMAObjectItem * ) item_from_desktop_file(
( const NadpDesktopProvider * ) NADP_DESKTOP_PROVIDER( instance ),
@@ -453,7 +453,7 @@ read_start_read_subitems_key( const FMAIFactoryProvider *provider, FMAObjectItem
GSList *subitems;
gboolean key_found;
- subitems = nadp_desktop_file_get_string_list( reader_data->ndf,
+ subitems = fma_desktop_file_get_string_list( reader_data->ndf,
NADP_GROUP_DESKTOP,
FMA_IS_OBJECT_ACTION( item ) ? NADP_KEY_PROFILES : NADP_KEY_ITEMS_LIST,
&key_found,
@@ -474,7 +474,7 @@ read_start_profile_attach_profile( const FMAIFactoryProvider *provider, FMAObjec
/*
* reading any data from a desktop file requires:
- * - a NadpDesktopFile object which has been initialized with the .desktop file
+ * - a FMADesktopFile object which has been initialized with the .desktop file
* -> has been attached to the FMAObjectItem in get_item() above
* - the data type (+ reading default value)
* - group and key names
@@ -505,7 +505,7 @@ nadp_reader_ifactory_provider_read_data( const FMAIFactoryProvider *reader, void
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 );
+ g_return_val_if_fail( FMA_IS_DESKTOP_FILE( nrd->ndf ), NULL );
if( def->desktop_entry ){
@@ -522,7 +522,7 @@ nadp_reader_ifactory_provider_read_data( const FMAIFactoryProvider *reader, void
switch( def->type ){
case FMA_DATA_TYPE_LOCALE_STRING:
- str_value = nadp_desktop_file_get_locale_string( nrd->ndf, group,
def->desktop_entry, &found, def->default_value );
+ str_value = fma_desktop_file_get_locale_string( nrd->ndf, group,
def->desktop_entry, &found, def->default_value );
if( found ){
boxed = fma_data_boxed_new( def );
fma_boxed_set_from_void( FMA_BOXED( boxed ), str_value );
@@ -531,7 +531,7 @@ nadp_reader_ifactory_provider_read_data( const FMAIFactoryProvider *reader, void
break;
case FMA_DATA_TYPE_STRING:
- str_value = nadp_desktop_file_get_string( nrd->ndf, group,
def->desktop_entry, &found, def->default_value );
+ str_value = fma_desktop_file_get_string( nrd->ndf, group,
def->desktop_entry, &found, def->default_value );
if( found ){
boxed = fma_data_boxed_new( def );
fma_boxed_set_from_void( FMA_BOXED( boxed ), str_value );
@@ -540,7 +540,7 @@ nadp_reader_ifactory_provider_read_data( const FMAIFactoryProvider *reader, void
break;
case FMA_DATA_TYPE_BOOLEAN:
- bool_value = nadp_desktop_file_get_boolean( nrd->ndf, group,
def->desktop_entry, &found, fma_core_utils_boolean_from_string( def->default_value ));
+ bool_value = fma_desktop_file_get_boolean( nrd->ndf, group,
def->desktop_entry, &found, fma_core_utils_boolean_from_string( def->default_value ));
if( found ){
boxed = fma_data_boxed_new( def );
fma_boxed_set_from_void( FMA_BOXED( boxed ),
GUINT_TO_POINTER( bool_value ));
@@ -548,7 +548,7 @@ nadp_reader_ifactory_provider_read_data( const FMAIFactoryProvider *reader, void
break;
case FMA_DATA_TYPE_STRING_LIST:
- slist_value = nadp_desktop_file_get_string_list( nrd->ndf, group,
def->desktop_entry, &found, def->default_value );
+ slist_value = fma_desktop_file_get_string_list( nrd->ndf, group,
def->desktop_entry, &found, def->default_value );
if( found ){
boxed = fma_data_boxed_new( def );
fma_boxed_set_from_void( FMA_BOXED( boxed ), slist_value );
@@ -557,7 +557,7 @@ nadp_reader_ifactory_provider_read_data( const FMAIFactoryProvider *reader, void
break;
case FMA_DATA_TYPE_UINT:
- uint_value = nadp_desktop_file_get_uint( nrd->ndf, group,
def->desktop_entry, &found, atoi( def->default_value ));
+ uint_value = fma_desktop_file_get_uint( nrd->ndf, group,
def->desktop_entry, &found, atoi( def->default_value ));
if( found ){
boxed = fma_data_boxed_new( def );
fma_boxed_set_from_void( FMA_BOXED( boxed ),
GUINT_TO_POINTER( uint_value ));
@@ -615,12 +615,12 @@ nadp_reader_ifactory_provider_read_done( const FMAIFactoryProvider *reader, void
static gboolean
read_done_item_is_writable( const FMAIFactoryProvider *provider, FMAObjectItem *item, NadpReaderData
*reader_data, GSList **messages )
{
- NadpDesktopFile *ndf;
+ FMADesktopFile *ndf;
gchar *uri;
gboolean writable;
ndf = reader_data->ndf;
- uri = nadp_desktop_file_get_key_file_uri( ndf );
+ uri = fma_desktop_file_get_key_file_uri( ndf );
writable = nadp_utils_uri_is_writable( uri );
g_free( uri );
@@ -676,7 +676,7 @@ read_done_action_load_profile( const FMAIFactoryProvider *provider, NadpReaderDa
profile = fma_object_profile_new_with_defaults();
fma_object_set_id( profile, profile_id );
- if( nadp_desktop_file_has_profile( reader_data->ndf, profile_id )){
+ if( fma_desktop_file_has_profile( reader_data->ndf, profile_id )){
fma_ifactory_provider_read_item(
FMA_IFACTORY_PROVIDER( provider ),
reader_data,
diff --git a/src/io-desktop/nadp-writer.c b/src/io-desktop/nadp-writer.c
index 908a900..9f8b1c9 100644
--- a/src/io-desktop/nadp-writer.c
+++ b/src/io-desktop/nadp-writer.c
@@ -63,12 +63,12 @@ static ExportFormatFn st_export_format_fn[] = {
{ NULL }
};
-static guint write_item( const FMAIIOProvider *provider, const FMAObjectItem *item,
NadpDesktopFile *ndf, GSList **messages );
+static guint write_item( const FMAIIOProvider *provider, const FMAObjectItem *item, FMADesktopFile
*ndf, GSList **messages );
-static void desktop_weak_notify( NadpDesktopFile *ndf, GObject *item );
+static void desktop_weak_notify( FMADesktopFile *ndf, GObject *item );
-static void write_start_write_type( NadpDesktopFile *ndp, FMAObjectItem *item );
-static void write_done_write_subitems_list( NadpDesktopFile *ndp, FMAObjectItem *item );
+static void write_start_write_type( FMADesktopFile *ndp, FMAObjectItem *item );
+static void write_done_write_subitems_list( FMADesktopFile *ndp, FMAObjectItem *item );
static ExportFormatFn *find_export_format_fn( const gchar *format );
@@ -128,7 +128,7 @@ nadp_iio_provider_write_item( const FMAIIOProvider *provider, const FMAObjectIte
{
static const gchar *thisfn = "nadp_iio_provider_write_item";
guint ret;
- NadpDesktopFile *ndf;
+ FMADesktopFile *ndf;
gchar *path;
gchar *userdir;
gchar *id;
@@ -147,11 +147,11 @@ nadp_iio_provider_write_item( const FMAIIOProvider *provider, const FMAObjectIte
return( ret );
}
- ndf = ( NadpDesktopFile * ) fma_object_get_provider_data( item );
+ ndf = ( FMADesktopFile * ) fma_object_get_provider_data( item );
/* write into the current key file and write it to current path */
if( ndf ){
- g_return_val_if_fail( NADP_IS_DESKTOP_FILE( ndf ), ret );
+ g_return_val_if_fail( FMA_IS_DESKTOP_FILE( ndf ), ret );
} else {
userdir = nadp_xdg_dirs_get_user_data_dir();
@@ -172,7 +172,7 @@ nadp_iio_provider_write_item( const FMAIIOProvider *provider, const FMAObjectIte
if( dir_ok ){
id = fma_object_get_id( item );
- bname = g_strdup_printf( "%s%s", id, NADP_DESKTOP_FILE_SUFFIX );
+ bname = g_strdup_printf( "%s%s", id, FMA_DESKTOP_FILE_SUFFIX );
g_free( id );
path = g_build_filename( fulldir, bname, NULL );
g_free( bname );
@@ -180,7 +180,7 @@ nadp_iio_provider_write_item( const FMAIIOProvider *provider, const FMAObjectIte
g_free( fulldir );
if( dir_ok ){
- ndf = nadp_desktop_file_new_for_write( path );
+ ndf = fma_desktop_file_new_for_write( path );
fma_object_set_provider_data( item, ndf );
g_object_weak_ref( G_OBJECT( item ), ( GWeakNotify ) desktop_weak_notify, ndf );
g_free( path );
@@ -195,7 +195,7 @@ nadp_iio_provider_write_item( const FMAIIOProvider *provider, const FMAObjectIte
}
/*
- * actually writes the item to the existing NadpDesktopFile
+ * actually writes the item to the existing FMADesktopFile
* as we have chosen to take advantage of data factory management system
* we do not need to enumerate each and every elementary data
*
@@ -205,7 +205,7 @@ nadp_iio_provider_write_item( const FMAIIOProvider *provider, const FMAObjectIte
* -> as a side effect, we lose comments inside of these groups :(
*/
static guint
-write_item( const FMAIIOProvider *provider, const FMAObjectItem *item, NadpDesktopFile *ndf, GSList
**messages )
+write_item( const FMAIIOProvider *provider, const FMAObjectItem *item, FMADesktopFile *ndf, GSList
**messages )
{
static const gchar *thisfn = "nadp_iio_provider_write_item";
guint ret;
@@ -227,7 +227,7 @@ write_item( const FMAIIOProvider *provider, const FMAObjectItem *item, NadpDeskt
g_return_val_if_fail( FMA_IS_OBJECT_ITEM( item ), ret );
g_return_val_if_fail( FMA_IS_IFACTORY_OBJECT( item ), ret );
- g_return_val_if_fail( NADP_IS_DESKTOP_FILE( ndf ), ret );
+ g_return_val_if_fail( FMA_IS_DESKTOP_FILE( ndf ), ret );
self = NADP_DESKTOP_PROVIDER( provider );
@@ -239,7 +239,7 @@ write_item( const FMAIIOProvider *provider, const FMAObjectItem *item, NadpDeskt
fma_ifactory_provider_write_item( FMA_IFACTORY_PROVIDER( provider ), ndf, FMA_IFACTORY_OBJECT( item
), messages );
- if( !nadp_desktop_file_write( ndf )){
+ if( !fma_desktop_file_write( ndf )){
ret = IIO_PROVIDER_CODE_WRITE_ERROR;
}
@@ -252,7 +252,7 @@ nadp_iio_provider_delete_item( const FMAIIOProvider *provider, const FMAObjectIt
static const gchar *thisfn = "nadp_iio_provider_delete_item";
guint ret;
NadpDesktopProvider *self;
- NadpDesktopFile *ndf;
+ FMADesktopFile *ndf;
gchar *uri;
g_debug( "%s: provider=%p (%s), item=%p (%s), messages=%p",
@@ -273,18 +273,18 @@ nadp_iio_provider_delete_item( const FMAIIOProvider *provider, const FMAObjectIt
return( IIO_PROVIDER_CODE_NOT_WILLING_TO_RUN );
}
- ndf = ( NadpDesktopFile * ) fma_object_get_provider_data( item );
+ ndf = ( FMADesktopFile * ) fma_object_get_provider_data( item );
if( ndf ){
- g_return_val_if_fail( NADP_IS_DESKTOP_FILE( ndf ), ret );
- uri = nadp_desktop_file_get_key_file_uri( ndf );
+ g_return_val_if_fail( FMA_IS_DESKTOP_FILE( ndf ), ret );
+ uri = fma_desktop_file_get_key_file_uri( ndf );
if( nadp_utils_uri_delete( uri )){
ret = IIO_PROVIDER_CODE_OK;
}
g_free( uri );
} else {
- g_warning( "%s: NadpDesktopFile is null", thisfn );
+ g_warning( "%s: FMADesktopFile is null", thisfn );
ret = IIO_PROVIDER_CODE_OK;
}
@@ -292,7 +292,7 @@ nadp_iio_provider_delete_item( const FMAIIOProvider *provider, const FMAObjectIt
}
static void
-desktop_weak_notify( NadpDesktopFile *ndf, GObject *item )
+desktop_weak_notify( FMADesktopFile *ndf, GObject *item )
{
static const gchar *thisfn = "nadp_writer_desktop_weak_notify";
@@ -305,7 +305,7 @@ desktop_weak_notify( NadpDesktopFile *ndf, GObject *item )
/*
* Implementation of FMAIIOProvider::duplicate_data
- * Add a ref on NadpDesktopFile data, so that unreffing origin object in NACT
+ * Add a ref on FMADesktopFile data, so that unreffing origin object in NACT
* does not invalid duplicated pointer
*/
guint
@@ -314,7 +314,7 @@ nadp_iio_provider_duplicate_data( const FMAIIOProvider *provider, FMAObjectItem
static const gchar *thisfn = "nadp_iio_provider_duplicate_data";
guint ret;
NadpDesktopProvider *self;
- NadpDesktopFile *ndf;
+ FMADesktopFile *ndf;
g_debug( "%s: provider=%p (%s), dest=%p (%s), source=%p (%s), messages=%p",
thisfn,
@@ -336,8 +336,8 @@ nadp_iio_provider_duplicate_data( const FMAIIOProvider *provider, FMAObjectItem
return( IIO_PROVIDER_CODE_NOT_WILLING_TO_RUN );
}
- ndf = ( NadpDesktopFile * ) fma_object_get_provider_data( source );
- g_return_val_if_fail( ndf && NADP_IS_DESKTOP_FILE( ndf ), ret );
+ ndf = ( FMADesktopFile * ) fma_object_get_provider_data( source );
+ g_return_val_if_fail( ndf && FMA_IS_DESKTOP_FILE( ndf ), ret );
fma_object_set_provider_data( dest, g_object_ref( ndf ));
g_object_weak_ref( G_OBJECT( dest ), ( GWeakNotify ) desktop_weak_notify, ndf );
@@ -358,7 +358,7 @@ nadp_writer_iexporter_export_to_buffer( const FMAIExporter *instance, FMAIExport
guint code, write_code;
ExportFormatFn *fmt;
GKeyFile *key_file;
- NadpDesktopFile *ndf;
+ FMADesktopFile *ndf;
g_debug( "%s: instance=%p, parms=%p", thisfn, ( void * ) instance, ( void * ) parms );
@@ -385,14 +385,14 @@ nadp_writer_iexporter_export_to_buffer( const FMAIExporter *instance, FMAIExport
code = FMA_IEXPORTER_CODE_INVALID_FORMAT;
} else {
- ndf = nadp_desktop_file_new();
+ ndf = fma_desktop_file_new();
write_code = fma_ifactory_provider_write_item( FMA_IFACTORY_PROVIDER( instance ),
ndf, FMA_IFACTORY_OBJECT( parms->exported ), &parms->messages );
if( write_code != IIO_PROVIDER_CODE_OK ){
code = FMA_IEXPORTER_CODE_ERROR;
} else {
- key_file = nadp_desktop_file_get_key_file( ndf );
+ key_file = fma_desktop_file_get_key_file( ndf );
parms->buffer = g_key_file_to_data( key_file, NULL, NULL );
}
@@ -418,7 +418,7 @@ nadp_writer_iexporter_export_to_file( const FMAIExporter *instance, FMAIExporter
guint code, write_code;
gchar *id, *folder_path, *dest_path;
ExportFormatFn *fmt;
- NadpDesktopFile *ndf;
+ FMADesktopFile *ndf;
g_debug( "%s: instance=%p, parms=%p", thisfn, ( void * ) instance, ( void * ) parms );
@@ -446,20 +446,20 @@ nadp_writer_iexporter_export_to_file( const FMAIExporter *instance, FMAIExporter
} else {
id = fma_object_get_id( parms->exported );
- parms->basename = g_strdup_printf( "%s%s", id, NADP_DESKTOP_FILE_SUFFIX );
+ parms->basename = g_strdup_printf( "%s%s", id, FMA_DESKTOP_FILE_SUFFIX );
g_free( id );
folder_path = g_filename_from_uri( parms->folder, NULL, NULL );
dest_path = g_strdup_printf( "%s/%s", folder_path, parms->basename );
g_free( folder_path );
- ndf = nadp_desktop_file_new_for_write( dest_path );
+ ndf = fma_desktop_file_new_for_write( dest_path );
write_code = fma_ifactory_provider_write_item( FMA_IFACTORY_PROVIDER( instance ),
ndf, FMA_IFACTORY_OBJECT( parms->exported ), &parms->messages );
if( write_code != IIO_PROVIDER_CODE_OK ){
code = FMA_IEXPORTER_CODE_ERROR;
- } else if( !nadp_desktop_file_write( ndf )){
+ } else if( !fma_desktop_file_write( ndf )){
code = FMA_IEXPORTER_CODE_UNABLE_TO_WRITE;
}
@@ -477,16 +477,16 @@ nadp_writer_ifactory_provider_write_start( const FMAIFactoryProvider *provider,
const FMAIFactoryObject *object, GSList **messages )
{
if( FMA_IS_OBJECT_ITEM( object )){
- write_start_write_type( NADP_DESKTOP_FILE( writer_data ), FMA_OBJECT_ITEM( object ));
+ write_start_write_type( FMA_DESKTOP_FILE( writer_data ), FMA_OBJECT_ITEM( object ));
}
return( IIO_PROVIDER_CODE_OK );
}
static void
-write_start_write_type( NadpDesktopFile *ndp, FMAObjectItem *item )
+write_start_write_type( FMADesktopFile *ndp, FMAObjectItem *item )
{
- nadp_desktop_file_set_string(
+ fma_desktop_file_set_string(
ndp,
NADP_GROUP_DESKTOP,
NADP_KEY_TYPE,
@@ -503,7 +503,7 @@ nadp_writer_ifactory_provider_write_data(
const FMADataBoxed *boxed, GSList **messages )
{
static const gchar *thisfn = "nadp_writer_ifactory_provider_write_data";
- NadpDesktopFile *ndf;
+ FMADesktopFile *ndf;
guint code;
const FMADataDef *def;
gchar *profile_id;
@@ -514,11 +514,11 @@ nadp_writer_ifactory_provider_write_data(
guint uint_value;
gchar *parms, *tmp;
- g_return_val_if_fail( NADP_IS_DESKTOP_FILE( writer_data ), IIO_PROVIDER_CODE_PROGRAM_ERROR );
+ g_return_val_if_fail( FMA_IS_DESKTOP_FILE( writer_data ), IIO_PROVIDER_CODE_PROGRAM_ERROR );
/*g_debug( "%s: object=%p (%s)", thisfn, ( void * ) object, G_OBJECT_TYPE_NAME( object ));*/
code = IIO_PROVIDER_CODE_OK;
- ndf = NADP_DESKTOP_FILE( writer_data );
+ ndf = FMA_DESKTOP_FILE( writer_data );
def = fma_data_boxed_get_data_def( boxed );
if( def->desktop_entry && strlen( def->desktop_entry )){
@@ -547,30 +547,30 @@ nadp_writer_ifactory_provider_write_data(
str_value = tmp;
}
- nadp_desktop_file_set_string( ndf, group_name, def->desktop_entry,
str_value );
+ fma_desktop_file_set_string( ndf, group_name, def->desktop_entry,
str_value );
g_free( str_value );
break;
case FMA_DATA_TYPE_LOCALE_STRING:
str_value = fma_boxed_get_string( FMA_BOXED( boxed ));
- nadp_desktop_file_set_locale_string( ndf, group_name,
def->desktop_entry, str_value );
+ fma_desktop_file_set_locale_string( ndf, group_name,
def->desktop_entry, str_value );
g_free( str_value );
break;
case FMA_DATA_TYPE_BOOLEAN:
bool_value = GPOINTER_TO_UINT( fma_boxed_get_as_void( FMA_BOXED(
boxed )));
- nadp_desktop_file_set_boolean( ndf, group_name, def->desktop_entry,
bool_value );
+ fma_desktop_file_set_boolean( ndf, group_name, def->desktop_entry,
bool_value );
break;
case FMA_DATA_TYPE_STRING_LIST:
slist_value = ( GSList * ) fma_boxed_get_as_void( FMA_BOXED( boxed ));
- nadp_desktop_file_set_string_list( ndf, group_name,
def->desktop_entry, slist_value );
+ fma_desktop_file_set_string_list( ndf, group_name,
def->desktop_entry, slist_value );
fma_core_utils_slist_free( slist_value );
break;
case FMA_DATA_TYPE_UINT:
uint_value = GPOINTER_TO_UINT( fma_boxed_get_as_void( FMA_BOXED(
boxed )));
- nadp_desktop_file_set_uint( ndf, group_name, def->desktop_entry,
uint_value );
+ fma_desktop_file_set_uint( ndf, group_name, def->desktop_entry,
uint_value );
break;
default:
@@ -579,7 +579,7 @@ nadp_writer_ifactory_provider_write_data(
}
} else {
- nadp_desktop_file_remove_key( ndf, group_name, def->desktop_entry );
+ fma_desktop_file_remove_key( ndf, group_name, def->desktop_entry );
}
g_free( group_name );
@@ -593,14 +593,14 @@ nadp_writer_ifactory_provider_write_done( const FMAIFactoryProvider *provider, v
const FMAIFactoryObject *object, GSList **messages )
{
if( FMA_IS_OBJECT_ITEM( object )){
- write_done_write_subitems_list( NADP_DESKTOP_FILE( writer_data ), FMA_OBJECT_ITEM( object ));
+ write_done_write_subitems_list( FMA_DESKTOP_FILE( writer_data ), FMA_OBJECT_ITEM( object ));
}
return( IIO_PROVIDER_CODE_OK );
}
static void
-write_done_write_subitems_list( NadpDesktopFile *ndp, FMAObjectItem *item )
+write_done_write_subitems_list( FMADesktopFile *ndp, FMAObjectItem *item )
{
static const gchar *thisfn = "nadp_writer_write_done_write_subitems_list";
GSList *subitems;
@@ -612,13 +612,13 @@ write_done_write_subitems_list( NadpDesktopFile *ndp, FMAObjectItem *item )
fma_core_utils_slist_dump( tmp, subitems );
g_free( tmp );
- nadp_desktop_file_set_string_list(
+ fma_desktop_file_set_string_list(
ndp,
NADP_GROUP_DESKTOP,
FMA_IS_OBJECT_ACTION( item ) ? NADP_KEY_PROFILES : NADP_KEY_ITEMS_LIST,
subitems );
- profile_groups = nadp_desktop_file_get_profiles( ndp );
+ profile_groups = fma_desktop_file_get_profiles( ndp );
tmp = g_strdup_printf( "%s (existing profiles)", thisfn );
fma_core_utils_slist_dump( tmp, profile_groups );
g_free( tmp );
@@ -626,7 +626,7 @@ write_done_write_subitems_list( NadpDesktopFile *ndp, FMAObjectItem *item )
for( ip = profile_groups ; ip ; ip = ip->next ){
if( fma_core_utils_slist_count( subitems, ( const gchar * ) ip->data ) == 0 ){
g_debug( "%s: deleting (removed) profile %s", thisfn, ( const gchar * ) ip->data );
- nadp_desktop_file_remove_profile( ndp, ( const gchar * ) ip->data );
+ fma_desktop_file_remove_profile( ndp, ( const gchar * ) ip->data );
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]