Gtk.RecentChooserWidget
Gtk.RecentChooserWidget — Displays recently used files
Object Hierarchy:
GObject
╰── GInitiallyUnowned
╰── Gtk.Widget
╰── Gtk.Container
╰── Gtk.Box
╰── Gtk.RecentChooserWidget
See also:
Gtk.RecentChooser, Gtk.RecentChooserDialog
Functions:
- new
() -> Gtk.Widget
- new_for_manager
(manager:Gtk.RecentManager) -> Gtk.Widget
Description:
Gtk.RecentChooserWidget
is a widget suitable for selecting recently used files. It is the main building block of a Gtk.RecentChooserDialog. Most applications will only need to use the latter; you can use Gtk.RecentChooserWidget
as part of a larger window if you have special needs.
Note that Gtk.RecentChooserWidget
does not have any methods of its own.
Instead, you should use the functions that work on a Gtk.RecentChooser.
Recently used files are supported since GTK+ 2.10.
Function Details:
new()
new () -> Gtk.Widget
Creates a new Gtk.RecentChooserWidget
object. This is an embeddable widgetused to access the recently used resources list.
Returns: a new Gtk.RecentChooserWidget
Since: 2.10
new_for_manager()
new_for_manager (manager:Gtk.RecentManager) -> Gtk.Widget
Creates a new Gtk.RecentChooserWidget
with a specified recent manager.
This is useful if you have implemented your own recent manager, or if youhave a customized instance of a Gtk.RecentManager
object.
Returns: a new Gtk.RecentChooserWidget
Since: 2.10
Example:
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
class RecentChooserWidget(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self)
self.set_title('RecentChooserWidget')
self.set_default_size(300, 250)
self.set_border_width(5)
self.connect('destroy', Gtk.main_quit)
recentchooserwidget = Gtk.RecentChooserWidget()
recentchooserwidget.connect('item-activated', self.on_item_activated)
self.add(recentchooserwidget)
def on_item_activated(self, recentchooserwidget):
item = recentchooserwidget.get_current_item()
if item:
print('Item selected:')
print('Name:\t %s' % (item.get_display_name()))
print('URI:\t %s' % (item.get_uri()))
window = RecentChooserWidget()
window.show_all()
Gtk.main()