[nautilus-actions] Set loadable population before calling na_pivot_load_items



commit 08fddb5163608f0216c9c159948ffa60145e419d
Author: Pierre Wieser <pwieser trychlos org>
Date:   Mon Feb 22 05:22:34 2010 +0100

    Set loadable population before calling na_pivot_load_items

 ChangeLog                          |   12 +++++++++
 src/core/na-io-provider.c          |    3 --
 src/core/na-pivot.c                |   48 ++++++++++++++++-------------------
 src/core/na-pivot.h                |    7 +++--
 src/nact/nact-application.c        |    3 +-
 src/nact/nact-main-window.c        |    2 +-
 src/plugin-menu/nautilus-actions.c |    3 +-
 src/utils/nautilus-actions-run.c   |    3 +-
 8 files changed, 45 insertions(+), 36 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4aeb013..d4557fd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2009-02-22 Pierre Wieser <pwieser trychlos org>
+
+	* src/core/na-io-provider.c:
+	* src/core/na-pivot.c:
+	* src/core/na-pivot.h:
+	* src/nact/nact-application.c:
+	* src/nact/nact-main-window.c:
+	* src/plugin-menu/nautilus-actions.c:
+	* src/utils/nautilus-actions-run.c
+	(na_pivot_set_loadable): New function.
+	(na_pivot_reload_items): Removed function.
+
 2009-02-21 Pierre Wieser <pwieser trychlos org>
 
 	* src/core/na-pivot.c:
diff --git a/src/core/na-io-provider.c b/src/core/na-io-provider.c
index 6b53d31..8e175bb 100644
--- a/src/core/na-io-provider.c
+++ b/src/core/na-io-provider.c
@@ -635,9 +635,6 @@ na_io_provider_read_items( const NAPivot *pivot, GSList **messages )
 	g_return_val_if_fail( NA_IS_PIVOT( pivot ), NULL );
 	g_return_val_if_fail( NA_IS_IPREFS( pivot ), NULL );
 
-	hierarchy = NULL;
-	*messages = NULL;
-
 	providers = na_io_provider_get_providers_list( pivot );
 
 	merged = get_merged_items_list( pivot, providers, messages );
diff --git a/src/core/na-pivot.c b/src/core/na-pivot.c
index 971a4b5..240fe2b 100644
--- a/src/core/na-pivot.c
+++ b/src/core/na-pivot.c
@@ -531,35 +531,11 @@ na_pivot_get_items( const NAPivot *pivot )
 /**
  * na_pivot_load_items:
  * @pivot: this #NAPivot instance.
- * @loadable: the loadable set of items population.
  *
  * Loads the hierarchical list of items from I/O providers.
  */
 void
-na_pivot_load_items( NAPivot *pivot, guint loadable )
-{
-	static const gchar *thisfn = "na_pivot_load_items";
-
-	g_debug( "%s: pivot=%p", thisfn, ( void * ) pivot );
-	g_return_if_fail( NA_IS_PIVOT( pivot ));
-
-	if( !pivot->private->dispose_has_run ){
-
-		pivot->private->loadable_set = loadable;
-
-		na_pivot_reload_items( pivot );
-	}
-}
-
-/**
- * na_pivot_reload_items:
- * @pivot: this #NAPivot instance.
- *
- * Reloads the hierarchical list of items from I/O providers, using
- * the same loadable set that the previous time.
- */
-void
-na_pivot_reload_items( NAPivot *pivot )
+na_pivot_load_items( NAPivot *pivot )
 {
 	static const gchar *thisfn = "na_pivot_load_items";
 	GSList *messages, *im;
@@ -571,6 +547,8 @@ na_pivot_reload_items( NAPivot *pivot )
 
 		na_object_unref_items( pivot->private->tree );
 
+		messages = NULL;
+
 		pivot->private->tree = na_io_provider_read_items( pivot, &messages );
 
 		for( im = messages ; im ; im = im->next ){
@@ -641,7 +619,7 @@ on_item_changed_timeout( NAPivot *pivot )
 	}
 
 	if( pivot->private->automatic_reload ){
-		na_pivot_reload_items( pivot );
+		na_pivot_load_items( pivot );
 	}
 
 	for( ic = pivot->private->consumers ; ic ; ic = ic->next ){
@@ -812,6 +790,24 @@ na_pivot_is_invalid_loadable( const NAPivot *pivot )
 }
 
 /**
+ * na_pivot_set_loadable:
+ * @pivot: this #NAPivot instance.
+ * @loadable: the population of items to be loaded.
+ *
+ * Sets the loadable set.
+ */
+void
+na_pivot_set_loadable( NAPivot *pivot, guint loadable )
+{
+	g_return_if_fail( NA_IS_PIVOT( pivot ));
+
+	if( !pivot->private->dispose_has_run ){
+
+		pivot->private->loadable_set = loadable;
+	}
+}
+
+/**
  * na_pivot_is_level_zero_writable:
  * @pivot: this #NAPivot instance.
  *
diff --git a/src/core/na-pivot.h b/src/core/na-pivot.h
index 25c3c57..791394a 100644
--- a/src/core/na-pivot.h
+++ b/src/core/na-pivot.h
@@ -135,8 +135,7 @@ void          na_pivot_free_providers( GList *providers );
  */
 NAObjectItem *na_pivot_get_item( const NAPivot *pivot, const gchar *id );
 GList        *na_pivot_get_items( const NAPivot *pivot );
-void          na_pivot_load_items( NAPivot *pivot, guint loadable );
-void          na_pivot_reload_items( NAPivot *pivot );
+void          na_pivot_load_items( NAPivot *pivot );
 
 void          na_pivot_item_changed_handler( NAIIOProvider *provider, const gchar *id, NAPivot *pivot  );
 
@@ -148,10 +147,12 @@ void          na_pivot_register_consumer( NAPivot *pivot, const NAIPivotConsumer
 
 /* NAPivot properties and configuration
  */
-void          na_pivot_set_automatic_reload( NAPivot *pivot, gboolean reload );
+void          na_pivot_set_automatic_reload            ( NAPivot *pivot, gboolean reload );
 
 gboolean      na_pivot_is_disable_loadable             ( const NAPivot *pivot );
 gboolean      na_pivot_is_invalid_loadable             ( const NAPivot *pivot );
+void          na_pivot_set_loadable                    ( NAPivot *pivot, guint loadable );
+
 gboolean      na_pivot_is_level_zero_writable          ( const NAPivot *pivot );
 gboolean      na_pivot_is_configuration_locked_by_admin( const NAPivot *pivot );
 
diff --git a/src/nact/nact-application.c b/src/nact/nact-application.c
index c649040..c646744 100644
--- a/src/nact/nact-application.c
+++ b/src/nact/nact-application.c
@@ -393,7 +393,8 @@ appli_initialize_application( BaseApplication *application )
 	g_debug( "%s: application=%p", thisfn, ( void * ) application );
 
 	NACT_APPLICATION( application )->private->updater = na_updater_new();
-	na_pivot_load_items( NA_PIVOT( NACT_APPLICATION( application )->private->updater ), PIVOT_LOAD_ALL );
+	na_pivot_set_loadable( NA_PIVOT( NACT_APPLICATION( application )->private->updater ), PIVOT_LOAD_ALL );
+	na_pivot_load_items( NA_PIVOT( NACT_APPLICATION( application )->private->updater ));
 
 	/* call parent class */
 	ok = BASE_APPLICATION_CLASS( st_parent_class )->initialize_application( application );
diff --git a/src/nact/nact-main-window.c b/src/nact/nact-main-window.c
index 8b944eb..2433a92 100644
--- a/src/nact/nact-main-window.c
+++ b/src/nact/nact-main-window.c
@@ -1399,7 +1399,7 @@ reload( NactMainWindow *window )
 
 		application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( window )));
 		updater = nact_application_get_updater( application );
-		na_pivot_reload_items( NA_PIVOT( updater ));
+		na_pivot_load_items( NA_PIVOT( updater ));
 		nact_iactions_list_fill( NACT_IACTIONS_LIST( window ), na_pivot_get_items( NA_PIVOT( updater )));
 		nact_iactions_list_bis_select_first_row( NACT_IACTIONS_LIST( window ));
 
diff --git a/src/plugin-menu/nautilus-actions.c b/src/plugin-menu/nautilus-actions.c
index ddbc1ca..352da89 100644
--- a/src/plugin-menu/nautilus-actions.c
+++ b/src/plugin-menu/nautilus-actions.c
@@ -205,7 +205,8 @@ instance_constructed( GObject *object )
 		self->private->pivot = na_pivot_new();
 		na_pivot_register_consumer( self->private->pivot, NA_IPIVOT_CONSUMER( self ));
 		na_pivot_set_automatic_reload( self->private->pivot, TRUE );
-		na_pivot_load_items( self->private->pivot, !PIVOT_LOAD_DISABLED & !PIVOT_LOAD_INVALID );
+		na_pivot_set_loadable( self->private->pivot, !PIVOT_LOAD_DISABLED & !PIVOT_LOAD_INVALID );
+		na_pivot_load_items( self->private->pivot );
 
 		/* chain up to the parent class */
 		if( G_OBJECT_CLASS( st_parent_class )->constructed ){
diff --git a/src/utils/nautilus-actions-run.c b/src/utils/nautilus-actions-run.c
index 45d86f7..d6fb8f9 100644
--- a/src/utils/nautilus-actions-run.c
+++ b/src/utils/nautilus-actions-run.c
@@ -214,7 +214,8 @@ get_action( const gchar *id )
 	action = NULL;
 
 	pivot = na_pivot_new();
-	na_pivot_load_items( pivot, !PIVOT_LOAD_DISABLED & !PIVOT_LOAD_INVALID );
+	na_pivot_set_loadable( pivot, !PIVOT_LOAD_DISABLED & !PIVOT_LOAD_INVALID );
+	na_pivot_load_items( pivot );
 
 	action = ( NAObjectAction * ) na_pivot_get_item( pivot, id );
 



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