[nautilus-actions] Fix write/delete operations in NAIODesktopProvider



commit 1b4d36cdd559c494440be292d5ef981ee170945b
Author: Pierre Wieser <pwieser trychlos org>
Date:   Tue Dec 22 20:40:49 2009 +0100

    Fix write/delete operations in NAIODesktopProvider

 ChangeLog                                         |    9 +++++++++
 nautilus-actions/io-provider-desktop/nadp-read.c  |    2 +-
 nautilus-actions/io-provider-desktop/nadp-write.c |   10 +++++++---
 3 files changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0880fb3..a1d3d57 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2009-12-22 Pierre Wieser <pwieser trychlos org>
 
+	Fix write/delete operations in NAIIODesktopProvider.
+
+	* nautilus-actions/io-provider-desktop/nadp-read.c
+	(action_from_desktop_path): Set provider data.
+
+	* nautilus-actions/io-provider-desktop/nadp-write.c
+	(nadp_iio_provider_is_writable, nadp_iio_provider_write_item,
+	nadp_iio_provider_delete_item): Get provider data.
+
 	Let the I/O provider set specific data into NAObjectItem.
 
 	* nautilus-actions/api/na-object-api.h
diff --git a/nautilus-actions/io-provider-desktop/nadp-read.c b/nautilus-actions/io-provider-desktop/nadp-read.c
index c7871e9..bbd5a56 100644
--- a/nautilus-actions/io-provider-desktop/nadp-read.c
+++ b/nautilus-actions/io-provider-desktop/nadp-read.c
@@ -220,7 +220,7 @@ action_from_desktop_path( const NadpDesktopProvider *provider, DesktopPath *dps,
 	action = na_object_action_new();
 	read_action_properties( provider, action, ndf, messages );
 
-	g_object_set_data( G_OBJECT( action ), "nadp-desktop-file", ndf );
+	na_object_set_provider_data( action, ndf );
 	g_object_weak_ref( G_OBJECT( action ), ( GWeakNotify ) g_object_unref, ndf );
 
 	/* have at least one profile */
diff --git a/nautilus-actions/io-provider-desktop/nadp-write.c b/nautilus-actions/io-provider-desktop/nadp-write.c
index 395726f..3c62450 100644
--- a/nautilus-actions/io-provider-desktop/nadp-write.c
+++ b/nautilus-actions/io-provider-desktop/nadp-write.c
@@ -101,7 +101,7 @@ nadp_iio_provider_is_writable( const NAIIOProvider *provider, const NAObjectItem
 		return( FALSE );
 	}
 
-	ndf = ( NadpDesktopFile * ) g_object_get_data( G_OBJECT( item ), "nadp-desktop-file" );
+	ndf = ( NadpDesktopFile * ) na_object_get_provider_data( item );
 
 	if( ndf ){
 		g_return_val_if_fail( NADP_IS_DESKTOP_FILE( ndf ), writable );
@@ -139,7 +139,7 @@ nadp_iio_provider_write_item( const NAIIOProvider *provider, const NAObjectItem
 		return( ret );
 	}
 
-	ndf = ( NadpDesktopFile * ) g_object_get_data( G_OBJECT( item ), "nadp-desktop-file" );
+	ndf = ( NadpDesktopFile * ) na_object_get_provider_data( item );
 
 	/* write into the current key file and write it to current path */
 	if( ndf ){
@@ -227,6 +227,9 @@ nadp_iio_provider_delete_item( const NAIIOProvider *provider, const NAObjectItem
 	NadpDesktopFile *ndf;
 	gchar *path;
 
+	g_debug( "%s: provider=%p, item=%p (%s), messages=%p",
+			thisfn, ( void * ) provider, ( void * ) item, G_OBJECT_TYPE_NAME( item ), messages );
+
 	ret = NA_IIO_PROVIDER_NOT_WILLING_TO_WRITE;
 	g_return_val_if_fail( NADP_IS_DESKTOP_PROVIDER( provider ), ret );
 	g_return_val_if_fail( NA_IS_OBJECT_ITEM( item ), ret );
@@ -236,7 +239,7 @@ nadp_iio_provider_delete_item( const NAIIOProvider *provider, const NAObjectItem
 		return( NA_IIO_PROVIDER_NOT_WRITABLE );
 	}
 
-	ndf = ( NadpDesktopFile * ) g_object_get_data( G_OBJECT( item ), "nadp-desktop-file" );
+	ndf = ( NadpDesktopFile * ) na_object_get_provider_data( item );
 
 	if( ndf ){
 		g_return_val_if_fail( NADP_IS_DESKTOP_FILE( ndf ), ret );
@@ -247,6 +250,7 @@ nadp_iio_provider_delete_item( const NAIIOProvider *provider, const NAObjectItem
 		g_free( path );
 
 	} else {
+		g_warning( "%s: NadpDesktopFile is null", thisfn );
 		ret = NA_IIO_PROVIDER_WRITE_OK;
 	}
 



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