Commit aa2f3743 authored by Vincent Untz's avatar Vincent Untz Committed by Vincent Untz

Remove the 1-second delay to display the inhibit dialog when an

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

svn path=/trunk/; revision=5376
parent 67d9c1a0
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> 2009-04-08 Vincent Untz <vuntz@gnome.org>
* gnome-session/gsm-manager.c: (do_phase_end_session), * gnome-session/gsm-manager.c: (do_phase_end_session),
......
...@@ -984,6 +984,13 @@ query_end_session_complete (GsmManager *manager) ...@@ -984,6 +984,13 @@ query_end_session_complete (GsmManager *manager)
{ {
g_debug ("GsmManager: query end session complete"); g_debug ("GsmManager: query end session complete");
/* Remove the timeout since this can be called from outside the timer
* and we don't want to have it called twice */
if (manager->priv->query_timeout_id > 0) {
g_source_remove (manager->priv->query_timeout_id);
manager->priv->query_timeout_id = 0;
}
if (! gsm_manager_is_logout_inhibited (manager)) { if (! gsm_manager_is_logout_inhibited (manager)) {
end_phase (manager); end_phase (manager);
return; return;
...@@ -1086,15 +1093,6 @@ do_phase_query_end_session (GsmManager *manager) ...@@ -1086,15 +1093,6 @@ do_phase_query_end_session (GsmManager *manager)
{ {
ClientEndSessionData data; ClientEndSessionData data;
/* This phase doesn't time out. This separate timer
* is only used to show UI.
*/
if (manager->priv->query_timeout_id > 0) {
g_source_remove (manager->priv->query_timeout_id);
manager->priv->query_timeout_id = 0;
}
data.manager = manager; data.manager = manager;
data.flags = 0; data.flags = 0;
...@@ -1111,6 +1109,8 @@ do_phase_query_end_session (GsmManager *manager) ...@@ -1111,6 +1109,8 @@ do_phase_query_end_session (GsmManager *manager)
(GsmStoreFunc)_client_query_end_session, (GsmStoreFunc)_client_query_end_session,
&data); &data);
/* This phase doesn't time out. This separate timer is only used to
* show UI. */
manager->priv->query_timeout_id = g_timeout_add_seconds (1, (GSourceFunc)_on_query_end_session_timeout, manager); manager->priv->query_timeout_id = g_timeout_add_seconds (1, (GSourceFunc)_on_query_end_session_timeout, manager);
} }
...@@ -1776,27 +1776,33 @@ on_client_end_session_response (GsmClient *client, ...@@ -1776,27 +1776,33 @@ on_client_end_session_response (GsmClient *client,
(gpointer)gsm_client_peek_id (client)); (gpointer)gsm_client_peek_id (client));
} }
if (do_last && manager->priv->phase == GSM_MANAGER_PHASE_END_SESSION) { if (manager->priv->phase == GSM_MANAGER_PHASE_QUERY_END_SESSION) {
/* This only makes sense if we're in part 1 of if (manager->priv->query_clients == NULL) {
* GSM_MANAGER_PHASE_END_SESSION. Doing this in part 2 can only query_end_session_complete (manager);
* happen because of a buggy client that loops wanting to be }
* last again and again. The phase timeout will take care of } else if (manager->priv->phase == GSM_MANAGER_PHASE_END_SESSION) {
* this issue. */ if (do_last) {
manager->priv->next_query_clients = g_slist_prepend (manager->priv->next_query_clients, /* This only makes sense if we're in part 1 of
client); * GSM_MANAGER_PHASE_END_SESSION. Doing this in part 2
} * can only happen because of a buggy client that loops
* wanting to be last again and again. The phase
* timeout will take care of this issue. */
manager->priv->next_query_clients = g_slist_prepend (manager->priv->next_query_clients,
client);
}
/* we can continue to the next step if all clients have replied and /* we can continue to the next step if all clients have replied
* if there's no inhibitor */ * and if there's no inhibitor */
if (manager->priv->query_clients != NULL if (manager->priv->query_clients != NULL
|| gsm_store_size (manager->priv->inhibitors) != 0) { || gsm_manager_is_logout_inhibited (manager)) {
return; return;
} }
if (manager->priv->next_query_clients != NULL) { if (manager->priv->next_query_clients != NULL) {
do_phase_end_session_part_2 (manager); do_phase_end_session_part_2 (manager);
} else { } else {
end_phase (manager); end_phase (manager);
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment