Re: Gtk.RecentManager doesn't flush updates

2012-12-21 Thread Emmanuele Bassi
hi;

no, the RecentManager does not work without the gtk main loop. and yes:
once the main loop is stopped, and it's the last level, gtk will flush any
pending write.

If we ever move the recently used files API to Gio, then it'll have to work
without a main loop, but it'll also need a fairly deep re-engineering and
re-design, as the current spec and implementation are neither nice nor
enough.

ciao,
Emmanuele (original author of GtkRecent*).
 On Dec 21, 2012 4:25 PM, "Colomban Wendling" 
wrote:

> 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
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Gtk.RecentManager doesn't flush updates

2012-12-21 Thread Colomban Wendling
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


Gtk.RecentManager doesn't flush updates

2012-12-21 Thread Kerrick Staley
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);
}

Thanks,
Kerrick
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list