I'm not sure, but if your application is dedicated to gnome, why not registering to session manager?
https://wiki.gnome.org/SessionManagement/GnomeSession Other question: where is your code related to saving state? I do not see it in your example. 2013/8/25 Dylan McCall <[email protected]> > > I'm working on a small program that sits in the background and runs > several counters and timers: > https://wiki.gnome.org/SummerOfCode2013/Projects/DylanMccall_BreakTimer > > When the user logs out, I want my application to save its current > state to a file, and then restore from that file when the user logs > back in. Most of this is implemented (with Vala), and I'm connecting > to the SIGINT, SIGTERM and SIGHUP signals to trigger a clean exit: > > public int main(string[] args) { > application = new HelperApplication(); > Posix.signal(Posix.SIGINT, sigint_cb); > Posix.signal(Posix.SIGTERM, sigint_cb); > Posix.signal(Posix.SIGHUP, sigint_cb); > int status = application.run(args); > return status; > } > > void sigint_cb(int signal_number) { > application.quit(); > } > > (There is a bunch of code in application.quit that handles the state > saving stuff). > > Everything is fine if I exit the program by sending it one of those > signals, of course. The problem I'm running into is gnome-session > seems to be more aggressive (is it sending SIGKILL?), so, when the > user logs out, my program doesn't get a chance to save its state. > > I looked at Gtk.Application.inhibit(), but what I'm doing doesn't > really jive with what that does (and I'm a big fan of semantics), and > I'm still stuck trying to reliably catch when we're logging out. > > So… is there a useful pattern for doing something like > Posix.signal(Posix.SIGINT, …), but for gnome-session? > > Thanks! > > -- > Dylan > _______________________________________________ > gnome-devel-list mailing list > [email protected] > https://mail.gnome.org/mailman/listinfo/gnome-devel-list > -- Guilhem BONNEFILLE -=- JID: [email protected] MSN: [email protected] -=- mailto:[email protected] -=- http://nathguil.free.fr/
_______________________________________________ gnome-devel-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/gnome-devel-list
