Index: capplets/network/gnome-network-preferences.glade
===================================================================
--- capplets/network/gnome-network-preferences.glade	(revision 8870)
+++ capplets/network/gnome-network-preferences.glade	(working copy)
@@ -21,11 +21,78 @@
   <property name="urgency_hint">False</property>
   <property name="has_separator">False</property>
 
-  <child internal-child="vbox">
-    <widget class="GtkVBox" id="dialog-vbox1">
-      <property name="visible">True</property>
-      <property name="homogeneous">False</property>
-      <property name="spacing">2</property>
+      <child internal-child="vbox">
+	<widget class="GtkVBox" id="dialog-vbox1">
+	<property name="visible">True</property>
+	<property name="homogeneous">False</property>
+	<property name="spacing">2</property>
+	  <child>
+		<widget class="GtkHBox" id="hbox2">
+		<property name="visible">True</property>
+		  <child>
+			<widget class="GtkLabel" id="label1">
+			  <property name="visible">True</property>
+			  <property name="label" translatable="yes">Location:</property>
+			</widget>
+			<packing>
+			  <property name="expand">False</property>
+			</packing>
+		  </child>
+		  <child>
+			<widget class="GtkComboBox" id="location_combobox">
+			  <property name="visible">True</property>
+			  <property name="items"> </property>
+			</widget>
+			<packing>
+			  <property name="position">1</property>
+			</packing>
+		  </child>
+		  <child>
+			<widget class="GtkButton" id="apply_button">
+			  <property name="label">gtk-apply</property>
+			  <property name="visible">True</property>
+			  <property name="can_focus">True</property>
+			  <property name="receives_default">True</property>
+			  <property name="use_stock">True</property>
+			</widget>
+			<packing>
+			  <property name="expand">False</property>
+			  <property name="position">2</property>
+			</packing>
+		  </child>
+		  <child>
+			<widget class="GtkButton" id="save_button">
+			  <property name="label">gtk-save</property>
+			  <property name="visible">True</property>
+			  <property name="can_focus">True</property>
+			  <property name="receives_default">True</property>
+			  <property name="use_stock">True</property>
+			</widget>
+			<packing>
+			  <property name="expand">False</property>
+			  <property name="position">3</property>
+			</packing>
+		  </child>
+		  <child>
+			<widget class="GtkButton" id="delete_button">
+			  <property name="label">gtk-delete</property>
+			  <property name="visible">True</property>
+			  <property name="can_focus">True</property>
+			  <property name="receives_default">True</property>
+			  <property name="use_stock">True</property>
+			</widget>
+			<packing>
+			  <property name="expand">False</property>
+			  <property name="position">4</property>
+			</packing>
+		  </child>
+	</widget>
+	<packing>
+	 <property name="expand">False</property>
+	 <property name="fill">False</property>
+	 <property name="position">1</property>
+	</packing>
+      </child>
 
       <child internal-child="action_area">
 	<widget class="GtkHButtonBox" id="dialog-action_area1">
Index: capplets/network/gnome-network-preferences.c
===================================================================
--- capplets/network/gnome-network-preferences.c	(revision 8870)
+++ capplets/network/gnome-network-preferences.c	(working copy)
@@ -68,6 +68,7 @@
 #define SOCKS_PROXY_PORT_KEY  "/system/proxy/socks_port"
 #define OLD_SOCKS_PROXY_PORT_KEY  "/system/proxy/old_socks_port"
 #define PROXY_AUTOCONFIG_URL_KEY  "/system/proxy/autoconfig_url"
+#define LOCATION_DIR "/apps/control-center/network"
 
 static GtkWidget *details_dialog = NULL;
 static GSList *ignore_hosts = NULL;
@@ -258,6 +259,237 @@
 }
 
 static void
+save_key (GConfClient* client, gchar* key, gchar* path)
+{
+	int t;
+	gboolean tb;
+	GSList *tl;
+	gchar *str, *skey;
+
+	skey=g_strconcat (path, key, NULL);
+	GConfValue* val = gconf_client_get (client, key, NULL);
+
+	switch ( val->type )
+	{
+		case GCONF_VALUE_STRING:
+			str = gconf_client_get_string (client, key, NULL);
+			gconf_client_set_string (client, skey, str, NULL);
+			g_free (str);
+			break;
+		case GCONF_VALUE_INT:
+			t = gconf_client_get_int (client, key, NULL);
+			gconf_client_set_int (client, key, t, NULL);
+			break;
+		case GCONF_VALUE_BOOL:
+			tb = gconf_client_get_bool (client, key, NULL);
+			gconf_client_set_bool (client, key, tb, NULL);
+			break;
+		case GCONF_VALUE_LIST:
+			tl = gconf_client_get_list (client, key, GCONF_VALUE_STRING, NULL);
+			gconf_client_set_list (client, key, GCONF_VALUE_STRING, tl, NULL);
+			g_slist_foreach ( tl, (GFunc) g_free, NULL);
+			g_slist_free (tl);
+			break;
+		default:
+			break;
+	}
+	g_free (skey);
+}
+
+static void
+load_key(gchar* key, GConfClient* client)
+{
+	int t;
+	gboolean tb;
+	GSList *tl;
+	gchar *str, *skey;
+
+	for ( t = strlen (LOCATION_DIR) + 2; key[t] != '\0' && key[t] != '/' ; t++) ;
+	skey = g_strdup (key + t);
+	GConfValue* val = gconf_client_get (client, key, NULL);
+	if ( val == NULL ) return;
+	switch ( val->type )
+	{
+		case GCONF_VALUE_STRING:
+			str = gconf_client_get_string (client, key, NULL);
+			gconf_client_set_string (client, skey, str, NULL);
+			g_free (str);
+			break;
+		case GCONF_VALUE_INT:
+			t = gconf_client_get_int (client, key, NULL);
+			gconf_client_set_int (client, key, t, NULL);
+			break;
+		case GCONF_VALUE_BOOL:
+			tb = gconf_client_get_bool (client, key, NULL);
+			gconf_client_set_bool (client, key, tb, NULL);
+			break;
+		case GCONF_VALUE_LIST:
+			tl = gconf_client_get_list (client, key, GCONF_VALUE_STRING, NULL);
+			gconf_client_set_list (client, key, GCONF_VALUE_STRING, tl, NULL);
+			g_slist_foreach ( tl, (GFunc) g_free, NULL);
+			g_slist_free (tl);
+			break;
+		default:
+			break;
+	}
+	g_free (skey);
+}
+
+static void
+load_location (gchar* from,GConfClient *client)
+{
+	GSList *list,*iter;
+
+	list = gconf_client_all_dirs (client, from, NULL);
+	g_slist_foreach (list, (GFunc) load_location, client);
+	g_slist_foreach (list, (GFunc) g_free, NULL);
+	g_slist_free (list);
+
+	list = gconf_client_all_entries (client, from, NULL);
+	for (iter = list; iter != NULL; iter = g_slist_next (iter))
+	{
+		load_key ( ( (GConfEntry*)iter->data )->key, client);
+	}
+	g_slist_foreach (list, (GFunc) gconf_entry_free, NULL);
+	g_slist_free (list);
+}
+
+static void
+save_location (GConfClient *client,gchar* key)
+{
+	save_key (client, PROXY_AUTOCONFIG_URL_KEY, key);
+	save_key (client, SOCKS_PROXY_PORT_KEY, key);
+	save_key (client, SOCKS_PROXY_HOST_KEY, key);
+	save_key (client, FTP_PROXY_PORT_KEY, key);
+	save_key (client, FTP_PROXY_HOST_KEY, key);
+	save_key (client, SECURE_PROXY_PORT_KEY, key);
+	save_key (client, SECURE_PROXY_HOST_KEY, key);
+	save_key (client, PROXY_MODE_KEY, key);
+	save_key (client, HTTP_AUTH_PASSWD_KEY, key);
+	save_key (client, HTTP_AUTH_USER_KEY, key);
+	save_key (client, HTTP_USE_AUTH_KEY, key);
+	save_key (client, HTTP_PROXY_PORT_KEY, key);
+	save_key (client, HTTP_PROXY_HOST_KEY, key);
+	save_key (client, USE_SAME_PROXY_KEY, key);
+	save_key (client, USE_PROXY_KEY, key);
+	save_key (client, IGNORE_HOSTS_KEY, key);
+
+	gconf_client_notify (client, LOCATION_DIR);
+}
+
+static void
+cb_change_location_dir(GConfClient *client,
+						guint cnxn_id,
+						GConfEntry *entry,
+						GladeXML *dialog)
+{
+	int i;
+	gconf_client_suggest_sync (client, NULL);
+	GtkComboBox *location = GTK_COMBO_BOX (WID ("location_combobox"));
+	GSList *list = gconf_client_all_dirs (client, LOCATION_DIR, NULL);
+	GSList *iter;
+	/*Clear GtkComboBox*/
+	i = gtk_tree_model_iter_n_children (gtk_combo_box_get_model (location), NULL);
+	while (i>=0)
+	{
+		gtk_combo_box_remove_text (location, i);
+		i--;
+	}
+
+	for ( iter = list ; iter != NULL ; iter = g_slist_next(iter) )
+	{
+		gtk_combo_box_append_text (location, ((gchar*)iter->data + strlen (LOCATION_DIR) + 1));
+	}
+
+	g_slist_foreach (list, (GFunc)gconf_entry_free, NULL);
+	g_slist_free (list);
+}
+
+static void
+cb_apply_button_clicked (GtkWidget *applybutton,
+						 GladeXML *dialog)
+{
+	gchar *str;
+	GConfClient* client = gconf_client_get_default ();
+	gchar* name = gtk_combo_box_get_active_text (GTK_COMBO_BOX (WID ("location_combobox")));
+
+	str=g_strconcat (LOCATION_DIR, "/", name, NULL);
+	if ( gconf_valid_key (str,NULL) ) load_location (str, client);
+	else
+	{
+		GtkDialog *dialog = GTK_DIALOG (gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CANCEL, "Incorrect location name"));
+		g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog);
+		gtk_dialog_run (dialog);
+	}
+
+	g_free (str);
+	g_free (name);
+	g_object_unref (client);
+}
+
+static void
+cb_save_button_clicked (GtkWidget *savebutton,
+						 GladeXML *dialog)
+{
+	GConfClient* client=gconf_client_get_default();
+	GtkWidget *askdialog, *text, *content_area;
+	askdialog = gtk_dialog_new_with_buttons ("Save As",
+	                                         NULL,
+	                                         GTK_DIALOG_DESTROY_WITH_PARENT,
+	                                         GTK_STOCK_OK,
+	                                         GTK_RESPONSE_OK,
+	                                         GTK_STOCK_CANCEL,
+	                                         GTK_RESPONSE_CANCEL,
+	                                         NULL);
+	content_area = gtk_dialog_get_content_area (GTK_DIALOG (askdialog));
+	text = gtk_entry_new ();
+	gtk_widget_show (text);
+	gtk_container_add (GTK_CONTAINER (content_area), text);
+	if (gtk_dialog_run (GTK_DIALOG(askdialog)) == GTK_RESPONSE_OK)
+	{
+		gchar* key_name = NULL;
+		key_name = g_strconcat (LOCATION_DIR, "/", gtk_entry_get_text(GTK_ENTRY(text)), NULL);
+		if ( gconf_valid_key (key_name,NULL) )
+		{
+			save_location (client, key_name);
+		}
+		else
+		{
+			GtkDialog *dialog=GTK_DIALOG (gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CANCEL, "Incorrect location name"));
+			g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog);
+			gtk_dialog_run (dialog);
+		}
+		g_free (key_name);
+	}
+	gtk_widget_destroy (text);
+	gtk_widget_destroy (askdialog);
+	g_object_unref (client);
+}
+
+static void
+cb_delete_button_clicked (GtkWidget *deletebutton,
+						  GladeXML *dialog)
+{
+	gchar* str;
+	GConfClient* client = gconf_client_get_default ();
+	gchar* name = gtk_combo_box_get_active_text (GTK_COMBO_BOX (WID ("location_combobox")));
+
+	str = g_strconcat (LOCATION_DIR, "/", name, NULL);
+	if ( gconf_valid_key(str, NULL) ) gconf_client_recursive_unset (client, str, GCONF_UNSET_INCLUDING_SCHEMA_NAMES, NULL);
+	else
+	{
+		GtkDialog *dialog = GTK_DIALOG (gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CANCEL, "Incorrect location name"));
+		g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog);
+		gtk_dialog_run (dialog);
+	}
+	gconf_client_notify (client, LOCATION_DIR);
+
+	g_free (str);
+	g_free (name);
+	g_object_unref (client);
+}
+
+static void
 cb_use_same_proxy_checkbutton_clicked (GtkWidget *checkbutton,
 					GladeXML *dialog)
 {
@@ -445,7 +677,12 @@
 	/* There's a bug in peditors that cause them to not initialize the entry
 	 * correctly. */
 	client = gconf_client_get_default ();
-
+	/*Locations*/
+	gconf_client_notify_add (client, LOCATION_DIR, cb_change_location_dir, dialog, NULL, NULL);
+	g_signal_connect (WID("apply_button"), "clicked", G_CALLBACK (cb_apply_button_clicked), dialog);
+	g_signal_connect (WID("save_button"), "clicked", G_CALLBACK (cb_save_button_clicked), dialog);
+	g_signal_connect (WID("delete_button"), "clicked", G_CALLBACK (cb_delete_button_clicked), dialog);
+	cb_change_location_dir(client, 0, NULL, dialog);
 	/* Hackety hack */
 	gtk_label_set_use_markup (GTK_LABEL (GTK_BIN (WID ("none_radiobutton"))->child), TRUE);
 	gtk_label_set_use_markup (GTK_LABEL (GTK_BIN (WID ("manual_radiobutton"))->child), TRUE);
