Re: How does one add an item to the “recently used” file list (from Python)?
- Date: Sat, 8 Oct 2016 00:13:57 +0200
- From: infirit <infirit@xxxxxxxxx>
- Subject: Re: How does one add an item to the “recently used” file list (from Python)?
Op 10/07/2016 om 11:55 PM schreef Laurence Gonsalves:
> However, when I tried adding an item like this...
> # /home/laurence/foo/bar.txt is an existing text file
> ...the file does not show up in the Recent section of Nautilus or in
> file dialogs. It doesn't even show up in the results returned by
> recent_mgr.get_items(). The call to add_item returned True.
That is how you do it, however you _require_ a main-loop running for
this to work. Working example below.
from gi.repository import Gtk, GLib
res = manager.add_item('file:///home/user/example.txt')
recent_manager = Gtk.RecentManager.get_default()
GLib.timeout_add(5000, on_timeout, recent_manager)
gtk-list mailing list