Le 21/12/2012 16:02, Kerrick Staley a écrit : > Hello, > > I'm trying to modify the recent files list from a Vala program. I construct > a Gtk.RecentManager and call its remove_item() and add_full() methods, but > neither has any effect; the recent files list is unchanged (and > ~/.local/share/recently-used.xbel is unmodified). I notice in strace that > it opens ~.local/share/recently-used.xbel as read-only: > open("/home/kerrick/.local/share/recently-used.xbel", O_RDONLY) = 8 > meaning it can't possibly modify the file. What am I doing wrong? > > My code follows: > using Gtk; > > void main(string[] args) > { > var rm = RecentManager.get_default(); > > string uri = "file://" + Environment.get_current_dir(); > Gtk.RecentData data = Gtk.RecentData(); > data.mime_type = "inode/directory"; > data.app_name = "gnome-terminal"; > data.app_exec = "gnome-terminal"; > rm.add_full(uri, data); > }
GTK3 delays recent list writing for performance reason, so I guess the behavior you see is not that surprising. 2 points here I guess: 1) question: is GtkRecentManager supposed to work without a main loop? It probably would be convenient, and useful if GIO/GLib doesn't provide the feature. 2) GtkRecentManager should make sure to flush any remaining updates when quitting time, so none gets lost. Regards, Colomban > > Thanks, > Kerrick > _______________________________________________ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list > _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list