~ubuntu-branches/debian/experimental/thunar/experimental

« back to all changes in this revision

Viewing changes to docs/reference/thunarx/html/thunarx-writing-extensions.html

  • Committer: Bazaar Package Importer
  • Author(s): Yves-Alexis Perez
  • Date: 2006-01-02 23:42:32 UTC
  • Revision ID: james.westby@ubuntu.com-20060102234232-8xeq0lqhyn70syr0
Tags: upstream-0.1.4svn+r18850
ImportĀ upstreamĀ versionĀ 0.1.4svn+r18850

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<html>
 
2
<head>
 
3
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
 
4
<title>Part&#160;II.&#160;Writing Extensions</title>
 
5
<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
 
6
<link rel="start" href="index.html" title="Thunar Extensions Reference Manual">
 
7
<link rel="up" href="index.html" title="Thunar Extensions Reference Manual">
 
8
<link rel="prev" href="thunarx-overview.html" title="Part&#160;I.&#160;Overview">
 
9
<link rel="next" href="thunarx-writing-extensions-getting-started.html" title="Getting Started">
 
10
<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
 
11
<link rel="stylesheet" href="style.css" type="text/css">
 
12
<link rel="part" href="thunarx-overview.html" title="Part&#160;I.&#160;Overview">
 
13
<link rel="part" href="thunarx-writing-extensions.html" title="Part&#160;II.&#160;Writing Extensions">
 
14
<link rel="part" href="thunarx-fundamentals.html" title="Part&#160;III.&#160;Fundamentals">
 
15
<link rel="part" href="thunarx-abstraction-layer.html" title="Part&#160;IV.&#160;Abstraction Layer">
 
16
<link rel="part" href="thunarx-providers.html" title="Part&#160;V.&#160;Providers">
 
17
<link rel="index" href="ix01.html" title="Index">
 
18
</head>
 
19
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
 
20
<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
 
21
<td><a accesskey="p" href="thunarx-overview.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
 
22
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
 
23
<th width="100%" align="center">Thunar Extensions Reference Manual</th>
 
24
<td><a accesskey="n" href="thunarx-writing-extensions-getting-started.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
 
25
</tr></table>
 
26
<div class="part" lang="en">
 
27
<div class="titlepage"><div><div><h1 class="title">
 
28
<a name="thunarx-writing-extensions"></a>Writing Extensions</h1></div></div></div>
 
29
<p>
 
30
      This section explains the basic steps required to write an extension for the <a href="http://thunar.xfce.org" target="_top">Thunar File Manager</a> using the C language interface. It is
 
31
      just a short introduction and not meant to provide extensive details about the internal workings
 
32
      of the file manager.
 
33
    </p>
 
34
<div class="sect1" lang="en">
 
35
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
 
36
<a name="thunarx-writing-extensions-basic-concepts"></a>Basic Concepts</h2></div></div></div>
 
37
<div class="sect2" lang="en">
 
38
<div class="titlepage"><div><div><h3 class="title">
 
39
<a name="thunarx-writing-extensions-extensions-and-providers"></a>Extensions and Providers</h3></div></div></div>
 
40
<p>
 
41
          <span class="emphasis"><em>Thunar Extensions</em></span> are shared libraries that extend the basic functionality
 
42
          provided by the Thunar File Manager. An extension exports one or more <span class="type">GObject</span>s, called <span class="emphasis"><em>providers</em></span> to Thunar.
 
43
        </p>
 
44
<p>
 
45
          Providers implement one or more of the <span class="type">GInterface</span>s included with
 
46
          the <code class="systemitem">thunarx</code> library. The currently exported interfaces
 
47
          include the <a href="ThunarxMenuProvider.html" title="ThunarxMenuProvider"><span class="type">ThunarxMenuProvider</span></a> for adding context menu
 
48
          items to the file views and the <a href="ThunarxPropertyPageProvider.html" title="ThunarxPropertyPageProvider"><span class="type">ThunarxPropertyPageProvider</span></a> for adding pages to the
 
49
          file properties dialog.
 
50
        </p>
 
51
</div>
 
52
<div class="sect2" lang="en">
 
53
<div class="titlepage"><div><div><h3 class="title">
 
54
<a name="thunarx-writing-extensions-thunarxfileinfo"></a>ThunarxFileInfo</h3></div></div></div>
 
55
<p>
 
56
          Thunar passes file references to the provider using <a href="ThunarxFileInfo.html" title="ThunarxFileInfo"><span class="type">ThunarxFileInfo</span></a>
 
57
          objects. The <a href="ThunarxFileInfo.html" title="ThunarxFileInfo"><span class="type">ThunarxFileInfo</span></a> interface provides access to the file
 
58
          information that Thunar has already read - mime type, URI, name, etc. Extensions should use the data from
 
59
          from the <a href="ThunarxFileInfo.html" title="ThunarxFileInfo"><span class="type">ThunarxFileInfo</span></a> rather than reading it themselves, to
 
60
          prevent excessive I/O.
 
61
        </p>
 
62
<p>
 
63
          There is exactly one <a href="ThunarxFileInfo.html" title="ThunarxFileInfo"><span class="type">ThunarxFileInfo</span></a> per file, and it is kept around
 
64
          for as long as Thunar is interested in the file. Extensions can use this information to manage lifecycles of
 
65
          its own data - e.g. when the <a href="ThunarxFileInfo.html" title="ThunarxFileInfo"><span class="type">ThunarxFileInfo</span></a> goes away, it is safe
 
66
          for the extension to forget any private data for that file.
 
67
        </p>
 
68
</div>
 
69
<div class="sect2" lang="en">
 
70
<div class="titlepage"><div><div><h3 class="title">
 
71
<a name="thunarx-writing-extensions-names"></a>Names</h3></div></div></div>
 
72
<p>
 
73
          Most objects created by the extensions need names, e.g. the <span class="type">GtkAction</span>s
 
74
          returned from the <a href="ThunarxMenuProvider.html" title="ThunarxMenuProvider"><span class="type">ThunarxMenuProvider</span></a>s. These names must be
 
75
          namespaced with the name of the extension. For example the main action returned from the
 
76
          <span class="application">OpenTerminal</span> extension should be called <code class="literal">OpenTerminal::open-terminal</code>.
 
77
          The namespace must be global among the providers exported by a certain extension.
 
78
        </p>
 
79
</div>
 
80
<div class="sect2" lang="en">
 
81
<div class="titlepage"><div><div><h3 class="title">
 
82
<a name="thunarx-writing-extensions-types"></a>Types</h3></div></div></div>
 
83
<p>
 
84
          Thunar extensions are loaded as <span class="type">GTypeModule</span>s. This means that all GTypes
 
85
          created by the extension must be registered with the <span class="type">GTypeModule</span>, using
 
86
          <code class="function">g_type_module_register_type()</code> function rather
 
87
          than <code class="function">g_type_register_static()</code>. All types exported by
 
88
          an extension must be registered in
 
89
          <code class="function">thunar_extension_initialize()</code>.
 
90
        </p>
 
91
</div>
 
92
</div>
 
93
</div>
 
94
<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
 
95
<td align="left"><a accesskey="p" href="thunarx-overview.html"><b>&lt;&lt;&#160;Part&#160;I.&#160;Overview</b></a></td>
 
96
<td align="right"><a accesskey="n" href="thunarx-writing-extensions-getting-started.html"><b>Getting Started&#160;&gt;&gt;</b></a></td>
 
97
</tr></table>
 
98
</body>
 
99
</html>