Commit 08fddb51 authored by Pierre Wieser's avatar Pierre Wieser

Set loadable population before calling na_pivot_load_items

parent cb134830
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:
......
......@@ -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 );
......
......@@ -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 ){
......@@ -811,6 +789,24 @@ na_pivot_is_invalid_loadable( const NAPivot *pivot )
return( is_loadable );
}
/**
* 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.
......
......@@ -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 );
......
......@@ -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 );
......
......@@ -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 ));
......
......@@ -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 ){
......
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment