ThunarxMenuProvider

ThunarxMenuProvider — The interface to extensions that provide additional menu items

Functions

Types and Values

Object Hierarchy

    GInterface
    ╰── ThunarxMenuProvider

Prerequisites

ThunarxMenuProvider requires GObject.

Includes

#include <thunarx/thunarx.h>

Description

The ThunarxMenuProvider interface is implemented by extensions which provide additional menu items that should be displayed in the file or folder context menus for certain types of files.

Extensions that implement this interface should do its best to respond as fast as possible to method invokations by the file manager. That said, when the file manager calls the thunarx_menu_provider_get_file_menu_items() or the thunarx_menu_provider_get_folder_menu_items() method, the implementation in the extension should use only the thunarx_file_info_has_mime_type() and thunarx_file_info_is_directory() methods to determine the menu items that should be added to the file manager's context menu. Don't perform any complicated I/O to determine the menu items list, as that would block the whole file manager process.

The name of ThunarxMenuItems returned from the thunarx_menu_provider_get_file_menu_items() and thunarx_menu_provider_get_folder_menu_items() methods must be namespaced with the module to avoid collision with internal file manager menu items and menu items provided by other extensions. For example, the menu item provided by the ThunarOpenTerminal extension should be called ThunarOpenTerminal::open-terminal.

Functions

thunarx_menu_provider_get_file_menu_items ()

GList *
thunarx_menu_provider_get_file_menu_items
                               (ThunarxMenuProvider *provider,
                                GtkWidget *window,
                                GList *files);

Returns the list of ThunarxMenuItems that provider has to offer for files .

As a special note, this method automatically takes a reference on the provider for every ThunarxMenuItem object returned from the real implementation of this method in provider . This is to make sure that the extension stays in memory for at least the time that the menu items are used. If the extension wants to stay in memory for a longer time, it'll need to take care of this itself (e.g. by taking an additional reference on the provider itself, that's released at a later time).

The caller is responsible to free the returned list of menu items using something like this when no longer needed:

1
g_list_free_full (list, g_object_unref);

[skip]

Parameters

provider

a ThunarxMenuProvider.

 

window

the GtkWindow within which the menu items will be used.

 

files

the list of ThunarxFileInfos to which the menu items will be applied.

[element-type ThunarxFileInfo]

Returns

the list of ThunarxMenuItems that provider has to offer for files .

[transfer full][element-type ThunarxMenuItem]


thunarx_menu_provider_get_folder_menu_items ()

GList *
thunarx_menu_provider_get_folder_menu_items
                               (ThunarxMenuProvider *provider,
                                GtkWidget *window,
                                ThunarxFileInfo *folder);

Returns the list of ThunarxMenuItems that provider has to offer for folder .

As a special note, this method automatically takes a reference on the provider for every ThunarxMenuItem object returned from the real implementation of this method in provider . This is to make sure that the extension stays in memory for at least the time that the menu items are used. If the extension wants to stay in memory for a longer time, it'll need to take care of this itself (e.g. by taking an additional reference on the provider itself, that's released at a later time).

The caller is responsible to free the returned list of menu items using something like this when no longer needed:

1
g_list_free_full (list, g_object_unref);

[skip]

Parameters

provider

a ThunarxMenuProvider.

 

window

the GtkWindow within which the menu items will be used.

 

folder

the folder to which the menu items should will be applied.

 

Returns

the list of ThunarxMenuItems that provider has to offer for folder .

[transfer full][element-type ThunarxMenuItem]


thunarx_menu_provider_get_dnd_menu_items ()

GList *
thunarx_menu_provider_get_dnd_menu_items
                               (ThunarxMenuProvider *provider,
                                GtkWidget *window,
                                ThunarxFileInfo *folder,
                                GList *files);

Returns the list of ThunarxMenuItems that provider has to offer for dropping the files into the folder . For example, the thunar-archive-plugin provides Extract Here menu items when dropping archive files into a folder that is writable by the user.

As a special note, this method automatically takes a reference on the provider for every ThunarxMenuItem object returned from the real implementation of this method in provider . This is to make sure that the extension stays in memory for at least the time that the menu items are used. If the extension wants to stay in memory for a longer time, it'll need to take care of this itself (e.g. by taking an additional reference on the provider itself, that's released at a later time).

The caller is responsible to free the returned list of menu items using something like this when no longer needed:

1
g_list_free_full (list, g_object_unref);

[skip]

Parameters

provider

a ThunarxMenuProvider.

 

window

the GtkWindow within which the menu items will be used.

 

folder

the folder into which the files are being dropped

 

files

the list of ThunarxFileInfos for the files that are being dropped to folder in window .

[element-type ThunarxFileInfo]

Returns

the list of ThunarxMenuItems that provider has to offer for dropping files to folder .

[transfer full][element-type ThunarxMenuItem]

Since: 0.4.1

Types and Values

struct ThunarxMenuProviderIface

struct ThunarxMenuProviderIface {
  GList *(*get_file_menu_items)    (ThunarxMenuProvider *provider,
                                    GtkWidget           *window,
                                    GList               *files);

  GList *(*get_folder_menu_items)  (ThunarxMenuProvider *provider,
                                    GtkWidget           *window,
                                    ThunarxFileInfo     *folder);

  GList *(*get_dnd_menu_items)     (ThunarxMenuProvider *provider,
                                    GtkWidget           *window,
                                    ThunarxFileInfo     *folder,
                                    GList               *files);
};

Interface with virtual methods implemented by extensions that provide additional menu items for the file manager's context menus. Providers don't need to implement all of the virtual methods listed in the interface.

Members

get_file_menu_items ()

See thunarx_menu_provider_get_file_menu_items().

 

get_folder_menu_items ()

See thunarx_menu_provider_get_folder_menu_items().

 

get_dnd_menu_items ()

See thunarx_menu_provider_get_dnd_menu_items().

 

ThunarxMenuProvider

typedef struct _ThunarxMenuProvider ThunarxMenuProvider;