## ThunarActionManager ThunarActionManager — Manages creation and execution of menu-item |

## Functions

void | thunar_action_manager_activate_selected_files ()
void | thunar_action_manager_open_selected_folders ()
void | thunar_action_manager_set_widget ()
GtkWidget * | thunar_action_manager_get_widget ()
void | thunar_action_manager_append_accelerators ()
GtkWidget * | thunar_action_manager_append_menu_item ()
gboolean | thunar_action_manager_append_open_section ()
gboolean | thunar_action_manager_append_custom_actions ()
gboolean | thunar_action_manager_check_uca_key_activation ()
void | thunar_action_manager_action_mount ()
gboolean | thunar_action_manager_action_unmount ()
gboolean | thunar_action_manager_action_eject ()
void | thunar_action_manager_set_selection ()
gboolean | thunar_action_manager_action_empty_trash ()
gboolean | thunar_action_manager_action_restore ()
gboolean | thunar_action_manager_action_restore_and_show ()
void | thunar_action_manager_set_searching ()
XfceGtkActionEntry * | thunar_action_manager_get_action_entries ()

## Properties

gpointer | selected-device | Write
gpointer | selected-location | Write
GtkWidget * | widget | Write

## Signals

void | device-operation-finished | No Hooks
void | device-operation-started | No Hooks
void | new-files-created | No Hooks

## Types and Values

enum | ThunarActionManagerAction
enum | ThunarActionManagerFolderOpenAction
| XfceGtkActionEntry

## Object Hierarchy

        GObject
        ╰── ThunarActionManager

## Description

The ThunarActionManager class manages the creation and execution of menu-item which are used by multiple menus. The management is done in a central way to prevent code duplication on various places. XfceGtkActionEntry is used in order to define a list of the managed items and ease the setup of single items.

ThunarActionManager implements the ThunarNavigator interface in order to use the "open in new tab" and "change directory" service. It as well tracks the current directory via ThunarNavigator.

ThunarActionManager implements the ThunarComponent interface in order to track the currently selected files. Based on to the current selection (and some other criteria), some menu items will not be shown, or will be insensitive.

Files which are opened via ThunarActionManager are poked first in order to e.g do missing mount operations.

As well menu-item related services, like activation of selected files and opening tabs/new windows, are provided by ThunarActionManager.

It is required to keep an instance of ThunarActionManager open, in order to listen to accellerators which target menu-items managed by ThunarActionManager. Typically a single instance of ThunarActionManager is provided by each ThunarWindow.

## Functions

### thunar_action_manager_activate_selected_files ()

    void
    thunar_action_manager_activate_selected_files
                                   (ThunarActionManager *action_mgr,
                                    ThunarActionManagerFolderOpenAction action,
                                    GAppInfo *app_info);

Will try to open all selected files with the provided GAppInfo

#### Parameters

action_mgr | a ThunarActionManager instance |
action | the ThunarActionManagerFolderOpenAction to use, if there are folders among the selected files |
app_info | a GAppInfo instance |

### thunar_action_manager_open_selected_folders ()

    void
    thunar_action_manager_open_selected_folders
                                   (ThunarActionManager *action_mgr,
                                    gboolean open_in_tabs);

Will open each selected folder in a new tab/window

#### Parameters

action_mgr | a ThunarActionManager instance |
open_in_tabs | TRUE to open each folder in a new tab, FALSE to open each folder in a new window |

### thunar_action_manager_set_widget ()

    void
    thunar_action_manager_set_widget (ThunarActionManager *action_mgr,
                                      GtkWidget *widget);

Associates `action_mgr` with `widget` .

#### Parameters

action_mgr | a ThunarActionManager. |
widget | a GtkWidget or `NULL`. |

### thunar_action_manager_get_widget ()

    GtkWidget *
    thunar_action_manager_get_widget (ThunarActionManager *action_mgr);

Will return the parent widget of this ThunarActionManager

#### Parameters

action_mgr | a ThunarActionManager instance |

#### Returns

the parent widget of this ThunarActionManager.

[transfer none]

### thunar_action_manager_append_accelerators ()

    void
    thunar_action_manager_append_accelerators
                                   (ThunarActionManager *action_mgr,
                                    GtkAccelGroup *accel_group);

Connects all accelerators and corresponding default keys of this widget to the global accelerator list

#### Parameters

action_mgr | a ThunarActionManager. |
accel_group | a GtkAccelGroup to be used used for new menu items |

### thunar_action_manager_append_menu_item ()

    GtkWidget *
    thunar_action_manager_append_menu_item
                                   (ThunarActionManager *action_mgr,
                                    GtkMenuShell *menu,
                                    ThunarActionManagerAction action,
                                    gboolean force);

Adds the selected, widget specific GtkMenuItem to the passed GtkMenuShell

#### Parameters

action_mgr | Instance of a ThunarActionManager |
menu | GtkMenuShell to which the item should be added |
action | ThunarActionManagerAction to select which item should be added |
force | force to generate the item. If it cannot be used, it will be shown as insensitive |

#### Returns

The added GtkMenuItem.

[transfer none]

### thunar_action_manager_append_open_section ()

    gboolean
    thunar_action_manager_append_open_section
                                   (ThunarActionManager *action_mgr,
                                    GtkMenuShell *menu,
                                    gboolean support_tabs,
                                    gboolean support_change_directory,
                                    gboolean force);

Will append the section "open/open in new window/open in new tab/open with" to the provided GtkMenuShell

#### Parameters

action_mgr | a ThunarActionManager instance |
menu | GtkMenuShell on which the open section should be appended |
support_tabs | Set to TRUE if 'open in new tab' should be shown |
support_change_directory | Set to TRUE if 'open' should be shown |
force | Append the open section, even if the selected folder is the current folder |

#### Returns

TRUE if the section was added

### thunar_action_manager_append_custom_actions ()

    gboolean
    thunar_action_manager_append_custom_actions
                                   (ThunarActionManager *action_mgr,
                                    GtkMenuShell *menu);

Will append all custom actions which match the file-type to the provided GtkMenuShell

#### Parameters

action_mgr | a ThunarActionManager instance |
menu | GtkMenuShell on which the custom actions should be appended |

#### Returns

TRUE if any custom action was added

### thunar_action_manager_check_uca_key_activation ()

    gboolean
    thunar_action_manager_check_uca_key_activation
                                   (ThunarActionManager *action_mgr,
                                    GdkEventKey *key_event);

### thunar_action_manager_action_mount ()

    void
    thunar_action_manager_action_mount (ThunarActionManager *action_mgr);

Will mount the selected device, if any. The related folder will not be opened.

#### Parameters

action_mgr | a ThunarActionManager instance |

### thunar_action_manager_action_unmount ()

    gboolean
    thunar_action_manager_action_unmount (ThunarActionManager *action_mgr);

### thunar_action_manager_action_eject ()

    gboolean
    thunar_action_manager_action_eject (ThunarActionManager *action_mgr);

Will unmount the selected device, if any

#### Parameters

action_mgr | a ThunarActionManager instance |

### thunar_action_manager_set_selection ()

    void
    thunar_action_manager_set_selection (ThunarActionManager *action_mgr,
                                         GList *selected_thunar_files,
                                         ThunarDevice *selected_device,
                                         GFile *selected_location);

Will set the related items as "selection" and clear any previous selection. Note that always only one of the 3 "selected" arguments should be set.

#### Parameters

action_mgr | a ThunarActionManager instance |
selected_thunar_files | GList of selected ThunarFile instances, or NULL |
selected_device | selected ThunarDevice or NULL |
selected_location | selected GFile (possibly only holds an URI), or NULL |

### thunar_action_manager_action_empty_trash ()

    gboolean
    thunar_action_manager_action_empty_trash
                                   (ThunarActionManager *action_mgr);

### thunar_action_manager_action_restore ()

    gboolean
    thunar_action_manager_action_restore (ThunarActionManager *action_mgr);

### thunar_action_manager_action_restore_and_show ()

    gboolean
    thunar_action_manager_action_restore_and_show
                                   (ThunarActionManager *action_mgr);

### thunar_action_manager_set_searching ()

    void
    thunar_action_manager_set_searching (ThunarActionManager *action_mgr,
                                         gboolean b);

### thunar_action_manager_get_action_entries ()

    XfceGtkActionEntry *
    thunar_action_manager_get_action_entries
                                   (void);

## Types and Values

### enum ThunarActionManagerAction

#### Members

THUNAR_ACTION_MANAGER_ACTION_OPEN |  |
THUNAR_ACTION_MANAGER_ACTION_EXECUTE |  |
THUNAR_ACTION_MANAGER_ACTION_OPEN_IN_TAB |  |
THUNAR_ACTION_MANAGER_ACTION_OPEN_IN_WINDOW |  |
THUNAR_ACTION_MANAGER_ACTION_OPEN_LOCATION |  |
THUNAR_ACTION_MANAGER_ACTION_OPEN_WITH_OTHER |  |
THUNAR_ACTION_MANAGER_ACTION_SET_DEFAULT_APP |  |
THUNAR_ACTION_MANAGER_ACTION_SENDTO_MENU |  |
THUNAR_ACTION_MANAGER_ACTION_SENDTO_SHORTCUTS |  |
THUNAR_ACTION_MANAGER_ACTION_SENDTO_DESKTOP |  |
THUNAR_ACTION_MANAGER_ACTION_PROPERTIES |  |
THUNAR_ACTION_MANAGER_ACTION_MAKE_LINK |  |
THUNAR_ACTION_MANAGER_ACTION_DUPLICATE |  |
THUNAR_ACTION_MANAGER_ACTION_RENAME |  |
THUNAR_ACTION_MANAGER_ACTION_EMPTY_TRASH |  |
THUNAR_ACTION_MANAGER_ACTION_REMOVE_FROM_RECENT |  |
THUNAR_ACTION_MANAGER_ACTION_CREATE_FOLDER |  |
THUNAR_ACTION_MANAGER_ACTION_CREATE_DOCUMENT |  |
THUNAR_ACTION_MANAGER_ACTION_RESTORE |  |
THUNAR_ACTION_MANAGER_ACTION_RESTORE_SHOW |  |
THUNAR_ACTION_MANAGER_ACTION_MOVE_TO_TRASH |  |
THUNAR_ACTION_MANAGER_ACTION_DELETE |  |
THUNAR_ACTION_MANAGER_ACTION_TRASH_DELETE |  |
THUNAR_ACTION_MANAGER_ACTION_PASTE |  |
THUNAR_ACTION_MANAGER_ACTION_PASTE_INTO_FOLDER |  |
THUNAR_ACTION_MANAGER_ACTION_COPY |  |
THUNAR_ACTION_MANAGER_ACTION_CUT |  |
THUNAR_ACTION_MANAGER_ACTION_MOUNT |  |
THUNAR_ACTION_MANAGER_ACTION_UNMOUNT |  |
THUNAR_ACTION_MANAGER_ACTION_EJECT |  |
THUNAR_ACTION_MANAGER_ACTION_EDIT_LAUNCHER |  |
THUNAR_ACTION_MANAGER_N_ACTIONS |  |

### enum ThunarActionManagerFolderOpenAction

#### Members

THUNAR_ACTION_MANAGER_CHANGE_DIRECTORY |  |
THUNAR_ACTION_MANAGER_OPEN_AS_NEW_TAB |  |
THUNAR_ACTION_MANAGER_OPEN_AS_NEW_WINDOW |  |
THUNAR_ACTION_MANAGER_NO_ACTION |  |

### XfceGtkActionEntry

    typedef struct _XfceGtkActionEntry XfceGtkActionEntry;

## Property Details

### The `“selected-device”` property

      “selected-device”          gpointer

selected-device.

Owner: ThunarActionManager

Flags: Write

### The `“selected-location”` property

      “selected-location”        gpointer

selected-location.

Owner: ThunarActionManager

Flags: Write

### The `“widget”` property

      “widget”                   GtkWidget *

The GtkWidget with which this action manager is associated.

Owner: ThunarActionManager

Flags: Write

## Signal Details

### The `“device-operation-finished”` signal

    void
    user_function (ThunarActionManager *action_mgr,
                   ThunarDevice        *device,
                   gpointer             user_data)

This signal is emitted by the `action_mgr` right after the device operation (mount/unmount/eject) is finished

#### Parameters

action_mgr | a ThunarActionManager |
device | the ThunarDevice on which the operation was finished |
user_data | user data set when the signal handler was connected. |

Flags: No Hooks

### The `“device-operation-started”` signal

    void
    user_function (ThunarActionManager *action_mgr,
                   ThunarDevice        *device,
                   gpointer             user_data)

This signal is emitted by the `action_mgr` right after the device operation (mount/unmount/eject) is started

#### Parameters

action_mgr | a ThunarActionManager |
device | the ThunarDevice on which the operation was finished |
user_data | user data set when the signal handler was connected. |

Flags: No Hooks

### The `“new-files-created”` signal

    void
    user_function (ThunarActionManager *action_mgr,
                   gpointer             files,
                   gpointer             user_data)

This signal is emitted by the `action_mgr` whenever new files were created (e.g. via "rename", "create" or "paste")

#### Parameters

action_mgr | a ThunarActionManager |
files | a GList of ThunarFiles which were created |
user_data | user data set when the signal handler was connected. |

Flags: No Hooks