[nautilus] Bug 583214 – Nautilus aborts when giving an empty dest.



commit 437b01afc7ee7325ec8ba65bea05a13ef072063a
Author: A. Walton <awalton gnome org>
Date:   Fri Jun 5 10:18:41 2009 -0400

    Bug 583214 â?? Nautilus aborts when giving an empty dest.
    
    Follow up commit which fixes the code formatting and
    ensures the 'Open' button is insensitive when the entry
    is empty.
---
 src/nautilus-location-dialog.c |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/src/nautilus-location-dialog.c b/src/nautilus-location-dialog.c
index 7f187c9..8d2ceb4 100644
--- a/src/nautilus-location-dialog.c
+++ b/src/nautilus-location-dialog.c
@@ -123,8 +123,9 @@ entry_activate_callback (GtkEntry *entry,
 	
 	dialog = NAUTILUS_LOCATION_DIALOG (user_data);
 
-	if (gtk_entry_get_text_length (GTK_ENTRY (dialog->details->entry)) != 0)
+	if (gtk_entry_get_text_length (GTK_ENTRY (dialog->details->entry)) != 0) {
 		gtk_dialog_response (GTK_DIALOG (dialog), RESPONSE_OPEN);
+	}
 }
 
 static void
@@ -141,6 +142,20 @@ nautilus_location_dialog_class_init (NautilusLocationDialogClass *class)
 }
 
 static void
+entry_text_changed (GObject *object, GParamSpec *spec, gpointer user_data)
+{
+	NautilusLocationDialog *dialog;
+
+	dialog = NAUTILUS_LOCATION_DIALOG (user_data);
+
+	if (gtk_entry_get_text_length (GTK_ENTRY (dialog->details->entry)) != 0) {
+		gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), RESPONSE_OPEN, TRUE);
+	} else {
+		gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), RESPONSE_OPEN, FALSE);
+	}
+}
+
+static void
 nautilus_location_dialog_init (NautilusLocationDialog *dialog)
 {
 	GtkWidget *box;
@@ -192,6 +207,9 @@ nautilus_location_dialog_init (NautilusLocationDialog *dialog)
 	gtk_dialog_set_default_response (GTK_DIALOG (dialog),
 					 RESPONSE_OPEN);
 
+	g_signal_connect (dialog->details->entry, "notify::text", 
+                          G_CALLBACK (entry_text_changed), dialog);
+
 	g_signal_connect (dialog, "response",
 			  G_CALLBACK (response_callback),
 			  dialog);



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