RecentChooserMenu
Object Hierarchy:
Description:
public class RecentChooserMenu : Menu, Implementor, Activatable, Buildable, RecentChooser
RecentChooserMenu is a widget suitable for displaying recently used files inside a menu.
It can be used to set a sub-menu of a MenuItem using set_submenu, or as the menu of a MenuToolButton.
Note that RecentChooserMenu does not have any methods of its own. Instead, you should use the functions that work on a RecentChooser.
Note also that RecentChooserMenu does not support multiple filters, as it has no way to let the user choose between them as the RecentChooserWidget and RecentChooserDialog widgets do. Thus using add_filter on a RecentChooserMenu widget will yield the same effects as using set_filter, replacing any currently set filter with the supplied filter; remove_filter will remove any currently set RecentFilter object and will unset the current filter; list_filters will return a list containing a single RecentFilter object.
Recently used files are supported since GTK+ 2.10.
Example: RecentChooserMenu:
public class Application : Gtk.Window {
public Application () {
// Prepare Gtk.Window:
this.title = "My Gtk.RecentChooserMenu";
this.window_position = Gtk.WindowPosition.CENTER;
this.destroy.connect (Gtk.main_quit);
// MenuBar:
Gtk.MenuBar bar = new Gtk.MenuBar ();
this.add (bar);
// File:
Gtk.MenuItem item_file = new Gtk.MenuItem.with_label ("File");
bar.add (item_file);
Gtk.RecentChooserMenu recent = new Gtk.RecentChooserMenu ();
item_file.set_submenu (recent);
recent.item_activated.connect (() => {
Gtk.RecentInfo info = recent.get_current_item ();
print ("%s\n", info.get_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.RecentChooserMenu.vala