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

## Functions

void | thunar_launcher_activate_selected_files ()
void | thunar_launcher_open_selected_folders ()
void | thunar_launcher_set_widget ()
GtkWidget * | thunar_launcher_get_widget ()
void | thunar_launcher_append_accelerators ()
GtkWidget * | thunar_launcher_append_menu_item ()
gboolean | thunar_launcher_append_open_section ()
gboolean | thunar_launcher_append_custom_actions ()
gboolean | thunar_launcher_check_uca_key_activation ()
void | thunar_launcher_action_mount ()
gboolean | thunar_launcher_action_unmount ()
gboolean | thunar_launcher_action_eject ()
void | thunar_launcher_set_selection ()
gboolean | thunar_launcher_action_empty_trash ()
gboolean | thunar_launcher_action_restore ()
gboolean | thunar_launcher_action_restore_and_show ()
void | thunar_launcher_set_searching ()
XfceGtkActionEntry * | thunar_launcher_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 | ThunarLauncherAction
enum | ThunarLauncherFolderOpenAction
| XfceGtkActionEntry

## Object Hierarchy

        GObject
        ╰── ThunarLauncher

## Description

The ThunarLauncher 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.

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

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

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

## Functions

### thunar_launcher_activate_selected_files ()

    void
    thunar_launcher_activate_selected_files
                                   (ThunarLauncher *launcher,
                                    ThunarLauncherFolderOpenAction action,
                                    GAppInfo *app_info);

Will try to open all selected files with the provided GAppInfo

#### Parameters

launcher | a ThunarLauncher instance |
action | the ThunarLauncherFolderOpenAction to use, if there are folders among the selected files |
app_info | a GAppInfo instance |

### thunar_launcher_open_selected_folders ()

    void
    thunar_launcher_open_selected_folders (ThunarLauncher *launcher,
                                           gboolean open_in_tabs);

Will open each selected folder in a new tab/window

#### Parameters

launcher | a ThunarLauncher instance |
open_in_tabs | TRUE to open each folder in a new tab, FALSE to open each folder in a new window |

### thunar_launcher_set_widget ()

    void
    thunar_launcher_set_widget (ThunarLauncher *launcher,
                                GtkWidget *widget);

Associates `launcher` with `widget` .

#### Parameters

launcher | a ThunarLauncher. |
widget | a GtkWidget or `NULL`. |

### thunar_launcher_get_widget ()

    GtkWidget *
    thunar_launcher_get_widget (ThunarLauncher *launcher);

Will return the parent widget of this ThunarLauncher

#### Parameters

launcher | a ThunarLauncher instance |

#### Returns

the parent widget of this ThunarLauncher.

[transfer none]

### thunar_launcher_append_accelerators ()

    void
    thunar_launcher_append_accelerators (ThunarLauncher *launcher,
                                         GtkAccelGroup *accel_group);

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

#### Parameters

launcher | a ThunarLauncher. |
accel_group | a GtkAccelGroup to be used used for new menu items |

### thunar_launcher_append_menu_item ()

    GtkWidget *
    thunar_launcher_append_menu_item (ThunarLauncher *launcher,
                                      GtkMenuShell *menu,
                                      ThunarLauncherAction action,
                                      gboolean force);

Adds the selected, widget specific GtkMenuItem to the passed GtkMenuShell

#### Parameters

launcher | Instance of a ThunarLauncher |
menu | GtkMenuShell to which the item should be added |
action | ThunarLauncherAction 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_launcher_append_open_section ()

    gboolean
    thunar_launcher_append_open_section (ThunarLauncher *launcher,
                                         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

launcher | a ThunarLauncher 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_launcher_append_custom_actions ()

    gboolean
    thunar_launcher_append_custom_actions (ThunarLauncher *launcher,
                                           GtkMenuShell *menu);

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

#### Parameters

launcher | a ThunarLauncher instance |
menu | GtkMenuShell on which the custom actions should be appended |

#### Returns

TRUE if any custom action was added

### thunar_launcher_check_uca_key_activation ()

    gboolean
    thunar_launcher_check_uca_key_activation
                                   (ThunarLauncher *launcher,
                                    GdkEventKey *key_event);

### thunar_launcher_action_mount ()

    void
    thunar_launcher_action_mount (ThunarLauncher *launcher);

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

#### Parameters

launcher | a ThunarLauncher instance |

### thunar_launcher_action_unmount ()

    gboolean
    thunar_launcher_action_unmount (ThunarLauncher *launcher);

### thunar_launcher_action_eject ()

    gboolean
    thunar_launcher_action_eject (ThunarLauncher *launcher);

Will unmount the selected device, if any

#### Parameters

launcher | a ThunarLauncher instance |

### thunar_launcher_set_selection ()

    void
    thunar_launcher_set_selection (ThunarLauncher *launcher,
                                   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

launcher | a ThunarLauncher 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_launcher_action_empty_trash ()

    gboolean
    thunar_launcher_action_empty_trash (ThunarLauncher *launcher);

### thunar_launcher_action_restore ()

    gboolean
    thunar_launcher_action_restore (ThunarLauncher *launcher);

### thunar_launcher_action_restore_and_show ()

    gboolean
    thunar_launcher_action_restore_and_show
                                   (ThunarLauncher *launcher);

### thunar_launcher_set_searching ()

    void
    thunar_launcher_set_searching (ThunarLauncher *launcher,
                                   gboolean b);

### thunar_launcher_get_action_entries ()

    XfceGtkActionEntry *
    thunar_launcher_get_action_entries (void);

## Types and Values

### enum ThunarLauncherAction

#### Members

THUNAR_LAUNCHER_ACTION_OPEN |  |
THUNAR_LAUNCHER_ACTION_EXECUTE |  |
THUNAR_LAUNCHER_ACTION_OPEN_IN_TAB |  |
THUNAR_LAUNCHER_ACTION_OPEN_IN_WINDOW |  |
THUNAR_LAUNCHER_ACTION_OPEN_LOCATION |  |
THUNAR_LAUNCHER_ACTION_OPEN_WITH_OTHER |  |
THUNAR_LAUNCHER_ACTION_SET_DEFAULT_APP |  |
THUNAR_LAUNCHER_ACTION_SENDTO_MENU |  |
THUNAR_LAUNCHER_ACTION_SENDTO_SHORTCUTS |  |
THUNAR_LAUNCHER_ACTION_SENDTO_DESKTOP |  |
THUNAR_LAUNCHER_ACTION_PROPERTIES |  |
THUNAR_LAUNCHER_ACTION_MAKE_LINK |  |
THUNAR_LAUNCHER_ACTION_DUPLICATE |  |
THUNAR_LAUNCHER_ACTION_RENAME |  |
THUNAR_LAUNCHER_ACTION_EMPTY_TRASH |  |
THUNAR_LAUNCHER_ACTION_REMOVE_FROM_RECENT |  |
THUNAR_LAUNCHER_ACTION_CREATE_FOLDER |  |
THUNAR_LAUNCHER_ACTION_CREATE_DOCUMENT |  |
THUNAR_LAUNCHER_ACTION_RESTORE |  |
THUNAR_LAUNCHER_ACTION_RESTORE_SHOW |  |
THUNAR_LAUNCHER_ACTION_MOVE_TO_TRASH |  |
THUNAR_LAUNCHER_ACTION_DELETE |  |
THUNAR_LAUNCHER_ACTION_TRASH_DELETE |  |
THUNAR_LAUNCHER_ACTION_PASTE |  |
THUNAR_LAUNCHER_ACTION_PASTE_INTO_FOLDER |  |
THUNAR_LAUNCHER_ACTION_COPY |  |
THUNAR_LAUNCHER_ACTION_CUT |  |
THUNAR_LAUNCHER_ACTION_MOUNT |  |
THUNAR_LAUNCHER_ACTION_UNMOUNT |  |
THUNAR_LAUNCHER_ACTION_EJECT |  |
THUNAR_LAUNCHER_N_ACTIONS |  |

### enum ThunarLauncherFolderOpenAction

#### Members

THUNAR_LAUNCHER_CHANGE_DIRECTORY |  |
THUNAR_LAUNCHER_OPEN_AS_NEW_TAB |  |
THUNAR_LAUNCHER_OPEN_AS_NEW_WINDOW |  |
THUNAR_LAUNCHER_NO_ACTION |  |

### XfceGtkActionEntry

    typedef struct _XfceGtkActionEntry XfceGtkActionEntry;

## Property Details

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

      “selected-device”          gpointer

selected-device.

Owner: ThunarLauncher

Flags: Write

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

      “selected-location”        gpointer

selected-location.

Owner: ThunarLauncher

Flags: Write

### The `“widget”` property

      “widget”                   GtkWidget *

The GtkWidget with which this launcher is associated.

Owner: ThunarLauncher

Flags: Write

## Signal Details

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

    void
    user_function (ThunarLauncher *launcher,
                   ThunarDevice   *device,
                   gpointer        user_data)

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

#### Parameters

launcher | a ThunarLauncher |
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 (ThunarLauncher *launcher,
                   ThunarDevice   *device,
                   gpointer        user_data)

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

#### Parameters

launcher | a ThunarLauncher |
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 (ThunarLauncher *launcher,
                   gpointer        files,
                   gpointer        user_data)

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

#### Parameters

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

Flags: No Hooks