[Lazarus] Gtk2 Linux detect user logoff?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] Gtk2 Linux detect user logoff?

Free Pascal - Lazarus mailing list
Does anyone here know how to detect user log off and gracefully terminate under Gtk2 Linux? I have an app which uses some temporary files (in /tmp) and I want to ensure those files are deleted when the user logs off. The application query/end sessionĀ eventsĀ don't seem to be connected when using the Gtk2 widgetset.

From this stack overflow answer it would seem there is a 'save-yourself' sinal to notify you when the user logs off, but I don't know what the LCL value of client might be. Could it be application handle? Is there a better way to detect user log off on Gtk2?


--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Gtk2 Linux detect user logoff?

Free Pascal - Lazarus mailing list


On Mon, 23 Mar 2020, Anthony Walter via lazarus wrote:

> Does anyone here know how to detect user log off and gracefully terminate
> under Gtk2 Linux? I have an app which uses some temporary files (in /tmp)
> and I want to ensure those files are deleted when the user logs off. The
> application query/end session events don't seem to be connected when using
> the Gtk2 widgetset.
>
>> From this stack overflow answer it would seem there is a 'save-yourself'
> sinal to notify you when the user logs off, but I don't know what the LCL
> value of client might be. Could it be application handle? Is there a better
> way to detect user log off on Gtk2?
>
> https://stackoverflow.com/a/2519829/269630

I suspect this is a dbus signal.
Maybe gnome API interfaces expose an api for the signals of the session
manager. I doubt GTK handles these signals, and I don't think Lazarus uses
the Gnome signals or the Gnome API.

So I would attempt to connect to the gnome session manager using dbus.
FPC has a DBUS client component, so this should not be too hard.

I have some uncommitted example programs that may help you if you decide to
go this path.

Michael.
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus