[Gambas-user] Saving settings on system shutdown

Bruce Steers bsteers4 at gmail.com
Wed Oct 6 23:08:14 CEST 2021


Thank you Ben.

I guess it's safer to save settings as they change instead.

Many thanks
BruceS


On Mon, 4 Oct 2021, 20:38 Benoît Minisini, <g4mba5 at gmail.com> wrote:

> Le 03/10/2021 à 12:59, Bruce Steers a écrit :
> >
> > I have a program that starts with my system and runs in the background.
> >
> > It has icons i can move and on exit it saves the positions.
> >
> > I have noticed if i do not exit the program but shutdown the computer
> > the settings do not save.
> >
> > Of course i could just save the settings on moving icons but i wondered
> > if there is a recommended method to catch an application exit due to a
> > shutdown?
> > Does the system just kill the program?
> >
> > I guessed DBus would probably be the best alternative way but wouldn't
> > hurt to ask the experts if there is already an easier way.
> >
> > Thanks for any advice :)
> >
> > BruceS
> >
>
> QT4, QT5 and GTK+2 components handle the "X11 session management protocol".
>
> https://www.x.org/releases/X11R7.7/doc/libSM/xsmp.html
>
> To handle it with Gambas, you just have to define the
> Application.Restart property with a string array that defines the
> command that will be run to automatically restart your application the
> next time the desktop starts again.
>
> When the desktop shutdowns, it is supposed to gracefully close the
> windows of your application, so that you can cancel the shutdown. If you
> do nothing, your application will be closed gracefully. It will be
> killed only if it does not answer to the window close events.
>
> GTK+3 component does not support that protocol (hey, it's a modern
> toolkit!), and I don't think there is the equivalent on Wayland, but I
> may be wrong. I need more information about that.
>
> Regards,
>
> --
> Benoît Minisini
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20211006/c467b86c/attachment.htm>


More information about the User mailing list