[nautilus-actions] Desktop I/O provider reads subitems key in 'read_start' interface



commit dd68d90068d91a1b440d4f5d8d38600ddc2d2323
Author: Pierre Wieser <pwieser trychlos org>
Date:   Mon Jul 26 05:35:18 2010 +0200

    Desktop I/O provider reads subitems key in 'read_start' interface

 ChangeLog                              |   11 +++++++++++
 src/io-desktop/nadp-desktop-provider.c |    2 +-
 src/io-desktop/nadp-reader.c           |   30 +++++++++++++++++++++++++++++-
 src/io-desktop/nadp-reader.h           |    5 +++--
 4 files changed, 44 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 074a280..ff01384 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2010-07-26 Pierre Wieser <pwieser trychlos org>
+
+	Move the reading of the subitems key for the desktop I/O provider
+	from 'read_done' to 'read_start'.
+
+	* src/io-desktop/nadp-reader.c:
+	* src/io-desktop/nadp-reader.h
+	(nadp_reader_ifactory_provider_read_start): New function.
+
+	* src/io-desktop/nadp-desktop-provider.c: Updated accordingly.
+
 2010-07-19 Pierre Wieser <pwieser trychlos org>
 
 	* src/api/na-object-item.h:
diff --git a/src/io-desktop/nadp-desktop-provider.c b/src/io-desktop/nadp-desktop-provider.c
index d96d29e..5014995 100644
--- a/src/io-desktop/nadp-desktop-provider.c
+++ b/src/io-desktop/nadp-desktop-provider.c
@@ -233,7 +233,7 @@ ifactory_provider_iface_init( NAIFactoryProviderInterface *iface )
 	g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
 
 	iface->get_version = ifactory_provider_get_version;
-	iface->read_start = NULL;
+	iface->read_start = nadp_reader_ifactory_provider_read_start;
 	iface->read_data = nadp_reader_ifactory_provider_read_data;
 	iface->read_done = nadp_reader_ifactory_provider_read_done;
 	iface->write_start = nadp_writer_ifactory_provider_write_start;
diff --git a/src/io-desktop/nadp-reader.c b/src/io-desktop/nadp-reader.c
index 237079d..383184d 100644
--- a/src/io-desktop/nadp-reader.c
+++ b/src/io-desktop/nadp-reader.c
@@ -323,6 +323,35 @@ free_desktop_paths( GList *paths )
 }
 
 /*
+ * at this time, the object has been allocated and its id has been set
+ * read here the subitems key, which may be 'Profiles' or 'ItemsList'
+ * depending of the exact class of the NAObjectItem
+ */
+void
+nadp_reader_ifactory_provider_read_start( const NAIFactoryProvider *reader, void *reader_data, const NAIFactoryObject *serializable, GSList **messages )
+{
+	static const gchar *thisfn = "nadp_reader_ifactory_provider_read_start";
+	gboolean writable;
+
+	g_debug( "%s: reader=%p (%s), reader_data=%p, serializable=%p (%s), messages=%p",
+			thisfn,
+			( void * ) reader, G_OBJECT_TYPE_NAME( reader ),
+			( void * ) reader_data,
+			( void * ) serializable, G_OBJECT_TYPE_NAME( serializable ),
+			( void * ) messages );
+
+	g_return_if_fail( NA_IS_IFACTORY_PROVIDER( reader ));
+	g_return_if_fail( NADP_IS_DESKTOP_PROVIDER( reader ));
+	g_return_if_fail( NA_IS_IFACTORY_OBJECT( serializable ));
+
+	if( !NADP_DESKTOP_PROVIDER( reader )->private->dispose_has_run ){
+		if( NA_IS_OBJECT_ITEM( serializable )){
+			read_subitems_key( reader, NA_OBJECT_ITEM( serializable ), ( NadpReaderData * ) reader_data, messages );
+		}
+	}
+}
+
+/*
  * reading any data from a desktop file requires:
  * - a NadpDesktopFile object which has been initialized with the .desktop file
  *   -> has been attached to the NAObjectItem in get_item() above
@@ -460,7 +489,6 @@ nadp_reader_ifactory_provider_read_done( const NAIFactoryProvider *reader, void
 		if( NA_IS_OBJECT_ITEM( serializable )){
 			writable = read_done_desktop_is_writable( reader, NA_OBJECT_ITEM( serializable ), ( NadpReaderData * ) reader_data, messages );
 			na_object_set_readonly( serializable, !writable );
-			read_subitems_key( reader, NA_OBJECT_ITEM( serializable ), ( NadpReaderData * ) reader_data, messages );
 		}
 
 		if( NA_IS_OBJECT_ACTION( serializable )){
diff --git a/src/io-desktop/nadp-reader.h b/src/io-desktop/nadp-reader.h
index 71b743b..4af4f92 100644
--- a/src/io-desktop/nadp-reader.h
+++ b/src/io-desktop/nadp-reader.h
@@ -37,8 +37,9 @@ G_BEGIN_DECLS
 
 GList       *nadp_iio_provider_read_items( const NAIIOProvider *provider, GSList **messages );
 
-NADataBoxed *nadp_reader_ifactory_provider_read_data( const NAIFactoryProvider *reader, void *reader_data, const NAIFactoryObject *serializable, const NADataDef *iddef, GSList **messages );
-void         nadp_reader_ifactory_provider_read_done( const NAIFactoryProvider *reader, void *reader_data, const NAIFactoryObject *serializable, GSList **messages );
+void         nadp_reader_ifactory_provider_read_start( const NAIFactoryProvider *reader, void *reader_data, const NAIFactoryObject *serializable, GSList **messages );
+NADataBoxed *nadp_reader_ifactory_provider_read_data ( const NAIFactoryProvider *reader, void *reader_data, const NAIFactoryObject *serializable, const NADataDef *iddef, GSList **messages );
+void         nadp_reader_ifactory_provider_read_done ( const NAIFactoryProvider *reader, void *reader_data, const NAIFactoryObject *serializable, GSList **messages );
 
 G_END_DECLS
 



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