<!-- ##### SECTION Title ##### -->
ThunarxMenuProvider

<!-- ##### SECTION Short_Description ##### -->
The interface to extensions that provide additional menu items

<!-- ##### SECTION Long_Description ##### -->
<para>
  The <interface>ThunarxMenuProvider</interface> 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.
</para>

<para>
  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_actions() or the
  thunarx_menu_provider_get_folder_actions() 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 actions that should
  be added to the file manager's context menu. Don't perform any complicated I/O
  to determine the action list, as that would block the whole file manager process.
</para>

<para>
  The <link linkend="GtkAction">GtkAction</link>s returned from the
  thunarx_menu_provider_get_file_actions() and thunarx_menu_provider_get_folder_actions()
  methods must be namespaced with the module to avoid collision with internal file manager
  actions and actions provided by other extensions. For example, the menu action provided
  by the <systemitem class="library">ThunarOpenTerminal</systemitem> extension should be
  called <literal>ThunarOpenTerminal::open-terminal</literal>.
</para>

<example>
  <title>Menu provider example</title>

  <programlisting>
static void   hello_menu_provider_init (ThunarxMenuProviderIface *iface);
static GList *hello_get_file_actions   (ThunarxMenuProvider      *provider,
                                        GtkWidget                *window,
                                        GList                    *files);

THUNARX_DEFINE_TYPE_WITH_CODE (Hello, hello, G_TYPE_OBJECT,
                               THUNARX_IMPLEMENT_INTERFACE (THUNARX_TYPE_MENU_PROVIDER,
                                                            hello_menu_provider_init));

static void
hello_menu_provider_init (ThunarxMenuProviderIface *iface)
{
  iface->get_file_actions = hello_get_file_actions;
}

static void
hello_activated (GtkWidget *window)
{
  GtkWidget *dialog;

  dialog = gtk_message_dialog_new (GTK_WINDOW (window),
                                   GTK_DIALOG_MODAL
                                   | GTK_DIALOG_DESTROY_WITH_PARENT,
                                   GTK_MESSAGE_INFO,
                                   GTK_BUTTONS_OK,
                                   "Hello World!");
  gtk_dialog_run (GTK_DIALOG (dialog));
  gtk_widget_destroy (dialog);
}

static GList*
hello_get_file_actions (ThunarxMenuProvider *provider,
                        GtkWidget           *window,
                        GList               *files)
{
  GtkAction *action;
  GClosure  *closure;

  action = gtk_action_new ("Hello::say-hello", "Say hello", "Say hello", NULL);
  closure = g_cclosure_new_object_swap (G_CALLBACK (hello_activated), G_OBJECT (window));
  g_signal_connect_closure (G_OBJECT (action), "activate", closure, TRUE);

  return g_list_append (NULL, action);
}</programlisting>

  <para>
    The above example will add an item <guimenu><guimenuitem>Say hello</guimenuitem></guimenu>
    to the file context menus as shown in the picture below:
  </para>

  <para>
    <inlinegraphic fileref="say-hello.png" format="PNG" />
  </para>
</example>

<!-- ##### SECTION See_Also ##### -->
<para>
  The description of the <link linkend="ThunarxFileInfo">ThunarxFileInfo</link>
  interface.
</para>

<!-- ##### SECTION Stability_Level ##### -->
Stable

<!-- ##### SECTION Image ##### -->


<!-- ##### STRUCT ThunarxMenuProviderIface ##### -->
<para>
  Interface with virtual methods implemented by extensions that provide
  additional menu items for the file manager's context menus.
</para>

<para>
  Providers don't need to implement all of the virtual methods listed in
  the interface.
</para>

@get_file_actions: See thunarx_menu_provider_get_file_actions().
@get_folder_actions: See thunarx_menu_provider_get_folder_actions().
@get_dnd_actions: See thunarx_menu_provider_get_dnd_actions().

<!-- ##### STRUCT ThunarxMenuProvider ##### -->
<para>
  Menu provider type.
</para>


<!-- ##### FUNCTION thunarx_menu_provider_get_file_actions ##### -->
<para>

</para>

@provider: 
@window: 
@files: 
@Returns: 


<!-- ##### FUNCTION thunarx_menu_provider_get_folder_actions ##### -->
<para>

</para>

@provider: 
@window: 
@folder: 
@Returns: 


<!-- ##### FUNCTION thunarx_menu_provider_get_dnd_actions ##### -->
<para>

</para>

@provider: 
@window: 
@folder: 
@files: 
@Returns: 


