NAObjectItem

NAObjectItem

Synopsis

#define             NA_OBJECT_ITEM_TYPE
typedef             NAObjectItemPrivate;
typedef             NAObjectItemClassPrivate;
                    NAObjectItem;
gboolean            na_object_item_are_equal            (const NAObjectItem *a,
                                                         const NAObjectItem *b);
NAObjectId *        na_object_item_get_item             (const NAObjectItem *item,
                                                         const gchar *id);
gint                na_object_item_get_position         (const NAObjectItem *item,
                                                         const NAObjectId *child);
void                na_object_item_append_item          (NAObjectItem *item,
                                                         const NAObjectId *child);
void                na_object_item_insert_at            (NAObjectItem *item,
                                                         const NAObjectId *child,
                                                         gint pos);
void                na_object_item_insert_item          (NAObjectItem *item,
                                                         const NAObjectId *child,
                                                         const NAObjectId *before);
void                na_object_item_remove_item          (NAObjectItem *item,
                                                         const NAObjectId *child);
guint               na_object_item_get_items_count      (const NAObjectItem *item);
void                na_object_item_count_items          (GList *items,
                                                         gint *menus,
                                                         gint *actions,
                                                         gint *profiles,
                                                         gboolean recurse);
void                na_object_item_unref_items          (GList *items);
void                na_object_item_unref_items_rec      (GList *items);
void                na_object_item_rebuild_children_slist
                                                        (NAObjectItem *item);

Object Hierarchy

  GObject
   +----NAObject
         +----NAObjectId
               +----NAObjectItem
                     +----NAObjectMenu
                     +----NAObjectAction

Implemented Interfaces

NAObjectItem implements NAIDuplicable.

Description

Details

NA_OBJECT_ITEM_TYPE

#define NA_OBJECT_ITEM_TYPE					( na_object_item_get_type())


NAObjectItemPrivate

typedef struct NAObjectItemPrivate      NAObjectItemPrivate;


NAObjectItemClassPrivate

typedef struct NAObjectItemClassPrivate NAObjectItemClassPrivate;


NAObjectItem

typedef struct _NAObjectItem NAObjectItem;


na_object_item_are_equal ()

gboolean            na_object_item_are_equal            (const NAObjectItem *a,
                                                         const NAObjectItem *b);

a :

the first (original) NAObjectItem instance.

b :

the second NAObjectItem instance.

Returns :

TRUE if a is equal to b. This function participates to the #na_iduplicable_check_status() stack, and is triggered after all comparable elementary data (in NAIFactoryObject sense) have already been successfully compared. We have to deal here with the subitems: comparing children by their ids between a and b. Note that, when called from na_object_check_status, the status of children have already been checked, and so we should be able to rely on them.

na_object_item_get_item ()

NAObjectId *        na_object_item_get_item             (const NAObjectItem *item,
                                                         const gchar *id);

item :

the NAObjectItem from which we want retrieve a subitem.

id :

the id of the searched subitem.

Returns :

a pointer to the NAObjectId-derived child with the required id. The returned NAObjectId is owned by the item object ; the caller should not try to g_free() nor g_object_unref() it.

na_object_item_get_position ()

gint                na_object_item_get_position         (const NAObjectItem *item,
                                                         const NAObjectId *child);

item :

this NAObjectItem object.

child :

a NAObjectId-derived child.

Returns :

the position of child in the subitems list of item, starting from zero, or -1 if not found.

na_object_item_append_item ()

void                na_object_item_append_item          (NAObjectItem *item,
                                                         const NAObjectId *child);

Appends a new child to the list of subitems of item, and setup the parent pointer of the child to its new parent.

Doesn't modify the reference count on object.

item :

the NAObjectItem to which add the subitem.

child :

a NAObjectId to be added to list of subitems.

na_object_item_insert_at ()

void                na_object_item_insert_at            (NAObjectItem *item,
                                                         const NAObjectId *child,
                                                         gint pos);

Inserts a new child in the list of subitems of item.

Doesn't modify the reference count on child.

item :

the NAObjectItem in which add the subitem.

child :

a NAObjectId-derived to be inserted in the list of subitems.

pos :

the position at which the child should be inserted.

na_object_item_insert_item ()

void                na_object_item_insert_item          (NAObjectItem *item,
                                                         const NAObjectId *child,
                                                         const NAObjectId *before);

Inserts a new child in the list of subitems of item.

Doesn't modify the reference count on child.

item :

the NAObjectItem to which add the subitem.

child :

a NAObjectId to be inserted in the list of subitems.

before :

the NAObjectId before which the child should be inserted.

na_object_item_remove_item ()

void                na_object_item_remove_item          (NAObjectItem *item,
                                                         const NAObjectId *child);

Removes a child from the list of subitems of item.

Doesn't modify the reference count on child.

item :

the NAObjectItem from which the subitem must be removed.

child :

a NAObjectId-derived to be removed from the list of subitems.

na_object_item_get_items_count ()

guint               na_object_item_get_items_count      (const NAObjectItem *item);

item :

the NAObjectItem from which we want a count of subitems.

Returns :

the count of subitems of item.

na_object_item_count_items ()

void                na_object_item_count_items          (GList *items,
                                                         gint *menus,
                                                         gint *actions,
                                                         gint *profiles,
                                                         gboolean recurse);

Count the numbers of items if the provided list.

As this function is recursive, the counters should be initialized by the caller before calling it.

items :

a list if NAObject-derived to be counted.

menus :

will be set to the count of menus.

actions :

will be set to the count of actions.

profiles :

will be set to the count of profiles.

recurse :

whether to recursively count all items, or only those in level zero of the list.

na_object_item_unref_items ()

void                na_object_item_unref_items          (GList *items);

Unref only the first level the NAObject of the list, freeing the list at last.

This is rather only used by NAPivot.

items :

a list of NAObject-derived items.

na_object_item_unref_items_rec ()

void                na_object_item_unref_items_rec      (GList *items);

Recursively unref the NAObject's of the list, freeing the list at last.

This is heavily used by NACT.

items :

a list of NAObject-derived items.

na_object_item_rebuild_children_slist ()

void                na_object_item_rebuild_children_slist
                                                        (NAObjectItem *item);

Rebuild the string list of children.

item :

this NAObjectItem-derived object.