[gnome-bluetooth] wizard: use different signal handlers for the two types of radio buttons



commit ede97e75a14f8c7d410ffaa195ae5fe3cc1f428c
Author: Daniele Forsi <dforsi src gnome org>
Date:   Sun Dec 18 22:20:23 2011 +0100

    wizard: use different signal handlers for the two types of radio buttons
    
    Do not call set_user_pincode() for the radio button beside the entry widget,
    just call toggle_set_sensitive().
    Also there is no need to loop over the button group since we know the address of
    the widget that was toggled.

 wizard/main.c    |   32 ++++----------------------------
 wizard/wizard.ui |    1 -
 2 files changed, 4 insertions(+), 29 deletions(-)
---
diff --git a/wizard/main.c b/wizard/main.c
index 9209752..d01c4dd 100644
--- a/wizard/main.c
+++ b/wizard/main.c
@@ -648,35 +648,11 @@ toggle_set_sensitive (GtkWidget *button,
 void
 set_user_pincode (GtkWidget *button)
 {
-	GSList *list, *l;
-
-	list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
-	for (l = list; l ; l = l->next) {
-		GtkEntry *entry;
-		const char *pin;
-
-		if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)))
-			continue;
-
-		pin = g_object_get_data (G_OBJECT (button), "pin");
-		entry = g_object_get_data (G_OBJECT (button), "entry");
-
-		if (entry != NULL) {
-			g_free (user_pincode);
-			user_pincode = g_strdup (gtk_entry_get_text(entry));
-			gtk_dialog_set_response_sensitive (GTK_DIALOG (pin_dialog),
-							   GTK_RESPONSE_ACCEPT,
-							   gtk_entry_get_text_length (entry) >= 1);
-		} else if (pin != NULL) {
-			g_free (user_pincode);
-			if (*pin == '\0')
-				user_pincode = NULL;
-			else
-				user_pincode = g_strdup (pin);
-		}
+	if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
+		return;
 
-		break;
-	}
+	g_free (user_pincode);
+	user_pincode = g_strdup (g_object_get_data (G_OBJECT (button), "pin"));
 }
 
 void
diff --git a/wizard/wizard.ui b/wizard/wizard.ui
index 5c8b289..c5e215f 100644
--- a/wizard/wizard.ui
+++ b/wizard/wizard.ui
@@ -488,7 +488,6 @@
                     <property name="active">True</property>
                     <property name="draw_indicator">True</property>
                     <property name="group">radio_auto</property>
-                    <signal name="toggled" handler="set_user_pincode"/>
                     <signal name="toggled" handler="toggle_set_sensitive"/>
                   </object>
                   <packing>



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