RecentChooserWidget is a widget suitable for selecting recently used files.
It is the main building block of a RecentChooserDialog. Most applications will only need to use the latter; you can use RecentChooserWidget as part of a larger window if you have special needs.
Note that RecentChooserWidget does not have any methods of its own. Instead, you should use the functions that work on a RecentChooser.
Recently used files are supported since GTK+ 2.10.
Example: RecentChooserWidget:
public class Application : Gtk.Window {
public Application () {
// Prepare Gtk.Window:
this.title = "My Gtk.RecentChooserWidget";
this.window_position = Gtk.WindowPosition.CENTER;
this.destroy.connect (Gtk.main_quit);
// The RecentChooserWidget:
Gtk.RecentChooserWidget chooser = new Gtk.RecentChooserWidget ();
this.add (chooser);
chooser.selection_changed.connect (() => {
string uri = chooser.get_current_uri ();
print ("%s\n", uri);
});
}
public static int main (string[] args) {
Gtk.init (ref args);
Application app = new Application ();
app.show_all ();
Gtk.main ();
return 0;
}
}
valac --pkg gtk+-3.0 Gtk.RecentChooserWidget.vala