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.
This commit is contained in:
A. Walton 2009-06-05 10:18:41 -04:00
parent 7b7a40130e
commit 437b01afc7

View file

@ -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
@ -140,6 +141,20 @@ nautilus_location_dialog_class_init (NautilusLocationDialogClass *class)
object_class->destroy = nautilus_location_dialog_destroy;
}
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)
{
@ -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);