[nautilus-actions/file-manager-actions] NAModule class is renamed to FMAModule



commit e888a7ec7c520b1d8921f77e393aee5dc05d804a
Author: Pierre Wieser <pwieser trychlos org>
Date:   Tue Sep 8 11:55:22 2015 +0200

    NAModule class is renamed to FMAModule

 src/core/Makefile.am                   |    4 +-
 src/core/{na-module.c => fma-module.c} |  154 ++++++++++++++++----------------
 src/core/{na-module.h => fma-module.h} |   62 +++++++-------
 src/core/na-pivot.c                    |   10 +-
 src/test/test-module-plugin.c          |   64 +++++++-------
 src/test/test-module.c                 |  104 +++++++++++-----------
 6 files changed, 199 insertions(+), 199 deletions(-)
---
diff --git a/src/core/Makefile.am b/src/core/Makefile.am
index 829af15..5b29fdb 100644
--- a/src/core/Makefile.am
+++ b/src/core/Makefile.am
@@ -98,8 +98,8 @@ libna_core_la_SOURCES = \
        fma-ioptions-list.h                                                                     \
        fma-iprefs.c                                                                                    \
        fma-iprefs.h                                                                                    \
-       na-module.c                                                                                     \
-       na-module.h                                                                                     \
+       fma-module.c                                                                                    \
+       fma-module.h                                                                                    \
        fma-object.c                                                                                    \
        fma-object-id.c                                                                         \
        fma-object-id-factory.c                                                         \
diff --git a/src/core/na-module.c b/src/core/fma-module.c
similarity index 74%
rename from src/core/na-module.c
rename to src/core/fma-module.c
index 9707ee2..4a72206 100644
--- a/src/core/na-module.c
+++ b/src/core/fma-module.c
@@ -35,17 +35,17 @@
 
 #include <api/fma-core-utils.h>
 
-#include "na-module.h"
+#include "fma-module.h"
 
 /* private class data
  */
-struct _NAModuleClassPrivate {
+struct _FMAModuleClassPrivate {
        void *empty;                                            /* so that gcc -pedantic is happy */
 };
 
 /* private instance data
  */
-struct _NAModulePrivate {
+struct _FMAModulePrivate {
        gboolean  dispose_has_run;
        gchar    *path;                                         /* full pathname of the plugin */
        gchar    *name;                                         /* basename without the extension */
@@ -63,23 +63,23 @@ struct _NAModulePrivate {
 static GTypeModuleClass *st_parent_class = NULL;
 
 static GType     register_type( void );
-static void      class_init( NAModuleClass *klass );
+static void      class_init( FMAModuleClass *klass );
 static void      instance_init( GTypeInstance *instance, gpointer klass );
 static void      instance_dispose( GObject *object );
 static void      instance_finalize( GObject *object );
 
-static NAModule *module_new( const gchar *filename );
+static FMAModule *module_new( const gchar *filename );
 static gboolean  on_module_load( GTypeModule *gmodule );
-static gboolean  is_a_na_plugin( NAModule *module );
-static gboolean  plugin_check( NAModule *module, const gchar *symbol, gpointer *pfn );
-static void      register_module_types( NAModule *module );
-static void      add_module_type( NAModule *module, GType type );
-static void      object_weak_notify( NAModule *module, GObject *object );
+static gboolean  is_a_na_plugin( FMAModule *module );
+static gboolean  plugin_check( FMAModule *module, const gchar *symbol, gpointer *pfn );
+static void      register_module_types( FMAModule *module );
+static void      add_module_type( FMAModule *module, GType type );
+static void      object_weak_notify( FMAModule *module, GObject *object );
 
 static void      on_module_unload( GTypeModule *gmodule );
 
 GType
-na_module_get_type( void )
+fma_module_get_type( void )
 {
        static GType object_type = 0;
 
@@ -93,32 +93,32 @@ na_module_get_type( void )
 static GType
 register_type( void )
 {
-       static const gchar *thisfn = "na_module_register_type";
+       static const gchar *thisfn = "fma_module_register_type";
        GType type;
 
        static GTypeInfo info = {
-               sizeof( NAModuleClass ),
+               sizeof( FMAModuleClass ),
                ( GBaseInitFunc ) NULL,
                ( GBaseFinalizeFunc ) NULL,
                ( GClassInitFunc ) class_init,
                NULL,
                NULL,
-               sizeof( NAModule ),
+               sizeof( FMAModule ),
                0,
                ( GInstanceInitFunc ) instance_init
        };
 
        g_debug( "%s", thisfn );
 
-       type = g_type_register_static( G_TYPE_TYPE_MODULE, "NAModule", &info, 0 );
+       type = g_type_register_static( G_TYPE_TYPE_MODULE, "FMAModule", &info, 0 );
 
        return( type );
 }
 
 static void
-class_init( NAModuleClass *klass )
+class_init( FMAModuleClass *klass )
 {
-       static const gchar *thisfn = "na_module_class_init";
+       static const gchar *thisfn = "fma_module_class_init";
        GObjectClass *object_class;
        GTypeModuleClass *module_class;
 
@@ -134,23 +134,23 @@ class_init( NAModuleClass *klass )
        module_class->load = on_module_load;
        module_class->unload = on_module_unload;
 
-       klass->private = g_new0( NAModuleClassPrivate, 1 );
+       klass->private = g_new0( FMAModuleClassPrivate, 1 );
 }
 
 static void
 instance_init( GTypeInstance *instance, gpointer klass )
 {
-       static const gchar *thisfn = "na_module_instance_init";
-       NAModule *self;
+       static const gchar *thisfn = "fma_module_instance_init";
+       FMAModule *self;
 
-       g_return_if_fail( NA_IS_MODULE( instance ));
+       g_return_if_fail( FMA_IS_MODULE( instance ));
 
        g_debug( "%s: instance=%p (%s), klass=%p",
                        thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ), ( void * ) klass );
 
-       self = NA_MODULE( instance );
+       self = FMA_MODULE( instance );
 
-       self->private = g_new0( NAModulePrivate, 1 );
+       self->private = g_new0( FMAModulePrivate, 1 );
 
        self->private->dispose_has_run = FALSE;
 }
@@ -158,12 +158,12 @@ instance_init( GTypeInstance *instance, gpointer klass )
 static void
 instance_dispose( GObject *object )
 {
-       static const gchar *thisfn = "na_module_instance_dispose";
-       NAModule *self;
+       static const gchar *thisfn = "fma_module_instance_dispose";
+       FMAModule *self;
 
-       g_return_if_fail( NA_IS_MODULE( object ));
+       g_return_if_fail( FMA_IS_MODULE( object ));
 
-       self = NA_MODULE( object );
+       self = FMA_MODULE( object );
 
        if( !self->private->dispose_has_run ){
 
@@ -180,14 +180,14 @@ instance_dispose( GObject *object )
 static void
 instance_finalize( GObject *object )
 {
-       static const gchar *thisfn = "na_module_instance_finalize";
-       NAModule *self;
+       static const gchar *thisfn = "fma_module_instance_finalize";
+       FMAModule *self;
 
-       g_return_if_fail( NA_IS_MODULE( object ));
+       g_return_if_fail( FMA_IS_MODULE( object ));
 
        g_debug( "%s: object=%p (%s)", thisfn, ( void * ) object, G_OBJECT_TYPE_NAME( object ));
 
-       self = NA_MODULE( object );
+       self = FMA_MODULE( object );
 
        g_free( self->private->path );
        g_free( self->private->name );
@@ -201,15 +201,15 @@ instance_finalize( GObject *object )
 }
 
 /*
- * na_module_dump:
- * @module: this #NAModule instance.
+ * fma_module_dump:
+ * @module: this #FMAModule instance.
  *
  * Dumps the content of the module.
  */
 void
-na_module_dump( const NAModule *module )
+fma_module_dump( const FMAModule *module )
 {
-       static const gchar *thisfn = "na_module_dump";
+       static const gchar *thisfn = "fma_module_dump";
        GList *iobj;
 
        g_debug( "%s:    path=%s", thisfn, module->private->path );
@@ -222,18 +222,18 @@ na_module_dump( const NAModule *module )
 }
 
 /*
- * na_module_load_modules:
+ * fma_module_load_modules:
  *
  * Load availables dynamically loadable extension libraries (plugins).
  *
- * Returns: a #GList of #NAModule, each object representing a dynamically
- * loaded library. The list should be na_module_release_modules() by the
+ * Returns: a #GList of #FMAModule, each object representing a dynamically
+ * loaded library. The list should be fma_module_release_modules() by the
  * caller after use.
  */
 GList *
-na_module_load_modules( void )
+fma_module_load_modules( void )
 {
-       static const gchar *thisfn = "na_module_load_modules";
+       static const gchar *thisfn = "fma_module_load_modules";
        const gchar *dirname = PKGLIBDIR;
        const gchar *suffix = ".so";
        GList *modules;
@@ -241,7 +241,7 @@ na_module_load_modules( void )
        GError *error;
        const gchar *entry;
        gchar *fname;
-       NAModule *module;
+       FMAModule *module;
 
        g_debug( "%s", thisfn );
 
@@ -276,12 +276,12 @@ na_module_load_modules( void )
 /*
  * @fname: full pathname of the being-loaded dynamic library.
  */
-static NAModule *
+static FMAModule *
 module_new( const gchar *fname )
 {
-       NAModule *module;
+       FMAModule *module;
 
-       module = g_object_new( NA_TYPE_MODULE, NULL );
+       module = g_object_new( FMA_TYPE_MODULE, NULL );
        module->private->path = g_strdup( fname );
 
        if( !g_type_module_use( G_TYPE_MODULE( module )) || !is_a_na_plugin( module )){
@@ -303,8 +303,8 @@ module_new( const gchar *fname )
 static gboolean
 on_module_load( GTypeModule *gmodule )
 {
-       static const gchar *thisfn = "na_module_on_module_load";
-       NAModule *module;
+       static const gchar *thisfn = "fma_module_on_module_load";
+       FMAModule *module;
        gboolean loaded;
 
        g_return_val_if_fail( G_IS_TYPE_MODULE( gmodule ), FALSE );
@@ -312,7 +312,7 @@ on_module_load( GTypeModule *gmodule )
        g_debug( "%s: gmodule=%p", thisfn, ( void * ) gmodule );
 
        loaded = FALSE;
-       module = NA_MODULE( gmodule );
+       module = FMA_MODULE( gmodule );
 
        module->private->library = g_module_open(
                        module->private->path, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL );
@@ -338,9 +338,9 @@ on_module_load( GTypeModule *gmodule )
  * - fma_extension_get_version is optional, and defaults to 1.
  */
 static gboolean
-is_a_na_plugin( NAModule *module )
+is_a_na_plugin( FMAModule *module )
 {
-       static const gchar *thisfn = "na_module_is_a_na_plugin";
+       static const gchar *thisfn = "fma_module_is_a_na_plugin";
        gboolean ok;
 
        ok =
@@ -357,9 +357,9 @@ is_a_na_plugin( NAModule *module )
 }
 
 static gboolean
-plugin_check( NAModule *module, const gchar *symbol, gpointer *pfn )
+plugin_check( FMAModule *module, const gchar *symbol, gpointer *pfn )
 {
-       static const gchar *thisfn = "na_module_plugin_check";
+       static const gchar *thisfn = "fma_module_plugin_check";
        gboolean ok;
 
        ok = g_module_symbol( module->private->library, symbol, pfn );
@@ -381,7 +381,7 @@ plugin_check( NAModule *module, const gchar *symbol, gpointer *pfn )
  * and keep this object in the module's list
  */
 static void
-register_module_types( NAModule *module )
+register_module_types( FMAModule *module )
 {
        const GType *types;
        guint count, i;
@@ -397,12 +397,12 @@ register_module_types( NAModule *module )
 }
 
 static void
-add_module_type( NAModule *module, GType type )
+add_module_type( FMAModule *module, GType type )
 {
        GObject *object;
 
        object = g_object_new( type, NULL );
-       g_debug( "na_module_add_module_type: allocating object=%p (%s)", ( void * ) object, 
G_OBJECT_TYPE_NAME( object ));
+       g_debug( "fma_module_add_module_type: allocating object=%p (%s)", ( void * ) object, 
G_OBJECT_TYPE_NAME( object ));
 
        g_object_weak_ref( object, ( GWeakNotify ) object_weak_notify, module );
 
@@ -410,9 +410,9 @@ add_module_type( NAModule *module, GType type )
 }
 
 static void
-object_weak_notify( NAModule *module, GObject *object )
+object_weak_notify( FMAModule *module, GObject *object )
 {
-       static const gchar *thisfn = "na_module_object_weak_notify";
+       static const gchar *thisfn = "fma_module_object_weak_notify";
 
        g_debug( "%s: module=%p, object=%p (%s)",
                        thisfn, ( void * ) module, ( void * ) object, G_OBJECT_TYPE_NAME( object ));
@@ -422,19 +422,19 @@ object_weak_notify( NAModule *module, GObject *object )
 
 /*
  * 'unload' is triggered by the last 'unuse' call
- * which is itself called in na_module::instance_dispose
+ * which is itself called in fma_module::instance_dispose
  */
 static void
 on_module_unload( GTypeModule *gmodule )
 {
-       static const gchar *thisfn = "na_module_on_module_unload";
-       NAModule *module;
+       static const gchar *thisfn = "fma_module_on_module_unload";
+       FMAModule *module;
 
        g_return_if_fail( G_IS_TYPE_MODULE( gmodule ));
 
        g_debug( "%s: gmodule=%p", thisfn, ( void * ) gmodule );
 
-       module = NA_MODULE( gmodule );
+       module = FMA_MODULE( gmodule );
 
        if( module->private->shutdown ){
                module->private->shutdown();
@@ -451,23 +451,23 @@ on_module_unload( GTypeModule *gmodule )
 }
 
 /*
- * na_module_get_extensions_for_type:
+ * fma_module_get_extensions_for_type:
  * @type: the serched GType.
  *
  * Returns: a list of loaded modules willing to deal with requested @type.
  *
- * The returned list should be na_module_free_extensions_list() by the caller.
+ * The returned list should be fma_module_free_extensions_list() by the caller.
  */
 GList *
-na_module_get_extensions_for_type( GList *modules, GType type )
+fma_module_get_extensions_for_type( GList *modules, GType type )
 {
        GList *willing_to, *im, *io;
-       NAModule *a_modul;
+       FMAModule *a_modul;
 
        willing_to = NULL;
 
        for( im = modules; im ; im = im->next ){
-               a_modul = NA_MODULE( im->data );
+               a_modul = FMA_MODULE( im->data );
                for( io = a_modul->private->objects ; io ; io = io->next ){
                        if( G_TYPE_CHECK_INSTANCE_TYPE( G_OBJECT( io->data ), type )){
                                willing_to = g_list_prepend( willing_to, g_object_ref( io->data ));
@@ -479,58 +479,58 @@ na_module_get_extensions_for_type( GList *modules, GType type )
 }
 
 /*
- * na_module_free_extensions_list:
- * @extensions: a #GList as returned by #na_module_get_extensions_for_type().
+ * fma_module_free_extensions_list:
+ * @extensions: a #GList as returned by #fma_module_get_extensions_for_type().
  *
  * Free the previously returned list.
  */
 void
-na_module_free_extensions_list( GList *extensions )
+fma_module_free_extensions_list( GList *extensions )
 {
        g_list_foreach( extensions, ( GFunc ) g_object_unref, NULL );
        g_list_free( extensions );
 }
 
 /*
- * na_module_has_id:
- * @module: this #NAModule object.
+ * fma_module_has_id:
+ * @module: this #FMAModule object.
  * @id: the searched id.
  *
  * Returns: %TRUE if one of the interfaces advertised by the module has
  * the given id, %FALSE else.
  */
 gboolean
-na_module_has_id( NAModule *module, const gchar *id )
+fma_module_has_id( FMAModule *module, const gchar *id )
 {
        gboolean id_ok;
        GList *iobj;
 
        id_ok = FALSE;
        for( iobj = module->private->objects ; iobj && !id_ok ; iobj = iobj->next ){
-               g_debug( "na_module_has_id: object=%s", G_OBJECT_TYPE_NAME( iobj->data ));
+               g_debug( "fma_module_has_id: object=%s", G_OBJECT_TYPE_NAME( iobj->data ));
        }
 
        return( id_ok );
 }
 
 /*
- * na_module_release_modules:
+ * fma_module_release_modules:
  * @modules: the list of loaded modules.
  *
  * Release resources allocated to the loaded modules on #NAPivot dispose.
  */
 void
-na_module_release_modules( GList *modules )
+fma_module_release_modules( GList *modules )
 {
-       static const gchar *thisfn = "na_modules_release_modules";
-       NAModule *module;
+       static const gchar *thisfn = "fma_modules_release_modules";
+       FMAModule *module;
        GList *imod;
        GList *iobj;
 
        g_debug( "%s: modules=%p (count=%d)", thisfn, ( void * ) modules, g_list_length( modules ));
 
        for( imod = modules ; imod ; imod = imod->next ){
-               module = NA_MODULE( imod->data );
+               module = FMA_MODULE( imod->data );
 
                for( iobj = module->private->objects ; iobj ; iobj = iobj->next ){
                        g_object_unref( iobj->data );
diff --git a/src/core/na-module.h b/src/core/fma-module.h
similarity index 56%
rename from src/core/na-module.h
rename to src/core/fma-module.h
index 6e99b91..dcd4a50 100644
--- a/src/core/na-module.h
+++ b/src/core/fma-module.h
@@ -27,22 +27,22 @@
  *   ... and many others (see AUTHORS)
  */
 
-#ifndef __CORE_NA_MODULE_H__
-#define __CORE_NA_MODULE_H__
+#ifndef __CORE_FMA_MODULE_H__
+#define __CORE_FMA_MODULE_H__
 
-/* @title: NAModule
- * @short_description: The #NAModule Class Definition
- * @include: core/na-module.h
+/* @title: FMAModule
+ * @short_description: The #FMAModule Class Definition
+ * @include: core/fma-module.h
  *
- * The NAModule class manages FileManager-Actions extensions as dynamically
+ * The FMAModule class manages FileManager-Actions extensions as dynamically
  * loadable modules (plugins).
  *
- * NAModule
+ * FMAModule
  *  +- is derived from GTypeModule
  *      +- which itself implements GTypePlugin
  *
- * Each NAModule physically corresponds to a dynamically loadable library
- * (i.e. a plugin). A NAModule implements one or more interfaces, and/or
+ * Each FMAModule physically corresponds to a dynamically loadable library
+ * (i.e. a plugin). A FMAModule implements one or more interfaces, and/or
  * provides one or more services.
  *
  * Interfaces (resp. services) are implemented (resp. provided) by GObjects
@@ -67,43 +67,43 @@
 
 G_BEGIN_DECLS
 
-#define NA_TYPE_MODULE                ( na_module_get_type())
-#define NA_MODULE( object )           ( G_TYPE_CHECK_INSTANCE_CAST( object, NA_TYPE_MODULE, NAModule ))
-#define NA_MODULE_CLASS( klass )      ( G_TYPE_CHECK_CLASS_CAST( klass, NA_TYPE_MODULE, NAModuleClass ))
-#define NA_IS_MODULE( object )        ( G_TYPE_CHECK_INSTANCE_TYPE( object, NA_TYPE_MODULE ))
-#define NA_IS_MODULE_CLASS( klass )   ( G_TYPE_CHECK_CLASS_TYPE(( klass ), NA_TYPE_MODULE ))
-#define NA_MODULE_GET_CLASS( object ) ( G_TYPE_INSTANCE_GET_CLASS(( object ), NA_TYPE_MODULE, NAModuleClass 
))
+#define FMA_TYPE_MODULE                ( fma_module_get_type())
+#define FMA_MODULE( object )           ( G_TYPE_CHECK_INSTANCE_CAST( object, FMA_TYPE_MODULE, FMAModule ))
+#define FMA_MODULE_CLASS( klass )      ( G_TYPE_CHECK_CLASS_CAST( klass, FMA_TYPE_MODULE, FMAModuleClass ))
+#define FMA_IS_MODULE( object )        ( G_TYPE_CHECK_INSTANCE_TYPE( object, FMA_TYPE_MODULE ))
+#define FMA_IS_MODULE_CLASS( klass )   ( G_TYPE_CHECK_CLASS_TYPE(( klass ), FMA_TYPE_MODULE ))
+#define FMA_MODULE_GET_CLASS( object ) ( G_TYPE_INSTANCE_GET_CLASS(( object ), FMA_TYPE_MODULE, 
FMAModuleClass ))
 
-typedef struct _NAModulePrivate       NAModulePrivate;
+typedef struct _FMAModulePrivate       FMAModulePrivate;
 
 typedef struct {
        /*< private >*/
-       GTypeModule      parent;
-       NAModulePrivate *private;
+       GTypeModule       parent;
+       FMAModulePrivate *private;
 }
-       NAModule;
+       FMAModule;
 
-typedef struct _NAModuleClassPrivate  NAModuleClassPrivate;
+typedef struct _FMAModuleClassPrivate  FMAModuleClassPrivate;
 
 typedef struct {
        /*< private >*/
-       GTypeModuleClass      parent;
-       NAModuleClassPrivate *private;
+       GTypeModuleClass       parent;
+       FMAModuleClassPrivate *private;
 }
-       NAModuleClass;
+       FMAModuleClass;
 
-GType    na_module_get_type               ( void );
+GType    fma_module_get_type               ( void );
 
-void     na_module_dump                   ( const NAModule *module );
-GList   *na_module_load_modules           ( void );
+void     fma_module_dump                   ( const FMAModule *module );
+GList   *fma_module_load_modules           ( void );
 
-GList   *na_module_get_extensions_for_type( GList *modules, GType type );
-void     na_module_free_extensions_list   ( GList *extensions );
+GList   *fma_module_get_extensions_for_type( GList *modules, GType type );
+void     fma_module_free_extensions_list   ( GList *extensions );
 
-gboolean na_module_has_id                 ( NAModule *module, const gchar *id );
+gboolean fma_module_has_id                 ( FMAModule *module, const gchar *id );
 
-void     na_module_release_modules        ( GList *modules );
+void     fma_module_release_modules        ( GList *modules );
 
 G_END_DECLS
 
-#endif /* __CORE_NA_MODULE_H__ */
+#endif /* __CORE_FMA_MODULE_H__ */
diff --git a/src/core/na-pivot.c b/src/core/na-pivot.c
index f901937..adc3418 100644
--- a/src/core/na-pivot.c
+++ b/src/core/na-pivot.c
@@ -37,7 +37,7 @@
 #include <api/fma-timeout.h>
 
 #include "fma-io-provider.h"
-#include "na-module.h"
+#include "fma-module.h"
 #include "na-pivot.h"
 
 /* private class data
@@ -241,7 +241,7 @@ instance_constructed( GObject *object )
 
                g_debug( "%s: object=%p (%s)", thisfn, ( void * ) object, G_OBJECT_TYPE_NAME( object ));
 
-               priv->modules = na_module_load_modules();
+               priv->modules = fma_module_load_modules();
 
                /* force class initialization and io-factory registration
                 */
@@ -319,7 +319,7 @@ instance_dispose( GObject *object )
                self->private->dispose_has_run = TRUE;
 
                /* release modules */
-               na_module_release_modules( self->private->modules );
+               fma_module_release_modules( self->private->modules );
                self->private->modules = NULL;
 
                /* release item tree */
@@ -446,7 +446,7 @@ na_pivot_get_providers( const NAPivot *pivot, GType type )
 
                g_debug( "%s: pivot=%p, type=%lu (%s)", thisfn, ( void * ) pivot, ( unsigned long ) type, 
g_type_name( type ));
 
-               list = na_module_get_extensions_for_type( pivot->private->modules, type );
+               list = fma_module_get_extensions_for_type( pivot->private->modules, type );
                g_debug( "%s: list=%p, count=%d", thisfn, ( void * ) list, list ? g_list_length( list ) : 0 );
        }
 
@@ -466,7 +466,7 @@ na_pivot_free_providers( GList *providers )
 
        g_debug( "%s: providers=%p", thisfn, ( void * ) providers );
 
-       na_module_free_extensions_list( providers );
+       fma_module_free_extensions_list( providers );
 }
 
 /*
diff --git a/src/test/test-module-plugin.c b/src/test/test-module-plugin.c
index ea692a0..5988f26 100755
--- a/src/test/test-module-plugin.c
+++ b/src/test/test-module-plugin.c
@@ -87,47 +87,47 @@ say_hello( GModule *module )
 /* version 2
  * define the module as a GTypeModule-derived one
  */
-#define TEST_MODULE_PLUGIN_TYPE                 ( na_module_plugin_get_type())
-#define TEST_MODULE_PLUGIN( object )            ( G_TYPE_CHECK_INSTANCE_CAST( object, 
TEST_MODULE_PLUGIN_TYPE, NAModulePlugin ))
-#define TEST_MODULE_PLUGIN_CLASS( klass )       ( G_TYPE_CHECK_CLASS_CAST( klass, TEST_MODULE_PLUGIN_TYPE, 
NAModulePluginClass ))
+#define TEST_MODULE_PLUGIN_TYPE                 ( fma_module_plugin_get_type())
+#define TEST_MODULE_PLUGIN( object )            ( G_TYPE_CHECK_INSTANCE_CAST( object, 
TEST_MODULE_PLUGIN_TYPE, FMAModulePlugin ))
+#define TEST_MODULE_PLUGIN_CLASS( klass )       ( G_TYPE_CHECK_CLASS_CAST( klass, TEST_MODULE_PLUGIN_TYPE, 
FMAModulePluginClass ))
 #define TEST_IS_MODULE_PLUGIN( object )         ( G_TYPE_CHECK_INSTANCE_TYPE( object, 
TEST_MODULE_PLUGIN_TYPE ))
 #define TEST_IS_MODULE_PLUGIN_CLASS( klass )    ( G_TYPE_CHECK_CLASS_TYPE(( klass ), TEST_MODULE_PLUGIN_TYPE 
))
-#define TEST_MODULE_PLUGIN_GET_CLASS( object )  ( G_TYPE_INSTANCE_GET_CLASS(( object ), 
TEST_MODULE_PLUGIN_TYPE, NAModulePluginClass ))
+#define TEST_MODULE_PLUGIN_GET_CLASS( object )  ( G_TYPE_INSTANCE_GET_CLASS(( object ), 
TEST_MODULE_PLUGIN_TYPE, FMAModulePluginClass ))
 
-typedef struct _NAModulePluginPrivate           NAModulePluginPrivate;
-typedef struct _NAModulePluginClassPrivate      NAModulePluginClassPrivate;
+typedef struct _FMAModulePluginPrivate           FMAModulePluginPrivate;
+typedef struct _FMAModulePluginClassPrivate      FMAModulePluginClassPrivate;
 
 typedef struct {
        GObject                parent;
-       NAModulePluginPrivate *private;
+       FMAModulePluginPrivate *private;
 }
-       NAModulePlugin;
+       FMAModulePlugin;
 
 typedef struct {
        GObjectClass                parent;
-       NAModulePluginClassPrivate *private;
+       FMAModulePluginClassPrivate *private;
 }
-       NAModulePluginClass;
+       FMAModulePluginClass;
 
-GType na_module_plugin_get_type( void );
+GType fma_module_plugin_get_type( void );
 
 /* private instance data
  */
-struct _NAModulePluginPrivate {
+struct _FMAModulePluginPrivate {
        gboolean dispose_has_run;
 };
 
 /* private class data
  */
-struct _NAModulePluginClassPrivate {
+struct _FMAModulePluginClassPrivate {
        void *empty;                                            /* so that gcc -pedantic is happy */
 };
 
 static GType             st_module_type = 0;
 static GTypeModuleClass *st_parent_class = NULL;
 
-static void           na_module_plugin_register_type( GTypeModule *module );
-static void class_init( NAModulePluginClass *klass );
+static void           fma_module_plugin_register_type( GTypeModule *module );
+static void class_init( FMAModulePluginClass *klass );
 static void instance_init( GTypeInstance *instance, gpointer klass );
 static void instance_dispose( GObject *object );
 static void instance_finalize( GObject *object );
@@ -135,24 +135,24 @@ static void instance_finalize( GObject *object );
 G_MODULE_EXPORT void plugin_init( GTypeModule *module );
 
 GType
-na_module_plugin_get_type( void )
+fma_module_plugin_get_type( void )
 {
        return( st_module_type );
 }
 
 static void
-na_module_plugin_register_type( GTypeModule *module )
+fma_module_plugin_register_type( GTypeModule *module )
 {
-       static const gchar *thisfn = "na_module_plugin_register_type";
+       static const gchar *thisfn = "fma_module_plugin_register_type";
 
        static GTypeInfo info = {
-               sizeof( NAModulePluginClass ),
+               sizeof( FMAModulePluginClass ),
                NULL,
                NULL,
                ( GClassInitFunc ) class_init,
                NULL,
                NULL,
-               sizeof( NAModulePlugin ),
+               sizeof( FMAModulePlugin ),
                0,
                ( GInstanceInitFunc ) instance_init
        };
@@ -165,15 +165,15 @@ na_module_plugin_register_type( GTypeModule *module )
 
        g_debug( "%s", thisfn );
 
-       st_module_type = g_type_module_register_type( module, G_TYPE_OBJECT, "NAModulePlugin", &info, 0 );
+       st_module_type = g_type_module_register_type( module, G_TYPE_OBJECT, "FMAModulePlugin", &info, 0 );
 
        /*g_type_module_add_interface( module, st_module_type, FMA_TYPE_IIO_PROVIDER, 
&iio_provider_iface_info );*/
 }
 
 static void
-class_init( NAModulePluginClass *klass )
+class_init( FMAModulePluginClass *klass )
 {
-       static const gchar *thisfn = "na_module_plugin_class_init";
+       static const gchar *thisfn = "fma_module_plugin_class_init";
        GObjectClass *object_class;
 
        g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
@@ -184,14 +184,14 @@ class_init( NAModulePluginClass *klass )
        object_class->dispose = instance_dispose;
        object_class->finalize = instance_finalize;
 
-       klass->private = g_new0( NAModulePluginClassPrivate, 1 );
+       klass->private = g_new0( FMAModulePluginClassPrivate, 1 );
 }
 
 static void
 instance_init( GTypeInstance *instance, gpointer klass )
 {
-       static const gchar *thisfn = "na_module_plugin_instance_init";
-       NAModulePlugin *self;
+       static const gchar *thisfn = "fma_module_plugin_instance_init";
+       FMAModulePlugin *self;
 
        g_return_if_fail( TEST_IS_MODULE_PLUGIN( instance ));
 
@@ -200,7 +200,7 @@ instance_init( GTypeInstance *instance, gpointer klass )
 
        self = TEST_MODULE_PLUGIN( instance );
 
-       self->private = g_new0( NAModulePluginPrivate, 1 );
+       self->private = g_new0( FMAModulePluginPrivate, 1 );
 
        self->private->dispose_has_run = FALSE;
 }
@@ -208,8 +208,8 @@ instance_init( GTypeInstance *instance, gpointer klass )
 static void
 instance_dispose( GObject *object )
 {
-       static const gchar *thisfn = "na_module_plugin_instance_dispose";
-       NAModulePlugin *self;
+       static const gchar *thisfn = "fma_module_plugin_instance_dispose";
+       FMAModulePlugin *self;
 
        g_return_if_fail( TEST_IS_MODULE_PLUGIN( object ));
 
@@ -232,7 +232,7 @@ static void
 instance_finalize( GObject *object )
 {
        static const gchar *thisfn = "na_test_module_plugin_instance_finalize";
-       NAModulePlugin *self;
+       FMAModulePlugin *self;
 
        g_return_if_fail( TEST_IS_MODULE_PLUGIN( object ));
 
@@ -267,7 +267,7 @@ g_module_unload( GModule *module )
        g_debug( "in g_module_unload: module=%p", ( void * ) module );
 }
 
-/* module is actually a NAModule, but we do not care of that
+/* module is actually a FMAModule, but we do not care of that
  * registering the type - but do not yet allocate an object
  */
 G_MODULE_EXPORT void
@@ -275,5 +275,5 @@ plugin_init( GTypeModule *module )
 {
        g_debug( "plugin_init: module=%p", ( void * ) module );
 
-       na_module_plugin_register_type( module );
+       fma_module_plugin_register_type( module );
 }
diff --git a/src/test/test-module.c b/src/test/test-module.c
index da85a2d..1169b1a 100755
--- a/src/test/test-module.c
+++ b/src/test/test-module.c
@@ -125,13 +125,13 @@ unload_plugin( GModule *module )
 /* version 2
  * Having the plugin register dynamic GTypes require a GTypeModule
  * This GTtypeModule is provided by the program as a GTypeModule-derived object
- * NAModule embeds the GModule
+ * FMAModule embeds the GModule
  *
  * Result:
  *
  * - the main program (the loader) should define a GTypeModule derived class
  *
- * - the GTypeModule derived class (here NAModule) embeds a GModule pointer
+ * - the GTypeModule derived class (here FMAModule) embeds a GModule pointer
  *
  * - when loading plugins:
  *
@@ -166,41 +166,41 @@ unload_plugin( GModule *module )
  * in the same process).
  */
 
-#define NA_TYPE_MODULE                  ( na_module_get_type())
-#define NA_MODULE( object )             ( G_TYPE_CHECK_INSTANCE_CAST( object, NA_TYPE_MODULE, NAModule ))
-#define NA_MODULE_CLASS( klass )        ( G_TYPE_CHECK_CLASS_CAST( klass, NA_TYPE_MODULE, NAModuleClass ))
-#define NA_IS_MODULE( object )          ( G_TYPE_CHECK_INSTANCE_TYPE( object, NA_TYPE_MODULE ))
-#define NA_IS_MODULE_CLASS( klass )     ( G_TYPE_CHECK_CLASS_TYPE(( klass ), NA_TYPE_MODULE ))
-#define NA_MODULE_GET_CLASS( object )   ( G_TYPE_INSTANCE_GET_CLASS(( object ), NA_TYPE_MODULE, 
NAModuleClass ))
+#define FMA_TYPE_MODULE                  ( fma_module_get_type())
+#define FMA_MODULE( object )             ( G_TYPE_CHECK_INSTANCE_CAST( object, FMA_TYPE_MODULE, FMAModule ))
+#define FMA_MODULE_CLASS( klass )        ( G_TYPE_CHECK_CLASS_CAST( klass, FMA_TYPE_MODULE, FMAModuleClass ))
+#define FMA_IS_MODULE( object )          ( G_TYPE_CHECK_INSTANCE_TYPE( object, FMA_TYPE_MODULE ))
+#define FMA_IS_MODULE_CLASS( klass )     ( G_TYPE_CHECK_CLASS_TYPE(( klass ), FMA_TYPE_MODULE ))
+#define FMA_MODULE_GET_CLASS( object )   ( G_TYPE_INSTANCE_GET_CLASS(( object ), FMA_TYPE_MODULE, 
FMAModuleClass ))
 
-typedef struct _NAModulePrivate         NAModulePrivate;
-typedef struct _NAModuleClassPrivate    NAModuleClassPrivate;
+typedef struct _FMAModulePrivate         FMAModulePrivate;
+typedef struct _FMAModuleClassPrivate    FMAModuleClassPrivate;
 
 typedef struct {
        /*< private >*/
        GTypeModule      parent;
-       NAModulePrivate *private;
+       FMAModulePrivate *private;
 }
-       NAModule;
+       FMAModule;
 
 typedef struct {
        /*< private >*/
        GTypeModuleClass      parent;
-       NAModuleClassPrivate *private;
+       FMAModuleClassPrivate *private;
 }
-       NAModuleClass;
+       FMAModuleClass;
 
-GType    na_module_get_type               ( void );
+GType    fma_module_get_type               ( void );
 
 /* private class data
  */
-struct _NAModuleClassPrivate {
+struct _FMAModuleClassPrivate {
        void *empty;                                            /* so that gcc -pedantic is happy */
 };
 
 /* private instance data
  */
-struct _NAModulePrivate {
+struct _FMAModulePrivate {
        gboolean  dispose_has_run;
        GModule  *plugin;
 };
@@ -208,18 +208,18 @@ struct _NAModulePrivate {
 static GTypeModuleClass *st_parent_class = NULL;
 
 static GType     register_type( void );
-static void      class_init( NAModuleClass *klass );
+static void      class_init( FMAModuleClass *klass );
 static void      instance_init( GTypeInstance *instance, gpointer klass );
 static void      instance_dispose( GObject *object );
 static void      instance_finalize( GObject *object );
 
-static NAModule *load_plugin( void );
+static FMAModule *load_plugin( void );
 static gboolean  on_module_load( GTypeModule *module );
-static void      call_plugin_fn( NAModule *module );
+static void      call_plugin_fn( FMAModule *module );
 static void      on_unload_plugin( GTypeModule *module );
 
 GType
-na_module_get_type( void )
+fma_module_get_type( void )
 {
        static GType object_type = 0;
 
@@ -233,32 +233,32 @@ na_module_get_type( void )
 static GType
 register_type( void )
 {
-       static const gchar *thisfn = "na_module_register_type";
+       static const gchar *thisfn = "fma_module_register_type";
        GType type;
 
        static GTypeInfo info = {
-               sizeof( NAModuleClass ),
+               sizeof( FMAModuleClass ),
                ( GBaseInitFunc ) NULL,
                ( GBaseFinalizeFunc ) NULL,
                ( GClassInitFunc ) class_init,
                NULL,
                NULL,
-               sizeof( NAModule ),
+               sizeof( FMAModule ),
                0,
                ( GInstanceInitFunc ) instance_init
        };
 
        g_debug( "%s", thisfn );
 
-       type = g_type_register_static( G_TYPE_TYPE_MODULE, "NAModule", &info, 0 );
+       type = g_type_register_static( G_TYPE_TYPE_MODULE, "FMAModule", &info, 0 );
 
        return( type );
 }
 
 static void
-class_init( NAModuleClass *klass )
+class_init( FMAModuleClass *klass )
 {
-       static const gchar *thisfn = "na_module_class_init";
+       static const gchar *thisfn = "fma_module_class_init";
        GObjectClass *object_class;
        GTypeModuleClass *module_class;
 
@@ -274,23 +274,23 @@ class_init( NAModuleClass *klass )
        module_class->load = on_module_load;
        module_class->unload = on_unload_plugin;
 
-       klass->private = g_new0( NAModuleClassPrivate, 1 );
+       klass->private = g_new0( FMAModuleClassPrivate, 1 );
 }
 
 static void
 instance_init( GTypeInstance *instance, gpointer klass )
 {
-       static const gchar *thisfn = "na_module_instance_init";
-       NAModule *self;
+       static const gchar *thisfn = "fma_module_instance_init";
+       FMAModule *self;
 
-       g_return_if_fail( NA_IS_MODULE( instance ));
+       g_return_if_fail( FMA_IS_MODULE( instance ));
 
        g_debug( "%s: instance=%p (%s), klass=%p",
                        thisfn, ( void * ) instance, G_OBJECT_TYPE_NAME( instance ), ( void * ) klass );
 
-       self = NA_MODULE( instance );
+       self = FMA_MODULE( instance );
 
-       self->private = g_new0( NAModulePrivate, 1 );
+       self->private = g_new0( FMAModulePrivate, 1 );
 
        self->private->dispose_has_run = FALSE;
 }
@@ -298,12 +298,12 @@ instance_init( GTypeInstance *instance, gpointer klass )
 static void
 instance_dispose( GObject *object )
 {
-       static const gchar *thisfn = "na_module_instance_dispose";
-       NAModule *self;
+       static const gchar *thisfn = "fma_module_instance_dispose";
+       FMAModule *self;
 
-       g_return_if_fail( NA_IS_MODULE( object ));
+       g_return_if_fail( FMA_IS_MODULE( object ));
 
-       self = NA_MODULE( object );
+       self = FMA_MODULE( object );
 
        if( !self->private->dispose_has_run ){
 
@@ -326,14 +326,14 @@ instance_dispose( GObject *object )
 static void
 instance_finalize( GObject *object )
 {
-       static const gchar *thisfn = "na_module_instance_finalize";
-       NAModule *self;
+       static const gchar *thisfn = "fma_module_instance_finalize";
+       FMAModule *self;
 
-       g_return_if_fail( NA_IS_MODULE( object ));
+       g_return_if_fail( FMA_IS_MODULE( object ));
 
        g_debug( "%s: object=%p (%s)", thisfn, ( void * ) object, G_OBJECT_TYPE_NAME( object ));
 
-       self = NA_MODULE( object );
+       self = FMA_MODULE( object );
 
        g_free( self->private );
 
@@ -346,7 +346,7 @@ instance_finalize( GObject *object )
 int
 main( int argc, char **argv )
 {
-       NAModule *module;
+       FMAModule *module;
 
 #if !GLIB_CHECK_VERSION( 2,36, 0 )
        g_type_init();
@@ -359,7 +359,7 @@ main( int argc, char **argv )
                /* call a function in the module */
                call_plugin_fn( module );
 
-               /* try to just unref the NAModule */
+               /* try to just unref the FMAModule */
                /* not ok */
                /*g_object_unref( module );*/
 
@@ -378,16 +378,16 @@ main( int argc, char **argv )
        return( 0 );
 }
 
-static NAModule *
+static FMAModule *
 load_plugin( void )
 {
-       NAModule *module;
+       FMAModule *module;
 
        module = NULL;
 
        if( g_module_supported()){
 
-               module = g_object_new( NA_TYPE_MODULE, NULL );
+               module = g_object_new( FMA_TYPE_MODULE, NULL );
                g_debug( "test_module_load_plugin: module=%p", ( void * ) module );
 
                if( !g_type_module_use( G_TYPE_MODULE( module ))){
@@ -403,7 +403,7 @@ on_module_load( GTypeModule *module )
 {
        gboolean ok;
        gchar *module_path;
-       NAModule *na_module = NA_MODULE( module );
+       FMAModule *fma_module = FMA_MODULE( module );
 
        g_debug( "test_module_on_module_load" );
 
@@ -411,9 +411,9 @@ on_module_load( GTypeModule *module )
        module_path = g_module_build_path( PKGLIBDIR, PLUGIN_NAME );
 
        g_debug( "test_module_on_module_load: opening the library" );
-       na_module->private->plugin = g_module_open( module_path, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL );
+       fma_module->private->plugin = g_module_open( module_path, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL );
 
-       if( !na_module->private->plugin ){
+       if( !fma_module->private->plugin ){
                g_printerr( "%s: %s\n", module_path, g_module_error());
                ok = FALSE;
        }
@@ -424,9 +424,9 @@ on_module_load( GTypeModule *module )
 }
 
 static void
-call_plugin_fn( NAModule *module )
+call_plugin_fn( FMAModule *module )
 {
-       typedef void ( *PluginInit )( NAModule *module );
+       typedef void ( *PluginInit )( FMAModule *module );
        PluginInit plugin_fn;
 
        if( !g_module_symbol( module->private->plugin, "plugin_init", ( gpointer * ) &plugin_fn )){
@@ -444,7 +444,7 @@ static void
 on_unload_plugin( GTypeModule *module )
 {
        g_debug( "test_module_on_unload_plugin" );
-       if( !g_module_close( NA_MODULE( module )->private->plugin )){
+       if( !g_module_close( FMA_MODULE( module )->private->plugin )){
                g_printerr( "%s\n", g_module_error());
        }
 }


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