New upstream version 3.23.2
This commit is contained in:
@ -3,12 +3,12 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>GtkRecentManager: GTK+ 3 Reference Manual</title>
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
|
||||
<link rel="home" href="index.html" title="GTK+ 3 Reference Manual">
|
||||
<link rel="up" href="RecentDocuments.html" title="Recently Used Documents">
|
||||
<link rel="prev" href="RecentDocuments.html" title="Recently Used Documents">
|
||||
<link rel="next" href="GtkRecentChooser.html" title="GtkRecentChooser">
|
||||
<meta name="generator" content="GTK-Doc V1.27 (XML mode)">
|
||||
<meta name="generator" content="GTK-Doc V1.28 (XML mode)">
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
@ -416,35 +416,69 @@ registered it.</p>
|
||||
used files. You can create new <a class="link" href="GtkRecentManager.html" title="GtkRecentManager"><span class="type">GtkRecentManager</span></a> objects, but
|
||||
it is more efficient to use the default manager created by GTK+.</p>
|
||||
<p>Adding a new recently used file is as simple as:</p>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
GtkRecentManager *manager;
|
||||
<div class="informalexample">
|
||||
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="listing_lines" align="right"><pre>1
|
||||
2
|
||||
3
|
||||
4</pre></td>
|
||||
<td class="listing_code"><pre class="programlisting"><span class="usertype">GtkRecentManager</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">manager</span><span class="symbol">;</span>
|
||||
|
||||
<span class="normal">manager </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GtkRecentManager.html#gtk-recent-manager-get-default">gtk_recent_manager_get_default</a></span><span class="normal"> </span><span class="symbol">();</span>
|
||||
<span class="function"><a href="GtkRecentManager.html#gtk-recent-manager-add-item">gtk_recent_manager_add_item</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">manager</span><span class="symbol">,</span><span class="normal"> file_uri</span><span class="symbol">);</span></pre></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
manager = gtk_recent_manager_get_default ();
|
||||
gtk_recent_manager_add_item (manager, file_uri);
|
||||
</pre></div>
|
||||
<p></p>
|
||||
<p>The <a class="link" href="GtkRecentManager.html" title="GtkRecentManager"><span class="type">GtkRecentManager</span></a> will try to gather all the needed information
|
||||
from the file itself through GIO.</p>
|
||||
<p>Looking up the meta-data associated with a recently used file
|
||||
given its URI requires calling <a class="link" href="GtkRecentManager.html#gtk-recent-manager-lookup-item" title="gtk_recent_manager_lookup_item ()"><code class="function">gtk_recent_manager_lookup_item()</code></a>:</p>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
GtkRecentManager *manager;
|
||||
GtkRecentInfo *info;
|
||||
GError *error = NULL;
|
||||
<div class="informalexample">
|
||||
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="listing_lines" align="right"><pre>1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16</pre></td>
|
||||
<td class="listing_code"><pre class="programlisting"><span class="usertype">GtkRecentManager</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">manager</span><span class="symbol">;</span>
|
||||
<span class="usertype">GtkRecentInfo</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">info</span><span class="symbol">;</span>
|
||||
<span class="usertype">GError</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">error </span><span class="symbol">=</span><span class="normal"> NULL</span><span class="symbol">;</span>
|
||||
|
||||
<span class="normal">manager </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GtkRecentManager.html#gtk-recent-manager-get-default">gtk_recent_manager_get_default</a></span><span class="normal"> </span><span class="symbol">();</span>
|
||||
<span class="normal">info </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GtkRecentManager.html#gtk-recent-manager-lookup-item">gtk_recent_manager_lookup_item</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">manager</span><span class="symbol">,</span><span class="normal"> file_uri</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">error</span><span class="symbol">);</span>
|
||||
<span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">error</span><span class="symbol">)</span>
|
||||
<span class="normal"> </span><span class="cbracket">{</span>
|
||||
<span class="normal"> </span><span class="function">g_warning</span><span class="normal"> </span><span class="symbol">(</span><span class="string">"Could not find the file: %s"</span><span class="symbol">,</span><span class="normal"> error</span><span class="symbol">-></span><span class="normal">message</span><span class="symbol">);</span>
|
||||
<span class="normal"> </span><span class="function">g_error_free</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">error</span><span class="symbol">);</span>
|
||||
<span class="normal"> </span><span class="cbracket">}</span>
|
||||
<span class="keyword">else</span>
|
||||
<span class="normal"> </span><span class="cbracket">{</span>
|
||||
<span class="normal"> </span><span class="comment">// Use the info object</span>
|
||||
<span class="normal"> </span><span class="function"><a href="GtkRecentManager.html#gtk-recent-info-unref">gtk_recent_info_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">info</span><span class="symbol">);</span>
|
||||
<span class="normal"> </span><span class="cbracket">}</span></pre></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
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></p>
|
||||
<p>In order to retrieve the list of recently used files, you can use
|
||||
<a class="link" href="GtkRecentManager.html#gtk-recent-manager-get-items" title="gtk_recent_manager_get_items ()"><code class="function">gtk_recent_manager_get_items()</code></a>, which returns a list of <span class="type">GtkRecentInfo-structs</span>.</p>
|
||||
@ -1911,6 +1945,6 @@ by another application.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<hr>Generated by GTK-Doc V1.27</div>
|
||||
<hr>Generated by GTK-Doc V1.28</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user