## FMAObjectItem FMAObjectItem — The Object Item Base Class Definition |

## Functions

#define | FMA_OBJECT_ITEM()
#define | FMA_IS_OBJECT_ITEM()
gboolean | fma_object_item_is_finally_writable ()
void | fma_object_item_set_writability_status ()
FMAObjectId * | fma_object_item_get_item ()
gint | fma_object_item_get_position ()
void | fma_object_item_append_item ()
void | fma_object_item_insert_at ()
void | fma_object_item_insert_item ()
void | fma_object_item_remove_item ()
guint | fma_object_item_get_items_count ()
void | fma_object_item_count_items ()
GList * | fma_object_item_copyref_items ()
GList * | fma_object_item_free_items ()
void | fma_object_item_rebuild_children_slist ()
void | fma_object_item_deals_with_version ()

## Types and Values

#define | FMA_TYPE_OBJECT_ITEM
| FMAObjectItem
enum | FMAItemTarget

## Includes

    #include <filemanager-actions/fma-object-item.h>

## Description

This is a pure virtual class, i.e. not an instantiatable one, but serves as the base class for FMAObjectAction and FMAObjectMenu.

## Functions

### FMA_OBJECT_ITEM()

    #define FMA_OBJECT_ITEM( object )           ( G_TYPE_CHECK_INSTANCE_CAST( object, FMA_TYPE_OBJECT_ITEM, FMAObjectItem ))

### FMA_IS_OBJECT_ITEM()

    #define FMA_IS_OBJECT_ITEM( object )        ( G_TYPE_CHECK_INSTANCE_TYPE( object, FMA_TYPE_OBJECT_ITEM ))

### fma_object_item_is_finally_writable ()

    gboolean
    fma_object_item_is_finally_writable (const FMAObjectItem *item,
                                         guint *reason);

#### Parameters

item | this FMAObjectItem -derived object. |
reason | if not `NULL`, a pointer to a guint which will hold the reason code. |

#### Returns

the writability status of the `item` .

Since: 3.1

### fma_object_item_set_writability_status ()

    void
    fma_object_item_set_writability_status
                                   (FMAObjectItem *item,
                                    gboolean writable,
                                    guint reason);

Set the writability status of the `item` .

#### Parameters

item | this FMAObjectItem -derived object. |
writable | whether the item is finally writable. |
reason | the reason code. |

Since: 3.1

### fma_object_item_get_item ()

    FMAObjectId *
    fma_object_item_get_item (const FMAObjectItem *item,
                              const gchar *id);

#### Parameters

item | the FMAObjectItem from which we want retrieve a subitem. |
id | the id of the searched subitem. |

#### Returns

a pointer to the FMAObjectId -derived child with the required id.

The returned FMAObjectId is owned by the `item` object ; the caller should not try to `g_free()` nor `g_object_unref()` it.

Since: 2.30

### fma_object_item_get_position ()

    gint
    fma_object_item_get_position (const FMAObjectItem *item,
                                  const FMAObjectId *child);

#### Parameters

item | this FMAObjectItem object. |
child | a FMAObjectId -derived child. |

#### Returns

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

Since: 2.30

### fma_object_item_append_item ()

    void
    fma_object_item_append_item (FMAObjectItem *item,
                                 const FMAObjectId *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` .

#### Parameters

item | the FMAObjectItem to which add the subitem. |
child | a FMAObjectId to be added to list of subitems. |

Since: 2.30

### fma_object_item_insert_at ()

    void
    fma_object_item_insert_at (FMAObjectItem *item,
                               const FMAObjectId *child,
                               gint pos);

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

Doesn't modify the reference count on `child` .

#### Parameters

item | the FMAObjectItem in which add the subitem. |
child | a FMAObjectId -derived to be inserted in the list of subitems. |
pos | the position at which the `child` should be inserted. |

Since: 2.30

### fma_object_item_insert_item ()

    void
    fma_object_item_insert_item (FMAObjectItem *item,
                                 const FMAObjectId *child,
                                 const FMAObjectId *before);

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

Doesn't modify the reference count on `child` .

#### Parameters

item | the FMAObjectItem to which add the subitem. |
child | a FMAObjectId to be inserted in the list of subitems. |
before | the FMAObjectId before which the `child` should be inserted. |

Since: 2.30

### fma_object_item_remove_item ()

    void
    fma_object_item_remove_item (FMAObjectItem *item,
                                 const FMAObjectId *child);

Removes a `child` from the list of subitems of `item` .

Doesn't modify the reference count on `child` .

#### Parameters

item | the FMAObjectItem from which the subitem must be removed. |
child | a FMAObjectId -derived to be removed from the list of subitems. |

Since: 2.30

### fma_object_item_get_items_count ()

    guint
    fma_object_item_get_items_count (const FMAObjectItem *item);

#### Parameters

item | the FMAObjectItem from which we want a count of subitems. |

#### Returns

the count of subitems of `item` .

Since: 2.30

### fma_object_item_count_items ()

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

#### Parameters

items | a list if FMAObject -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. |

#### Returns

the 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.

Since: 2.30

### fma_object_item_copyref_items ()

    GList *
    fma_object_item_copyref_items (GList *items);

Creates a copy of the provided list, recursively incrementing the reference count of FMAObjects.

#### Parameters

items | a list of FMAObject -derived items. |

#### Returns

the new list, which should be `fma_object_free_items()` by the caller.

Since: 3.1

### fma_object_item_free_items ()

    GList *
    fma_object_item_free_items (GList *items);

Free the items list.

#### Parameters

items | a list of FMAObject -derived items. |

#### Returns

a `NULL` pointer.

Since: 3.1

### fma_object_item_rebuild_children_slist ()

    void
    fma_object_item_rebuild_children_slist
                                   (FMAObjectItem *item);

Rebuild the string list of children.

#### Parameters

item | this FMAObjectItem -derived object. |

Since: 2.30

### fma_object_item_deals_with_version ()

    void
    fma_object_item_deals_with_version (FMAObjectItem *item);

Just after the `item` has been read from FMAIFactoryProvider, setup the version. This is needed because some conversions may occur in this object.

Note that there is only some 2.x versions where the version string was not systematically written. If `item` has been read from a .desktop file, then iversion is already set to (at least) 3.

#### Parameters

item | this FMAObjectItem -derived object. |

Since: 2.30

## Types and Values

### FMA_TYPE_OBJECT_ITEM

    #define FMA_TYPE_OBJECT_ITEM                ( fma_object_item_get_type())

### FMAObjectItem

    typedef struct {
    } FMAObjectItem;

### enum FMAItemTarget

The FMAItemTarget mode is driven by the file manager. It determines in which part of the file manager UI our actions will be displayed.

#### Members

ITEM_TARGET_SELECTION | when targeting the selection context menu. |
ITEM_TARGET_LOCATION | when targeting the background context menu. |
ITEM_TARGET_TOOLBAR | when targeting the toolbar. |
ITEM_TARGET_ANY | a wilcard target defined in order to be able to activate an action from a keyboard shortcut, while keeping this same action hidden from the UI. |