Blob Blame History Raw
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Displaying the Recently Used Documents: GTK+ 2 Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="GTK+ 2 Reference Manual">
<link rel="up" href="gtk-migrating-GtkRecentChooser.html" title="Migrating from EggRecent to GtkRecentChooser">
<link rel="prev" href="gtk-migrating-GtkRecentChooser.html" title="Migrating from EggRecent to GtkRecentChooser">
<link rel="next" href="gtkrecent-advanced.html" title="Advanced usage">
<meta name="generator" content="GTK-Doc V1.26.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</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="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts"></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="gtk-migrating-GtkRecentChooser.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="gtk-migrating-GtkRecentChooser.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="gtkrecent-advanced.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="gtkrecent-chooser"></a>Displaying the Recently Used Documents</h2></div></div></div>
<p>
      Displaying the Recently Used Documents list is handled by any widget
      implementing the <a class="link" href="GtkRecentChooser.html" title="GtkRecentChooser"><span class="type">GtkRecentChooser</span></a> interface. These widgets also handle
      the sorting and filtering of the list; they will create their own
      <a class="link" href="GtkRecentManager.html" title="GtkRecentManager"><span class="type">GtkRecentManager</span></a> objects by default:
      </p>
<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
17
18
19
20
21
22
23
24
25</pre></td>
        <td class="listing_code"><pre class="programlisting">GtkWidget <span class="gtkdoc opt">*</span>chooser<span class="gtkdoc opt">;</span>
	gint response<span class="gtkdoc opt">;</span>

	<span class="comment">/* create a new dialog with the recently used documents list shown</span>
<span class="comment">	 * using a GtkTreeView widget</span>
<span class="comment">	 */</span>
	chooser <span class="gtkdoc opt">=</span> <span class="function"><a href="GtkRecentChooserDialog.html#gtk-recent-chooser-dialog-new">gtk_recent_chooser_dialog_new</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;Recent Documents&quot;</span><span class="gtkdoc opt">,</span>
	                                         parent_window<span class="gtkdoc opt">,</span>
						 GTK_STOCK_CLOSE<span class="gtkdoc opt">,</span> GTK_RESPONSE_CANCEL<span class="gtkdoc opt">,</span>
						 GTK_STOCK_OPEN<span class="gtkdoc opt">,</span> GTK_RESPONSE_OK<span class="gtkdoc opt">,</span>
						 NULL<span class="gtkdoc opt">);</span>
<span class="comment">/* set the sorting order to &quot;most recently used first&quot; */</span>
	<span class="function"><a href="GtkRecentChooser.html#gtk-recent-chooser-set-sort-type">gtk_recent_chooser_set_sort_type</a></span> <span class="gtkdoc opt">(</span><span class="function">GTK_RECENT_CHOOSER</span> <span class="gtkdoc opt">(</span>chooser<span class="gtkdoc opt">),</span> GTK_RECENT_SORT_MRU<span class="gtkdoc opt">);</span>
	response <span class="gtkdoc opt">=</span> <span class="function"><a href="GtkDialog.html#gtk-dialog-run">gtk_dialog_run</a></span> <span class="gtkdoc opt">(</span><span class="function">GTK_DIALOG</span> <span class="gtkdoc opt">(</span>chooser<span class="gtkdoc opt">));</span>
	<span class="keyword">if</span> <span class="gtkdoc opt">(</span>response <span class="gtkdoc opt">==</span> GTK_RESPONSE_OK<span class="gtkdoc opt">)</span>
	  <span class="gtkdoc opt">{</span>
	    GtkRecentInfo <span class="gtkdoc opt">*</span>info<span class="gtkdoc opt">;</span>

    info <span class="gtkdoc opt">=</span> <span class="function"><a href="GtkRecentChooser.html#gtk-recent-chooser-get-current-item">gtk_recent_chooser_get_current_item</a></span> <span class="gtkdoc opt">(</span><span class="function">GTK_RECENT_CHOOSER</span> <span class="gtkdoc opt">(</span>chooser<span class="gtkdoc opt">));</span>
	    <span class="function">do_something_with_the_item</span> <span class="gtkdoc opt">(</span>info<span class="gtkdoc opt">);</span>

	    <span class="function"><a href="GtkRecentManager.html#gtk-recent-info-unref">gtk_recent_info_unref</a></span> <span class="gtkdoc opt">(</span>info<span class="gtkdoc opt">);</span>
	  <span class="gtkdoc opt">}</span>
	
	<span class="function"><a href="GtkWidget.html#gtk-widget-destroy">gtk_widget_destroy</a></span> <span class="gtkdoc opt">(</span>chooser<span class="gtkdoc opt">);</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>
    </p>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.26.1</div>
</body>
</html>