Index: src/nautilus-connect-server-dialog.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-connect-server-dialog.c,v
retrieving revision 1.19
diff -u -r1.19 nautilus-connect-server-dialog.c
--- src/nautilus-connect-server-dialog.c	24 Mar 2006 05:41:23 -0000	1.19
+++ src/nautilus-connect-server-dialog.c	11 Nov 2006 11:35:43 -0000
@@ -783,7 +783,11 @@
 	/* Only allow digits to be inserted as port number */
 	for (pos = 0; pos < new_text_length; pos++) {
 		if (!g_ascii_isdigit (new_text[pos])) {
-		    gdk_display_beep (gtk_widget_get_display (GTK_WIDGET (editable)));
+		    GtkWindow *window = gtk_widget_get_toplevel (GTK_WIDGET (editable));
+			if (window != NULL && GTK_IS_WINDOW(window) 
+							&& GTK_WIDGET_TOPLEVEL(window)) {
+		    	gdk_window_beep (gtk_widget_get_display (GTK_WIDGET (window)->window));
+			}
 		    g_signal_stop_emission_by_name (editable, "insert_text");
 		    return;
 		}
