Hide logout button based on gnome-session's CanSwitchUser
As requested by @guido.gunther, creating this issue, and a separate one for turning session into a GObject: #399 (closed)
ollieparanoid: would a patch to hide the logout button with a gconf option get accepted?
ollieparanoid: context: in postmarketOS, the button is not useful in the default, single UI install. If users want to use pmOS with multiple UIs, we have a guide that explains how to adjust the install and they could enable the button then.
Guido: there's no logout button - there's only a menu entry in a popover and that gets disabled automatically when the session does not support logout.
Guido: a patch that hides that entry (instead of disabling) it when the session does not support logout is fine.
craftyguy: hmm, so we could signal to phosh somehow that logout isn't supported?
Guido: it currently allows logout when started from a DM https://source.puri.sm/Librem5/phosh/-/blob/master/src/panel.c#L343 - currently gnome-session does not have a CanLogout flag (only `CanShutdown) - it be cool to have that. Otherwise we need to come up with something else that let's the shell decide when to show logout.
Guido: (gsetting worst case)
Guido: but then we're surely looking towards user switching in phosh (although not short term)
[...]
ollieparanoid: gnome-session apparently has CanSwitchUser, this looks suitable
ollieparanoid: so in theory... in phosh, add src/session.c:phosh_session_can_switch_user(), which does the dbus call to gnome session, and has a callback parameter, and call that from src/panel.c:phosh_panel_constructed() - the callback would then hide the logout button if the session can't swich the user?
Guido: basially yes, it would be better to turn session into a GObject (it's from the early times) and then just listen to notify::can-switch-user) - similar to what we do other things (e.g. network connectivity, torch, ...), this is also needed for logout dialogs, ...