1
1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
5
<title>GTypeModule</title>
6
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2">
7
<link rel="start" href="index.html" title="GObject Reference Manual">
6
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
7
<link rel="home" href="index.html" title="GObject Reference Manual">
8
8
<link rel="up" href="rn01.html" title="API Reference">
9
9
<link rel="prev" href="GTypePlugin.html" title="GTypePlugin">
10
<link rel="next" href="gobject-The-Base-Object-Type.html" title="GObject">
11
<meta name="generator" content="GTK-Doc V1.9 (XML mode)">
10
<link rel="next" href="gobject-The-Base-Object-Type.html" title="The Base Object Type">
11
<meta name="generator" content="GTK-Doc V1.11 (XML mode)">
12
12
<link rel="stylesheet" href="style.css" type="text/css">
13
13
<link rel="preface" href="pr01.html" title="Introduction">
14
<link rel="part" href="pt01.html" title="Part I. Concepts">
14
<link rel="part" href="pt01.html" title="Part I. Concepts">
15
15
<link rel="chapter" href="chapter-intro.html" title="Background">
16
16
<link rel="chapter" href="chapter-gtype.html" title="The GLib Dynamic Type System">
17
17
<link rel="chapter" href="chapter-gobject.html" title="The GObject base class">
18
18
<link rel="chapter" href="chapter-signal.html" title="The GObject messaging system">
19
19
<link rel="reference" href="rn01.html" title="API Reference">
20
20
<link rel="reference" href="rn02.html" title="Tools Reference">
21
<link rel="part" href="pt02.html" title="Part IV. Tutorial">
21
<link rel="part" href="pt02.html" title="Part IV. Tutorial">
22
22
<link rel="chapter" href="howto-gobject.html" title="How to define and implement a new GObject">
23
23
<link rel="chapter" href="howto-interface.html" title="How to define and implement interfaces">
24
24
<link rel="chapter" href="howto-signals.html" title="How to create and use signals">
25
<link rel="part" href="pt03.html" title="Part V. Related Tools">
25
<link rel="part" href="pt03.html" title="Part V. Related Tools">
26
<link rel="chapter" href="tools-vala.html" title="Vala">
26
27
<link rel="chapter" href="tools-gob.html" title="GObject builder">
27
28
<link rel="chapter" href="tools-ginspector.html" title="Graphical inspection of GObjects">
28
29
<link rel="chapter" href="tools-refdb.html" title="Debugging reference count problems">
46
48
<th width="100%" align="center">GObject Reference Manual</th>
47
49
<td><a accesskey="n" href="gobject-The-Base-Object-Type.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
49
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id2852704" class="shortcut">Top</a>
51
<a href="#id2853058" class="shortcut">Description</a>
53
<a href="#id2853011" class="shortcut">Object Hierarchy</a>
55
<a href="#id2853036" class="shortcut">Implemented Interfaces</a></nobr></td></tr>
51
<tr><td colspan="5" class="shortcuts">
52
<a href="#GTypeModule.synopsis" class="shortcut">Top</a>
54
<a href="#GTypeModule.description" class="shortcut">Description</a>
56
<a href="#GTypeModule.object-hierarchy" class="shortcut">Object Hierarchy</a>
58
<a href="#GTypeModule.implemented-interfaces" class="shortcut">Implemented Interfaces</a>
57
61
<div class="refentry" lang="en">
58
62
<a name="GTypeModule"></a><div class="titlepage"></div>
59
63
<div class="refnamediv"><table width="100%"><tr>
62
<a name="id2852704"></a><span class="refentrytitle">GTypeModule</span>
64
<p>GTypeModule — Type loading modules</p>
65
<h2><span class="refentrytitle"><a name="GTypeModule.top_of_page"></a>GTypeModule</span></h2>
66
<p>GTypeModule — Type loading modules</p>
66
68
<td valign="top" align="right"></td>
67
69
</tr></table></div>
68
70
<div class="refsynopsisdiv">
71
<a name="GTypeModule.synopsis"></a><h2>Synopsis</h2>
70
72
<pre class="synopsis">
72
74
#include <glib-object.h>
75
<a class="link" href="GTypeModule.html#GTypeModule-struct">GTypeModule</a>;
76
<a class="link" href="GTypeModule.html#GTypeModuleClass">GTypeModuleClass</a>;
76
<a class="link" href="GTypeModule.html#GTypeModule-struct" title="GTypeModule">GTypeModule</a>;
77
<a class="link" href="GTypeModule.html#GTypeModuleClass" title="GTypeModuleClass">GTypeModuleClass</a>;
78
79
href="./../glib/glib/glib-Basic-Types.html#gboolean"
79
>gboolean</a> <a class="link" href="GTypeModule.html#g-type-module-use">g_type_module_use</a> (<a class="link" href="GTypeModule.html" title="GTypeModule">GTypeModule</a> *module);
80
void <a class="link" href="GTypeModule.html#g-type-module-unuse">g_type_module_unuse</a> (<a class="link" href="GTypeModule.html" title="GTypeModule">GTypeModule</a> *module);
81
void <a class="link" href="GTypeModule.html#g-type-module-set-name">g_type_module_set_name</a> (<a class="link" href="GTypeModule.html" title="GTypeModule">GTypeModule</a> *module,
80
>gboolean</a> <a class="link" href="GTypeModule.html#g-type-module-use" title="g_type_module_use ()">g_type_module_use</a> (<a class="link" href="GTypeModule.html" title="GTypeModule">GTypeModule</a> *module);
81
void <a class="link" href="GTypeModule.html#g-type-module-unuse" title="g_type_module_unuse ()">g_type_module_unuse</a> (<a class="link" href="GTypeModule.html" title="GTypeModule">GTypeModule</a> *module);
82
void <a class="link" href="GTypeModule.html#g-type-module-set-name" title="g_type_module_set_name ()">g_type_module_set_name</a> (<a class="link" href="GTypeModule.html" title="GTypeModule">GTypeModule</a> *module,
83
84
href="./../glib/glib/glib-Basic-Types.html#gchar"
85
<a class="link" href="gobject-Type-Information.html#GType">GType</a> <a class="link" href="GTypeModule.html#g-type-module-register-type">g_type_module_register_type</a> (<a class="link" href="GTypeModule.html" title="GTypeModule">GTypeModule</a> *module,
86
<a class="link" href="gobject-Type-Information.html#GType">GType</a> parent_type,
86
<a class="link" href="gobject-Type-Information.html#GType" title="GType">GType</a> <a class="link" href="GTypeModule.html#g-type-module-register-type" title="g_type_module_register_type ()">g_type_module_register_type</a> (<a class="link" href="GTypeModule.html" title="GTypeModule">GTypeModule</a> *module,
87
<a class="link" href="gobject-Type-Information.html#GType" title="GType">GType</a> parent_type,
88
89
href="./../glib/glib/glib-Basic-Types.html#gchar"
89
90
>gchar</a> *type_name,
90
const <a class="link" href="gobject-Type-Information.html#GTypeInfo">GTypeInfo</a> *type_info,
91
<a class="link" href="gobject-Type-Information.html#GTypeFlags">GTypeFlags</a> flags);
92
void <a class="link" href="GTypeModule.html#g-type-module-add-interface">g_type_module_add_interface</a> (<a class="link" href="GTypeModule.html" title="GTypeModule">GTypeModule</a> *module,
93
<a class="link" href="gobject-Type-Information.html#GType">GType</a> instance_type,
94
<a class="link" href="gobject-Type-Information.html#GType">GType</a> interface_type,
95
const <a class="link" href="gobject-Type-Information.html#GInterfaceInfo">GInterfaceInfo</a> *interface_info);
96
<a class="link" href="gobject-Type-Information.html#GType">GType</a> <a class="link" href="GTypeModule.html#g-type-module-register-enum">g_type_module_register_enum</a> (<a class="link" href="GTypeModule.html" title="GTypeModule">GTypeModule</a> *module,
98
href="./../glib/glib/glib-Basic-Types.html#gchar"
100
const <a class="link" href="gobject-Enumeration-and-Flag-Types.html#GEnumValue">GEnumValue</a> *const_static_values);
101
<a class="link" href="gobject-Type-Information.html#GType">GType</a> <a class="link" href="GTypeModule.html#g-type-module-register-flags">g_type_module_register_flags</a> (<a class="link" href="GTypeModule.html" title="GTypeModule">GTypeModule</a> *module,
103
href="./../glib/glib/glib-Basic-Types.html#gchar"
105
const <a class="link" href="gobject-Enumeration-and-Flag-Types.html#GFlagsValue">GFlagsValue</a> *const_static_values);
106
#define <a class="link" href="GTypeModule.html#G-DEFINE-DYNAMIC-TYPE:CAPS">G_DEFINE_DYNAMIC_TYPE</a> (TN, t_n, T_P)
107
#define <a class="link" href="GTypeModule.html#G-DEFINE-DYNAMIC-TYPE-EXTENDED:CAPS">G_DEFINE_DYNAMIC_TYPE_EXTENDED</a> (TypeName, type_name, TYPE_PARENT, flags, CODE)
91
const <a class="link" href="gobject-Type-Information.html#GTypeInfo" title="GTypeInfo">GTypeInfo</a> *type_info,
92
<a class="link" href="gobject-Type-Information.html#GTypeFlags" title="enum GTypeFlags">GTypeFlags</a> flags);
93
void <a class="link" href="GTypeModule.html#g-type-module-add-interface" title="g_type_module_add_interface ()">g_type_module_add_interface</a> (<a class="link" href="GTypeModule.html" title="GTypeModule">GTypeModule</a> *module,
94
<a class="link" href="gobject-Type-Information.html#GType" title="GType">GType</a> instance_type,
95
<a class="link" href="gobject-Type-Information.html#GType" title="GType">GType</a> interface_type,
96
const <a class="link" href="gobject-Type-Information.html#GInterfaceInfo" title="GInterfaceInfo">GInterfaceInfo</a> *interface_info);
97
<a class="link" href="gobject-Type-Information.html#GType" title="GType">GType</a> <a class="link" href="GTypeModule.html#g-type-module-register-enum" title="g_type_module_register_enum ()">g_type_module_register_enum</a> (<a class="link" href="GTypeModule.html" title="GTypeModule">GTypeModule</a> *module,
99
href="./../glib/glib/glib-Basic-Types.html#gchar"
101
const <a class="link" href="gobject-Enumeration-and-Flag-Types.html#GEnumValue" title="GEnumValue">GEnumValue</a> *const_static_values);
102
<a class="link" href="gobject-Type-Information.html#GType" title="GType">GType</a> <a class="link" href="GTypeModule.html#g-type-module-register-flags" title="g_type_module_register_flags ()">g_type_module_register_flags</a> (<a class="link" href="GTypeModule.html" title="GTypeModule">GTypeModule</a> *module,
104
href="./../glib/glib/glib-Basic-Types.html#gchar"
106
const <a class="link" href="gobject-Enumeration-and-Flag-Types.html#GFlagsValue" title="GFlagsValue">GFlagsValue</a> *const_static_values);
107
#define <a class="link" href="GTypeModule.html#G-DEFINE-DYNAMIC-TYPE--CAPS" title="G_DEFINE_DYNAMIC_TYPE()">G_DEFINE_DYNAMIC_TYPE</a> (TN, t_n, T_P)
108
#define <a class="link" href="GTypeModule.html#G-DEFINE-DYNAMIC-TYPE-EXTENDED--CAPS" title="G_DEFINE_DYNAMIC_TYPE_EXTENDED()">G_DEFINE_DYNAMIC_TYPE_EXTENDED</a> (TypeName, type_name, TYPE_PARENT, flags, CODE)
111
111
<div class="refsect1" lang="en">
112
<a name="id2853011"></a><h2>Object Hierarchy</h2>
112
<a name="GTypeModule.object-hierarchy"></a><h2>Object Hierarchy</h2>
113
113
<pre class="synopsis">
115
114
<a class="link" href="gobject-The-Base-Object-Type.html#GObject">GObject</a>
119
118
<div class="refsect1" lang="en">
120
<a name="id2853036"></a><h2>Implemented Interfaces</h2>
119
<a name="GTypeModule.implemented-interfaces"></a><h2>Implemented Interfaces</h2>
122
121
GTypeModule implements
123
122
<a class="link" href="GTypePlugin.html" title="GTypePlugin">GTypePlugin</a>.</p>
125
124
<div class="refsect1" lang="en">
126
<a name="id2853058"></a><h2>Description</h2>
125
<a name="GTypeModule.description"></a><h2>Description</h2>
128
127
<a class="link" href="GTypeModule.html" title="GTypeModule"><span class="type">GTypeModule</span></a> provides a simple implementation of the <a class="link" href="GTypePlugin.html" title="GTypePlugin"><span class="type">GTypePlugin</span></a>
129
128
interface. The model of <a class="link" href="GTypeModule.html" title="GTypeModule"><span class="type">GTypeModule</span></a> is a dynamically loaded module
130
129
which implements some number of types and interface
131
130
implementations. When the module is loaded, it registers its types
132
and interfaces using <a class="link" href="GTypeModule.html#g-type-module-register-type"><code class="function">g_type_module_register_type()</code></a> and
133
<a class="link" href="GTypeModule.html#g-type-module-add-interface"><code class="function">g_type_module_add_interface()</code></a>. As long as any instances of these
131
and interfaces using <a class="link" href="GTypeModule.html#g-type-module-register-type" title="g_type_module_register_type ()"><code class="function">g_type_module_register_type()</code></a> and
132
<a class="link" href="GTypeModule.html#g-type-module-add-interface" title="g_type_module_add_interface ()"><code class="function">g_type_module_add_interface()</code></a>. As long as any instances of these
134
133
types and interface implementations are in use, the module is kept
135
134
loaded. When the types and interfaces are gone, the module may be
136
135
unloaded. If the types and interfaces become used again, the module
137
136
will be reloaded. Note that the last unref can not happen in module
138
137
code, since that would lead to the caller's code being unloaded before
139
<a class="link" href="gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a> returns to it.
138
<a class="link" href="gobject-The-Base-Object-Type.html#g-object-unref" title="g_object_unref ()"><code class="function">g_object_unref()</code></a> returns to it.
142
141
Keeping track of whether the module should be loaded or not is done by
143
142
using a use count - it starts at zero, and whenever it is greater than
144
143
zero, the module is loaded. The use count is maintained internally by
145
144
the type system, but also can be explicitly controlled by
146
<a class="link" href="GTypeModule.html#g-type-module-use"><code class="function">g_type_module_use()</code></a> and <a class="link" href="GTypeModule.html#g-type-module-unuse"><code class="function">g_type_module_unuse()</code></a>. Typically, when loading
147
a module for the first type, <a class="link" href="GTypeModule.html#g-type-module-use"><code class="function">g_type_module_use()</code></a> will be used to load
145
<a class="link" href="GTypeModule.html#g-type-module-use" title="g_type_module_use ()"><code class="function">g_type_module_use()</code></a> and <a class="link" href="GTypeModule.html#g-type-module-unuse" title="g_type_module_unuse ()"><code class="function">g_type_module_unuse()</code></a>. Typically, when loading
146
a module for the first type, <a class="link" href="GTypeModule.html#g-type-module-use" title="g_type_module_use ()"><code class="function">g_type_module_use()</code></a> will be used to load
148
147
it so that it can initialize its types. At some later point, when the
149
148
module no longer needs to be loaded except for the type
150
implementations it contains, <a class="link" href="GTypeModule.html#g-type-module-unuse"><code class="function">g_type_module_unuse()</code></a> is called.
149
implementations it contains, <a class="link" href="GTypeModule.html#g-type-module-unuse" title="g_type_module_unuse ()"><code class="function">g_type_module_unuse()</code></a> is called.
153
152
<a class="link" href="GTypeModule.html" title="GTypeModule"><span class="type">GTypeModule</span></a> does not actually provide any implementation of module
154
153
loading and unloading. To create a particular module type you must
155
154
derive from <a class="link" href="GTypeModule.html" title="GTypeModule"><span class="type">GTypeModule</span></a> and implement the load and unload functions
156
in <a class="link" href="GTypeModule.html#GTypeModuleClass"><span class="type">GTypeModuleClass</span></a>.
155
in <a class="link" href="GTypeModule.html#GTypeModuleClass" title="GTypeModuleClass"><span class="type">GTypeModuleClass</span></a>.</p>
159
159
<div class="refsect1" lang="en">
160
<a name="id2853224"></a><h2>Details</h2>
160
<a name="GTypeModule.details"></a><h2>Details</h2>
161
161
<div class="refsect2" lang="en">
162
<a name="id2853234"></a><h3>
163
<a name="GTypeModule-struct"></a>GTypeModule</h3>
164
<a class="indexterm" name="id2853247"></a><pre class="programlisting">typedef struct {
162
<a name="GTypeModule-struct"></a><h3>GTypeModule</h3>
163
<pre class="programlisting">typedef struct {
169
168
The members of the <span class="structname">GTypeModule</span> structure should not
170
be accessed directly, except for the <em class="parameter"><code>name</code></em> field.
169
be accessed directly, except for the <em class="parameter"><code>name</code></em> field.</p>
172
172
<div class="variablelist"><table border="0">
173
173
<col align="left" valign="top">
175
175
<td><p><span class="term"><a
176
176
href="./../glib/glib/glib-Basic-Types.html#gchar"
177
>gchar</a> *<em class="structfield"><code>name</code></em>;</span></p></td>
178
<td>the name of the module
177
>gchar</a> *<em class="structfield"><code>name</code></em>;</span></p></td>
178
<td> the name of the module
185
184
<div class="refsect2" lang="en">
186
<a name="id2853298"></a><h3>
187
<a name="GTypeModuleClass"></a>GTypeModuleClass</h3>
188
<a class="indexterm" name="id2853311"></a><pre class="programlisting">typedef struct {
185
<a name="GTypeModuleClass"></a><h3>GTypeModuleClass</h3>
186
<pre class="programlisting">typedef struct {
189
187
GObjectClass parent_class;
191
189
gboolean (* load) (GTypeModule *module);
256
253
<div class="refsect2" lang="en">
257
<a name="id2853521"></a><h3>
258
<a name="g-type-module-unuse"></a>g_type_module_unuse ()</h3>
259
<a class="indexterm" name="id2853534"></a><pre class="programlisting">void g_type_module_unuse (<a class="link" href="GTypeModule.html" title="GTypeModule">GTypeModule</a> *module);</pre>
254
<a name="g-type-module-unuse"></a><h3>g_type_module_unuse ()</h3>
255
<pre class="programlisting">void g_type_module_unuse (<a class="link" href="GTypeModule.html" title="GTypeModule">GTypeModule</a> *module);</pre>
261
257
Decreases the use count of a <a class="link" href="GTypeModule.html" title="GTypeModule"><span class="type">GTypeModule</span></a> by one. If the
262
258
result is zero, the module will be unloaded. (However, the
263
259
<a class="link" href="GTypeModule.html" title="GTypeModule"><span class="type">GTypeModule</span></a> will not be freed, and types associated with the
264
<a class="link" href="GTypeModule.html" title="GTypeModule"><span class="type">GTypeModule</span></a> are not unregistered. Once a <a class="link" href="GTypeModule.html" title="GTypeModule"><span class="type">GTypeModule</span></a> is
265
initialized, it must exist forever.)
260
<a class="link" href="GTypeModule.html" title="GTypeModule"><span class="type">GTypeModule</span></a> are not unregistered. Once a <a class="link" href="GTypeModule.html" title="GTypeModule"><span class="type">GTypeModule</span></a> is
261
initialized, it must exist forever.)</p>
267
264
<div class="variablelist"><table border="0">
268
265
<col align="left" valign="top">
270
<td><p><span class="term"><em class="parameter"><code>module</code></em> :</span></p></td>
271
<td>a <a class="link" href="GTypeModule.html" title="GTypeModule"><span class="type">GTypeModule</span></a>
267
<td><p><span class="term"><em class="parameter"><code>module</code></em> :</span></p></td>
268
<td> a <a class="link" href="GTypeModule.html" title="GTypeModule"><span class="type">GTypeModule</span></a>
279
274
<div class="refsect2" lang="en">
280
<a name="id2853622"></a><h3>
281
<a name="g-type-module-set-name"></a>g_type_module_set_name ()</h3>
282
<a class="indexterm" name="id2853636"></a><pre class="programlisting">void g_type_module_set_name (<a class="link" href="GTypeModule.html" title="GTypeModule">GTypeModule</a> *module,
275
<a name="g-type-module-set-name"></a><h3>g_type_module_set_name ()</h3>
276
<pre class="programlisting">void g_type_module_set_name (<a class="link" href="GTypeModule.html" title="GTypeModule">GTypeModule</a> *module,
284
278
href="./../glib/glib/glib-Basic-Types.html#gchar"
285
279
>gchar</a> *name);</pre>
287
Sets the name for a <a class="link" href="GTypeModule.html" title="GTypeModule"><span class="type">GTypeModule</span></a>
281
Sets the name for a <a class="link" href="GTypeModule.html" title="GTypeModule"><span class="type">GTypeModule</span></a></p>
289
284
<div class="variablelist"><table border="0">
290
285
<col align="left" valign="top">
293
<td><p><span class="term"><em class="parameter"><code>module</code></em> :</span></p></td>
294
<td>a <a class="link" href="GTypeModule.html" title="GTypeModule"><span class="type">GTypeModule</span></a>.
288
<td><p><span class="term"><em class="parameter"><code>module</code></em> :</span></p></td>
289
<td> a <a class="link" href="GTypeModule.html" title="GTypeModule"><span class="type">GTypeModule</span></a>.
298
<td><p><span class="term"><em class="parameter"><code>name</code></em> :</span></p></td>
299
<td>a human-readable name to use in error messages.
293
<td><p><span class="term"><em class="parameter"><code>name</code></em> :</span></p></td>
294
<td> a human-readable name to use in error messages.
372
363
<div class="refsect2" lang="en">
373
<a name="id2853935"></a><h3>
374
<a name="g-type-module-add-interface"></a>g_type_module_add_interface ()</h3>
375
<a class="indexterm" name="id2853949"></a><pre class="programlisting">void g_type_module_add_interface (<a class="link" href="GTypeModule.html" title="GTypeModule">GTypeModule</a> *module,
376
<a class="link" href="gobject-Type-Information.html#GType">GType</a> instance_type,
377
<a class="link" href="gobject-Type-Information.html#GType">GType</a> interface_type,
378
const <a class="link" href="gobject-Type-Information.html#GInterfaceInfo">GInterfaceInfo</a> *interface_info);</pre>
364
<a name="g-type-module-add-interface"></a><h3>g_type_module_add_interface ()</h3>
365
<pre class="programlisting">void g_type_module_add_interface (<a class="link" href="GTypeModule.html" title="GTypeModule">GTypeModule</a> *module,
366
<a class="link" href="gobject-Type-Information.html#GType" title="GType">GType</a> instance_type,
367
<a class="link" href="gobject-Type-Information.html#GType" title="GType">GType</a> interface_type,
368
const <a class="link" href="gobject-Type-Information.html#GInterfaceInfo" title="GInterfaceInfo">GInterfaceInfo</a> *interface_info);</pre>
380
Registers an additional interface for a type, whose interface
381
lives in the given type plugin. If the interface was already registered
382
for the type in this plugin, nothing will be done.
370
Registers an additional interface for a type, whose interface lives
371
in the given type plugin. If the interface was already registered
372
for the type in this plugin, nothing will be done.
385
375
As long as any instances of the type exist, the type plugin will
388
379
<div class="variablelist"><table border="0">
389
380
<col align="left" valign="top">
392
<td><p><span class="term"><em class="parameter"><code>module</code></em> :</span></p></td>
393
<td>a <a class="link" href="GTypeModule.html" title="GTypeModule"><span class="type">GTypeModule</span></a>
397
<td><p><span class="term"><em class="parameter"><code>instance_type</code></em> :</span></p></td>
398
<td>type to which to add the interface.
402
<td><p><span class="term"><em class="parameter"><code>interface_type</code></em> :</span></p></td>
403
<td>interface type to add
407
<td><p><span class="term"><em class="parameter"><code>interface_info</code></em> :</span></p></td>
408
<td>type information structure
383
<td><p><span class="term"><em class="parameter"><code>module</code></em> :</span></p></td>
384
<td> a <a class="link" href="GTypeModule.html" title="GTypeModule"><span class="type">GTypeModule</span></a>
388
<td><p><span class="term"><em class="parameter"><code>instance_type</code></em> :</span></p></td>
389
<td> type to which to add the interface.
393
<td><p><span class="term"><em class="parameter"><code>interface_type</code></em> :</span></p></td>
394
<td> interface type to add
398
<td><p><span class="term"><em class="parameter"><code>interface_info</code></em> :</span></p></td>
399
<td> type information structure
417
406
<div class="refsect2" lang="en">
418
<a name="id2854078"></a><h3>
419
<a name="g-type-module-register-enum"></a>g_type_module_register_enum ()</h3>
420
<a class="indexterm" name="id2854093"></a><pre class="programlisting"><a class="link" href="gobject-Type-Information.html#GType">GType</a> g_type_module_register_enum (<a class="link" href="GTypeModule.html" title="GTypeModule">GTypeModule</a> *module,
407
<a name="g-type-module-register-enum"></a><h3>g_type_module_register_enum ()</h3>
408
<pre class="programlisting"><a class="link" href="gobject-Type-Information.html#GType" title="GType">GType</a> g_type_module_register_enum (<a class="link" href="GTypeModule.html" title="GTypeModule">GTypeModule</a> *module,
422
410
href="./../glib/glib/glib-Basic-Types.html#gchar"
423
411
>gchar</a> *name,
424
const <a class="link" href="gobject-Enumeration-and-Flag-Types.html#GEnumValue">GEnumValue</a> *const_static_values);</pre>
412
const <a class="link" href="gobject-Enumeration-and-Flag-Types.html#GEnumValue" title="GEnumValue">GEnumValue</a> *const_static_values);</pre>
426
414
Looks up or registers an enumeration that is implemented with a particular
427
415
type plugin. If a type with name <em class="parameter"><code>type_name</code></em> was previously registered,
428
the <a class="link" href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> identifier for the type is returned, otherwise the type
429
is newly registered, and the resulting <a class="link" href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> identifier returned.
416
the <a class="link" href="gobject-Type-Information.html#GType" title="GType"><span class="type">GType</span></a> identifier for the type is returned, otherwise the type
417
is newly registered, and the resulting <a class="link" href="gobject-Type-Information.html#GType" title="GType"><span class="type">GType</span></a> identifier returned.
432
420
As long as any instances of the type exist, the type plugin will
435
424
<div class="variablelist"><table border="0">
436
425
<col align="left" valign="top">
439
<td><p><span class="term"><em class="parameter"><code>module</code></em> :</span></p></td>
440
<td> a <a class="link" href="GTypeModule.html" title="GTypeModule"><span class="type">GTypeModule</span></a>
444
<td><p><span class="term"><em class="parameter"><code>name</code></em> :</span></p></td>
445
<td> name for the type
449
<td><p><span class="term"><em class="parameter"><code>const_static_values</code></em> :</span></p></td>
450
<td>an array of <a class="link" href="gobject-Enumeration-and-Flag-Types.html#GEnumValue"><span class="type">GEnumValue</span></a> structs for the possible
451
enumeration values. The array is terminated by a struct with all
456
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
457
<td>the new or existing type ID
428
<td><p><span class="term"><em class="parameter"><code>module</code></em> :</span></p></td>
429
<td> a <a class="link" href="GTypeModule.html" title="GTypeModule"><span class="type">GTypeModule</span></a>
433
<td><p><span class="term"><em class="parameter"><code>name</code></em> :</span></p></td>
434
<td> name for the type
438
<td><p><span class="term"><em class="parameter"><code>const_static_values</code></em> :</span></p></td>
439
<td> an array of <a class="link" href="gobject-Enumeration-and-Flag-Types.html#GEnumValue" title="GEnumValue"><span class="type">GEnumValue</span></a> structs for the
440
possible enumeration values. The array is
441
terminated by a struct with all members being
446
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
447
<td> the new or existing type ID
462
<p class="since">Since 2.6
452
<p class="since">Since 2.6</p>
468
455
<div class="refsect2" lang="en">
469
<a name="id2854250"></a><h3>
470
<a name="g-type-module-register-flags"></a>g_type_module_register_flags ()</h3>
471
<a class="indexterm" name="id2854266"></a><pre class="programlisting"><a class="link" href="gobject-Type-Information.html#GType">GType</a> g_type_module_register_flags (<a class="link" href="GTypeModule.html" title="GTypeModule">GTypeModule</a> *module,
456
<a name="g-type-module-register-flags"></a><h3>g_type_module_register_flags ()</h3>
457
<pre class="programlisting"><a class="link" href="gobject-Type-Information.html#GType" title="GType">GType</a> g_type_module_register_flags (<a class="link" href="GTypeModule.html" title="GTypeModule">GTypeModule</a> *module,
473
459
href="./../glib/glib/glib-Basic-Types.html#gchar"
474
460
>gchar</a> *name,
475
const <a class="link" href="gobject-Enumeration-and-Flag-Types.html#GFlagsValue">GFlagsValue</a> *const_static_values);</pre>
461
const <a class="link" href="gobject-Enumeration-and-Flag-Types.html#GFlagsValue" title="GFlagsValue">GFlagsValue</a> *const_static_values);</pre>
477
463
Looks up or registers a flags type that is implemented with a particular
478
464
type plugin. If a type with name <em class="parameter"><code>type_name</code></em> was previously registered,
479
the <a class="link" href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> identifier for the type is returned, otherwise the type
480
is newly registered, and the resulting <a class="link" href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> identifier returned.
465
the <a class="link" href="gobject-Type-Information.html#GType" title="GType"><span class="type">GType</span></a> identifier for the type is returned, otherwise the type
466
is newly registered, and the resulting <a class="link" href="gobject-Type-Information.html#GType" title="GType"><span class="type">GType</span></a> identifier returned.
483
469
As long as any instances of the type exist, the type plugin will
486
473
<div class="variablelist"><table border="0">
487
474
<col align="left" valign="top">
490
<td><p><span class="term"><em class="parameter"><code>module</code></em> :</span></p></td>
491
<td> a <a class="link" href="GTypeModule.html" title="GTypeModule"><span class="type">GTypeModule</span></a>
495
<td><p><span class="term"><em class="parameter"><code>name</code></em> :</span></p></td>
496
<td> name for the type
500
<td><p><span class="term"><em class="parameter"><code>const_static_values</code></em> :</span></p></td>
501
<td>an array of <a class="link" href="gobject-Enumeration-and-Flag-Types.html#GFlagsValue"><span class="type">GFlagsValue</span></a> structs for the possible
502
flags values. The array is terminated by a struct with all
507
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
508
<td>the new or existing type ID
477
<td><p><span class="term"><em class="parameter"><code>module</code></em> :</span></p></td>
478
<td> a <a class="link" href="GTypeModule.html" title="GTypeModule"><span class="type">GTypeModule</span></a>
482
<td><p><span class="term"><em class="parameter"><code>name</code></em> :</span></p></td>
483
<td> name for the type
487
<td><p><span class="term"><em class="parameter"><code>const_static_values</code></em> :</span></p></td>
488
<td> an array of <a class="link" href="gobject-Enumeration-and-Flag-Types.html#GFlagsValue" title="GFlagsValue"><span class="type">GFlagsValue</span></a> structs for the
489
possible flags values. The array is
490
terminated by a struct with all members being
495
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
496
<td> the new or existing type ID
513
<p class="since">Since 2.6
501
<p class="since">Since 2.6</p>
519
504
<div class="refsect2" lang="en">
520
<a name="id2854422"></a><h3>
521
<a name="G-DEFINE-DYNAMIC-TYPE:CAPS"></a>G_DEFINE_DYNAMIC_TYPE()</h3>
522
<a class="indexterm" name="id2854438"></a><pre class="programlisting">#define G_DEFINE_DYNAMIC_TYPE(TN, t_n, T_P) G_DEFINE_DYNAMIC_TYPE_EXTENDED (TN, t_n, T_P, 0, {})
505
<a name="G-DEFINE-DYNAMIC-TYPE--CAPS"></a><h3>G_DEFINE_DYNAMIC_TYPE()</h3>
506
<pre class="programlisting">#define G_DEFINE_DYNAMIC_TYPE(TN, t_n, T_P) G_DEFINE_DYNAMIC_TYPE_EXTENDED (TN, t_n, T_P, 0, {})
525
509
A convenience macro for dynamic type implementations, which declares a
526
510
class initialization function, an instance initialization function (see
527
<a class="link" href="gobject-Type-Information.html#GTypeInfo"><span class="type">GTypeInfo</span></a> for information about these) and a static variable named
511
<a class="link" href="gobject-Type-Information.html#GTypeInfo" title="GTypeInfo"><span class="type">GTypeInfo</span></a> for information about these) and a static variable named
528
512
<em class="parameter"><code>t_n</code></em>_parent_class pointing to the parent class. Furthermore,
529
513
it defines a <code class="function">*<code class="function">_get_type()</code></code> and a static
530
514
<code class="function">*<code class="function">_register_type()</code></code> function for use in your
531
515
<code class="function"><code class="function">module_init()</code></code>.
532
See <a class="link" href="GTypeModule.html#G-DEFINE-DYNAMIC-TYPE-EXTENDED:CAPS"><code class="function">G_DEFINE_DYNAMIC_TYPE_EXTENDED()</code></a> for an example.
516
See <a class="link" href="GTypeModule.html#G-DEFINE-DYNAMIC-TYPE-EXTENDED--CAPS" title="G_DEFINE_DYNAMIC_TYPE_EXTENDED()"><code class="function">G_DEFINE_DYNAMIC_TYPE_EXTENDED()</code></a> for an example.</p>
534
519
<div class="variablelist"><table border="0">
535
520
<col align="left" valign="top">
538
<td><p><span class="term"><em class="parameter"><code>TN</code></em> :</span></p></td>
539
<td>The name of the new type, in Camel case.
543
<td><p><span class="term"><em class="parameter"><code>t_n</code></em> :</span></p></td>
544
<td>The name of the new type, in lowercase, with words
549
<td><p><span class="term"><em class="parameter"><code>T_P</code></em> :</span></p></td>
550
<td>The <a class="link" href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> of the parent type.
523
<td><p><span class="term"><em class="parameter"><code>TN</code></em> :</span></p></td>
524
<td> The name of the new type, in Camel case.
528
<td><p><span class="term"><em class="parameter"><code>t_n</code></em> :</span></p></td>
529
<td> The name of the new type, in lowercase, with words
534
<td><p><span class="term"><em class="parameter"><code>T_P</code></em> :</span></p></td>
535
<td> The <a class="link" href="gobject-Type-Information.html#GType" title="GType"><span class="type">GType</span></a> of the parent type.
555
<p class="since">Since 2.14
540
<p class="since">Since 2.14</p>
561
543
<div class="refsect2" lang="en">
562
<a name="id2854593"></a><h3>
563
<a name="G-DEFINE-DYNAMIC-TYPE-EXTENDED:CAPS"></a>G_DEFINE_DYNAMIC_TYPE_EXTENDED()</h3>
564
<a class="indexterm" name="id2854609"></a><pre class="programlisting">#define G_DEFINE_DYNAMIC_TYPE_EXTENDED(TypeName, type_name, TYPE_PARENT, flags, CODE)</pre>
566
A more general version of <a class="link" href="GTypeModule.html#G-DEFINE-DYNAMIC-TYPE:CAPS"><code class="function">G_DEFINE_DYNAMIC_TYPE()</code></a> which
567
allows to specify <a class="link" href="gobject-Type-Information.html#GTypeFlags"><span class="type">GTypeFlags</span></a> and custom code.
569
<div class="informalexample">
570
<pre class="programlisting">
544
<a name="G-DEFINE-DYNAMIC-TYPE-EXTENDED--CAPS"></a><h3>G_DEFINE_DYNAMIC_TYPE_EXTENDED()</h3>
545
<pre class="programlisting">#define G_DEFINE_DYNAMIC_TYPE_EXTENDED(TypeName, type_name, TYPE_PARENT, flags, CODE)</pre>
547
A more general version of <a class="link" href="GTypeModule.html#G-DEFINE-DYNAMIC-TYPE--CAPS" title="G_DEFINE_DYNAMIC_TYPE()"><code class="function">G_DEFINE_DYNAMIC_TYPE()</code></a> which
548
allows to specify <a class="link" href="gobject-Type-Information.html#GTypeFlags" title="enum GTypeFlags"><span class="type">GTypeFlags</span></a> and custom code.
552
<div class="informalexample"><pre class="programlisting">
571
553
G_DEFINE_DYNAMIC_TYPE_EXTENDED (GtkGadget,
575
557
G_IMPLEMENT_INTERFACE (TYPE_GIZMO,
576
558
gtk_gadget_gizmo_init));
579
<pre class="programlisting">
563
<div class="informalexample"><pre class="programlisting">
580
564
static void gtk_gadget_init (GtkGadget *self);
581
565
static void gtk_gadget_class_init (GtkGadgetClass *klass);
582
566
static void gtk_gadget_class_finalize (GtkGadgetClass *klass);
623
607
g_type_add_interface_static (g_define_type_id, TYPE_GIZMO, &g_implement_interface_info);
628
613
<div class="variablelist"><table border="0">
629
614
<col align="left" valign="top">
632
<td><p><span class="term"><em class="parameter"><code>TypeName</code></em> :</span></p></td>
633
<td>The name of the new type, in Camel case.
637
<td><p><span class="term"><em class="parameter"><code>type_name</code></em> :</span></p></td>
638
<td>The name of the new type, in lowercase, with words
643
<td><p><span class="term"><em class="parameter"><code>TYPE_PARENT</code></em> :</span></p></td>
644
<td>The <a class="link" href="gobject-Type-Information.html#GType"><span class="type">GType</span></a> of the parent type.
648
<td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
650
<a class="link" href="gobject-Type-Information.html#GTypeFlags"><span class="type">GTypeFlags</span></a> to pass to <a class="link" href="GTypeModule.html#g-type-module-register-type"><code class="function">g_type_module_register_type()</code></a>
654
<td><p><span class="term"><em class="parameter"><code>CODE</code></em> :</span></p></td>
655
<td>Custom code that gets inserted in the *<code class="function">_get_type()</code> function.
617
<td><p><span class="term"><em class="parameter"><code>TypeName</code></em> :</span></p></td>
618
<td> The name of the new type, in Camel case.
622
<td><p><span class="term"><em class="parameter"><code>type_name</code></em> :</span></p></td>
623
<td> The name of the new type, in lowercase, with words
628
<td><p><span class="term"><em class="parameter"><code>TYPE_PARENT</code></em> :</span></p></td>
629
<td> The <a class="link" href="gobject-Type-Information.html#GType" title="GType"><span class="type">GType</span></a> of the parent type.
633
<td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
634
<td> <a class="link" href="gobject-Type-Information.html#GTypeFlags" title="enum GTypeFlags"><span class="type">GTypeFlags</span></a> to pass to <a class="link" href="GTypeModule.html#g-type-module-register-type" title="g_type_module_register_type ()"><code class="function">g_type_module_register_type()</code></a>
638
<td><p><span class="term"><em class="parameter"><code>CODE</code></em> :</span></p></td>
639
<td> Custom code that gets inserted in the *<code class="function">_get_type()</code> function.
660
<p class="since">Since 2.14
644
<p class="since">Since 2.14</p>
666
647
<div class="refsect1" lang="en">
667
<a name="id2852684"></a><h2>See Also</h2>
648
<a name="GTypeModule.see-also"></a><h2>See Also</h2>
670
649
<div class="variablelist"><table border="0">
671
650
<col align="left" valign="top">