static void finish_interact (gboolean shutdown) { if (current_state == STATE_DONE_WITH_INTERACT) /* paranoia */ { SmcInteractDone (session_connection, False /* don't cancel logout */); save_yourself_possibly_done (shutdown, TRUE); } }
void nsNativeAppSupportUnix::DoInteract() { nsCOMPtr<nsIObserverService> obsServ = mozilla::services::GetObserverService(); if (!obsServ) { SmcInteractDone(mSessionConnection, False); SmcSaveYourselfDone(mSessionConnection, True); SetClientState(STATE_IDLE); return; } nsCOMPtr<nsISupportsPRBool> cancelQuit = do_CreateInstance(NS_SUPPORTS_PRBOOL_CONTRACTID); bool abortQuit = false; if (cancelQuit) { cancelQuit->SetData(false); obsServ->NotifyObservers(cancelQuit, "quit-application-requested", nullptr); cancelQuit->GetData(&abortQuit); } if (!abortQuit && mClientState == STATE_DISCONNECTED) { // The session manager disappeared, whilst we were interacting, so // quit now nsCOMPtr<nsIAppStartup> appService = do_GetService("@mozilla.org/toolkit/app-startup;1"); if (appService) { appService->Quit(nsIAppStartup::eForceQuit); } } else { if (mClientState != STATE_SHUTDOWN_CANCELLED) { // Only do this if the shutdown wasn't cancelled SmcInteractDone(mSessionConnection, !!abortQuit); SmcSaveYourselfDone(mSessionConnection, !abortQuit); } SetClientState(STATE_IDLE); } }