?? gio-extension-points.html
字號:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"><title>Extension Points</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"><link rel="start" href="index.html" title="GIO Reference Manual"><link rel="up" href="extending.html" title="Extending GIO"><link rel="prev" href="GIOModule.html" title="GIOModule"><link rel="next" href="migrating.html" title="Part III. Migrating to GIO"><meta name="generator" content="GTK-Doc V1.9 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="part" href="pt01.html" title="Part I. GIO Overview"><link rel="chapter" href="ch01.html" title="Introduction"><link rel="chapter" href="ch02.html" title="Compiling GIO applications"><link rel="chapter" href="ch03.html" title="Running GIO applications"><link rel="chapter" href="gio-extension-points.html" title="Extending GIO"><link rel="part" href="pt02.html" title="Part II. API Reference"><link rel="chapter" href="file_ops.html" title="File Operations"><link rel="chapter" href="file_mon.html" title="File System Monitoring"><link rel="chapter" href="async.html" title="Asynchronous I/O"><link rel="chapter" href="streaming.html" title="Streaming I/O"><link rel="chapter" href="types.html" title="File types and applications"><link rel="chapter" href="volume_mon.html" title="Volumes and Drives"><link rel="chapter" href="icons.html" title="Icons"><link rel="chapter" href="utils.html" title="Utilities"><link rel="chapter" href="extending.html" title="Extending GIO"><link rel="part" href="migrating.html" title="Part III. Migrating to GIO"><link rel="chapter" href="ch14.html" title="Migrating from POSIX to GIO"><link rel="chapter" href="ch15.html" title="Migrating from GnomeVFS to GIO"><link rel="chapter" href="gio-hierarchy.html" title="Object Hierarchy"><link rel="index" href="ix01.html" title="Index"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="GIOModule.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="extending.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">GIO Reference Manual</th><td><a accesskey="n" href="migrating.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr><tr><td colspan="5" class="shortcuts"><nobr><a href="#id3141819" class="shortcut">Top</a>  |  <a href="#id3236862" class="shortcut">Description</a></nobr></td></tr></table><div class="refentry" lang="en"><a name="gio-Extension-Points"></a><div class="titlepage"></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><a name="id3141819"></a><span class="refentrytitle">Extension Points</span></h2><p>Extension Points — Extension Points</p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">#include <gio.h> <a class="link" href="gio-Extension-Points.html#GIOExtension">GIOExtension</a>; <a class="link" href="gio-Extension-Points.html#GIOExtensionPoint">GIOExtensionPoint</a>;const char* <a class="link" href="gio-Extension-Points.html#g-io-extension-get-name">g_io_extension_get_name</a> (<a class="link" href="gio-Extension-Points.html#GIOExtension">GIOExtension</a> *extension);<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> <a class="link" href="gio-Extension-Points.html#g-io-extension-get-priority">g_io_extension_get_priority</a> (<a class="link" href="gio-Extension-Points.html#GIOExtension">GIOExtension</a> *extension);<ahref="/usr/share/gtk-doc/html/gobject/gobject-Type-Information.html#GType">GType</a> <a class="link" href="gio-Extension-Points.html#g-io-extension-get-type">g_io_extension_get_type</a> (<a class="link" href="gio-Extension-Points.html#GIOExtension">GIOExtension</a> *extension);<a class="link" href="gio-Extension-Points.html#GIOExtension">GIOExtension</a>* <a class="link" href="gio-Extension-Points.html#g-io-extension-point-get-extension-by-name">g_io_extension_point_get_extension_by_name</a> (<a class="link" href="gio-Extension-Points.html#GIOExtensionPoint">GIOExtensionPoint</a> *extension_point, const char *name);<ahref="/usr/share/gtk-doc/html/glib/glib-Doubly-Linked-Lists.html#GList">GList</a>* <a class="link" href="gio-Extension-Points.html#g-io-extension-point-get-extensions">g_io_extension_point_get_extensions</a> (<a class="link" href="gio-Extension-Points.html#GIOExtensionPoint">GIOExtensionPoint</a> *extension_point);<ahref="/usr/share/gtk-doc/html/gobject/gobject-Type-Information.html#GType">GType</a> <a class="link" href="gio-Extension-Points.html#g-io-extension-point-get-required-type">g_io_extension_point_get_required_type</a> (<a class="link" href="gio-Extension-Points.html#GIOExtensionPoint">GIOExtensionPoint</a> *extension_point);<a class="link" href="gio-Extension-Points.html#GIOExtension">GIOExtension</a>* <a class="link" href="gio-Extension-Points.html#g-io-extension-point-implement">g_io_extension_point_implement</a> (const char *extension_point_name, <ahref="/usr/share/gtk-doc/html/gobject/gobject-Type-Information.html#GType">GType</a> type, const char *extension_name, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> priority);<a class="link" href="gio-Extension-Points.html#GIOExtensionPoint">GIOExtensionPoint</a>* <a class="link" href="gio-Extension-Points.html#g-io-extension-point-lookup">g_io_extension_point_lookup</a> (const char *name);<a class="link" href="gio-Extension-Points.html#GIOExtensionPoint">GIOExtensionPoint</a>* <a class="link" href="gio-Extension-Points.html#g-io-extension-point-register">g_io_extension_point_register</a> (const char *name);void <a class="link" href="gio-Extension-Points.html#g-io-extension-point-set-required-type">g_io_extension_point_set_required_type</a> (<a class="link" href="gio-Extension-Points.html#GIOExtensionPoint">GIOExtensionPoint</a> *extension_point, <ahref="/usr/share/gtk-doc/html/gobject/gobject-Type-Information.html#GType">GType</a> type);<ahref="/usr/share/gtk-doc/html/gobject/gobject-Type-Information.html#GTypeClass">GTypeClass</a>* <a class="link" href="gio-Extension-Points.html#g-io-extension-ref-class">g_io_extension_ref_class</a> (<a class="link" href="gio-Extension-Points.html#GIOExtension">GIOExtension</a> *extension);</pre></div><div class="refsect1" lang="en"><a name="id3236862"></a><h2>Description</h2><p><a class="link" href="gio-Extension-Points.html#GIOExtensionPoint"><span class="type">GIOExtensionPoint</span></a> provides a mechanism for modules to extend thefunctionality of the library or application that loaded it in an organized fashion. </p><p>An extension point is identified by a name, and it may optionallyrequire that any implementation must by of a certain type (or derivedthereof). Use <a class="link" href="gio-Extension-Points.html#g-io-extension-point-register"><code class="function">g_io_extension_point_register()</code></a> to register anextension point, and <a class="link" href="gio-Extension-Points.html#g-io-extension-point-set-required-type"><code class="function">g_io_extension_point_set_required_type()</code></a> toset a required type.</p><p>A module can implement an extension point by specifying the <ahref="/usr/share/gtk-doc/html/gobject/gobject-Type-Information.html#GType"><span class="type">GType</span></a> that implements the functionality. Additionally, each implementationof an extension point has a name, and a priority. Use<a class="link" href="gio-Extension-Points.html#g-io-extension-point-implement"><code class="function">g_io_extension_point_implement()</code></a> to implement an extension point.</p><p> </p><div class="informalexample"><pre class="programlisting"> GIOExtensionPoint *ep; /* Register an extension point */ ep = g_io_extension_point_register ("my-extension-point"); g_io_extension_point_set_required_type (ep, MY_TYPE_EXAMPLE); </pre></div><p></p><p> </p><div class="informalexample"><pre class="programlisting"> /* Implement an extension point */ G_DEFINE_TYPE (MyExampleImpl, my_example_impl, MY_TYPE_EXAMPLE); g_io_extension_point_implement ("my-extension-point", my_example_impl_get_type (), "my-example", 10); </pre></div><p></p><p> It is up to the code that registered the extension point how it uses the implementations that have been associated with it. Depending on the use case, it may use all implementations, or only the one with the highest priority, or pick a specific one by name.</p><p></p></div><div class="refsect1" lang="en"><a name="id3237001"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id3237012"></a><h3><a name="GIOExtension"></a>GIOExtension</h3><a class="indexterm" name="id3237024"></a><pre class="programlisting">typedef struct _GIOExtension GIOExtension;</pre><p></p></div><hr><div class="refsect2" lang="en"><a name="id3237040"></a><h3><a name="GIOExtensionPoint"></a>GIOExtensionPoint</h3><a class="indexterm" name="id3237052"></a><pre class="programlisting">typedef struct _GIOExtensionPoint GIOExtensionPoint;</pre><p></p></div><hr><div class="refsect2" lang="en"><a name="id3237068"></a><h3><a name="g-io-extension-get-name"></a>g_io_extension_get_name ()</h3><a class="indexterm" name="id3237080"></a><pre class="programlisting">const char* g_io_extension_get_name (<a class="link" href="gio-Extension-Points.html#GIOExtension">GIOExtension</a> *extension);</pre><p>Gets the name under which <em class="parameter"><code>extension</code></em> was registered.</p><p>Note that the same type may be registered as extensionfor multiple extension points, under different names.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>extension</code></em> :</span></p></td><td> a <a class="link" href="gio-Extension-Points.html#GIOExtension"><span class="type">GIOExtension</span></a></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the name of <em class="parameter"><code>extension</code></em>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3237166"></a><h3><a name="g-io-extension-get-priority"></a>g_io_extension_get_priority ()</h3><a class="indexterm" name="id3237177"></a><pre class="programlisting"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> g_io_extension_get_priority (<a class="link" href="gio-Extension-Points.html#GIOExtension">GIOExtension</a> *extension);</pre><p>Gets the priority with which <em class="parameter"><code>extension</code></em> was registered.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>extension</code></em> :</span></p></td><td> a <a class="link" href="gio-Extension-Points.html#GIOExtension"><span class="type">GIOExtension</span></a></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the priority of <em class="parameter"><code>extension</code></em></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3237257"></a><h3><a name="g-io-extension-get-type"></a>g_io_extension_get_type ()</h3><a class="indexterm" name="id3239481"></a><pre class="programlisting"><ahref="/usr/share/gtk-doc/html/gobject/gobject-Type-Information.html#GType">GType</a> g_io_extension_get_type (<a class="link" href="gio-Extension-Points.html#GIOExtension">GIOExtension</a> *extension);</pre><p>Gets the type associated with <em class="parameter"><code>extension</code></em>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>extension</code></em> :</span></p></td><td> a <a class="link" href="gio-Extension-Points.html#GIOExtension"><span class="type">GIOExtension</span></a></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the type of <em class="parameter"><code>extension</code></em></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3239561"></a><h3><a name="g-io-extension-point-get-extension-by-name"></a>g_io_extension_point_get_extension_by_name ()</h3><a class="indexterm" name="id3239576"></a><pre class="programlisting"><a class="link" href="gio-Extension-Points.html#GIOExtension">GIOExtension</a>* g_io_extension_point_get_extension_by_name (<a class="link" href="gio-Extension-Points.html#GIOExtensionPoint">GIOExtensionPoint</a> *extension_point, const char *name);</pre><p>Finds a <a class="link" href="gio-Extension-Points.html#GIOExtension"><span class="type">GIOExtension</span></a> for an extension point by name.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -