Commit 2dee03ee authored by Pierre Wieser's avatar Pierre Wieser

na_object_item_factory_write_start function is renamed as na_object_item_rebuild_children_slist()

There was no sense to use a IFactory name in NAObjectItem class as this later does not have
any knowledge of IFactory interfaces.
parent fac4e0e9
2010-07-19 Pierre Wieser <pwieser@trychlos.org>
* src/api/na-object-item.h:
* src/core/na-object-item.c (na_object_item_factory_write_start):
Function is renamed as na_object_item_rebuild_children_slist().
* src/core/na-object-action.c:
* src/core/na-object-menu.c: Updated accordingly.
2010-07-05 Pierre Wieser <pwieser@trychlos.org>
* src/nact/nact-icommand-tab.c (nact_icommand_tab_runtime_init_toplevel):
......
......@@ -92,7 +92,7 @@ void na_object_item_count_items( GList *items, gint *menus, gint *actions
void na_object_item_unref_items( GList *items );
void na_object_item_unref_items_rec( GList *items );
void na_object_item_factory_write_start( NAObjectItem *item );
void na_object_item_rebuild_children_slist( NAObjectItem *item );
G_END_DECLS
......
......@@ -364,7 +364,7 @@ ifactory_object_read_done( NAIFactoryObject *instance, const NAIFactoryProvider
static guint
ifactory_object_write_start( NAIFactoryObject *instance, const NAIFactoryProvider *writer, void *writer_data, GSList **messages )
{
na_object_item_factory_write_start( NA_OBJECT_ITEM( instance ));
na_object_item_rebuild_children_slist( NA_OBJECT_ITEM( instance ));
return( NA_IIO_PROVIDER_CODE_OK );
}
......
......@@ -74,7 +74,6 @@ static void object_copy( NAObject*target, const NAObject *source, gboolean rec
static gchar *object_id_new_id( const NAObjectId *item, const NAObjectId *new_parent );
static void copy_children( NAObjectItem *target, const NAObjectItem *source );
static void rebuild_children_slist( NAObjectItem *item );
GType
na_object_item_get_type( void )
......@@ -697,15 +696,35 @@ na_object_item_unref_items_rec( GList *items )
}
/**
* na_object_item_factory_write_start:
* na_object_item_rebuild_children_slist:
* @item: this #NAObjectItem-derived object.
*
* Rebuild the string list of children.
*/
void
na_object_item_factory_write_start( NAObjectItem *item )
na_object_item_rebuild_children_slist( NAObjectItem *item )
{
rebuild_children_slist( item );
GSList *slist;
GList *subitems, *it;
gchar *id;
na_object_set_items_slist( item, NULL );
if( !item->private->dispose_has_run ){
subitems = na_object_get_items( item );
slist = NULL;
for( it = subitems ; it ; it = it->next ){
id = na_object_get_id( it->data );
slist = g_slist_prepend( slist, id );
}
slist = g_slist_reverse( slist );
na_object_set_items_slist( item, slist );
na_core_utils_slist_free( slist );
}
}
static void
......@@ -733,28 +752,3 @@ copy_children( NAObjectItem *target, const NAObjectItem *source )
tgt_children = g_list_reverse( tgt_children );
na_object_set_items( target, tgt_children );
}
static void
rebuild_children_slist( NAObjectItem *item )
{
GSList *slist;
GList *subitems, *it;
gchar *id;
slist = NULL;
if( !item->private->dispose_has_run ){
subitems = na_object_get_items( item );
for( it = subitems ; it ; it = it->next ){
id = na_object_get_id( it->data );
slist = g_slist_prepend( slist, id );
}
slist = g_slist_reverse( slist );
na_object_set_items_slist( item, slist );
na_core_utils_slist_free( slist );
}
}
......@@ -338,7 +338,7 @@ ifactory_object_read_done( NAIFactoryObject *instance, const NAIFactoryProvider
static guint
ifactory_object_write_start( NAIFactoryObject *instance, const NAIFactoryProvider *writer, void *writer_data, GSList **messages )
{
na_object_item_factory_write_start( NA_OBJECT_ITEM( instance ));
na_object_item_rebuild_children_slist( NA_OBJECT_ITEM( instance ));
return( NA_IIO_PROVIDER_CODE_OK );
}
......
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