[gnome-session] manager: clean up shell signal connection code



commit 6f0f9f0b55eb8b95f94415400ba6ecf5a8a773ad
Author: Ray Strode <rstrode redhat com>
Date:   Thu Feb 17 16:12:55 2011 -0500

    manager: clean up shell signal connection code
    
    We weren't doing a very good job disconnecting the handlers.
    
    Spotted by vuntz
    
    https://bugzilla.gnome.org/show_bug.cgi?id=637188

 gnome-session/gsm-manager.c |   41 +++++++++++++++++++++++++----------------
 1 files changed, 25 insertions(+), 16 deletions(-)
---
diff --git a/gnome-session/gsm-manager.c b/gnome-session/gsm-manager.c
index ada35e4..fd8ce42 100644
--- a/gnome-session/gsm-manager.c
+++ b/gnome-session/gsm-manager.c
@@ -3071,12 +3071,8 @@ show_fallback_logout_dialog (GsmManager *manager)
 }
 
 static void
-on_shell_end_session_dialog_canceled (GsmShell   *shell,
-                                      GsmManager *manager)
+disconnect_shell_dialog_signals (GsmManager *manager)
 {
-        cancel_end_session (manager);
-        manager->priv->shell_end_session_dialog_canceled_id = 0;
-
         if (manager->priv->shell_end_session_dialog_canceled_id != 0) {
                 g_signal_handler_disconnect (manager->priv->shell,
                                              manager->priv->shell_end_session_dialog_canceled_id);
@@ -3097,26 +3093,25 @@ on_shell_end_session_dialog_canceled (GsmShell   *shell,
 }
 
 static void
+on_shell_end_session_dialog_canceled (GsmShell   *shell,
+                                      GsmManager *manager)
+{
+        cancel_end_session (manager);
+        disconnect_shell_dialog_signals (manager);
+}
+
+static void
 on_shell_end_session_dialog_confirmed (GsmShell   *shell,
                                        GsmManager *manager)
 {
         manager->priv->logout_mode = GSM_MANAGER_LOGOUT_MODE_FORCE;
         end_phase (manager);
-
-        manager->priv->shell_end_session_dialog_confirmed_id = 0;
+        disconnect_shell_dialog_signals (manager);
 }
 
 static void
-show_shell_end_session_dialog (GsmManager                   *manager,
-                               GsmShellEndSessionDialogType  type)
+connect_shell_dialog_signals (GsmManager *manager)
 {
-        if (!gsm_shell_is_running (manager->priv->shell))
-                return;
-
-        gsm_shell_open_end_session_dialog (manager->priv->shell,
-                                           type,
-                                           manager->priv->inhibitors,
-                                           manager->priv->clients);
         if (manager->priv->shell_end_session_dialog_canceled_id != 0)
                 return;
 
@@ -3140,6 +3135,20 @@ show_shell_end_session_dialog (GsmManager                   *manager,
 }
 
 static void
+show_shell_end_session_dialog (GsmManager                   *manager,
+                               GsmShellEndSessionDialogType  type)
+{
+        if (!gsm_shell_is_running (manager->priv->shell))
+                return;
+
+        gsm_shell_open_end_session_dialog (manager->priv->shell,
+                                           type,
+                                           manager->priv->inhibitors,
+                                           manager->priv->clients);
+        connect_shell_dialog_signals (manager);
+}
+
+static void
 user_logout (GsmManager           *manager,
              GsmManagerLogoutMode  mode)
 {



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