## FmAction

FmAction — Support for DES-EMA extension for menus and actions.

## Functions

FmActionMenu * | fm_action_get_for_context ()
FmActionMenu * | fm_action_get_for_location ()
FmActionMenu * | fm_action_get_for_toolbar ()
const GList * | fm_action_menu_get_children ()
const char * | fm_action_get_suggested_shortcut ()
const char * | fm_action_get_toolbar_label ()
const char * | fm_action_get_startup_wm_class ()
FmActionCache * | fm_action_cache_new ()

## Object Hierarchy

        GObject
        ├── FmAction
        ├── FmActionCache
        ╰── FmActionMenu

## Description

`include` : libfm/fm.h

The FmActionCache object represents a cache for user-defined menus and actions that can be used in the file manager.

## Functions

### fm_action_get_for_context ()

    FmActionMenu *
    fm_action_get_for_context (FmActionCache *cache,
                               FmFileInfo *location,
                               FmFileInfoList *files);

Checks for files in `cache` that mets conditions and returns the list. Returned menu should be freed using `g_object_unref()`. Note that every g_app_info_launch*() call on any of items found in the menu will be always done against `files` and arguments of such call will be always ignored, therefore you should never launch any items found in the menu after you free it or otherwise your call will fail.

#### Parameters

cache | actions cache |
location | path to current directory |
files | list of files for context menu |

#### Returns

list of found actions.

[transfer full]

Since: 1.3.0

### fm_action_get_for_location ()

    FmActionMenu *
    fm_action_get_for_location (FmActionCache *cache,
                                FmFileInfo *location);

Checks for files in `cache` that mets conditions and returns the list. Only actions that targetted `location` are returned. Returned menu should be freed using `g_object_unref()`. Note that every g_app_info_launch*() call on any of items found in the menu will be always done against `location` and arguments of such call will be always ignored.

#### Parameters

cache | actions cache |
location | path to current directory |

#### Returns

list of found actions.

[transfer full]

Since: 1.3.0

### fm_action_get_for_toolbar ()

    FmActionMenu *
    fm_action_get_for_toolbar (FmActionCache *cache,
                               FmFileInfo *location);

Checks for files in `cache` that mets conditions and returns the list. Only actions that target toolbar are returned. Returned menu should be freed using `g_object_unref()`. Note that every g_app_info_launch*() call on any of items found in the menu will be always done against `location` and arguments of such call will be always ignored.

#### Parameters

cache | actions cache |
location | path to current directory |

#### Returns

list of found actions.

[transfer full]

Since: 1.3.0

### fm_action_menu_get_children ()

    const GList *
    fm_action_menu_get_children (FmActionMenu *menu);

Returns list of elements that belong to this menu. If an element is `NULL` then element is a separator. Otherwise element may be either FmAction or FmActionMenu. Returned list owned by `menu` and should not be freed by caller.

#### Parameters

menu | an action menu |

#### Returns

list of `menu` elements.

[transfer none][element-type GAppInfo]

Since: 1.3.0

### fm_action_get_suggested_shortcut ()

    const char *
    fm_action_get_suggested_shortcut (FmAction *action);

Returns suggested keyboard shortcut for `action` if available. The format may look like "<Control>a" or "<Shift><Alt>F1".

#### Parameters

action | an action |

#### Returns

keyboard shortcut string.

[transfer none]

Since: 1.3.0

### fm_action_get_toolbar_label ()

    const char *
    fm_action_get_toolbar_label (FmAction *action);

Returns toolbar label for `action` or `NULL` if not defined.

#### Parameters

action | an action |

#### Returns

toolbar label.

[transfer none]

Since: 1.3.0

### fm_action_get_startup_wm_class ()

    const char *
    fm_action_get_startup_wm_class (FmAction *action);

Returns startup WM class for `action` or `NULL` if not defined.

#### Parameters

action | an action |

#### Returns

startup WM class.

[transfer none]

Since: 1.3.0

### fm_action_cache_new ()

    FmActionCache *
    fm_action_cache_new (void);

Creates and initializes an FmActionCache object, or returns a reference for existing one if it was already created. Newly created cache will be collected on idle if not requested right away (what is highly unlikely).

#### Returns

a cache object.

[transfer full]

Since: 1.3.0