FmAction: Libfm Reference Manual

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

## Functions

#define | FM_ACTION()
#define | FM_ACTION_CACHE()
#define | FM_ACTION_MENU()
FmActionCache * | fm_action_cache_new ()
FmActionMenu * | fm_action_get_for_context ()
FmActionMenu * | fm_action_get_for_location ()
FmActionMenu * | fm_action_get_for_toolbar ()
const char * | fm_action_get_startup_wm_class ()
const char * | fm_action_get_suggested_shortcut ()
const char * | fm_action_get_toolbar_label ()
const GList * | fm_action_menu_get_children ()

## Types and Values

#define | FM_TYPE_ACTION
#define | FM_TYPE_ACTION_CACHE
#define | FM_TYPE_ACTION_MENU
| FmAction
| FmActionCache
struct | FmActionCacheClass
struct | FmActionClass
| FmActionMenu
struct | FmActionMenuClass

## Object Hierarchy

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

## Implemented Interfaces

FmAction implements GAppInfo.

FmActionMenu implements GAppInfo.

## 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()

    #define             FM_ACTION(obj)

### FM_ACTION_CACHE()

    #define             FM_ACTION_CACHE(obj)

### FM_ACTION_MENU()

    #define             FM_ACTION_MENU(obj)

### 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

### 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_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_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_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

## Types and Values

### FM_TYPE_ACTION

    #define FM_TYPE_ACTION               (fm_action_get_type())

### FM_TYPE_ACTION_CACHE

    #define FM_TYPE_ACTION_CACHE         (fm_action_cache_get_type())

### FM_TYPE_ACTION_MENU

    #define FM_TYPE_ACTION_MENU          (fm_action_menu_get_type())

### FmAction

    typedef struct _FmAction FmAction;

### FmActionCache

    typedef struct _FmActionCache FmActionCache;

### struct FmActionCacheClass

    struct FmActionCacheClass {
        GObjectClass parent;
    };

#### Members

GObjectClass `parent`; | the parent class |

### struct FmActionClass

    struct FmActionClass {
        GObjectClass parent;
    };

#### Members

GObjectClass `parent`; | the parent class |

### FmActionMenu

    typedef struct _FmActionMenu FmActionMenu;

### struct FmActionMenuClass

    struct FmActionMenuClass {
        GObjectClass parent;
    };

#### Members

GObjectClass `parent`; | the parent class |