See also http://live.gnome.org/SessionManagement/NewGnomeSession Startup ------- main() creates the GsmSession object representing the session (either failsafe or normal). gsm_session_new() reads the appropriate autostart and session files to create a list of GsmApps to be started. (GsmAppAutostart represents an autostarted app, and GsmAppResumed represents an app resumed from the previous saved session.) Startup is divided into 6 phases (GsmSessionPhase): * GSM_SESSION_PHASE_STARTUP covers mate-session's internal startup, which also includes starting dbus-daemon (if it's not already running). Mate-session starts up those explicitly because it needs them for its own purposes. * GSM_SESSION_PHASE_INITIALIZATION is the first phase of "normal" startup (ie, startup controlled by .desktop files rather than hardcoding). It covers low-level stuff like mate-settings-daemon and at-spi-registryd, that need to be running very early (before any windows are displayed). Apps in this phase can make use of a D-Bus interface (org.gnome.SessionManager.Setenv) to set environment variables in mate-session's environment. This can be used for things like $GTK_MODULES, $MATE_KEYRING_SOCKET, etc * GSM_SESSION_PHASE_WINDOW_MANAGER includes window managers and compositing managers, and anything else that has to be running before any windows are mapped * GSM_SESSION_PHASE_PANEL includes anything that permanently takes up screen real estate (via EWMH struts). This is the first phase where things actually appear on the screen. * GSM_SESSION_PHASE_DESKTOP includes anything that draws directly on the desktop (eg, caja). * GSM_SESSION_PHASE_APPLICATION is everything else (normal apps, tray icons, etc) For each startup phase, GsmSession launches the appropriate GsmApps. When apps connect to the XSMP or D-Bus servers, GsmClients are created and added to the session. The session tries to map these clients to GsmApps. GsmApps signal when they register (via XSMP or SN) or exit, and GsmSession uses this to decide when the phase is complete. FIXME: after starting the session, we need to run the DiscardCommands of resumed apps. Running/Shutdown ---------------- GSM_SESSION_PHASE_RUNNING is pretty similar to the old mate-session; mostly it just tracks XSMP clients, and watches for SmRestartImmediately clients exiting (NOTE: THIS DOESN'T HAPPEN YET). GsmClient is in theory not XSMP-specific, but it's very very XSMP-like, and the shutdown procedure is also very XSMP-like. This is just because there's no way to do XSMP shutdown correctly otherwise. However, GsmClientDBus will still be able to present a more sane protocol to its clients than GsmClient presents to it.