2009-04-08  Vincent Untz  <vuntz@gnome.org>

	* NEWS:
	* configure.in: version 2.26.0.90

2009-04-08  Vincent Untz  <vuntz@gnome.org>

	Make reboot and shutdown leave the session properly, by letting apps
	exit before doing the real reboot/shutdown.

	Note that because of the ConsoleKit policies, the ways it's handled
	when there are more than one user logged in or when the policy always
	require a password might be a bit different:
	 - in the usual case (single user, no password required), everything
	   works as expected.
	 - in the multiple users case (password generally required once), we
	   ask for the password before trying to exit the session.
	 - if the password is required each time the ConsoleKit action is
	   called, then we'll ask for the password only once, after having made
	   all apps exit. If this doesn't work (wrong password), since the
	   session is killed anyway, we log out and ask gdm to do the action.

	* gnome-session/gsm-marshal.list: add new signature that we need
	* gnome-session/gsm-consolekit.[ch]: add new privileges-completed
	signal
	(gsm_consolekit_class_init): add new signal
	(gsm_consolekit_get_result_for_action): new, split from
	gsm_consolekit_can_do_action()
	(gsm_consolekit_can_do_action): ensure that the CK connection works
	here (instead of requiring callers to do it), and use
	gsm_consolekit_get_result_for_action()
	(gsm_consolekit_is_session_for_other_user): new, ask ConsoleKit if a
	session object is for a different user than the current user (ignoring
	the login sessions)
	(gsm_consolekit_is_single_user): new, determine if there's only a
	single user logged in on this machine
	(obtain_privileges_cb): new, PolicyKit callback when the privileges
	were obtained/denied, to send the privileges-completed signal
	(gsm_consolekit_obtain_privileges_for_action): new, obtain the
	PolicyKit privileges for a specific action
	(gsm_consolekit_get_privileges_for_actions): new, to know if we have
	privileges for a set of actions, and request the privileges if needed
	(gsm_consolekit_get_restart_privileges): new, trivial
	(gsm_consolekit_get_stop_privileges): new, trivial
	(gsm_consolekit_can_restart): do not ensure that the CK connection
	works here, it will be done in gsm_consolekit_can_do_action()
	(gsm_consolekit_can_stop): ditto

	* gnome-session/gsm-manager.c: we add a logout type variable that lets
	us remember what should be done when gnome-session exits.
	(quit_request_completed): new, callback that will make gnome-session
	exit after the ConsoleKit call to Stop/Restart has been done. If the
	ConsoleKit call wasn't successful, we fallback on gdm (since we're in
	the EXIT phase, and all apps have quitted, there's no point in not
	asking gdm to do that).
	(gsm_manager_quit): new, to do the right thing to log out depending on
	what the user wanted to achieve when logging out.
	(end_phase): use gsm_manager_quit() instead of directly calling
	gtk_main_quit()
	(cancel_end_session): reset the logout type to none
	(do_attempt_reboot), (do_attempt_shutdown), (manager_attempt_reboot),
	(manager_attempt_shutdown): killed/merged in
	request_reboot/request_shutdown
	(do_inhibit_dialog_action): renamed from do_dialog_action(); for
	shutdown and reboot, we just do like logout and end the phase.
	(inhibit_dialog_response): s/do_dialog_action/do_inhibit_dialog_action
	(query_end_session_complete): add a comment about
	gsm_inhibit_dialog_new to make it clear that the
	GSM_LOGOUT_ACTION_LOGOUT parameter is fine for shutdown and reboot too
	(request_reboot_privileges_completed): new, handle the fact that we got
	the privileges from ConsoleKit to do the reboot.
	(request_reboot): ask ConsoleKit for the privileges to reboot, and if
	it doesn't work (no ConsoleKit), just end the phase
	(request_shutdown_privileges_completed), (request_shutdown): see above
	changes for reboot functions
	(request_logout): set the logout type

2009-04-08  Vincent Untz  <vuntz@gnome.org>

	Remove the 1-second delay to display the inhibit dialog when an
	application is blocking logging out.

	* gnome-session/gsm-manager.c: (query_end_session_complete): remove the
	query timeout since it might still be running
	(do_phase_query_end_session): do not remove the query timeout here:
	it's the start of a phase, so there's no such timeout
	(on_client_end_session_response): rework a bit to make sure we call
	query_end_session_complete() if we are at the end of
	GSM_MANAGER_PHASE_QUERY_END_SESSION

2009-04-08  Vincent Untz  <vuntz@gnome.org>

	* gnome-session/gsm-manager.c: (do_phase_end_session),
	(do_phase_exit): use GSM_MANAGER_PHASE_TIMEOUT instead of hard-coding
	10 seconds everywhere.

2009-04-08  Vincent Untz  <vuntz@gnome.org>

	* gnome-session/gsm-logout-dialog.c: (on_ck_request_completed): killed
	(gsm_logout_dialog_init): don't connect to request-completed of the
	consolekit object: we actually don't do anything in the callback
	anyway...

2009-04-08  Vincent Untz  <vuntz@gnome.org>

	* gnome-session/gsm-xsmp-client.c: (save_yourself_done_callback): only
	call SmsSaveComplete() if we are still in a SaveYourself state. My
	previous change about this didn't take into account the case where the
	logout is cancelled, in which case SmsSaveComplete() shouldn't be
	called.

2009-04-05  Matthias Clasen  <mclasen@redhat.com>

	* gnome-session/gs-idle-monitor.c (handle_alarm_notify_event): Ignore
	XSyncAlarmDestroyed events, and don't spam .xsession-errors for these.

2009-03-25  Vincent Untz  <vuntz@gnome.org>

	* gnome-session/gsm-manager.c: (end_phase): put the call that
	potentially saves the session here, at the end of END_SESSION instead
	of many random places
	(do_phase_end_session),
	(do_phase_end_session_part_2), (on_client_end_session_response): remove
	calls to maybe_save_session()

2009-03-25  Vincent Untz  <vuntz@gnome.org>

	Remove the END_SESSION_LAST phase since it was considered to break the
	design. Instead, just use a second step in the END_SESSION phase.

	* gnome-session/gsm-manager.[ch]: (phase_num_to_name): remove
	END_SESSION_LAST phase
	(end_phase): always clean up next_query_clients, and remove
	END_SESSION_LAST phase.
	(on_phase_timeout): remove END_SESSION_LAST phase
	(_client_end_session): change the function signature so that we can
	merge this old function and _client_end_session_last
	(_client_end_session_last): killed
	(_client_end_session_helper): new, helper used for
	do_phase_end_session() since _client_end_session() cannot be directly
	used anymore
	(do_phase_end_session): use _client_end_session_helper(), and save
	session if there's nothing to do
	(do_phase_end_session_last): renamed to...
	(do_phase_end_session_part_2): ... this. Don't reset the phase timeout
	since we're still in the END_SESSION phase. Clean up next_query_clients
	after having used it.
	(start_phase): always clean up next_query_clients, remove
	END_SESSION_LAST phase
	(maybe_save_session): s/END_SESSION_LAST/END_SESSION/
	(on_client_end_session_response): only accept to end a client last if
	we're in END_SESSION. Start the second step of END_SESSION if there's
	no clients that haven't replied, no inhibitor and if there are clients
	to end last. Note that we don't remove the phase timeout here since it
	will either be needed in the second step or will be removed in
	end_phase().

2009-03-25  Vincent Untz  <vuntz@gnome.org>

	Allow XSMP clients to interact only during the
	GSM_MANAGER_PHASE_QUERY_END_SESSION phase. If they didn't interact
	during this phase, too bad for them.
	The idea is that GSM_MANAGER_PHASE_QUERY_END_SESSION is about letting
	them save user data and interact if it's needed for saving user data,
	while GSM_MANAGER_PHASE_END_SESSION is about telling them that they
	really have to save data now if they need too.

	Also if we have a queued SaveYourself, remember if it allowed
	interaction or not.

	* gnome-session/gsm-xsmp-client.c: (gsm_xsmp_client_init): initialize
	next_save_yourself_allow_interact
	(do_save_yourself): change forceful argument to allow_interact for
	better clarity, and save it to next_save_yourself_allow_interact when
	relevant
	(xsmp_cancel_end_session): reset next_save_yourself_allow_interact
	(xsmp_query_end_session): update for do_save_yourself() argument
	change, and also enforce the fact that we don't save the state of the
	client here
	(xsmp_end_session): force the client to not interact here
	(save_yourself_request_callback): update for do_save_yourself()
	argument change
	(save_yourself_done_callback): use next_save_yourself_allow_interact if
	there was a queued SaveYourself.

2009-03-25  Vincent Untz  <vuntz@gnome.org>

	* gnome-session/gsm-manager.c: (maybe_save_session): re-enable session
	saving (revert the change that was committed just before 2.26.0).

2009-03-25  Vincent Untz  <vuntz@gnome.org>

	* tools/gnome-session-save.c: hide deprecated command-line options from
	--help, but still accept them.
	(main): return 0 instead of a variable that is always set to 0

2009-03-25  Vincent Untz  <vuntz@gnome.org>

	Create a END_SESSION_LAST phase during which we handle the clients
	which wanted to be ended last.
	For this, we need to keep a list of clients in that case.

	* gnome-session/gsm-client.h: add a new
	GSM_CLIENT_END_SESSION_FLAG_LAST flag, to tell the client it's running
	last.
	* gnome-session/gsm-manager.[ch]: (phase_num_to_name): handle new phase
	(end_phase): empty the list of clients that wants to be ended last if
	it's not a relevant phase. Also handle new phase.
	(on_phase_timeout): handle new phase
	(_client_end_session_last): new, to tell a client that the session is
	being ended. Works like _client_end_session()
	(do_phase_end_session_last): prepare the right flags to be used for
	each clients via _client_end_session_last(). Note that we don't use all
	clients in the session here, but the list of clients that wanted to be
	ended last.
	We use a 10 seconds timeout for that phase to not block on clients that
	don't reply. Also, if there's no client in the session, then save the
	session if auto-save is enabled.
	(start_phase): empty the list of clients that wants to be ended last if
	it's not a relevant phase. Also handle new phase.
	(maybe_save_session): make this call valid in END_SESSION_LAST instead
	of END_SESSION
	(on_client_end_session_response): save the client in a specific list if
	it wants to be ended last.
	* gnome-session/gsm-xsmp-client.c: (xsmp_save_yourself_phase2):
	uncomment
	(xsmp_end_session): if the client is running last, then it means it's
	phase2 of SaveYourself, so use xsmp_save_yourself_phase2()

2009-03-25  Vincent Untz  <vuntz@gnome.org>

	s/gdm_client_end_session_response/gsm_client_end_session_response/g

	* gnome-session/gsm-client.c: (gsm_client_end_session_response):
	* gnome-session/gsm-client.h:
	* gnome-session/gsm-dbus-client.c: (handle_end_session_response):
	* gnome-session/gsm-xsmp-client.c:
	(save_yourself_phase2_request_callback),
	(interact_request_callback), (interact_done_callback),
	(save_yourself_done_callback):

2009-03-25  Vincent Untz  <vuntz@gnome.org>

	Allow clients to specify that they want to be ended last (this mainly
	matches the Phase2 of SaveYourself in XSMP). The server doesn't use
	this information yet.

	* gnome-session/gsm-client.[ch]: (gsm_client_class_init): add new
	do_last argument to END_SESSION_RESPONSE signal
	(gdm_client_end_session_response): add do_last and use it
	* gnome-session/gsm-marshal.list: updated for new signature
	* gnome-session/gsm-manager.c: (on_client_end_session_response): add
	do_last parameter, unused for now
	* gnome-session/gsm-dbus-client.c: (handle_end_session_response): pass
	FALSE as do_last
	* gnome-session/gsm-xsmp-client.c:
	(save_yourself_phase2_request_callback): pass TRUE as do_last since
	that's what the phase2 is
	(interact_request_callback): pass FALSE as do_last
	(interact_done_callback): pass FALSE as do_last
	(save_yourself_done_callback): pass FALSE as do_last

2009-03-25  Vincent Untz  <vuntz@gnome.org>

	* gnome-session/gsm-manager.c: (do_phase_end_session),
	(auto_save_is_enabled): coding style nit-picking

2009-03-25  Vincent Untz  <vuntz@gnome.org>

	Allow an interacting app to cancel the logout.

	* gnome-session/gsm-client.[ch]: (gsm_client_class_init): add new
	cancel argument to END_SESSION_RESPONSE signal
	(gdm_client_end_session_response): add cancel and use it
	* gnome-session/gsm-marshal.list: updated for new signature
	* gnome-session/gsm-manager.c: (on_client_end_session_response): add
	cancel paramter, and call cancel_end_session if cancel is TRUE
	* gnome-session/gsm-dbus-client.c: (handle_end_session_response): pass
	FALSE as cancel
	* gnome-session/gsm-xsmp-client.c:
	(save_yourself_phase2_request_callback): pass FALSE as cancel
	(interact_request_callback): pass FALSE as cancel
	(interact_done_callback): pass the value returned by the client as
	cancel
	(save_yourself_done_callback): pass FALSE as cancel

2009-03-25  Vincent Untz  <vuntz@gnome.org>

	Actually allow XSMP clients to interact during the logout. It works
	quite well with the inhibitor infrastructure since a JIT inhibitor will
	be created.
	Note that the user will get two dialogs: eg, when gedit has an unsaved
	document, the user will see the gedit save/cancel dialog and the
	inhibit dialog. That's actually a good thing since the save/cancel
	dialog from gedit might be in another workspace, and so the inhibit
	dialog makes sure the user knows what's going on.

	* gnome-session/gsm-xsmp-client.c: (xsmp_interact): uncomment
	(interact_request_callback): stop cancelling the session when a client
	wants to interact, and allow the client to interact.

2009-03-25  Vincent Untz  <vuntz@gnome.org>

	Make session saving works a bit better by telling client to not just
	save the global state, but also the local state when relevant.

	* gnome-session/gsm-client.h: add new GSM_CLIENT_END_SESSION_FLAG_SAVE
	* gnome-session/gsm-manager.c: (do_phase_end_session): if the session
	should be autosaved, then pass the GSM_CLIENT_END_SESSION_FLAG_SAVE
	flag
	(do_phase_query_end_session): add a comment explaining why we don't use
	the GSM_CLIENT_END_SESSION_FLAG_SAVE flag
	* gnome-session/gsm-xsmp-client.c: (xsmp_query_end_session),
	(xsmp_end_session): depending on the presence of the
	GSM_CLIENT_END_SESSION_FLAG_SAVE flag, use SmSaveBoth or SmSaveGlobal

2009-03-24  Vincent Untz  <vuntz@gnome.org>

	* gnome-session/gsm-xsmp-client.c: (do_save_yourself): just add some
	paranoia code to make sure our state is consistent
	(xsmp_cancel_end_session): reset the save_yourself state here since we
	cancel the operation anyway
	(save_yourself_phase2_request_callback): fix to not behave exactly like
	SaveYourselfDone. This is wrong according to XSMP.
	(save_yourself_done_callback): always call SmsSaveComplete() (it's
	expected by XSMP), and ignore the success argument. It's actually
	useless.

2009-03-24  Vincent Untz  <vuntz@gnome.org>

	Rework deeply the code that writes the saved session to desktop files:
	we now properly discard a client when removing it; we also make sure we
	save the current session before we completely remove the previously
	saved session (to be on the safe side).
	Note that we only discard a client when the new saved session doesn't
	use the same discard command: for example, when metacity saves its
	state, it will reuse the same discard command and so we can't discard
	the old metacity client (it would discard the new client).

	* gnome-session/gsm-util.[ch]: (gsm_util_get_empty_tmp_session_dir):
	new function to get a temporary directory where to save the new
	session, while we still keep the previously saved session. It also
	makes sure the directory is empty.
	* gnome-session/gsm-session-save.[ch]: (save_one_client): update to
	make sure we remember the discard command from the client.
	(gsm_session_save): rework to first save the session in the temporary
	directory (and remember the discard commands from the saved clients),
	and then clear the old session. We finish by renaming the temporary
	directory to its final name.
	(gsm_session_clear_one_client): new, to properly clear one client from
	a saved session. We unlink the desktop file, but also run the discard
	command if it's not used by any other client from the newly saved
	session.
	(gsm_session_clear_saved_session): change to clear a saved session in a
	specified directory, and use gsm_session_clear_one_client() instead of
	just unlinking the desktop file. Also add missing g_dir_close().

2009-03-24  Vincent Untz  <vuntz@gnome.org>

	* gnome-session/gsm-xsmp-client.c: (xsmp_save): just don't return a
	keyfile if there's no restart command for this client (ie, we won't
	save this client). Also make sure keyfile is properly initialized to
	NULL to avoid an undefined return value in that case.

2009-03-24  Vincent Untz  <vuntz@gnome.org>

	* gnome-session/gsm-xsmp-client.c: (xsmp_get_discard_command):
	uncomment
	(xsmp_save): when saving the xsmp client to a desktop file, also save
	the discard command since we'll want to use it at some point when
	discarding the saved app.

2009-03-24  Vincent Untz  <vuntz@gnome.org>

	* gnome-session/gsm-manager.c: (cancel_end_session): ignore this if
	we're not in a relevant phase. Also make sure the inhibit dialog is
	destroyed before removing inhibitors (which would activate the
	inhibit dialog)

2009-03-24  Vincent Untz  <vuntz@gnome.org>

	* gnome-session/gsm-util.c: (ensure_dir_exists): create the dir with
	permission 0755.
	(gsm_util_get_saved_session_dir): use ~/.config instead of ~/.gnome2.
	It's a good time to start using the xdg folders before we actually
	start putting data.

2009-03-24  Vincent Untz  <vuntz@gnome.org>

	* gnome-session/gsm-inhibit-dialog.c: (update_dialog_text): fix debug
	string
	* gnome-session/gsm-manager.c: (cancel_end_session): add debug string
	(gsm_manager_shutdown): fix debug string

2009-03-24  Vincent Untz  <vuntz@gnome.org>

	* gnome-session/gsm-inhibit-dialog.c: (add_inhibitor): use
	gsm_util_get_desktop_dirs() instead of just gsm_util_get_app_dirs().
	Also try to handle desktop filenames that are an absolute path the best
	way possible (this happens with OpenOffice.org).
	* gnome-session/gsm-util.[ch]: (gsm_util_get_desktop_dirs): new
	function, to return all the directories where we look up for the
	desktop files.

2009-03-24  Vincent Untz  <vuntz@gnome.org>

	* gnome-session/gsm-inhibit-dialog.c: (add_inhibitor): handle NULL
	errors instead of crashing, which can happen in some cases in
	EggDesktopFile.

2009-03-24  Vincent Untz  <vuntz@gnome.org>

	* gnome-session/gsm-inhibit-dialog.c: use a 32x32 icon size for icons,
	looks better this way.

2009-03-24  Vincent Untz  <vuntz@gnome.org>

	Let all processes cleanly exit on exit.

	* gnome-session/gsm-manager.c: (end_phase): rework with a switch so
	that it's easy to see what's going on for which phases. We also don't
	exit immediately when we reach the exit phase, and instead let
	start_phase() do its work
	(_client_stop): stop a client
	(do_phase_exit): create a 10 second timeout that will force the end of
	the phase, and tells each client to stop via _client_stop() so they can
	have a chance to properly exit before we quit.
	(start_phase): call do_phase_exit() on exit phase

2009-03-18  Vincent Untz  <vuntz@gnome.org>

	* configure.in:
	* doc/man/*: rework the man pages so that they're up-to-date.

2009-03-16  Vincent Untz  <vuntz@gnome.org>

	* configure.in: post-release bump to 2.26.1

==================== 2.26.0 ====================