[nautilus] query-editor: no need to emit changed twice when location is toggled



commit 5675e90b61615f21f88f67b4effeeceff6fc556f
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Sep 6 14:51:08 2012 -0400

    query-editor: no need to emit changed twice when location is toggled
    
    Since the location buttons are two and mutually exclusive, it doesn't
    make sense to emit this signal twice, potentially triggering and then
    immediately cancelling a search operation.

 src/nautilus-query-editor.c |   15 ++++-----------
 1 files changed, 4 insertions(+), 11 deletions(-)
---
diff --git a/src/nautilus-query-editor.c b/src/nautilus-query-editor.c
index 48c146a..0bf669e 100644
--- a/src/nautilus-query-editor.c
+++ b/src/nautilus-query-editor.c
@@ -991,19 +991,12 @@ nautilus_query_editor_init (NautilusQueryEditor *editor)
 }
 
 static void
-on_all_button_toggled (GtkToggleButton     *button,
+on_location_button_toggled (GtkToggleButton     *button,
 		       NautilusQueryEditor *editor)
 {
 	nautilus_query_editor_changed (editor);
 }
 
-static void
-on_current_button_toggled (GtkToggleButton     *button,
-			   NautilusQueryEditor *editor)
-{
-	nautilus_query_editor_changed (editor);
-}
-
 static gboolean
 entry_key_press_event_cb (GtkWidget           *widget,
 			  GdkEventKey         *event,
@@ -1052,10 +1045,10 @@ setup_widgets (NautilusQueryEditor *editor)
 	editor->details->search_all_button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (editor->details->search_current_button),
 											  _("All Files"));
 	gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (editor->details->search_all_button), FALSE);
-	g_signal_connect (editor->details->search_all_button, "toggled",
-			  G_CALLBACK (on_all_button_toggled), editor);
+
+	/* connect to the signal only on one of the two, since they're mutually exclusive */
 	g_signal_connect (editor->details->search_current_button, "toggled",
-			  G_CALLBACK (on_current_button_toggled), editor);
+			  G_CALLBACK (on_location_button_toggled), editor);
 
 	button_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
 	gtk_box_pack_start (GTK_BOX (hbox), button_box, FALSE, FALSE, 0);



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