[patch] default adhoc name


See attached screenshot.

The attached patch fills out the GtkEntry in the "Create New Network"
dialog box with the machine's hostname, by default.

It also adds some text explaining the default choices.

This way a user need only click a couple of times to create a new
network, and the values they need to read off to friends to connect are
right there in front of them.

OS X has similar behavior in that the default Adhoc name is the
machine's hostname.  I like.

May I apply?

	Robert Love

 gnome/applet/other-network-dialog.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

Index: gnome/applet/other-network-dialog.c
RCS file: /cvs/gnome/NetworkManager/gnome/applet/other-network-dialog.c,v
retrieving revision 1.8
diff -u -u -r1.8 other-network-dialog.c
--- gnome/applet/other-network-dialog.c	4 Aug 2005 17:59:36 -0000	1.8
+++ gnome/applet/other-network-dialog.c	4 Aug 2005 18:39:45 -0000
@@ -32,6 +32,7 @@
 #include <string.h>
 #include <stdlib.h>
+#include <unistd.h>
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
@@ -214,15 +215,25 @@
 	gtk_widget_grab_default (GTK_WIDGET (button));
 	gtk_widget_grab_focus (essid_entry);
-	gtk_entry_set_text (GTK_ENTRY (essid_entry), "");
 	gtk_widget_set_sensitive (button, FALSE);
 	g_signal_connect (essid_entry, "changed", G_CALLBACK (update_button_cb), xml);
 	if (create_network)
-		label = g_strdup_printf ("<span size=\"larger\" weight=\"bold\">%s</span>\n\n%s",
+		char hostname[HOST_NAME_MAX] = "hostname";
+		gethostname (hostname, HOST_NAME_MAX);
+		hostname[HOST_NAME_MAX-1] = '\n';	/* unspecified whether a truncated hostname is terminated */
+		gtk_entry_set_text (GTK_ENTRY (essid_entry), hostname);
+		gtk_editable_set_position (GTK_EDITABLE (essid_entry), -1);
+		label = g_strdup_printf ("<span size=\"larger\" weight=\"bold\">%s</span>\n\n%s\n\n%s %s%s",
 			_("Create new wireless network"),
-			_("Enter the ESSID and security settings of the wireless network you wish to create."));
+			_("Enter the ESSID and security settings of the wireless network you wish to create."),
+			_("By default, the ESSID is set to your computer's name,"),
+			hostname,
+			_(", with no encryption enabled."));

Attachment: nm-screenshot-20050804.png
Description: PNG image

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