[libnma] cert-chooser-button: fix detection of selected item



commit 7d58bf8536779a7fddc4e827ecf83614124a14ff
Author: Ana Cabral <acabral redhat com>
Date:   Tue Sep 6 09:48:32 2022 +0200

    cert-chooser-button: fix detection of selected item
    
    Currently, 'changed' returns with no action if the first item
    is selected. This commit changes to return with no action only
    if there is no action selected in the menu.
    
    In the end of the call, it assigns the selected item of the menu
    for the first item of the list. This commit changes for, after
    executing the actions upon the selected item, on the cleanup
    phase setting the selected item to none again.
    
    https://gitlab.gnome.org/GNOME/libnma/-/merge_requests/39

 src/nma-cert-chooser-button.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/nma-cert-chooser-button.c b/src/nma-cert-chooser-button.c
index 4b14587c..9c80c321 100644
--- a/src/nma-cert-chooser-button.c
+++ b/src/nma-cert-chooser-button.c
@@ -362,7 +362,7 @@ changed (GtkComboBox *combo_box, gpointer user_data)
        gchar *label;
        GckSlot *slot;
 
-       if (gtk_combo_box_get_active (combo_box) == 0)
+       if (gtk_combo_box_get_active (combo_box) == -1)
                return;
 
        g_signal_stop_emission_by_name (combo_box, "changed");
@@ -379,7 +379,7 @@ changed (GtkComboBox *combo_box, gpointer user_data)
 
        g_free (label);
        g_clear_object (&slot);
-       gtk_combo_box_set_active (combo_box, 0);
+       gtk_combo_box_set_active (combo_box, -1);
 }
 
 static gboolean


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