[nautilus-actions] Rename NAIImporterParms structure as NAIImporterUriParms
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Rename NAIImporterParms structure as NAIImporterUriParms
- Date: Mon, 1 Mar 2010 19:20:22 +0000 (UTC)
commit 91825eca57bd6daa9807a0f49b3fb97c9d8ee697
Author: pierre <pierre vfedora10 virtuals pwi>
Date: Mon Mar 1 15:26:15 2010 +0100
Rename NAIImporterParms structure as NAIImporterUriParms
ChangeLog | 14 +++++++++++
src/api/na-iimporter.h | 31 ++++++++++++------------
src/core/na-iimporter.c | 4 +-
src/core/na-importer-ask.c | 12 ++++----
src/core/na-importer-ask.h | 2 +-
src/core/na-importer.c | 4 +-
src/core/na-importer.h | 2 +-
src/io-xml/naxml-reader.c | 48 +++++++++++++++++++-------------------
src/io-xml/naxml-reader.h | 2 +-
src/nact/nact-assistant-import.c | 6 ++--
src/nact/nact-tree-model-dnd.c | 14 +++++-----
src/test/test-reader.c | 10 ++++----
12 files changed, 82 insertions(+), 67 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8bc7c6e..4f4dc06 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2009-03-01 Pierre Wieser <pwieser trychlos org>
+ * src/api/na-iimporter.h:
+ * src/core/na-iimporter.c:
+ * src/core/na-importer-ask.c:
+ * src/core/na-importer-ask.h:
+ * src/core/na-importer.c:
+ * src/core/na-importer.h:
+ * src/io-xml/naxml-reader.c:
+ * src/io-xml/naxml-reader.h:
+ * src/nact/nact-assistant-import.c:
+ * src/nact/nact-tree-model-dnd.c:
+ * src/test/test-reader.c:
+ NAIImporterParms structure is renamed as NAIImporterUriParms.
+ 'item' member of this same structure is renamed as imported.
+
* src/io-gconf/nagp-reader.c:
* src/io-gconf/nagp-writer.c:
* src/io-gconf/nagp-writer.h: Cleanup the code.
diff --git a/src/api/na-iimporter.h b/src/api/na-iimporter.h
index 5299d23..ed85dba 100644
--- a/src/api/na-iimporter.h
+++ b/src/api/na-iimporter.h
@@ -53,7 +53,7 @@ G_BEGIN_DECLS
#define NA_IIMPORTER_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NA_IIMPORTER_TYPE, NAIImporterInterface ))
typedef struct NAIImporter NAIImporter;
-typedef struct NAIImporterParms NAIImporterParms;
+typedef struct NAIImporterUriParms NAIImporterUriParms;
typedef struct NAIImporterInterfacePrivate NAIImporterInterfacePrivate;
@@ -74,20 +74,13 @@ typedef struct {
/**
* import_from_uri:
* @instance: the #NAIImporter provider.
- * @uri: the URI of the file to be imported.
- * @mode: import mode.
- * @fn: a pointer to the function to be used to check for existancy of
- * imported id.
- * @fn_data: data to be passed to @fn.
- * @messages: a pointer to a #GSList list of strings; the provider
- * may append messages to this list, but shouldn't reinitialize it.
+ * @parms: a #NAIImporterUriParms structure.
*
* Imports an item.
*
- * Returns: a #NAObjectItem-derived object, or %NULL if an error has
- * been detected.
+ * Returns: the return code of the operation.
*/
- guint ( *import_from_uri )( const NAIImporter *instance, NAIImporterParms *parms );
+ guint ( *import_from_uri )( const NAIImporter *instance, NAIImporterUriParms *parms );
}
NAIImporterInterface;
@@ -112,16 +105,24 @@ enum {
IMPORTER_CODE_CANCELLED
};
-/* parameters via a structure
+/* the function which should be provider by the caller in order the
+ * #NAIImporter provider be able to check for pre-existance of the
+ * imported item
+ *
+ * the function should return the already existing item which has the
+ * same id than the currently being imported one, or %NULL if the
+ * imported id will be unique
*/
typedef NAObjectItem * ( *NAIImporterCheckFn )( const NAObjectItem *, void *fn_data );
-struct NAIImporterParms {
+/* parameters via a structure
+ */
+struct NAIImporterUriParms {
guint version; /* i 1: version of this structure */
gchar *uri; /* i 1: uri of the file to be imported */
guint mode; /* i 1: import mode */
GtkWindow *window; /* i 1: a window which will act as a parent of the ask dialog */
- NAObjectItem *item; /* o1: imported NAObjectItem-derived object */
+ NAObjectItem *imported; /* o1: eventually imported NAObjectItem-derived object */
NAIImporterCheckFn check_fn; /* i 1: a function to check the existance of the imported item */
void *check_fn_data; /* i 1: data function */
GSList *messages; /* io1: a #GSList list of localized strings;
@@ -131,7 +132,7 @@ struct NAIImporterParms {
GType na_iimporter_get_type( void );
-guint na_iimporter_ask_user( const NAIImporter *importer, const NAIImporterParms *parms, const NAObjectItem *existing );
+guint na_iimporter_ask_user( const NAIImporter *importer, const NAIImporterUriParms *parms, const NAObjectItem *existing );
G_END_DECLS
diff --git a/src/core/na-iimporter.c b/src/core/na-iimporter.c
index 196f1d7..9ba65a0 100644
--- a/src/core/na-iimporter.c
+++ b/src/core/na-iimporter.c
@@ -141,7 +141,7 @@ iimporter_get_version( const NAIImporter *instance )
/**
* na_iimporter_ask_user:
* @importer: this #NAIImporter instance.
- * @parms: a #NAIImporterParms structure.
+ * @parms: a #NAIImporterUriParms structure.
* @existing: the #NAObjectItem-derived already existing object.
*
* Ask the user for what to do when an imported item has the same ID
@@ -150,7 +150,7 @@ iimporter_get_version( const NAIImporter *instance )
* Returns: the definitive import mode.
*/
guint
-na_iimporter_ask_user( const NAIImporter *importer, const NAIImporterParms *parms, const NAObjectItem *existing )
+na_iimporter_ask_user( const NAIImporter *importer, const NAIImporterUriParms *parms, const NAObjectItem *existing )
{
guint mode;
diff --git a/src/core/na-importer-ask.c b/src/core/na-importer-ask.c
index b474a73..4c695e9 100644
--- a/src/core/na-importer-ask.c
+++ b/src/core/na-importer-ask.c
@@ -54,7 +54,7 @@ struct NAImporterAskPrivate {
gboolean dispose_has_run;
GtkBuilder *builder;
GtkWindow *toplevel;
- NAIImporterParms *parms;
+ NAIImporterUriParms *parms;
NAObjectItem *existing;
guint mode;
GConfClient *gconf;
@@ -218,7 +218,7 @@ import_ask_new()
/**
* na_importer_ask_user:
* @importer: this #NAIImporter instance.
- * @parms: a #NAIImporterParms structure.
+ * @parms: a #NAIImporterUriParms structure.
* @existing: the #NAObjectItem-derived already existing object.
*
* Ask the user for what to do when an imported item has the same ID
@@ -230,7 +230,7 @@ import_ask_new()
* becomes his preference import mode.
*/
guint
-na_importer_ask_user( const NAIImporterParms *parms, const NAObjectItem *existing )
+na_importer_ask_user( const NAIImporterUriParms *parms, const NAObjectItem *existing )
{
static const gchar *thisfn = "na_importer_ask_user";
NAImporterAsk *dialog;
@@ -246,7 +246,7 @@ na_importer_ask_user( const NAIImporterParms *parms, const NAObjectItem *existin
if( dialog->private->toplevel ){
- dialog->private->parms = ( NAIImporterParms * ) parms;
+ dialog->private->parms = ( NAIImporterUriParms * ) parms;
dialog->private->existing = ( NAObjectItem * ) existing;
dialog->private->mode = na_iprefs_get_import_mode( dialog->private->gconf, IPREFS_IMPORT_ASK_LAST_MODE );
@@ -283,10 +283,10 @@ init_dialog( NAImporterAsk *editor )
g_debug( "%s: editor=%p", thisfn, ( void * ) editor );
- imported_label = na_object_get_label( editor->private->parms->item );
+ imported_label = na_object_get_label( editor->private->parms->imported );
existing_label = na_object_get_label( editor->private->existing );
- if( NA_IS_OBJECT_ACTION( editor->private->parms->item )){
+ if( NA_IS_OBJECT_ACTION( editor->private->parms->imported )){
/* i18n: The action <action_label> imported from <file> has the same id than <existing_label> */
label = g_strdup_printf(
_( "The action \"%s\" imported from \"%s\" has the same identifiant than the already existing \"%s\"." ),
diff --git a/src/core/na-importer-ask.h b/src/core/na-importer-ask.h
index c57e41d..fc0fb5e 100644
--- a/src/core/na-importer-ask.h
+++ b/src/core/na-importer-ask.h
@@ -70,7 +70,7 @@ typedef struct {
GType na_importer_ask_get_type( void );
-guint na_importer_ask_user( const NAIImporterParms *parms, const NAObjectItem *existing );
+guint na_importer_ask_user( const NAIImporterUriParms *parms, const NAObjectItem *existing );
G_END_DECLS
diff --git a/src/core/na-importer.c b/src/core/na-importer.c
index 37606c9..cba0613 100644
--- a/src/core/na-importer.c
+++ b/src/core/na-importer.c
@@ -40,12 +40,12 @@ extern gboolean iimporter_finalized; /* defined in na-iimporter.c */
/**
* na_importer_import:
* @pivot: the #NAPivot pivot for this application.
- * @parms: a #NAIImporterParms structure.
+ * @parms: a #NAIImporterUriParms structure.
*
* Returns: the import operation code.
*/
guint
-na_importer_import_from_uri( const NAPivot *pivot, NAIImporterParms *parms )
+na_importer_import_from_uri( const NAPivot *pivot, NAIImporterUriParms *parms )
{
static const gchar *thisfn = "na_importer_import_from_uri";
GList *modules, *im;
diff --git a/src/core/na-importer.h b/src/core/na-importer.h
index f12ab2e..6d696f8 100644
--- a/src/core/na-importer.h
+++ b/src/core/na-importer.h
@@ -44,7 +44,7 @@
G_BEGIN_DECLS
-guint na_importer_import_from_uri( const NAPivot *pivot, NAIImporterParms *parms );
+guint na_importer_import_from_uri( const NAPivot *pivot, NAIImporterUriParms *parms );
G_END_DECLS
diff --git a/src/io-xml/naxml-reader.c b/src/io-xml/naxml-reader.c
index f136b40..95874e0 100644
--- a/src/io-xml/naxml-reader.c
+++ b/src/io-xml/naxml-reader.c
@@ -79,7 +79,7 @@ struct NAXMLReaderPrivate {
/* data provided by the caller
*/
NAIImporter *importer;
- NAIImporterParms *parms;
+ NAIImporterUriParms *parms;
/* data dynamically set during the import operation
*/
@@ -308,14 +308,14 @@ reader_new( void )
/**
* naxml_reader_import_uri:
* @instance: the #NAIImporter provider.
- * @parms: a #NAIImporterParms structure.
+ * @parms: a #NAIImporterUriParms structure.
*
* Imports an item.
*
* Returns: the import operation code.
*/
guint
-naxml_reader_import_from_uri( const NAIImporter *instance, NAIImporterParms *parms )
+naxml_reader_import_from_uri( const NAIImporter *instance, NAIImporterUriParms *parms )
{
static const gchar *thisfn = "naxml_reader_import_from_uri";
NAXMLReader *reader;
@@ -329,19 +329,19 @@ naxml_reader_import_from_uri( const NAIImporter *instance, NAIImporterParms *par
reader->private->importer = ( NAIImporter * ) instance;
reader->private->parms = parms;
- parms->item = NULL;
+ parms->imported = NULL;
code = reader_parse_xmldoc( reader );
if( code == IMPORTER_CODE_OK ){
- g_assert( NA_IS_OBJECT_ITEM( reader->private->parms->item ));
+ g_assert( NA_IS_OBJECT_ITEM( reader->private->parms->imported ));
code = manage_import_mode( reader );
}
if( code != IMPORTER_CODE_OK ){
- if( reader->private->parms->item ){
- g_object_unref( reader->private->parms->item );
- reader->private->parms->item = NULL;
+ if( reader->private->parms->imported ){
+ g_object_unref( reader->private->parms->imported );
+ reader->private->parms->imported = NULL;
}
}
@@ -554,7 +554,7 @@ iter_on_list_children( NAXMLReader *reader, xmlNode *list )
if( code == IMPORTER_CODE_OK ){
if( !reader->private->type_found ){
- reader->private->parms->item = NA_OBJECT_ITEM( na_object_action_new());
+ reader->private->parms->imported = NA_OBJECT_ITEM( na_object_action_new());
}
}
@@ -562,12 +562,12 @@ iter_on_list_children( NAXMLReader *reader, xmlNode *list )
*/
if( code == IMPORTER_CODE_OK ){
- na_object_set_id( reader->private->parms->item, reader->private->item_id );
+ na_object_set_id( reader->private->parms->imported, reader->private->item_id );
na_ifactory_provider_read_item(
NA_IFACTORY_PROVIDER( reader->private->importer ),
reader,
- NA_IFACTORY_OBJECT( reader->private->parms->item ),
+ NA_IFACTORY_OBJECT( reader->private->parms->imported ),
&reader->private->parms->messages );
}
@@ -760,11 +760,11 @@ read_done_object_action( NAXMLReader *reader, NAObjectAction *action )
GSList *order, *ip;
gchar *profile_id;
- if( !na_object_get_items_count( reader->private->parms->item )){
+ if( !na_object_get_items_count( reader->private->parms->imported )){
/* first attach potential ordered profiles
*/
- order = na_object_get_items_slist( reader->private->parms->item );
+ order = na_object_get_items_slist( reader->private->parms->imported );
for( ip = order ; ip ; ip = ip->next ){
read_done_load_profile( reader, ( const gchar * ) ip->data );
}
@@ -788,7 +788,7 @@ read_done_object_action( NAXMLReader *reader, NAObjectAction *action )
static void
read_done_object_profile( NAXMLReader *reader, NAObjectProfile *profile )
{
- na_object_attach_profile( reader->private->parms->item, profile );
+ na_object_attach_profile( reader->private->parms->imported, profile );
}
/*
@@ -818,7 +818,7 @@ read_done_get_next_profile_id( NAXMLReader *reader )
profile_id = g_path_get_basename( name );
g_free( name );
- if( na_object_get_item( reader->private->parms->item, profile_id )){
+ if( na_object_get_item( reader->private->parms->imported, profile_id )){
g_free( profile_id );
profile_id = NULL;
}
@@ -970,10 +970,10 @@ schema_check_for_type( NAXMLReader *reader, xmlNode *iter )
gchar *type = get_value_from_child_node( iter->parent, NAXML_KEY_SCHEMA_NODE_DEFAULT );
if( !strcmp( type, NAGP_VALUE_TYPE_ACTION )){
- reader->private->parms->item = NA_OBJECT_ITEM( na_object_action_new());
+ reader->private->parms->imported = NA_OBJECT_ITEM( na_object_action_new());
} else if( !strcmp( type, NAGP_VALUE_TYPE_MENU )){
- reader->private->parms->item = NA_OBJECT_ITEM( na_object_menu_new());
+ reader->private->parms->imported = NA_OBJECT_ITEM( na_object_menu_new());
} else {
add_message( reader, ERR_NODE_UNKNOWN_TYPE, type, iter->line );
@@ -1094,10 +1094,10 @@ dump_check_for_type( NAXMLReader *reader, xmlNode *key_node )
gchar *type = get_value_from_child_child_node( key_node->parent, NAXML_KEY_DUMP_NODE_VALUE, NAXML_KEY_DUMP_NODE_VALUE_TYPE_STRING );
if( !strcmp( type, NAGP_VALUE_TYPE_ACTION )){
- reader->private->parms->item = NA_OBJECT_ITEM( na_object_action_new());
+ reader->private->parms->imported = NA_OBJECT_ITEM( na_object_action_new());
} else if( !strcmp( type, NAGP_VALUE_TYPE_MENU )){
- reader->private->parms->item = NA_OBJECT_ITEM( na_object_menu_new());
+ reader->private->parms->imported = NA_OBJECT_ITEM( na_object_menu_new());
} else {
add_message( reader, ERR_NODE_UNKNOWN_TYPE, type, key_node->line );
@@ -1304,7 +1304,7 @@ manage_import_mode( NAXMLReader *reader )
if( reader->private->parms->check_fn ){
exists = ( *reader->private->parms->check_fn )
- ( reader->private->parms->item, reader->private->parms->check_fn_data );
+ ( reader->private->parms->imported, reader->private->parms->check_fn_data );
}
if( exists ){
@@ -1331,7 +1331,7 @@ manage_import_mode( NAXMLReader *reader )
case IMPORTER_MODE_NO_IMPORT:
default:
- id = na_object_get_id( reader->private->parms->item );
+ id = na_object_get_id( reader->private->parms->imported );
add_message( reader, ERR_ITEM_ID_ALREADY_EXISTS, id );
if( reader->private->parms->mode == IMPORTER_MODE_ASK ){
add_message( reader, "%s", _( "Import was canceled due to user request." ));
@@ -1368,14 +1368,14 @@ renumber_label_item( NAXMLReader *reader )
{
gchar *label, *tmp;
- na_object_set_new_id( reader->private->parms->item, NULL );
+ na_object_set_new_id( reader->private->parms->imported, NULL );
- label = na_object_get_label( reader->private->parms->item );
+ label = na_object_get_label( reader->private->parms->imported );
/* i18n: the action has been renumbered during import operation */
tmp = g_strdup_printf( "%s %s", label, _( "(renumbered)" ));
- na_object_set_label( reader->private->parms->item, tmp );
+ na_object_set_label( reader->private->parms->imported, tmp );
g_free( tmp );
g_free( label );
diff --git a/src/io-xml/naxml-reader.h b/src/io-xml/naxml-reader.h
index ff18998..0479619 100644
--- a/src/io-xml/naxml-reader.h
+++ b/src/io-xml/naxml-reader.h
@@ -75,7 +75,7 @@ typedef struct {
GType naxml_reader_get_type( void );
-guint naxml_reader_import_from_uri( const NAIImporter *instance, NAIImporterParms *parms );
+guint naxml_reader_import_from_uri( const NAIImporter *instance, NAIImporterUriParms *parms );
void naxml_reader_read_start( const NAIFactoryProvider *provider, void *reader_data, const NAIFactoryObject *object, GSList **messages );
NADataBoxed *naxml_reader_read_data ( const NAIFactoryProvider *provider, void *reader_data, const NAIFactoryObject *object, const NADataDef *def, GSList **messages );
diff --git a/src/nact/nact-assistant-import.c b/src/nact/nact-assistant-import.c
index 9e0d652..4f32d5f 100644
--- a/src/nact/nact-assistant-import.c
+++ b/src/nact/nact-assistant-import.c
@@ -676,7 +676,7 @@ assistant_apply( BaseAssistant *wnd, GtkAssistant *assistant )
guint mode;
NactApplication *application;
NAUpdater *updater;
- NAIImporterParms parms;
+ NAIImporterUriParms parms;
guint code;
ImportCheck check_str;
@@ -707,7 +707,7 @@ assistant_apply( BaseAssistant *wnd, GtkAssistant *assistant )
parms.mode = mode;
parms.window = base_window_get_toplevel( base_application_get_main_window( BASE_APPLICATION( application )));
parms.messages = NULL;
- parms.item = NULL;
+ parms.imported = NULL;
parms.check_fn = ( NAIImporterCheckFn ) &check_for_existance;
parms.check_fn_data = &check_str;
@@ -715,7 +715,7 @@ assistant_apply( BaseAssistant *wnd, GtkAssistant *assistant )
str = g_new0( ImportUriStruct, 1 );
str->uri = g_strdup( parms.uri );
- str->item = parms.item;
+ str->item = parms.imported;
str->msg = na_core_utils_slist_duplicate( parms.messages );
na_core_utils_slist_free( parms.messages );
diff --git a/src/nact/nact-tree-model-dnd.c b/src/nact/nact-tree-model-dnd.c
index 3a33101..2d37c65 100644
--- a/src/nact/nact-tree-model-dnd.c
+++ b/src/nact/nact-tree-model-dnd.c
@@ -755,7 +755,7 @@ drop_uri_list( NactTreeModel *model, GtkTreePath *dest, GtkSelectionData *selec
NactMainWindow *main_window;
GtkTreePath *new_dest;
GList *object_list;
- NAIImporterParms parms;
+ NAIImporterUriParms parms;
guint code;
GConfClient *gconf;
@@ -781,7 +781,7 @@ drop_uri_list( NactTreeModel *model, GtkTreePath *dest, GtkSelectionData *selec
parms.uri = ( gchar * ) is->data;
parms.mode = import_mode;
parms.messages = NULL;
- parms.item = NULL;
+ parms.imported = NULL;
parms.check_fn = NULL;
parms.check_fn_data = NULL;
@@ -796,11 +796,11 @@ drop_uri_list( NactTreeModel *model, GtkTreePath *dest, GtkSelectionData *selec
na_core_utils_slist_free( parms.messages );
}
- if( parms.item ){
- g_return_val_if_fail( NA_IS_OBJECT_ITEM( parms.item ), FALSE );
- object_list = g_list_prepend( object_list, parms.item );
- na_object_check_status( parms.item );
- na_object_dump( parms.item );
+ if( parms.imported ){
+ g_return_val_if_fail( NA_IS_OBJECT_ITEM( parms.imported ), FALSE );
+ object_list = g_list_prepend( object_list, parms.imported );
+ na_object_check_status( parms.imported );
+ na_object_dump( parms.imported );
drop_done = TRUE;
}
}
diff --git a/src/test/test-reader.c b/src/test/test-reader.c
index b06e139..130f87e 100755
--- a/src/test/test-reader.c
+++ b/src/test/test-reader.c
@@ -64,7 +64,7 @@ static void exit_with_usage( void );
int
main( int argc, char **argv )
{
- NAIImporterParms parms;
+ NAIImporterUriParms parms;
g_type_init();
@@ -76,7 +76,7 @@ main( int argc, char **argv )
parms.version = 1;
parms.uri = uri;
parms.mode = IMPORTER_MODE_ASK;
- parms.item = NULL;
+ parms.imported = NULL;
parms.check_fn = NULL;
parms.check_fn_data = NULL;
parms.messages = NULL;
@@ -85,9 +85,9 @@ main( int argc, char **argv )
g_print( "%s: return code from import is %u.\n", g_get_prgname(), code );
- if( parms.item ){
- na_object_dump( parms.item );
- g_object_unref( parms.item );
+ if( parms.imported ){
+ na_object_dump( parms.imported );
+ g_object_unref( parms.imported );
}
na_core_utils_slist_dump( parms.messages );
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]