[nautilus-actions] Only check status of pivot items from the plugin



commit 2c21842b0a336b0e9a71c749975e3216dfb8061d
Author: pierre <pierre vfedora10 virtuals pwi>
Date:   Wed Oct 14 16:17:50 2009 +0200

    Only check status of pivot items from the plugin

 ChangeLog                     |    9 +++++++++
 src/plugin/nautilus-actions.c |    1 +
 src/runtime/na-iio-provider.c |   10 +---------
 src/runtime/na-pivot.c        |   24 ++++++++++++++++++++++++
 src/runtime/na-pivot.h        |    1 +
 5 files changed, 36 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 10e802c..5724da8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,9 +11,18 @@
 	Also used to validate when dropping an uri.
 	(drop_uri_list): Check status of imported actions.
 
+	* src/plugin/nautilus-actions.c (instance_init):
+	Check status of loaded items.
+
 	* src/runtime/na-gconf-provider.c:
 	Manage unknown types.
 
+	* src/runtime/na-iio-provider.c (na_iio_provider_get_items_tree):
+	No more check here status of loaded items.
+
+	* src/runtime/na-pivot.c:
+	* src/runtime/na-pivot.h (na_pivot_check_status): New function.
+
 2009-10-13 Pierre Wieser <pwieser trychlos org>
 
 	* src/runtime/na-iduplicable.c:
diff --git a/src/plugin/nautilus-actions.c b/src/plugin/nautilus-actions.c
index 583bdb4..4e3e8f7 100644
--- a/src/plugin/nautilus-actions.c
+++ b/src/plugin/nautilus-actions.c
@@ -213,6 +213,7 @@ instance_init( GTypeInstance *instance, gpointer klass )
 	 */
 	self->private->pivot = na_pivot_new( NA_IPIVOT_CONSUMER( self ));
 	na_pivot_set_automatic_reload( self->private->pivot, TRUE );
+	na_pivot_check_status( self->private->pivot );
 }
 
 static void
diff --git a/src/runtime/na-iio-provider.c b/src/runtime/na-iio-provider.c
index 6079ad1..aca2d65 100644
--- a/src/runtime/na-iio-provider.c
+++ b/src/runtime/na-iio-provider.c
@@ -156,7 +156,7 @@ na_iio_provider_get_items_tree( const NAPivot *pivot )
 {
 	static const gchar *thisfn = "na_iio_provider_get_items_tree";
 	GList *providers;
-	GList *merged, *hierarchy, *it;
+	GList *merged, *hierarchy;
 	GSList *level_zero;
 	gint order_mode;
 
@@ -189,7 +189,6 @@ na_iio_provider_get_items_tree( const NAPivot *pivot )
 		}
 
 		na_utils_free_string_list( level_zero );
-		/*na_object_free_items_list( merged );*/
 
 		g_debug( "%s: tree before alphabetical reordering (if any)", thisfn );
 		na_object_dump_tree( hierarchy );
@@ -209,13 +208,6 @@ na_iio_provider_get_items_tree( const NAPivot *pivot )
 			default:
 				break;
 		}
-
-		/* required here because Nautilus-Actions plugin will only
-		 * display valid items, and doesn't care to have to check them
-		 */
-		for( it = hierarchy ; it ; it = it->next ){
-			na_object_check_status( it->data );
-		}
 	}
 
 	return( hierarchy );
diff --git a/src/runtime/na-pivot.c b/src/runtime/na-pivot.c
index 72c5b1d..e03b282 100644
--- a/src/runtime/na-pivot.c
+++ b/src/runtime/na-pivot.c
@@ -314,6 +314,29 @@ na_pivot_new( const NAIPivotConsumer *target )
 }
 
 /**
+ * na_pivot_check_status:
+ * @pivot: this #NAPivot object.
+ *
+ * Recursively checks the status of items in @pivot.
+ */
+void
+na_pivot_check_status( const NAPivot *pivot )
+{
+	static const gchar *thisfn = "na_pivot_check_status";
+	GList *it;
+
+	g_debug( "%s: pivot=%p", thisfn, ( void * ) pivot );
+	g_return_if_fail( NA_IS_PIVOT( pivot ));
+
+	if( !pivot->private->dispose_has_run ){
+
+		for( it = pivot->private->tree ; it ; it = it->next ){
+			na_object_check_status( it->data );
+		}
+	}
+}
+
+/**
  * na_pivot_dump:
  * @pivot: the #NAPivot object do be dumped.
  *
@@ -832,6 +855,7 @@ on_actions_changed_timeout( gpointer user_data )
 
 	if( pivot->private->automatic_reload ){
 		na_pivot_reload_items( pivot );
+		na_pivot_check_status( pivot );
 	}
 
 	for( ic = pivot->private->consumers ; ic ; ic = ic->next ){
diff --git a/src/runtime/na-pivot.h b/src/runtime/na-pivot.h
index d9503c8..e7ea54a 100644
--- a/src/runtime/na-pivot.h
+++ b/src/runtime/na-pivot.h
@@ -106,6 +106,7 @@ typedef struct {
 GType     na_pivot_get_type( void );
 
 NAPivot  *na_pivot_new( const NAIPivotConsumer *notified );
+void      na_pivot_check_status( const NAPivot *pivot );
 void      na_pivot_dump( const NAPivot *pivot );
 
 GList    *na_pivot_get_providers( const NAPivot *pivot, GType type );



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