[network-manager-applet/bg/wifi-dialog-fixes-rh1665653: 2/2] wifi-dialog: fix connection combo signals



commit ecbf480466845e5dbee3cde8c6a8fa85da01ef46
Author: Beniamino Galvani <bgalvani redhat com>
Date:   Sat Jan 12 22:35:10 2019 +0100

    wifi-dialog: fix connection combo signals
    
    We need to connect to "changed" signal only when the widget is
    displayed. Also, connection_combo_init() can be called multiple times
    and so we need to clear previous handlers registration or the
    function can be called multiple times.

 src/libnma/nma-wifi-dialog.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/libnma/nma-wifi-dialog.c b/src/libnma/nma-wifi-dialog.c
index c0f3336a..009bf440 100644
--- a/src/libnma/nma-wifi-dialog.c
+++ b/src/libnma/nma-wifi-dialog.c
@@ -542,11 +542,14 @@ connection_combo_init (NMAWifiDialog *self)
                                              NULL);
 
        gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
-       g_signal_connect (G_OBJECT (widget), "changed",
-                         G_CALLBACK (connection_combo_changed), self);
+
+       g_signal_handlers_disconnect_by_func (widget, connection_combo_changed, self);
        if (priv->specific_connection || !num_added) {
                gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (priv->builder, "connection_label")));
                gtk_widget_hide (widget);
+       } else {
+               g_signal_connect (widget, "changed",
+                                 G_CALLBACK (connection_combo_changed), self);
        }
        if (gtk_tree_model_get_iter_first (priv->connection_model, &tree_iter))
                gtk_tree_model_get (priv->connection_model, &tree_iter, C_CON_COLUMN, &priv->connection, -1);


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