⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 glib-bookmark-file-parser.html

📁 最新gtk中文资料集
💻 HTML
📖 第 1 页 / 共 5 页
字号:
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre></div><div class="refsect1" lang="en"><a name="id3198004"></a><h2>Description</h2><p><a class="link" href="glib-Bookmark-file-parser.html#GBookmarkFile"><span class="type">GBookmarkFile</span></a> lets you parse, edit or create files containing bookmarksto URI, along with some meta-data about the resource pointed by the URI likeits MIME type, the application that is registering the bookmark and theicon that should be used to represent the bookmark. The data is stored usingthe<a class="ulink" href="http://www.gnome.org/~ebassi/bookmark-spec" target="_top">Desktop BookmarkSpecification</a>.</p><p>The syntax of the bookmark files is described in detail inside the DesktopBookmark Specification, here is a quick summary: bookmark files use a sub-classof the<a class="ulink" href="" target="_top">XML Bookmark Exchange Language</a> specification, consistingof valid UTF-8 encoded XML, under the <code class="literal">xbel</code> root element;each bookmark is stored inside a <code class="literal">bookmark</code> element, usingits URI: no relative paths can be used inside a bookmark file. The bookmarkmay have a user defined title and description, to be used instead of the URI.Under the <code class="literal">metadata</code> element, with its <code class="literal">owner</code>attribute set to <code class="literal">http://freedesktop.org</code>, is stored themeta-data about a resource pointed by its URI. The meta-data consists ofthe resource's MIME type; the applications that have registered a bookmark;the groups to which a bookmark belongs to; a visibility flag, used to setthe bookmark as "private" to the applications and groups that has itregistered; the URI and MIME type of an icon, to be used when displaying thebookmark inside a GUI.</p><div class="informalexample"><pre class="programlisting">&lt;?xml version="1.0"?&gt;&lt;!DOCTYPE xbel PUBLIC   "+//IDN python.org//DTD XML Bookmark Exchange Language 1.0//EN//XML"  "http://www.python.org/topics/xml/dtds/xbel-1.0.dtd"&gt;&lt;xbel version="1.0"      xmlns:mime="http://www.freedesktop.org/standards/shared-mime-info"      xmlns:bookmark="http://www.freedesktop.org/standards/desktop-bookmarks"&gt;  &lt;bookmark href="file:///home/ebassi/bookmark-spec/bookmark-spec.xml"&gt;    &lt;title&gt;Desktop Bookmarks Spec&lt;/title&gt;    &lt;info&gt;      &lt;metadata owner="http://freedesktop.org"&gt;        &lt;mime:mime-type&gt;text/xml&lt;/mime:mime-type&gt;	&lt;bookmark:applications&gt;          &lt;bookmark:application name="GEdit" count="2" exec="gedit %u" timestamp="1115726763"/&gt;          &lt;bookmark:application name="GViM" count="7" exec="gvim %f" timestamp="1115726812"/&gt;	&lt;/bookmark:applications&gt;	&lt;bookmark:groups&gt;	  &lt;bookmark:group&gt;Editors&lt;/bookmark:group&gt;	&lt;/bookmark:groups&gt;      &lt;/metadata&gt;    &lt;/info&gt;  &lt;/bookmark&gt;&lt;/xbel&gt;</pre></div><p>A bookmark file might contain more than one bookmark; each bookmark is accessedthrough its URI.</p><p>The important caveat of bookmark files is that when you add a new bookmark youmust also add the application that is registering it, using<a class="link" href="glib-Bookmark-file-parser.html#g-bookmark-file-add-application"><code class="function">g_bookmark_file_add_application()</code></a> or <a class="link" href="glib-Bookmark-file-parser.html#g-bookmark-file-set-app-info"><code class="function">g_bookmark_file_set_app_info()</code></a>. If abookmark has no applications then it won't be dumped when creating theon disk representation, using <a class="link" href="glib-Bookmark-file-parser.html#g-bookmark-file-to-data"><code class="function">g_bookmark_file_to_data()</code></a> or<a class="link" href="glib-Bookmark-file-parser.html#g-bookmark-file-to-file"><code class="function">g_bookmark_file_to_file()</code></a>.</p><p>The <a class="link" href="glib-Bookmark-file-parser.html#GBookmarkFile"><span class="type">GBookmarkFile</span></a> parser was added in GLib 2.12.</p></div><div class="refsect1" lang="en"><a name="id3196289"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id3196299"></a><h3><a name="GBookmarkFile"></a>GBookmarkFile</h3><a class="indexterm" name="id3196312"></a><pre class="programlisting">typedef struct _GBookmarkFile GBookmarkFile;</pre><p>The <span class="structname">GBookmarkFile</span> struct contains only private dataand should not be used directly.</p></div><hr><div class="refsect2" lang="en"><a name="id3198381"></a><h3><a name="G-BOOKMARK-FILE-ERROR:CAPS"></a>G_BOOKMARK_FILE_ERROR</h3><a class="indexterm" name="id3198394"></a><pre class="programlisting">#define G_BOOKMARK_FILE_ERROR	(g_bookmark_file_error_quark ())</pre><p>Error domain for bookmark file parsing. Errors in this domain will befrom the <a class="link" href="glib-Bookmark-file-parser.html#GBookmarkFileError"><span class="type">GBookmarkFileError</span></a> enumeration. See <a class="link" href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for informationson error domains.</p></div><hr><div class="refsect2" lang="en"><a name="id3198429"></a><h3><a name="GBookmarkFileError"></a>enum GBookmarkFileError</h3><a class="indexterm" name="id3198442"></a><pre class="programlisting">typedef enum{  G_BOOKMARK_FILE_ERROR_INVALID_URI,  G_BOOKMARK_FILE_ERROR_INVALID_VALUE,  G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED,  G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND,  G_BOOKMARK_FILE_ERROR_READ,  G_BOOKMARK_FILE_ERROR_UNKNOWN_ENCODING,  G_BOOKMARK_FILE_ERROR_WRITE,  G_BOOKMARK_FILE_ERROR_FILE_NOT_FOUND} GBookmarkFileError;</pre><p>Error codes returned by bookmark file parsing.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><a name="G-BOOKMARK-FILE-ERROR-INVALID-URI:CAPS"></a><code class="literal">G_BOOKMARK_FILE_ERROR_INVALID_URI</code></span></p></td><td>URI was ill-formed</td></tr><tr><td><p><span class="term"><a name="G-BOOKMARK-FILE-ERROR-INVALID-VALUE:CAPS"></a><code class="literal">G_BOOKMARK_FILE_ERROR_INVALID_VALUE</code></span></p></td><td>a requested field was not found</td></tr><tr><td><p><span class="term"><a name="G-BOOKMARK-FILE-ERROR-APP-NOT-REGISTERED:CAPS"></a><code class="literal">G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED</code></span></p></td><td>a requested application did notregister a bookmark</td></tr><tr><td><p><span class="term"><a name="G-BOOKMARK-FILE-ERROR-URI-NOT-FOUND:CAPS"></a><code class="literal">G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND</code></span></p></td><td>a requested URI was not found</td></tr><tr><td><p><span class="term"><a name="G-BOOKMARK-FILE-ERROR-READ:CAPS"></a><code class="literal">G_BOOKMARK_FILE_ERROR_READ</code></span></p></td><td>document was ill formed</td></tr><tr><td><p><span class="term"><a name="G-BOOKMARK-FILE-ERROR-UNKNOWN-ENCODING:CAPS"></a><code class="literal">G_BOOKMARK_FILE_ERROR_UNKNOWN_ENCODING</code></span></p></td><td>the text being parsed was in anunknown encoding</td></tr><tr><td><p><span class="term"><a name="G-BOOKMARK-FILE-ERROR-WRITE:CAPS"></a><code class="literal">G_BOOKMARK_FILE_ERROR_WRITE</code></span></p></td><td>an error occurred while writing</td></tr><tr><td><p><span class="term"><a name="G-BOOKMARK-FILE-ERROR-FILE-NOT-FOUND:CAPS"></a><code class="literal">G_BOOKMARK_FILE_ERROR_FILE_NOT_FOUND</code></span></p></td><td>requested file was not found</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3198655"></a><h3><a name="g-bookmark-file-new"></a>g_bookmark_file_new ()</h3><a class="indexterm" name="id3198671"></a><pre class="programlisting"><a class="link" href="glib-Bookmark-file-parser.html#GBookmarkFile">GBookmarkFile</a>*      g_bookmark_file_new                 (void);</pre><p>Creates a new empty <a class="link" href="glib-Bookmark-file-parser.html#GBookmarkFile"><span class="type">GBookmarkFile</span></a> object.</p><p>Use <a class="link" href="glib-Bookmark-file-parser.html#g-bookmark-file-load-from-file"><code class="function">g_bookmark_file_load_from_file()</code></a>, <a class="link" href="glib-Bookmark-file-parser.html#g-bookmark-file-load-from-data"><code class="function">g_bookmark_file_load_from_data()</code></a>or <a class="link" href="glib-Bookmark-file-parser.html#g-bookmark-file-load-from-data-dirs"><code class="function">g_bookmark_file_load_from_data_dirs()</code></a> to read an existing bookmarkfile.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td><td> an empty <a class="link" href="glib-Bookmark-file-parser.html#GBookmarkFile"><span class="type">GBookmarkFile</span></a></td></tr></tbody></table></div><p class="since">Since  2.12</p></div><hr>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -