[gdm] Correctly disconnect the signals from the login buttons



commit ba33cc6ce71a56699aa22e3a08644b94f1fb56bb
Author: William Jon McCann <jmccann redhat com>
Date:   Tue Jun 15 14:39:56 2010 -0400

    Correctly disconnect the signals from the login buttons
    
    Fixes a problem where we answer a query twice.

 gui/simple-greeter/gdm-greeter-login-window.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/gui/simple-greeter/gdm-greeter-login-window.c b/gui/simple-greeter/gdm-greeter-login-window.c
index 77ced21..0b05609 100644
--- a/gui/simple-greeter/gdm-greeter-login-window.c
+++ b/gui/simple-greeter/gdm-greeter-login-window.c
@@ -101,6 +101,8 @@ struct GdmGreeterLoginWindowPrivate
         GtkBuilder      *builder;
         GtkWidget       *user_chooser;
         GtkWidget       *auth_banner_label;
+        GtkWidget       *current_button;
+
         guint            display_is_local : 1;
         guint            is_interactive : 1;
         guint            user_chooser_loaded : 1;
@@ -398,6 +400,15 @@ set_log_in_button_mode (GdmGreeterLoginWindow *login_window,
                                                       NULL); /* is separate */
         }
 
+        if (login_window->priv->current_button != NULL) {
+                /* disconnect any signals */
+                if (login_window->priv->login_button_handler_id > 0) {
+                        g_signal_handler_disconnect (login_window->priv->current_button,
+                                                     login_window->priv->login_button_handler_id);
+                        login_window->priv->login_button_handler_id = 0;
+                }
+        }
+
         unlock_button = GTK_WIDGET (gtk_builder_get_object (login_window->priv->builder, "unlock-button"));
         login_button = GTK_WIDGET (gtk_builder_get_object (login_window->priv->builder, "log-in-button"));
 
@@ -410,11 +421,7 @@ set_log_in_button_mode (GdmGreeterLoginWindow *login_window,
         }
         gtk_widget_grab_default (button);
 
-        /* disconnect any signals */
-        if (login_window->priv->login_button_handler_id > 0) {
-                g_signal_handler_disconnect (button, login_window->priv->login_button_handler_id);
-                login_window->priv->login_button_handler_id = 0;
-       }
+        login_window->priv->current_button = button;
 
         switch (mode) {
         case LOGIN_BUTTON_HIDDEN:



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