GNOME Bugzilla – Bug 706676
need to update Reboot to return an error when it fails/gets cancelled
Last modified: 2013-08-28 13:10:22 UTC
<aday> Jasper, ok, i think i have something for you <aday> i'm afraid it's a little different from the last iteration <aday> https://dl.dropboxusercontent.com/u/5031519/system-settings/end-session-dialogs.png <aday> with this you would only get one confirm dialog <aday> however, it would require that we add suspend to the menu <aday> let me know what you think <mclasen> thanks for adding the restart & install variant there, aday <mclasen> Jasper, we'll need a simple api to trigger that from gnome-software <-- drago01 has quit (Verlassend) <mclasen> aday: can we fit suspend in the menu ? with the rotation lock, there's already 4 buttons in there <aday> mclasen, i think we'll have to do it with alt, like now <aday> can't think of a better way <mclasen> a moon in a circle might look nice <aday> i was thinking of a pause icon <aday> since we call it suspend, not sleep <mclasen> will it be clear that it refers to your computer, not your music ? * jimmac doesn't like the moon metaphor at all <aday> mclasen, fair question <-- weld has quit (Read error: 145 (Connection timed out)) <jimmac> behaving like alt, that's not a concern <jimmac> s/like/using/ <aday> what i do know is that suspend doesn't work in the dialog <mclasen> true, with alt it'll be clear that its a 'variant' of power off <aday> gcampax, you might be interested in this too ^ <gcampax> aday, looks a lot like what we have right now :) <aday> gcampax, except the inhibitors are integrated into the confirm dialog <gcampax> aday, it's the same now, except for other logged user, that were hacked very quickly last cycle <gcampax> apps are already shown in the same dialog <aday> oh nice <aday> that's good --- aruna_away is now known as aruna <Jasper> aday, how do you suspend? <Jasper> mclasen, that should be a gnome-session API TBH <Jasper> mclasen, if we add a gnome-session API to say "restart and install updates", I'll add the dialog content. Shouldn't be too hard. <mclasen> but then you still need a gnome-shell api for gnome-session to call ? * mclasen forgets how that works between gnome-session and gnome-shell <aday> Jasper, we'd need it in the menu :/ (on alt modifier like now) <Jasper> mclasen, we already have it. When gnome-session wants to show the dialog, it passes an enum through telling us which dialog content we want <Jasper> aday, OK. Make a design and I'll add it back. <mclasen> oh right, need to add a new enum value <mclasen> halfline_laptop: can you do that for me ? <Jasper> aday, another thing I added at the last minute was to glow the power off icon when you had offline updates to restart. Do we still want this? <mclasen> Jasper: who would initiate the offline update in the end, gnome-shell or gnome-session or gnome-software ? <Jasper> mclasen, either gnome-software or gnome-session. <halfline_laptop> mclasen: what would you like me to do? * halfline_laptop reads scrollback <aday> Jasper, the design would be to replace the power off icon with media-playback-pause-symbolic <aday> when you hold down alt <Jasper> aday, OK. <-- evfool has quit (Leaving) <mclasen> halfline_laptop: make it possible to trigger a 'restart & install' dialog by calling into gnome-session <gcampax> aday, just saying, but we didn't have good feedback from using alt in the past (one way or the other) <aday> gcampax, yeah i know. i really can't come up with anything any better though <aday> if you expose it in the menu things get bloated and overwhelming <gcampax> aday, yeah, I wasn't complaining <Jasper> aday, do we want the icon to glow for updates btw? <Jasper> aday, or do we want to move the responsibility of updates to gnome-session? <aday> Jasper, there's no triggering updates from the menu with this design <Jasper> aday, OK <halfline_laptop> mclasen: so to be clear, you want me to add a new D-Bus api along side Shutdown and Reboot called, e.g., InstallUpdates that then calls into gnome-shell's EndSessionDialog using a new GSM_SHELL_END_SESSION_DIALOG_TYPE_INSTALL_UPDATES enum value <mclasen> I guess thats what Jasper wants, yes <halfline_laptop> and then on confirmation gnome-session should run /usr/libexec/pk-trigger-offline-update <mclasen> would that be right ? <aday> eee, exciting to see this stuff coming together <aday> sane updates here we come :) <halfline_laptop> mclasen: hmm <halfline_laptop> on the surface it seems okay, because it gives us additional knowledge about why we're rebooting in the reboot dialog <halfline_laptop> so we can custom taylor the message <halfline_laptop> on the other hand <mclasen> thats the main point <halfline_laptop> there are ways to trigger offline updates besides the menu item <halfline_laptop> and when it's triggered in that way, reboot is going to start installing updates <halfline_laptop> regardless of whether we say so in the dialog. <mclasen> sure, but having the shell throw up a system modal just because some file appeared in / would seem wrong, no ? <halfline_laptop> well the modal shouldn't ever be thrown up because the file appeared <halfline_laptop> but i do think the content of the dialog should depend on whether or not the file is there <mclasen> well, thats how the shell currently learns about available offline updates (and shows the menu item) <mclasen> oh <mclasen> so you're saying we just use the Reboot method, and gnome-session will notice the file and adjust the dialog <mclasen> that night be nice <halfline_laptop> yea <halfline_laptop> now the question is, who should be calling /usr/libexec/pk-trigger-offline-update <halfline_laptop> do we keep that gnome-shell? <mclasen> that is the thing that puts the symlink in place, right ? <halfline_laptop> right <mclasen> I guess if we go what you said, we have to call it before calling Reboot <mclasen> I guess the problem then is that we have to undo it if the user cancels <halfline_laptop> yea <halfline_laptop> and there's no pk-untrigger-offline-updates is there? <mclasen> we can certainly add one <mclasen> but it is just removing a symlink, I think <halfline_laptop> maybe we should be calling a new d-bus API in gnome-settings-daemon's update plugin and move all the triggering stuff there <halfline_laptop> even if we do that though <halfline_laptop> i guess we'd still have to call pk-trigger-offline-updates or somehting like it from there <halfline_laptop> so the indirection doesn't buy us much <halfline_laptop> the other thing is i think hughsie recently made pkcon have a trigger-offline-updates command ? <mclasen> yeah <mclasen> but I don't think you have to worry about how we trigger it - just make gnome-session adjust the dialog if it finds the symlink <mclasen> maybe you want some api to detect it instead of poking at the filesystem directly ? <aday> jimmac, andreasn, i don't think i can fix the width of those buttons without min-width :( <halfline_laptop> mclasen: yea that might be nice <aday> you end up with too wide in one place or too narrow in others <jimmac> aday: s/new/create new/ * jimmac runs <mclasen> actually, looking around, there is /usr/libexec/pk-clear-offline-update <halfline_laptop> sweet <halfline_laptop> on other thing to think about, is what to do if the dialog is up and the file changes <aday> jimmac, even better - s/New/ New / <aday> that's the way the pros do it <jimmac> haha <mclasen> halfline_laptop: I'd ignore that possibility <halfline_laptop> i guess the EndSessionDialog can be updated just by calling open on it again with new parameters <halfline_laptop> so it sounds like the plan then is "add a new enum type to gnome-session to have a Install Updates reboot dialog, change gnome-shell to use that new dialog, and have gnome-session request that dialog when it sees the file" <halfline_laptop> we can eitehr keep gnome-shell calling pk-trigger-offline-updates itself, or move that to the g-s-d updates plugin --> weld (~weld@p57A83AEF.dip0.t-ipconnect.de) has joined #gnome-design <mclasen> I think there's still some confusion about who and when to call pk-trigger-offline-updates <halfline_laptop> right <halfline_laptop> also <mclasen> that needs to be called early, because it is what puts the symlink in place that gnome-session will look for <mclasen> once it has been called, no further triggering is needed - just reboot <halfline_laptop> the stated goal of these changes was so that we can change the dialog message <halfline_laptop> but we can do today even if we kept all the logic in gnome-shell <mclasen> you may be right <halfline_laptop> so the only advantage of moving this to gnome-session / gnome-settings-daemon is because it's sort of "backend work" <halfline_laptop> and gnome-shell is the frontend not the backend <mclasen> but isn't gnome-session currently providing the content of the dialog ? <halfline_laptop> no <mclasen> or does all that live in gnome-shell ? <halfline_laptop> yes <halfline_laptop> gnome-session just passes the enum <mclasen> in that case, it might be most natural to just have gnome-shell look for the file <halfline_laptop> it's certainly less plumbing to do it that way <halfline_laptop> and more plumbing means less reliability <halfline_laptop> but moving these things to g-s and g-s-d is conceptually cleaner <halfline_laptop> okay so now that we've talked it through, i'd be interested to here Jasper's take <halfline_laptop> *hear <mclasen> last question: how does gnome-software learn if the reboot was canceled - just if the gnome-session dbus call returns ? --- alex is now known as alex_away <mclasen> because we need to clear the offline update in that case <halfline_laptop> well if gnome-shell is the one telling g-s-d to trigger the update, it should be the one to clear the update on cancellation <mclasen> again, the update has been triggered early <halfline_laptop> if gnome-session is the one telling g-s-d to trigger the update, it should be the one to clear the update on cancellation <mclasen> nobody needs to do any triggering once the dialog is up <mclasen> the dialog is just about 'reboot or not' <halfline_laptop> i don't dispute that <halfline_laptop> but somebody has to do it <mclasen> right <halfline_laptop> the person who does it needs to be the one to clear it <mclasen> my assumption is that gnome-software will be the one <mclasen> seems to me the least hassle <mclasen> why add g-s-d to the mix ? <halfline_laptop> well wait, there's a menu item "Install Updates & Restart" right ? <aday> halfline_laptop, not in the new menu <halfline_laptop> ohhh <mclasen> no <mclasen> thats gone <halfline_laptop> so the only way to install updates going forward will be by the gnome-software app? <mclasen> gnome-software is the place you go to for updates <aday> it's something we might want to look at in the future, but i discussed it with jimmac and i think it's ok not to have it for now <halfline_laptop> interesting <aday> we need to get the notification right for this to work <halfline_laptop> so it's the thing that needs to call Reboot() <halfline_laptop> but Reboot() doesn't have a return value <halfline_laptop> only gnome-shell and gnome-session know when the reboot dialog is cancelled <mclasen> it would be nice if gnome-session could pass that back to the caller <mclasen> by returning <halfline_laptop> yea <halfline_laptop> if it's the thing that's going to pk-clear-offline-updates <halfline_laptop> then it needs to be informed when the dialog is cancelled <halfline_laptop> somehow <-- tacg has quit (Ping timeout: 600 seconds) <halfline_laptop> so that's going to be moderately challenging to fix, just because of how gnome-session is glopped together <halfline_laptop> but should be doable <mclasen> I'm sure you can do it :-) <halfline_laptop> do we care about maintaining api compat ? <halfline_laptop> i think we already broke compat once before --> dylan-m (~dylan@154.5.54.69) has joined #gnome-design <halfline_laptop> so probably not <mclasen> you want to check the known callers, I guess <mclasen> gnome-shell, anybody else ? <-- foser has quit (Read error: 145 (Connection timed out)) <halfline_laptop> gnome-session-quit calls logout but not reboot <halfline_laptop> though it might be nice to fix logout too for consistency <halfline_laptop> i think gnome-control-center might call logout too when switching language ? <halfline_laptop> alright i'll look into this more on monday, i've got a lot of stuff to do today <mclasen> true <mclasen> ok, thanks <mclasen> having a plan is already great progress
Created attachment 253338 [details] [review] manager: make Shutdown/Reboot D-Bus APIs failable Right now Shutdown and Reboot return as soon as the operations are initiated. This means we get no notification if the operation is cancelled by the user later. This commit defers returning unless it's clear whether or not the operation will go through.
Matthias, do you want to give this a quick review?
Review of attachment 253338 [details] [review]: Looks fine to me ::: gnome-session/gsm-manager.c @@ +3501,3 @@ + dbus_g_method_return_error (context, error); + else + dbus_g_method_return (context); Can the non-error path here ever be taken ? We're talking about shutdown here, so if it doesn't fail, the maching stops before the method returns, right ?
it does return a little before shutdown finishes, but not by much. Granted, the main thing we care about is the cancelled case.
Attachment 253338 [details] pushed as 2040b88 - manager: make Shutdown/Reboot D-Bus APIs failable