Commit 5d1b60ac authored by Pierre Wieser's avatar Pierre Wieser

Use GList as subitems lists

Instead of GSList: shorter to type, more powerful
parent fa3a12cc
2009-09-17 Pierre Wieser <pwieser@trychlos.org>
* src/common/na-iio-provider.c
(get_merged_items_list, sort_tree):
* src/common/na-iio-provider.h
(read_items_list, na_iio_provider_get_items_tree):
* src/common/na-gconf-provider.c (iio_provider_read_items_list):
Now use a GList instead of a GSList (shorter, more powerful).
* src/common/na-object-api.h (na_object_set_new_id):
Fix declaration.
* src/common/na-object-id.c (new_id): New virtual function.
(na_object_id_set_new_id): new corresponding API.
Implements a 'most-derived' model.
* src/common/na-object-item.c:
Subitems are now managed in a GList instead of a GSList.
* src/common/na-obj-action.c:
* src/common/na-obj-menu.c:
* src/common/na-pivot.c:
* src/common/na-pivot.h:
* src/common/na-xml-writer.c:
* src/nact/nact-assistant-export.c:
* src/nact/nact-clipboard.c:
* src/nact/nact-clipboard.h:
* src/nact/nact-iactions-list.c:
* src/nact/nact-iactions-list.h:
* src/nact/nact-main-menubar.c
* src/nact/nact-main-window.c:
* src/nact/nact-tree-model.c:
* src/plugin/nautilus-actions.c:
* src/utils/nautilus-actions-new.c: Updated accordingly.
* src/nact/nact-iactions-list.c (filter_selection,
filter_selection_iter): Controls the allowed selection so that
we are only able to select profiles, or actions/menus.
Define new nact_iactions_list_set_filter_selection_mode() api.
* src/common/na-object.c:
* src/common/na-object-fn.h
(na_object_get_hierarchy, na_object_free_hierarchy): New functions.
* src/nact/nact-main-window.c (nact_main_window_delete_selection):
Renamed to nact_main_window_move_to_deleted().
* src/nact/nact-main-tab.c: Removed (unused) file.
2009-09-16 Pierre Wieser <pwieser@trychlos.org>
......
......@@ -73,7 +73,7 @@ static void install_monitors( NAGConfProvider *provider );
static void config_path_changed_cb( GConfClient *client, guint cnxn_id, GConfEntry *entry, NAGConfProvider *provider );
static NAPivotNotify *entry_to_notify( const GConfEntry *entry );
static GSList *iio_provider_read_items_list( const NAIIOProvider *provider );
static GList *iio_provider_read_items_list( const NAIIOProvider *provider );
static NAObjectItem *read_item( NAGConfProvider *provider, const gchar *path );
static void read_item_action( NAGConfProvider *provider, const gchar *path, NAObjectAction *action );
static void read_item_action_properties( NAGConfProvider *provider, GSList *entries, NAObjectAction *action );
......@@ -424,12 +424,12 @@ entry_to_notify( const GConfEntry *entry )
* stored as a #NAObjectAction and its set of #NAObjectProfile of the same,
* latest, version of these classes.
*/
static GSList *
static GList *
iio_provider_read_items_list( const NAIIOProvider *provider )
{
static const gchar *thisfn = "na_gconf_provider_iio_provider_read_items_list";
NAGConfProvider *self;
GSList *items_list = NULL;
GList *items_list = NULL;
GSList *listpath, *ip;
NAObjectItem *item;
......@@ -448,7 +448,7 @@ iio_provider_read_items_list( const NAIIOProvider *provider )
item = read_item( self, path );
items_list = g_slist_prepend( items_list, item );
items_list = g_list_prepend( items_list, item );
}
na_gconf_utils_free_subdirs( listpath );
......@@ -791,7 +791,7 @@ write_item_action( NAGConfProvider *provider, const NAObjectAction *action, gcha
{
gchar *uuid, *name;
gboolean ret;
GSList *profiles, *ip;
GList *profiles, *ip;
NAObjectProfile *profile;
if( !write_object_item( provider, NA_OBJECT_ITEM( action ), message )){
......
......@@ -52,13 +52,13 @@ static GType register_type( void );
static void interface_base_init( NAIIOProviderInterface *klass );
static void interface_base_finalize( NAIIOProviderInterface *klass );
static GSList *get_merged_items_list( const NAPivot *pivot, GSList *providers );
static GList *get_merged_items_list( const NAPivot *pivot, GSList *providers );
static guint try_write_item( const NAIIOProvider *instance, NAObject *item, gchar **message );
static gboolean do_is_willing_to_write( const NAIIOProvider *instance );
static gboolean do_is_writable( const NAIIOProvider *instance, const NAObject *item );
static GSList *sort_tree( const NAPivot *pivot, GSList *tree );
static GList *sort_tree( const NAPivot *pivot, GList *tree );
static gint compare_label_alpha_fn( const NAObjectId *a, const NAObjectId *b );
/**
......@@ -145,16 +145,16 @@ interface_base_finalize( NAIIOProviderInterface *klass )
*
* Loads the tree from I/O storage subsystems.
*
* Returns: a #GSList of newly allocated objects as a hierarchical tree
* Returns: a #GList of newly allocated objects as a hierarchical tree
* in display order. This tree may contain #NAActionMenu menus and
* #NAAction actions and their #NAActionProfile profiles.
*/
GSList *
GList *
na_iio_provider_get_items_tree( const NAPivot *pivot )
{
static const gchar *thisfn = "na_iio_provider_get_items_tree";
GSList *providers;
GSList *merged;
GList *merged;
GSList *level_zero;
gboolean alpha_order;
......@@ -183,12 +183,12 @@ na_iio_provider_get_items_tree( const NAPivot *pivot )
/*
* returns a concatened list of readen actions / menus
*/
static GSList *
static GList *
get_merged_items_list( const NAPivot *pivot, GSList *providers )
{
GSList *merged = NULL;
GSList *ip;
GSList *list, *item;
GList *merged = NULL;
GList *list, *item;
NAIIOProvider *instance;
for( ip = providers ; ip ; ip = ip->next ){
......@@ -204,7 +204,7 @@ get_merged_items_list( const NAPivot *pivot, GSList *providers )
na_object_dump( item->data );
}
merged = g_slist_concat( merged, list );
merged = g_list_concat( merged, list );
}
}
......@@ -362,13 +362,13 @@ do_is_writable( const NAIIOProvider *instance, const NAObject *item )
return( FALSE );
}
static GSList *
sort_tree( const NAPivot *pivot, GSList *tree )
static GList *
sort_tree( const NAPivot *pivot, GList *tree )
{
GSList *sorted;
GSList *items, *it;
GList *sorted;
GList *items, *it;
sorted = g_slist_sort( tree, ( GCompareFunc ) compare_label_alpha_fn );
sorted = g_list_sort( tree, ( GCompareFunc ) compare_label_alpha_fn );
/* recursively sort each level of the tree
*/
......
......@@ -70,7 +70,7 @@ typedef struct {
* Returns: a hierarchical #GSList of menus, actions and
* profiles as #NAObject-derived objects.
*/
GSList * ( *read_items_list ) ( const NAIIOProvider *instance );
GList * ( *read_items_list ) ( const NAIIOProvider *instance );
/**
* is_willing_to_write:
......@@ -127,12 +127,12 @@ typedef struct {
}
NAIIOProviderInterface;
GType na_iio_provider_get_type( void );
GType na_iio_provider_get_type( void );
GSList *na_iio_provider_get_items_tree( const NAPivot *pivot );
GList *na_iio_provider_get_items_tree( const NAPivot *pivot );
/*GSList *na_iio_provider_sort_tree( const NAPivot *pivot, GSList *tree );*/
guint na_iio_provider_write_item( const NAPivot *pivot, NAObject *item, gchar **message );
guint na_iio_provider_delete_item( const NAPivot *pivot, const NAObject *item, gchar **message );
guint na_iio_provider_write_item( const NAPivot *pivot, NAObject *item, gchar **message );
guint na_iio_provider_delete_item( const NAPivot *pivot, const NAObject *item, gchar **message );
/* modification notification message to NAPivot
*/
......
......@@ -515,7 +515,7 @@ object_copy( NAObject *target, const NAObject *source )
{
gchar *version;
gboolean readonly;
GSList *profiles, *ip;
GList *profiles, *ip;
g_return_if_fail( NA_IS_OBJECT_ACTION( target ));
g_return_if_fail( !NA_OBJECT_ACTION( target )->private->dispose_has_run );
......
......@@ -218,7 +218,7 @@ GSList *
na_object_menu_get_items_list( const NAObjectMenu *menu )
{
GSList *list = NULL;
GSList *items, *it;
GList *items, *it;
gchar *uuid;
g_return_val_if_fail( NA_IS_OBJECT_MENU( menu ), NULL );
......
......@@ -68,7 +68,7 @@ G_BEGIN_DECLS
#define na_object_get_label( object ) na_object_id_get_label( NA_OBJECT_ID( object ))
#define na_object_set_id( object, id ) na_object_id_set_id( NA_OBJECT_ID( object ), id )
#define na_object_set_new_id( object, id ) na_object_id_set_new_id( NA_OBJECT_ID( object ), id )
#define na_object_set_new_id( object ) na_object_id_set_new_id( NA_OBJECT_ID( object ))
#define na_object_set_label( object, label ) na_object_id_set_label( NA_OBJECT_ID( object ), label )
/* NAObjectItem
......
......@@ -53,6 +53,9 @@ gchar *na_object_object_get_clipboard_id( const NAObject *object );
NAObject *na_object_object_ref( const NAObject *object );
void na_object_object_copy( NAObject *target, const NAObject *source );
GList *na_object_get_hierarchy( const NAObject *object );
void na_object_free_hierarchy( GList *hierarchy );
/* NAIDuplicable
*/
NAObject *na_object_iduplicable_duplicate( const NAObject *object );
......
......@@ -63,6 +63,18 @@ typedef struct NAObjectIdClassPrivate NAObjectIdClassPrivate;
typedef struct {
NAObjectClass parent;
NAObjectIdClassPrivate *private;
/**
* new_id:
* @object: a #NAObjectId object.
*
* Returns: a new id suitable for this @object.
*
* This is a pure virtual function which should be implemented by
* the actual class. Actually, we asks for the most-derived class
* which implements this function.
*/
gchar * ( *new_id )( const NAObjectId *object );
}
NAObjectIdClass;
......
......@@ -51,6 +51,7 @@ gchar *na_object_id_get_id( const NAObjectId *object );
gchar *na_object_id_get_label( const NAObjectId *object );
void na_object_id_set_id( NAObjectId *object, const gchar *id );
void na_object_id_set_new_id( NAObjectId *object );
void na_object_id_set_label( NAObjectId *object, const gchar *label );
G_END_DECLS
......
......@@ -34,6 +34,7 @@
#include <string.h>
#include "na-object-fn.h"
#include "na-object-id-class.h"
#include "na-object-id-fn.h"
......@@ -78,6 +79,9 @@ static void object_copy( NAObject *target, const NAObject *source );
static gboolean object_are_equal( const NAObject *a, const NAObject *b );
static gboolean object_is_valid( const NAObject *object );
static gchar *v_new_id( NAObjectId *object );
static gchar *most_derived_new_id( NAObjectId *object );
GType
na_object_id_get_type( void )
{
......@@ -157,6 +161,8 @@ class_init( NAObjectIdClass *klass )
naobject_class->copy = object_copy;
naobject_class->are_equal = object_are_equal;
naobject_class->is_valid = object_is_valid;
klass->new_id = NULL;
}
static void
......@@ -327,6 +333,28 @@ na_object_id_set_id( NAObjectId *object, const gchar *id )
g_object_set( G_OBJECT( object ), NAOBJECT_ID_PROP_ID, id, NULL );
}
/**
* na_object_id_set_new_id:
* @object: the #NAObjectId object whose internal identifiant is to be
* set.
*
* Request a new id to the derived class, and set it.
*/
void
na_object_id_set_new_id( NAObjectId *object )
{
gchar *id;
g_return_if_fail( NA_IS_OBJECT_ID( object ));
g_return_if_fail( !object->private->dispose_has_run );
id = v_new_id( object );
g_object_set( G_OBJECT( object ), NAOBJECT_ID_PROP_ID, id, NULL );
g_free( id );
}
/**
* na_object_id_set_label:
* @object: the #NAObjectId object whose label is to be set.
......@@ -425,3 +453,32 @@ object_is_valid( const NAObject *object )
return( valid );
}
static gchar *
v_new_id( NAObjectId *object )
{
return( most_derived_new_id( object ));
}
static gchar *
most_derived_new_id( NAObjectId *object )
{
gchar *new_id;
GList *hierarchy, *ih;
gboolean found;
found = FALSE;
new_id = NULL;
hierarchy = g_list_reverse( na_object_get_hierarchy( NA_OBJECT( object )));
for( ih = hierarchy ; ih && !found ; ih = ih->next ){
if( NA_OBJECT_ID_CLASS( ih->data )->new_id ){
new_id = NA_OBJECT_ID_CLASS( ih->data )->new_id( object );
found = TRUE;
}
}
na_object_free_hierarchy( hierarchy );
return( new_id );
}
......@@ -54,16 +54,16 @@ GdkPixbuf *na_object_item_get_pixbuf( const NAObjectItem *item, GtkWidget *w
gboolean na_object_item_is_enabled( const NAObjectItem *item );
NAIIOProvider *na_object_item_get_provider( const NAObjectItem *item );
NAObject *na_object_item_get_item( const NAObjectItem *item, const gchar *id );
GSList *na_object_item_get_items( const NAObjectItem *item );
GList *na_object_item_get_items( const NAObjectItem *item );
guint na_object_item_get_items_count( const NAObjectItem *item );
void na_object_item_free_items( GSList *items );
void na_object_item_free_items( GList *items );
void na_object_item_set_new_uuid( NAObjectItem *item );
void na_object_item_set_tooltip( NAObjectItem *item, const gchar *tooltip );
void na_object_item_set_icon( NAObjectItem *item, const gchar *icon_name );
void na_object_item_set_enabled( NAObjectItem *item, gboolean enabled );
void na_object_item_set_provider( NAObjectItem *item, const NAIIOProvider *provider );
void na_object_item_set_items( NAObjectItem *item, GSList *items );
void na_object_item_set_items( NAObjectItem *item, GList *items );
void na_object_item_append_item( NAObjectItem *item, const NAObject *object );
void na_object_item_insert_item( NAObjectItem *item, const NAObject *object );
......
......@@ -59,7 +59,7 @@ struct NAObjectItemPrivate {
/* list of NAObjectId subitems
*/
GSList *items;
GList *items;
/* the original provider
* required to be able to edit/delete the item
......@@ -99,6 +99,8 @@ static void object_copy( NAObject *target, const NAObject *source );
static gboolean object_are_equal( const NAObject *a, const NAObject *b );
static gboolean object_is_valid( const NAObject *object );
static gchar *object_id_new_id( const NAObjectId *object );
GType
na_object_item_get_type( void )
{
......@@ -139,6 +141,7 @@ class_init( NAObjectItemClass *klass )
static const gchar *thisfn = "na_object_item_class_init";
GObjectClass *object_class;
NAObjectClass *naobject_class;
NAObjectIdClass *objectid_class;
GParamSpec *spec;
g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
......@@ -189,6 +192,9 @@ class_init( NAObjectItemClass *klass )
naobject_class->copy = object_copy;
naobject_class->are_equal = object_are_equal;
naobject_class->is_valid = object_is_valid;
objectid_class = NA_OBJECT_ID_CLASS( klass );
objectid_class->new_id = object_id_new_id;
}
static void
......@@ -482,7 +488,7 @@ na_object_item_get_provider( const NAObjectItem *item )
NAObject *
na_object_item_get_item( const NAObjectItem *item, const gchar *id )
{
GSList *it;
GList *it;
NAObject *found = NULL;
NAObject *isub;
gchar *isubid;
......@@ -506,27 +512,27 @@ na_object_item_get_item( const NAObjectItem *item, const gchar *id )
* na_object_item_get_items:
* @item: the #NAObjectItem from which we want a list of subitems.
*
* Returns: a newly allocated #GSList of #NAObject objects which are
* Returns: a newly allocated #GList of #NAObject objects which are
* embedded in the @item. Depending of the exact nature of @item, these
* may be #NAObjectMenu, #NAObjectAction or #NAObjectProfile subitems.
*
* The returned pointer should be na_object_item_free_items() by the
* caller.
* The returned pointer should be na_object_item_free_items() or
* na_object_free_items() by the caller.
*/
GSList *
GList *
na_object_item_get_items( const NAObjectItem *item )
{
GSList *items, *it;
GList *items, *it;
g_return_val_if_fail( NA_IS_OBJECT_ITEM( item ), NULL );
g_return_val_if_fail( !item->private->dispose_has_run, NULL );
items = NULL;
for( it = item->private->items ; it ; it = it->next ){
items = g_slist_prepend( items, g_object_ref( it->data ));
items = g_list_prepend( items, g_object_ref( it->data ));
}
return( g_slist_reverse( items ));
return( g_list_reverse( items ));
}
/**
......@@ -541,7 +547,7 @@ na_object_item_get_items_count( const NAObjectItem *item )
g_return_val_if_fail( NA_IS_OBJECT_ITEM( item ), 0 );
g_return_val_if_fail( !item->private->dispose_has_run, 0 );
return( item->private->items ? g_slist_length( item->private->items ) : 0 );
return( item->private->items ? g_list_length( item->private->items ) : 0 );
}
/**
......@@ -552,10 +558,10 @@ na_object_item_get_items_count( const NAObjectItem *item )
* Frees the list.
*/
void
na_object_item_free_items( GSList *items )
na_object_item_free_items( GList *items )
{
g_slist_foreach( items, ( GFunc ) g_object_unref, NULL );
g_slist_free( items );
g_list_foreach( items, ( GFunc ) g_object_unref, NULL );
g_list_free( items );
}
/**
......@@ -677,7 +683,7 @@ na_object_item_set_provider( NAObjectItem *item, const NAIIOProvider *provider )
/**
* na_object_item_set_items:
* @item: the #NAObjectItem whose subitems have to be set.
* @list: a #GSList list of #NAObject subitems to be installed.
* @list: a #GList list of #NAObject subitems to be installed.
*
* Sets the list of the subitems for the @item.
*
......@@ -687,9 +693,9 @@ na_object_item_set_provider( NAObjectItem *item, const NAIIOProvider *provider )
* by the caller.
*/
void
na_object_item_set_items( NAObjectItem *item, GSList *items )
na_object_item_set_items( NAObjectItem *item, GList *items )
{
GSList *it;
GList *it;
g_return_if_fail( NA_IS_OBJECT_ITEM( item ));
g_return_if_fail( !item->private->dispose_has_run );
......@@ -698,9 +704,9 @@ na_object_item_set_items( NAObjectItem *item, GSList *items )
item->private->items = NULL;
for( it = items ; it ; it = it->next ){
item->private->items = g_slist_prepend( item->private->items, g_object_ref( it->data ));
item->private->items = g_list_prepend( item->private->items, g_object_ref( it->data ));
}
item->private->items = g_slist_reverse( item->private->items );
item->private->items = g_list_reverse( item->private->items );
}
/**
......@@ -719,7 +725,7 @@ na_object_item_append_item( NAObjectItem *item, const NAObject *object )
g_return_if_fail( !item->private->dispose_has_run );
g_return_if_fail( NA_IS_OBJECT( object ));
item->private->items = g_slist_append( item->private->items, g_object_ref(( gpointer ) object ));
item->private->items = g_list_append( item->private->items, g_object_ref(( gpointer ) object ));
}
/**
......@@ -739,7 +745,7 @@ na_object_item_insert_item( NAObjectItem *item, const NAObject *object )
g_return_if_fail( !item->private->dispose_has_run );
g_return_if_fail( NA_IS_OBJECT( object ));
item->private->items = g_slist_prepend( item->private->items, g_object_ref(( gpointer ) object ));
item->private->items = g_list_prepend( item->private->items, g_object_ref(( gpointer ) object ));
}
/**
......@@ -758,7 +764,7 @@ na_object_item_remove_item( NAObjectItem *item, NAObject *object )
g_return_if_fail( !item->private->dispose_has_run );
g_return_if_fail( NA_IS_OBJECT( object ));
item->private->items = g_slist_remove( item->private->items, ( gconstpointer ) object );
item->private->items = g_list_remove( item->private->items, ( gconstpointer ) object );
g_object_unref( object );
}
......@@ -766,7 +772,7 @@ static void
object_dump( const NAObject *item )
{
static const gchar *thisfn = "na_object_item_object_dump";
GSList *it;
GList *it;
g_return_if_fail( NA_IS_OBJECT_ITEM( item ));
g_return_if_fail( !NA_OBJECT_ITEM( item )->private->dispose_has_run );
......@@ -779,7 +785,7 @@ object_dump( const NAObject *item )
/* dump subitems */
g_debug( "%s: %d subitem(s) at %p",
thisfn,
NA_OBJECT_ITEM( item )->private->items ? g_slist_length( NA_OBJECT_ITEM( item )->private->items ) : 0,
NA_OBJECT_ITEM( item )->private->items ? g_list_length( NA_OBJECT_ITEM( item )->private->items ) : 0,
( void * ) NA_OBJECT_ITEM( item )->private->items );
for( it = NA_OBJECT_ITEM( item )->private->items ; it ; it = it->next ){
......@@ -790,7 +796,7 @@ object_dump( const NAObject *item )
static void
object_ref( const NAObject *item )
{
g_slist_foreach( NA_OBJECT_ITEM( item )->private->items, ( GFunc ) g_object_ref, NULL );
g_list_foreach( NA_OBJECT_ITEM( item )->private->items, ( GFunc ) g_object_ref, NULL );
}
static void
......@@ -799,7 +805,7 @@ object_copy( NAObject *target, const NAObject *source )
gchar *tooltip, *icon;
gboolean enabled;
gpointer provider;
GSList *subitems, *it;
GList *subitems, *it;
g_return_if_fail( NA_IS_OBJECT_ITEM( target ));
g_return_if_fail( !NA_OBJECT_ITEM( target )->private->dispose_has_run );
......@@ -825,9 +831,9 @@ object_copy( NAObject *target, const NAObject *source )
subitems = NULL;
for( it = NA_OBJECT_ITEM( source )->private->items ; it ; it = it->next ){
subitems = g_slist_prepend( subitems, na_object_duplicate( it->data ));
subitems = g_list_prepend( subitems, na_object_duplicate( it->data ));
}
subitems = g_slist_reverse( subitems );
subitems = g_list_reverse( subitems );
na_object_set_items( target, subitems );
na_object_free_items( subitems );
......@@ -841,7 +847,7 @@ static gboolean
object_are_equal( const NAObject *a, const NAObject *b )
{
gboolean equal = TRUE;
GSList *it;
GList *it;
NAObject *first_obj, *second_obj;
gchar *first_id, *second_id;
......@@ -862,7 +868,7 @@ object_are_equal( const NAObject *a, const NAObject *b )
}
if( equal ){
equal = ( g_slist_length( NA_OBJECT_ITEM( a )->private->items ) == g_slist_length( NA_OBJECT_ITEM( b )->private->items ));
equal = ( g_list_length( NA_OBJECT_ITEM( a )->private->items ) == g_list_length( NA_OBJECT_ITEM( b )->private->items ));
}
if( equal ){
......@@ -893,7 +899,7 @@ object_are_equal( const NAObject *a, const NAObject *b )
}
}
g_debug( "na_object_item_are_equal: %s", equal ? "True":"False" );
/*g_debug( "na_object_item_are_equal: %s", equal ? "True":"False" );*/
return( equal );
}
......@@ -904,7 +910,7 @@ static gboolean
object_is_valid( const NAObject *object )
{
gboolean valid = TRUE;
GSList *it;
GList *it;
g_return_val_if_fail( NA_IS_OBJECT_ITEM( object ), FALSE );
g_return_val_if_fail( !NA_OBJECT_ITEM( object )->private->dispose_has_run, FALSE );
......@@ -917,3 +923,20 @@ object_is_valid( const NAObject *object )
return( valid );
}
static gchar *
object_id_new_id( const NAObjectId *item )
{
uuid_t uuid;
gchar uuid_str[64];
gchar *new_uuid;
g_return_val_if_fail( NA_IS_OBJECT_ITEM( item ), NULL );
g_return_val_if_fail( !NA_OBJECT_ITEM( item )->private->dispose_has_run, NULL );
uuid_generate( uuid );
uuid_unparse_lower( uuid, uuid_str );
new_uuid = g_strdup( uuid_str );
return( new_uuid );
}
......@@ -83,9 +83,6 @@ static gboolean do_is_valid( const NAObject *object );
static void do_copy( NAObject *target, const NAObject *source );
static GSList *get_hierarchy( const NAObject *object );
static void free_hierarchy( GSList *hierarchy );
GType
na_object_get_type( void )
{
......@@ -257,9 +254,9 @@ na_object_object_dump( const NAObject *object )
static void
dump_hierarchy( const NAObject *object )
{
GSList *hierarchy, *ih;
GList *hierarchy, *ih;
hierarchy = get_hierarchy( object );
hierarchy = na_object_get_hierarchy( object );
for( ih = hierarchy ; ih ; ih = ih->next ){
if( NA_OBJECT_CLASS( ih->data )->dump ){
......@@ -267,7 +264,7 @@ dump_hierarchy( const NAObject *object )
}
}
free_hierarchy( hierarchy );
na_object_free_hierarchy( hierarchy );
}
static void
......@@ -302,12 +299,12 @@ static gchar *
most_derived_clipboard_id( const NAObject *object )
{
gchar *clipboard_id;
GSList *hierarchy, *ih;
GList *hierarchy, *ih;
gboolean found;
found = FALSE;
clipboard_id = NULL;
hierarchy = g_slist_reverse( get_hierarchy( object ));
hierarchy = g_list_reverse( na_object_get_hierarchy( object ));
for( ih = hierarchy ; ih && !found ; ih = ih->next ){
if( NA_OBJECT_CLASS( ih->data )->get_clipboard_id ){
......@@ -316,7 +313,7 @@ most_derived_clipboard_id( const NAObject *object )
}
}
free_hierarchy( hierarchy );
na_object_free_hierarchy( hierarchy );
return( clipboard_id );
}
......@@ -344,9 +341,9 @@ na_object_object_ref( const NAObject *object )
static void
ref_hierarchy( const NAObject *object )
{
GSList *hierarchy, *ih;
GList *hierarchy, *ih;
hierarchy = get_hierarchy( object );
hierarchy = na_object_get_hierarchy( object );
for( ih = hierarchy ; ih ; ih = ih->next ){
if( NA_OBJECT_CLASS( ih->data )->ref ){
......@@ -354,7 +351,7 @@ ref_hierarchy( const NAObject *object )
}
}
free_hierarchy( hierarchy );
na_object_free_hierarchy( hierarchy );
}
/**
......@@ -412,12 +409,12 @@ static NAObject *
most_derived_new( const NAObject *object )
{
NAObject *new_object;
GSList *hierarchy, *ih;
GList *hierarchy, *ih;
gboolean found;
found = FALSE;
new_object = NULL;
hierarchy = g_slist_reverse( get_hierarchy( object ));
hierarchy = g_list_reverse( na_object_get_hierarchy( object ));
for( ih = hierarchy ; ih && !found ; ih = ih->next ){
if( NA_OBJECT_CLASS( ih->data )->new ){
......@@ -426,7 +423,7 @@ most_derived_new( const NAObject *object )
}
}
free_hierarchy( hierarchy );
na_object_free_hierarchy( hierarchy );
return( new_object );
}
......@@ -463,9 +460,9 @@ iduplicable_copy( NAIDuplicable *target, const NAIDuplicable *source )
static void
copy_hierarchy( NAObject *target, const NAObject *source )
{
GSList *hierarchy, *ih;
GList *hierarchy, *ih;
hierarchy = get_hierarchy( source );
hierarchy = na_object_get_hierarchy( source );