[Gambas-user] Inhibit shutdown/logout/etc if unsaved files.
bsteers4 at gmail.com
Thu Feb 23 03:26:17 CET 2023
Seems qt does have an alternative as kate editor does it using qt session
i do not really understand kate code but i think this could be it's inhibit
routine. (or part of it)
I found gedit worked on gnome2 and gnome3 variants but not on kde
kate on the other hand seems to inhibit on unsaved changes on all the above
so must be using a better method.
On Wed, 22 Feb 2023 at 18:11, Bruce Steers <bsteers4 at gmail.com> wrote:
> Benoit, gedit does inhibit on a gtk level using gtk_application_inhibit()
> could gb.gui implement inhibit? (if a qt alternative)
> gedit inhibit code..
> if (can_close && (priv->inhibition_cookie != 0))
> gtk_application_uninhibit (GTK_APPLICATION (g_application_get_default ()),
> priv->inhibition_cookie = 0;
> else if (!can_close && (priv->inhibition_cookie == 0))
> priv->inhibition_cookie = gtk_application_inhibit (GTK_APPLICATION (g_application_get_default ()),
> GTK_WINDOW (window),
> _("There are unsaved documents"));
> On Tue, 21 Feb 2023 at 20:08, Bruce Steers <bsteers4 at gmail.com> wrote:
>> if you have made inhibit work on anything other than gnome2
>> Or if you want a challenge and try to make it work on your system and
>> have success.
>> Then share the code on this post or the gambas.one forum topic i started,
>> Wishing well
>> On Tue, 21 Feb 2023 at 19:48, Bruce Steers <bsteers4 at gmail.com> wrote:
>>> Well i got part way then hit a roadblock.
>>> See this discussion for more details and a demo-app / screenshot of it
>>> working with gambas IDE.
>>> The class is currently very simple but limited to only working on gnome2
>>> based os's (mate, cinnamon, gnomoe-fallback)
>>> does not work for gnome3 (gnome shell), kde plasma, others
>>> But i use MATE and now my system CANNOT close down with an open unsaved
>>> gambas project running so i'm pretty happy about that. :)
>>> (it's a tiny 17k so i'll attach my demo to this post, i've added the
>>> same class to my gambas and edited the editors Modify and Save methods to
>>> enable/kill the inhibitors
>>> the roadblock is that org.gnome.SessionManager.Inhibit was the only one
>>> i could get to work properly. and that seems to only work on gnome2 systems.
>>> I have looked into many other ways.
>>> org.freedesktop.portal.Desktop (doesn't seem to work)
>>> System://org.freedesktop.login1 (just gives me segfault 11)
>>> a few others.
>>> I've tried various methods. the gnome.SessionManager is absolute
>>> simplicity compared to others.
>>> Anyone had any success with Inhibit on anything other than
>>> gnome.SessionManager ?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the User