📄 gtkrecentmanager.html
字号:
<a name="id4411188"></a><h2>Properties</h2><pre class="synopsis"> "<a class="link" href="GtkRecentManager.html#GtkRecentManager--filename">filename</a>" <ahref="/usr/share/gtk-doc/html/gobject/gobject-Standard-Parameter-and-Value-Types.html#gchararray">gchararray</a> : Read / Write / Construct Only "<a class="link" href="GtkRecentManager.html#GtkRecentManager--limit">limit</a>" <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> : Read / Write "<a class="link" href="GtkRecentManager.html#GtkRecentManager--size">size</a>" <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> : Read</pre></div><div class="refsect1" lang="en"><a name="id4411258"></a><h2>Signals</h2><pre class="synopsis"> "<a class="link" href="GtkRecentManager.html#GtkRecentManager-changed">changed</a>" : Run First</pre></div><div class="refsect1" lang="en"><a name="id4411286"></a><h2>Description</h2><p><a class="link" href="GtkRecentManager.html" title="GtkRecentManager"><span class="type">GtkRecentManager</span></a> provides a facility for adding, removing andlooking up recently used files. Each recently used file isidentified by its URI, and has meta-data associated to it, likethe names and command lines of the applications that haveregistered it, the number of time each application has registeredthe same file, the mime type of the file and whether the fileshould be displayed only by the applications that haveregistered it.</p><p>The <a class="link" href="GtkRecentManager.html" title="GtkRecentManager"><span class="type">GtkRecentManager</span></a> acts like a database of all the recentlyused files. You can create new <a class="link" href="GtkRecentManager.html" title="GtkRecentManager"><span class="type">GtkRecentManager</span></a> objects, butit is more efficient to use the standard recent manager forthe <ahref="/usr/share/gtk-doc/html/gdk/GdkScreen.html"><span class="type">GdkScreen</span></a> so that informations about the recently usedfiles is shared with other people using them. In case thedefault screen is being used, adding a new recently usedfile is as simple as:</p><div class="informalexample"><pre class="programlisting">GtkRecentManager *manager;manager = gtk_recent_manager_get_default ();gtk_recent_manager_add_item (manager, file_uri); </pre></div>While looking up a recently used file is as simple as:<div class="informalexample"><pre class="programlisting">GtkRecentManager *manager;GtkRecentInfo *info;GError *error = NULL;manager = gtk_recent_manager_get_default ();info = gtk_recent_manager_lookup_item (manager, file_uri, &error);if (error) { g_warning ("Could not find the file: %s", error->message); g_error_free (error); }else { /* Use the info object */ gtk_recent_info_unref (info); } </pre></div><p>Recently used files are supported since GTK+ 2.10.</p></div><div class="refsect1" lang="en"><a name="id4411384"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id4411393"></a><h3><a name="GtkRecentManager-struct"></a>GtkRecentManager</h3><a class="indexterm" name="id4411407"></a><pre class="programlisting">typedef struct _GtkRecentManager GtkRecentManager;</pre><p>Acts as a database of information about the list of recentlyused files. Normally, you retrieve the recent manager for aparticular screen using <a class="link" href="GtkRecentManager.html#gtk-recent-manager-get-for-screen"><code class="function">gtk_recent_manager_get_for_screen()</code></a>and it will contain information about current recent managerfor that screen.</p></div><hr><div class="refsect2" lang="en"><a name="id4411438"></a><h3><a name="GtkRecentInfo"></a>GtkRecentInfo</h3><a class="indexterm" name="id4411450"></a><pre class="programlisting">typedef struct _GtkRecentInfo GtkRecentInfo;</pre><p>Contains informations found when looking up an entry of therecently used files list.</p></div><hr><div class="refsect2" lang="en"><a name="id4411467"></a><h3><a name="GtkRecentData"></a>GtkRecentData</h3><a class="indexterm" name="id4411480"></a><pre class="programlisting">typedef struct { gchar *display_name; gchar *description; gchar *mime_type; gchar *app_name; gchar *app_exec; gchar **groups; gboolean is_private;} GtkRecentData;</pre><p>Meta-data to be passed to <a class="link" href="GtkRecentManager.html#gtk-recent-manager-add-full"><code class="function">gtk_recent_manager_add_full()</code></a> whenregistering a recently used resource.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar">gchar</a> *<em class="structfield"><code>display_name</code></em>;</span></p></td><td> a UTF-8 encoded string, containing the name of the recently used resource to be displayed, or <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a>;</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar">gchar</a> *<em class="structfield"><code>description</code></em>;</span></p></td><td> a UTF-8 encoded string, containing a short description of the resource, or <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a>;</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar">gchar</a> *<em class="structfield"><code>mime_type</code></em>;</span></p></td><td> the MIME type of the resource;</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar">gchar</a> *<em class="structfield"><code>app_name</code></em>;</span></p></td><td> the name of the application that is registering this recently used resource;</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar">gchar</a> *<em class="structfield"><code>app_exec</code></em>;</span></p></td><td> command line used to launch this resource; may contain the "%f" and "%u" escape characters which will be expanded to the resource file path and URI respectively when the command line is retrieved;</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar">gchar</a> **<em class="structfield"><code>groups</code></em>;</span></p></td><td> a vector of strings containing groups names;</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> <em class="structfield"><code>is_private</code></em>;</span></p></td><td> whether this resource should be displayed only by the applications that have registered it or not.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id4411692"></a><h3><a name="GTK-RECENT-MANAGER-ERROR:CAPS"></a>GTK_RECENT_MANAGER_ERROR</h3><a class="indexterm" name="id4411705"></a><pre class="programlisting">#define GTK_RECENT_MANAGER_ERROR (gtk_recent_manager_error_quark ())</pre><p>The <ahref="/usr/share/gtk-doc/html/glib/glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> used for <a class="link" href="GtkRecentManager.html#GtkRecentManagerError"><span class="type">GtkRecentManagerError</span></a> errors.</p></div><hr><div class="refsect2" lang="en"><a name="id4411739"></a><h3><a name="GtkRecentManagerError"></a>enum GtkRecentManagerError</h3><a class="indexterm" name="id4411752"></a><pre class="programlisting">typedef enum{ GTK_RECENT_MANAGER_ERROR_NOT_FOUND, GTK_RECENT_MANAGER_ERROR_INVALID_URI, GTK_RECENT_MANAGER_ERROR_INVALID_ENCODING, GTK_RECENT_MANAGER_ERROR_NOT_REGISTERED, GTK_RECENT_MANAGER_ERROR_READ, GTK_RECENT_MANAGER_ERROR_WRITE, GTK_RECENT_MANAGER_ERROR_UNKNOWN} GtkRecentManagerError;</pre><p>Error codes for GtkRecentManager operations</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><a name="GTK-RECENT-MANAGER-ERROR-NOT-FOUND:CAPS"></a><code class="literal">GTK_RECENT_MANAGER_ERROR_NOT_FOUND</code></span></p></td><td> the URI specified does not exists in the recently used resources list.</td></tr><tr><td><p><span class="term"><a name="GTK-RECENT-MANAGER-ERROR-INVALID-URI:CAPS"></a><code class="literal">GTK_RECENT_MANAGER_ERROR_INVALID_URI</code></span></p></td><td> the URI specified is not valid.</td></tr><tr><td><p><span class="term"><a name="GTK-RECENT-MANAGER-ERROR-INVALID-ENCODING:CAPS"></a><code class="literal">GTK_RECENT_MANAGER_ERROR_INVALID_ENCODING</code></span></p></td><td> the supplied string is not UTF-8 encoded.</td></tr><tr><td><p><span class="term"><a name="GTK-RECENT-MANAGER-ERROR-NOT-REGISTERED:CAPS"></a><code class="literal">GTK_RECENT_MANAGER_ERROR_NOT_REGISTERED</code></span></p></td><td> no application has registered the specified item.</td></tr><tr><td><p><span class="term"><a name="GTK-RECENT-MANAGER-ERROR-READ:CAPS"></a><code class="literal">GTK_RECENT_MANAGER_ERROR_READ</code></span></p></td><td> failure while reading the recently used resources file.</td></tr><tr><td><p><span class="term"><a name="GTK-RECENT-MANAGER-ERROR-WRITE:CAPS"></a><code class="literal">GTK_RECENT_MANAGER_ERROR_WRITE</code></span></p></td><td> failure while writing the recently used resources file.</td></tr><tr><td><p><span class="term"><a name="GTK-RECENT-MANAGER-ERROR-UNKNOWN:CAPS"></a><code class="literal">GTK_RECENT_MANAGER_ERROR_UNKNOWN</code></span></p></td><td> unspecified error.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id4411949"></a><h3><a name="gtk-recent-manager-new"></a>gtk_recent_manager_new ()</h3><a class="indexterm" name="id4411965"></a><pre class="programlisting"><a class="link" href="GtkRecentManager.html" title="GtkRecentManager">GtkRecentManager</a>* gtk_recent_manager_new (void);</pre><p>Creates a new recent manager object. Recent manager objects are used tohandle the list of recently used resources. A <a class="link" href="GtkRecentManager.html" title="GtkRecentManager"><span class="type">GtkRecentManager</span></a> objectmonitors the recently used resources list, and emits the "changed" signaleach time something inside the list changes.</p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -