1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
<title>Thunar Extensions Reference Manual: ThunarxMenuProvider</title>
6
<meta name="generator" content="DocBook XSL Stylesheets V1.78.0">
7
<link rel="home" href="index.html" title="Thunar Extensions Reference Manual">
8
<link rel="up" href="thunarx-providers.html" title="Part V. Providers">
9
<link rel="prev" href="thunarx-providers.html" title="Part V. Providers">
10
<link rel="next" href="ThunarxPropertyPageProvider.html" title="ThunarxPropertyPageProvider">
11
<meta name="generator" content="GTK-Doc V1.21 (XML mode)">
12
<link rel="stylesheet" href="style.css" type="text/css">
14
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
16
<td width="100%" align="left" class="shortcuts">
17
<a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span>
18
<a href="#ThunarxMenuProvider.description" class="shortcut">Description</a></span><span id="nav_hierarchy"> <span class="dim">|</span>
19
<a href="#ThunarxMenuProvider.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_prerequisites"> <span class="dim">|</span>
20
<a href="#ThunarxMenuProvider.prerequisites" class="shortcut">Prerequisites</a></span>
22
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
23
<td><a accesskey="u" href="thunarx-providers.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
24
<td><a accesskey="p" href="thunarx-providers.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
25
<td><a accesskey="n" href="ThunarxPropertyPageProvider.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
27
<div class="refentry">
28
<a name="ThunarxMenuProvider"></a><div class="titlepage"></div>
29
<div class="refnamediv"><table width="100%"><tr>
31
<h2><span class="refentrytitle"><a name="ThunarxMenuProvider.top_of_page"></a>ThunarxMenuProvider</span></h2>
32
<p>ThunarxMenuProvider — The interface to extensions that provide additional menu items</p>
34
<td class="gallery_image" valign="top" align="right"></td>
36
<div class="refsect1">
37
<a name="ThunarxMenuProvider.stability-level"></a><h2>Stability Level</h2>
38
<a href="http://foldoc.org/Stable"><span class="acronym">Stable</span></a>, unless otherwise indicated
40
<div class="refsect1">
41
<a name="ThunarxMenuProvider.functions"></a><h2>Functions</h2>
42
<div class="informaltable"><table width="100%" border="0">
44
<col width="150px" class="functions_return">
45
<col class="functions_name">
49
<td class="function_type">
50
<a href="https://developer.gnome.org/glib/unstable/glib-Doubly-Linked-Lists.html#GList"><span class="returnvalue">GList</span></a> *
52
<td class="function_name">
53
<a class="link" href="ThunarxMenuProvider.html#thunarx-menu-provider-get-file-actions" title="thunarx_menu_provider_get_file_actions ()">thunarx_menu_provider_get_file_actions</a> <span class="c_punctuation">()</span>
57
<td class="function_type">
58
<a href="https://developer.gnome.org/glib/unstable/glib-Doubly-Linked-Lists.html#GList"><span class="returnvalue">GList</span></a> *
60
<td class="function_name">
61
<a class="link" href="ThunarxMenuProvider.html#thunarx-menu-provider-get-folder-actions" title="thunarx_menu_provider_get_folder_actions ()">thunarx_menu_provider_get_folder_actions</a> <span class="c_punctuation">()</span>
65
<td class="function_type">
66
<a href="https://developer.gnome.org/glib/unstable/glib-Doubly-Linked-Lists.html#GList"><span class="returnvalue">GList</span></a> *
68
<td class="function_name">
69
<a class="link" href="ThunarxMenuProvider.html#thunarx-menu-provider-get-dnd-actions" title="thunarx_menu_provider_get_dnd_actions ()">thunarx_menu_provider_get_dnd_actions</a> <span class="c_punctuation">()</span>
75
<div class="refsect1">
76
<a name="ThunarxMenuProvider.other"></a><h2>Types and Values</h2>
77
<div class="informaltable"><table width="100%" border="0">
79
<col width="150px" class="name">
80
<col class="description">
84
<td class="datatype_keyword">struct</td>
85
<td class="function_name"><a class="link" href="ThunarxMenuProvider.html#ThunarxMenuProviderIface" title="struct ThunarxMenuProviderIface">ThunarxMenuProviderIface</a></td>
88
<td class="datatype_keyword"> </td>
89
<td class="function_name"><a class="link" href="ThunarxMenuProvider.html#ThunarxMenuProvider-struct" title="ThunarxMenuProvider">ThunarxMenuProvider</a></td>
94
<div class="refsect1">
95
<a name="ThunarxMenuProvider.object-hierarchy"></a><h2>Object Hierarchy</h2>
96
<pre class="screen"> <a href="https://developer.gnome.org/gobject/unstable/GTypeModule.html">GInterface</a>
97
<span class="lineart">╰──</span> ThunarxMenuProvider
100
<div class="refsect1">
101
<a name="ThunarxMenuProvider.prerequisites"></a><h2>Prerequisites</h2>
103
ThunarxMenuProvider requires
104
<a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>.</p>
106
<div class="refsect1">
107
<a name="ThunarxMenuProvider.includes"></a><h2>Includes</h2>
108
<pre class="synopsis">#include <thunarx/thunarx.h>
111
<div class="refsect1">
112
<a name="ThunarxMenuProvider.description"></a><h2>Description</h2>
114
The <span class="interface">ThunarxMenuProvider</span> interface is implemented by
115
extensions which provide additional menu items that should be displayed in
116
the file or folder context menus for certain types of files.
119
Extensions that implement this interface should do its best to respond as
120
fast as possible to method invokations by the file manager. That said, when
121
the file manager calls the <a class="link" href="ThunarxMenuProvider.html#thunarx-menu-provider-get-file-actions" title="thunarx_menu_provider_get_file_actions ()"><code class="function">thunarx_menu_provider_get_file_actions()</code></a> or the
122
<a class="link" href="ThunarxMenuProvider.html#thunarx-menu-provider-get-folder-actions" title="thunarx_menu_provider_get_folder_actions ()"><code class="function">thunarx_menu_provider_get_folder_actions()</code></a> method, the implementation in the
123
extension should use only the <a class="link" href="ThunarxFileInfo.html#thunarx-file-info-has-mime-type" title="thunarx_file_info_has_mime_type ()"><code class="function">thunarx_file_info_has_mime_type()</code></a> and
124
<a class="link" href="ThunarxFileInfo.html#thunarx-file-info-is-directory" title="thunarx_file_info_is_directory ()"><code class="function">thunarx_file_info_is_directory()</code></a> methods to determine the actions that should
125
be added to the file manager's context menu. Don't perform any complicated I/O
126
to determine the action list, as that would block the whole file manager process.
129
The <a href="http://developer.gnome.org/gtk2/GtkAction.html">GtkAction</a>s returned from the
130
<a class="link" href="ThunarxMenuProvider.html#thunarx-menu-provider-get-file-actions" title="thunarx_menu_provider_get_file_actions ()"><code class="function">thunarx_menu_provider_get_file_actions()</code></a> and <a class="link" href="ThunarxMenuProvider.html#thunarx-menu-provider-get-folder-actions" title="thunarx_menu_provider_get_folder_actions ()"><code class="function">thunarx_menu_provider_get_folder_actions()</code></a>
131
methods must be namespaced with the module to avoid collision with internal file manager
132
actions and actions provided by other extensions. For example, the menu action provided
133
by the <code class="systemitem">ThunarOpenTerminal</code> extension should be
134
called <code class="literal">ThunarOpenTerminal::open-terminal</code>.
136
<div class="example">
137
<a name="id-1.6.5.9.5"></a><p class="title"><b>Example 5. Menu provider example</b></p>
138
<div class="example-contents">
139
<pre class="programlisting">
140
static void hello_menu_provider_init (ThunarxMenuProviderIface *iface);
141
static GList *hello_get_file_actions (ThunarxMenuProvider *provider,
144
THUNARX_DEFINE_TYPE_WITH_CODE (Hello, hello, G_TYPE_OBJECT,
145
THUNARX_IMPLEMENT_INTERFACE (THUNARX_TYPE_MENU_PROVIDER,
146
hello_menu_provider_init));
148
hello_menu_provider_init (ThunarxMenuProviderIface *iface)
150
iface->get_file_actions = hello_get_file_actions;
153
hello_activated (GtkWidget *window)
156
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
158
| GTK_DIALOG_DESTROY_WITH_PARENT,
162
gtk_dialog_run (GTK_DIALOG (dialog));
163
gtk_widget_destroy (dialog);
166
hello_get_file_actions (ThunarxMenuProvider *provider,
172
action = gtk_action_new ("Hello::say-hello", "Say hello", "Say hello", NULL);
173
closure = g_cclosure_new_object_swap (G_CALLBACK (hello_activated), G_OBJECT (window));
174
g_signal_connect_closure (G_OBJECT (action), "activate", closure, TRUE);
175
return g_list_append (NULL, action);
178
The above example will add an item <span class="guimenu"><span class="guimenuitem">Say hello</span></span>
179
to the file context menus as shown in the picture below:
182
<img src="say-hello.png">
186
<br class="example-break">
188
<div class="refsect1">
189
<a name="ThunarxMenuProvider.functions_details"></a><h2>Functions</h2>
190
<div class="refsect2">
191
<a name="thunarx-menu-provider-get-file-actions"></a><h3>thunarx_menu_provider_get_file_actions ()</h3>
192
<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Doubly-Linked-Lists.html#GList"><span class="returnvalue">GList</span></a> *
193
thunarx_menu_provider_get_file_actions
194
(<em class="parameter"><code><a class="link" href="ThunarxMenuProvider.html" title="ThunarxMenuProvider"><span class="type">ThunarxMenuProvider</span></a> *provider</code></em>,
195
<em class="parameter"><code><a href="http://developer.gnome.org/gtk2/GtkWidget.html"><span class="type">GtkWidget</span></a> *window</code></em>,
196
<em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a> *files</code></em>);</pre>
197
<p>Returns the list of <a href="http://developer.gnome.org/gtk2/GtkAction.html"><span class="type">GtkAction</span></a>s that <em class="parameter"><code>provider</code></em>
199
<em class="parameter"><code>files</code></em>
201
<p>As a special note, this method automatically takes a reference on the
202
<em class="parameter"><code>provider</code></em>
203
for every <a href="http://developer.gnome.org/gtk2/GtkAction.html"><span class="type">GtkAction</span></a> object returned from the real implementation
204
of this method in <em class="parameter"><code>provider</code></em>
205
. This is to make sure that the extension stays
206
in memory for atleast the time that the actions are used. If the extension
207
wants to stay in memory for a longer time, it'll need to take care of this
208
itself (e.g. by taking an additional reference on the <em class="parameter"><code>provider</code></em>
210
that's released at a later time).</p>
211
<p>The caller is responsible to free the returned list of actions using
212
something like this when no longer needed:</p>
213
<div class="informalexample"><pre class="programlisting">
214
g_list_free_full (list, g_object_unref);
216
<div class="refsect3">
217
<a name="id-1.6.5.10.2.8"></a><h4>Parameters</h4>
218
<div class="informaltable"><table width="100%" border="0">
220
<col width="150px" class="parameters_name">
221
<col class="parameters_description">
222
<col width="200px" class="parameters_annotations">
226
<td class="parameter_name"><p>provider</p></td>
227
<td class="parameter_description"><p>a <a class="link" href="ThunarxMenuProvider.html" title="ThunarxMenuProvider"><span class="type">ThunarxMenuProvider</span></a>.</p></td>
228
<td class="parameter_annotations"> </td>
231
<td class="parameter_name"><p>window</p></td>
232
<td class="parameter_description"><p>the <a href="http://developer.gnome.org/gtk2/GtkWindow.html"><span class="type">GtkWindow</span></a> within which the actions will be used.</p></td>
233
<td class="parameter_annotations"> </td>
236
<td class="parameter_name"><p>files</p></td>
237
<td class="parameter_description"><p>the list of <a class="link" href="ThunarxFileInfo.html" title="ThunarxFileInfo"><span class="type">ThunarxFileInfo</span></a>s to which the actions will be applied.</p></td>
238
<td class="parameter_annotations"> </td>
243
<div class="refsect3">
244
<a name="id-1.6.5.10.2.9"></a><h4>Returns</h4>
245
<p> the list of <a href="http://developer.gnome.org/gtk2/GtkAction.html"><span class="type">GtkAction</span></a>s that <em class="parameter"><code>provider</code></em>
247
for <em class="parameter"><code>files</code></em>
253
<div class="refsect2">
254
<a name="thunarx-menu-provider-get-folder-actions"></a><h3>thunarx_menu_provider_get_folder_actions ()</h3>
255
<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Doubly-Linked-Lists.html#GList"><span class="returnvalue">GList</span></a> *
256
thunarx_menu_provider_get_folder_actions
257
(<em class="parameter"><code><a class="link" href="ThunarxMenuProvider.html" title="ThunarxMenuProvider"><span class="type">ThunarxMenuProvider</span></a> *provider</code></em>,
258
<em class="parameter"><code><a href="http://developer.gnome.org/gtk2/GtkWidget.html"><span class="type">GtkWidget</span></a> *window</code></em>,
259
<em class="parameter"><code><a class="link" href="ThunarxFileInfo.html" title="ThunarxFileInfo"><span class="type">ThunarxFileInfo</span></a> *folder</code></em>);</pre>
260
<p>Returns the list of <a href="http://developer.gnome.org/gtk2/GtkAction.html"><span class="type">GtkAction</span></a>s that <em class="parameter"><code>provider</code></em>
262
<em class="parameter"><code>folder</code></em>
264
<p>As a special note, this method automatically takes a reference on the
265
<em class="parameter"><code>provider</code></em>
266
for every <a href="http://developer.gnome.org/gtk2/GtkAction.html"><span class="type">GtkAction</span></a> object returned from the real implementation
267
of this method in <em class="parameter"><code>provider</code></em>
268
. This is to make sure that the extension stays
269
in memory for atleast the time that the actions are used. If the extension
270
wants to stay in memory for a longer time, it'll need to take care of this
271
itself (e.g. by taking an additional reference on the <em class="parameter"><code>provider</code></em>
273
that's released at a later time).</p>
274
<p>The caller is responsible to free the returned list of actions using
275
something like this when no longer needed:</p>
276
<div class="informalexample"><pre class="programlisting">
277
g_list_free_full (list, g_object_unref);
279
<div class="refsect3">
280
<a name="id-1.6.5.10.3.8"></a><h4>Parameters</h4>
281
<div class="informaltable"><table width="100%" border="0">
283
<col width="150px" class="parameters_name">
284
<col class="parameters_description">
285
<col width="200px" class="parameters_annotations">
289
<td class="parameter_name"><p>provider</p></td>
290
<td class="parameter_description"><p>a <a class="link" href="ThunarxMenuProvider.html" title="ThunarxMenuProvider"><span class="type">ThunarxMenuProvider</span></a>.</p></td>
291
<td class="parameter_annotations"> </td>
294
<td class="parameter_name"><p>window</p></td>
295
<td class="parameter_description"><p>the <a href="http://developer.gnome.org/gtk2/GtkWindow.html"><span class="type">GtkWindow</span></a> within which the actions will be used.</p></td>
296
<td class="parameter_annotations"> </td>
299
<td class="parameter_name"><p>folder</p></td>
300
<td class="parameter_description"><p>the folder to which the actions should will be applied.</p></td>
301
<td class="parameter_annotations"> </td>
306
<div class="refsect3">
307
<a name="id-1.6.5.10.3.9"></a><h4>Returns</h4>
308
<p> the list of <a href="http://developer.gnome.org/gtk2/GtkAction.html"><span class="type">GtkAction</span></a>s that <em class="parameter"><code>provider</code></em>
310
for <em class="parameter"><code>folder</code></em>
316
<div class="refsect2">
317
<a name="thunarx-menu-provider-get-dnd-actions"></a><h3>thunarx_menu_provider_get_dnd_actions ()</h3>
318
<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Doubly-Linked-Lists.html#GList"><span class="returnvalue">GList</span></a> *
319
thunarx_menu_provider_get_dnd_actions (<em class="parameter"><code><a class="link" href="ThunarxMenuProvider.html" title="ThunarxMenuProvider"><span class="type">ThunarxMenuProvider</span></a> *provider</code></em>,
320
<em class="parameter"><code><a href="http://developer.gnome.org/gtk2/GtkWidget.html"><span class="type">GtkWidget</span></a> *window</code></em>,
321
<em class="parameter"><code><a class="link" href="ThunarxFileInfo.html" title="ThunarxFileInfo"><span class="type">ThunarxFileInfo</span></a> *folder</code></em>,
322
<em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Doubly-Linked-Lists.html#GList"><span class="type">GList</span></a> *files</code></em>);</pre>
323
<p>Returns the list of <a href="http://developer.gnome.org/gtk2/GtkAction.html"><span class="type">GtkAction</span></a>s that <em class="parameter"><code>provider</code></em>
325
dropping the <em class="parameter"><code>files</code></em>
326
into the <em class="parameter"><code>folder</code></em>
327
. For example, the thunar-archive-plugin
328
provides <span class="guilabel">Extract Here</span> actions when dropping archive
329
files into a folder that is writable by the user.</p>
330
<p>As a special note, this method automatically takes a reference on the
331
<em class="parameter"><code>provider</code></em>
332
for every <a href="http://developer.gnome.org/gtk2/GtkAction.html"><span class="type">GtkAction</span></a> object returned from the real implementation
333
of this method in <em class="parameter"><code>provider</code></em>
334
. This is to make sure that the extension stays
335
in memory for atleast the time that the actions are used. If the extension
336
wants to stay in memory for a longer time, it'll need to take care of this
337
itself (e.g. by taking an additional reference on the <em class="parameter"><code>provider</code></em>
339
that's released at a later time).</p>
340
<p>The caller is responsible to free the returned list of actions using
341
something like this when no longer needed:</p>
342
<div class="informalexample"><pre class="programlisting">
343
g_list_free_full (list, g_object_unref);
345
<div class="refsect3">
346
<a name="id-1.6.5.10.4.8"></a><h4>Parameters</h4>
347
<div class="informaltable"><table width="100%" border="0">
349
<col width="150px" class="parameters_name">
350
<col class="parameters_description">
351
<col width="200px" class="parameters_annotations">
355
<td class="parameter_name"><p>provider</p></td>
356
<td class="parameter_description"><p>a <a class="link" href="ThunarxMenuProvider.html" title="ThunarxMenuProvider"><span class="type">ThunarxMenuProvider</span></a>.</p></td>
357
<td class="parameter_annotations"> </td>
360
<td class="parameter_name"><p>window</p></td>
361
<td class="parameter_description"><p>the <a href="http://developer.gnome.org/gtk2/GtkWindow.html"><span class="type">GtkWindow</span></a> within which the actions will be used.</p></td>
362
<td class="parameter_annotations"> </td>
365
<td class="parameter_name"><p>folder</p></td>
366
<td class="parameter_description"><p>the folder into which the <em class="parameter"><code>files</code></em>
367
are being dropped</p></td>
368
<td class="parameter_annotations"> </td>
371
<td class="parameter_name"><p>files</p></td>
372
<td class="parameter_description"><p>the list of <a class="link" href="ThunarxFileInfo.html" title="ThunarxFileInfo"><span class="type">ThunarxFileInfo</span></a>s for the files that are
373
being dropped to <em class="parameter"><code>folder</code></em>
374
in <em class="parameter"><code>window</code></em>
376
<td class="parameter_annotations"> </td>
381
<div class="refsect3">
382
<a name="id-1.6.5.10.4.9"></a><h4>Returns</h4>
383
<p> the list of <a href="http://developer.gnome.org/gtk2/GtkAction.html"><span class="type">GtkAction</span></a>s that <em class="parameter"><code>provider</code></em>
385
for dropping <em class="parameter"><code>files</code></em>
386
to <em class="parameter"><code>folder</code></em>
390
<p class="since">Since 0.4.1</p>
393
<div class="refsect1">
394
<a name="ThunarxMenuProvider.other_details"></a><h2>Types and Values</h2>
395
<div class="refsect2">
396
<a name="ThunarxMenuProviderIface"></a><h3>struct ThunarxMenuProviderIface</h3>
397
<pre class="programlisting">struct ThunarxMenuProviderIface {
398
GList *(*get_file_actions) (ThunarxMenuProvider *provider,
402
GList *(*get_folder_actions) (ThunarxMenuProvider *provider,
404
ThunarxFileInfo *folder);
406
GList *(*get_dnd_actions) (ThunarxMenuProvider *provider,
408
ThunarxFileInfo *folder,
413
Interface with virtual methods implemented by extensions that provide
414
additional menu items for the file manager's context menus.
417
Providers don't need to implement all of the virtual methods listed in
420
<div class="refsect3">
421
<a name="id-1.6.5.11.2.6"></a><h4>Members</h4>
422
<div class="informaltable"><table width="100%" border="0">
424
<col width="300px" class="struct_members_name">
425
<col class="struct_members_description">
426
<col width="200px" class="struct_members_annotations">
430
<td class="struct_member_name"><p><em class="structfield"><code><a name="ThunarxMenuProviderIface.get-file-actions"></a>get_file_actions</code></em> ()</p></td>
431
<td class="struct_member_description"><p>See <a class="link" href="ThunarxMenuProvider.html#thunarx-menu-provider-get-file-actions" title="thunarx_menu_provider_get_file_actions ()"><code class="function">thunarx_menu_provider_get_file_actions()</code></a>.</p></td>
432
<td class="struct_member_annotations"> </td>
435
<td class="struct_member_name"><p><em class="structfield"><code><a name="ThunarxMenuProviderIface.get-folder-actions"></a>get_folder_actions</code></em> ()</p></td>
436
<td class="struct_member_description"><p>See <a class="link" href="ThunarxMenuProvider.html#thunarx-menu-provider-get-folder-actions" title="thunarx_menu_provider_get_folder_actions ()"><code class="function">thunarx_menu_provider_get_folder_actions()</code></a>.</p></td>
437
<td class="struct_member_annotations"> </td>
440
<td class="struct_member_name"><p><em class="structfield"><code><a name="ThunarxMenuProviderIface.get-dnd-actions"></a>get_dnd_actions</code></em> ()</p></td>
441
<td class="struct_member_description"><p>See <a class="link" href="ThunarxMenuProvider.html#thunarx-menu-provider-get-dnd-actions" title="thunarx_menu_provider_get_dnd_actions ()"><code class="function">thunarx_menu_provider_get_dnd_actions()</code></a>.</p></td>
442
<td class="struct_member_annotations"> </td>
449
<div class="refsect2">
450
<a name="ThunarxMenuProvider-struct"></a><h3>ThunarxMenuProvider</h3>
451
<pre class="programlisting">typedef struct _ThunarxMenuProvider ThunarxMenuProvider;</pre>
457
<div class="refsect1">
458
<a name="ThunarxMenuProvider.see-also"></a><h2>See Also</h2>
460
The description of the <a class="link" href="ThunarxFileInfo.html" title="ThunarxFileInfo">ThunarxFileInfo</a>
467
Generated by GTK-Doc V1.21</div>
b'\\ No newline at end of file'