[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: shutdown from gnome logout dialog



On Sat, Oct 18, 2003 at 04:24:53PM +0200, Jarno Gassenbauer wrote:
> On Sat, 2003-10-18 at 15:27, Moray Allan wrote:
> > Hi, your patch sounds good, but just a quick question:
> > 
> > On Sat, 2003-10-18 at 02:33, Jarno Gassenbauer wrote:
> > > If you hit the cancel button in the gnome logout dialog then GDM will
> > > remember your selection until you open the logout dialog again. Of
> > > course, the radio button you selected the last time will be
> > > pre-activated for you.
> > 
> > Do you mean that if I bring up the dialog, select 'shut down', then
> > press cancel, when I next bring up the dialog 'shut down' will still be
> > selected?
> > 
> 
> Yes, that's true. Actually it wasn't planned.
> 
> The reason was that I didn't want to send the logout action change
> command to GDM after the user hits 'OK'. It might not arrive in time,
> that is, before gnome-session exits. And even if it arrives in GDM in
> time, it still has to be resent in time from the GDM master process to
> the GDM slave process that runs the X server and gnome-session. The
> slave process needs this information to know that it should neither
> restart the X server nor provide the login prompt anymore. Rather, it
> should tell the master process that the user wishes to log out as if he
> had chosen the 'logout' entry from a login prompt menu.

It will arrive in time.  You should first run it through gdm and wait for
gdm to respond before actually doing the logout.

If the master sends it on the slave pipe before it tells OK to the logout
dialog, the slave will read from the pipe when it exists the select call
that acts as the waitpid for the session.  So it WILL get it in time
always.  You could convolute it even more by adding a SOP command for the
slave to tell the master it got it, but I don't think that's needed.

> If the command is sent after pressing 'OK', should gnome-session wait
> for the acknowledge from the GDM master process? Currently the user
> can wait for us by watching the radio button become sensitive again.
> In practice this is so fast that it doesn't even flicker noticeable.
> 
> How about having gnome-session wait for GDM's response after hitting
> 'OK' and only continue after the response or a timeout?

It SHOULD wait.  It's a race if it doesn't.  Actually the way I'd do it is as
follows:

Before opening the dialog, talk to GDM and ask which actions are available,
and close the connection.  Then run the dialog which asks the user.  When the
user picked a choice and only if he selected OK, THEN talk to GDM and tell it
it should shut down.  So you only do two conversations.  I don't see the need
to do all that real time stuff, that seems pointless.  Also I don't see why
GDM should know what the user is clicking on.  It only needs that info after
the user pressed OK.  So after that we talk to gdm, tell it what to do, wait
for GDM to tell us it's got it, and then do the session shutdown.

> Note to myself: Figure out how to make the gdm master process wait
> until the slave process get's to know the new logout action. Have
> the master process only then acknowledge to gnome-session.

No need ... see above.

George

-- 
George <jirka@5z.com>
   It is a miracle that curiosity survives formal education.
                       -- Albert Einstein



Reply to: