Index: capplets/network/gnome-network-preferences.glade
===================================================================
--- capplets/network/gnome-network-preferences.glade	(revision 8849)
+++ capplets/network/gnome-network-preferences.glade	(working copy)
@@ -26,6 +26,82 @@
       <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="GtkComboBoxEntry" id="location_comboboxentry">
+                <property name="visible">True</property>
+                <property name="items" translatable="yes"> </property>
+                <child internal-child="entry">
+                  <widget class="GtkEntry" id="comboboxentry-entry1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                  </widget>
+                </child>
+              </widget>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="apply_button">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="label" translatable="yes">gtk-apply</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">0</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="save_button">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="label" translatable="yes">gtk-save</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">0</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="position">3</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="delete_button">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="label" translatable="yes">gtk-delete</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">0</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 8849)
+++ 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,328 @@
 }
 
 static void
+load_location(GConfClient *client,gchar* from)
+{
+	int t;
+	GSList *val=gconf_client_get_list(client,from,GCONF_VALUE_STRING,NULL);
+	GSList *iter=val;
+
+	/*load PROXY_AUTOCONFIG_URL_KEY*/
+	if (iter!=NULL)
+	{
+		gconf_client_set_string(client,PROXY_AUTOCONFIG_URL_KEY,iter->data,NULL);\
+		iter=g_slist_next(iter);
+	}
+
+	/*load SOCKS_PROXY_PORT_KEY*/
+	if (iter!=NULL)
+	{
+		sscanf(iter->data,"%d",&t);
+		gconf_client_set_int(client,SOCKS_PROXY_PORT_KEY,t,NULL);
+		iter=g_slist_next(iter);
+	}
+
+	/*load SOCKS_PROXY_HOST_KEY*/
+	if (iter!=NULL)
+	{
+		gconf_client_set_string(client,SOCKS_PROXY_HOST_KEY,iter->data,NULL);\
+		iter=g_slist_next(iter);
+	}
+
+	/*load FTP_PROXY_PORT_KEY*/
+	if (iter!=NULL)
+	{
+		sscanf(iter->data,"%d",&t);
+		gconf_client_set_int(client,FTP_PROXY_PORT_KEY,t,NULL);
+		iter=g_slist_next(iter);
+	}
+
+	/*load FTP_PROXY_HOST_KEY*/
+	if (iter!=NULL)
+	{
+		gconf_client_set_string(client,FTP_PROXY_HOST_KEY,iter->data,NULL);\
+		iter=g_slist_next(iter);
+	}
+
+	/*load SECURE_PROXY_PORT_KEY*/
+	if (iter!=NULL)
+	{
+		sscanf(iter->data,"%d",&t);
+		gconf_client_set_int(client,SECURE_PROXY_PORT_KEY,t,NULL);
+		iter=g_slist_next(iter);
+	}
+
+	/*load SECURE_PROXY_HOST_KEY*/
+	if (iter!=NULL)
+	{
+		gconf_client_set_string(client,SECURE_PROXY_HOST_KEY,iter->data,NULL);\
+		iter=g_slist_next(iter);
+	}
+
+	/*load PROXY_MODE_KEY*/
+	if (iter!=NULL)
+	{
+		gconf_client_set_string(client,PROXY_MODE_KEY,iter->data,NULL);\
+		iter=g_slist_next(iter);
+	}
+
+	/*load HTTP_AUTH_PASSWD_KEY*/
+	if (iter!=NULL)
+	{
+		gconf_client_set_string(client,HTTP_AUTH_PASSWD_KEY,iter->data,NULL);\
+		iter=g_slist_next(iter);
+	}
+
+	/*load HTTP_AUTH_USER_KEY*/
+	if (iter!=NULL)
+	{
+		gconf_client_set_string(client,HTTP_AUTH_USER_KEY,iter->data,NULL);\
+		iter=g_slist_next(iter);
+	}
+
+	/*load HTTP_USE_AUTH_KEY*/
+	if (iter!=NULL)
+	{
+		if (*(gchar*)iter->data=='0') gconf_client_set_bool(client,HTTP_USE_AUTH_KEY,FALSE,NULL);\
+		else gconf_client_set_bool(client,HTTP_USE_AUTH_KEY,TRUE,NULL);\
+		iter=g_slist_next(iter);
+	}
+
+	/*load HTTP_PROXY_PORT_KEY*/
+	if (iter!=NULL)
+	{
+		sscanf(iter->data,"%d",&t);
+		gconf_client_set_int(client,HTTP_PROXY_PORT_KEY,t,NULL);
+		iter=g_slist_next(iter);
+	}
+
+	/*load HTTP_PROXY_HOST_KEY*/
+	if (iter!=NULL)
+	{
+		gconf_client_set_string(client,HTTP_PROXY_HOST_KEY,iter->data,NULL);\
+		iter=g_slist_next(iter);
+	}
+
+	/*load USE_SAME_PROXY_KEY*/
+	if (iter!=NULL)
+	{
+		if (*(gchar*)iter->data=='0') gconf_client_set_bool(client,USE_SAME_PROXY_KEY,FALSE,NULL);\
+		else gconf_client_set_bool(client,USE_SAME_PROXY_KEY,TRUE,NULL);\
+		iter=g_slist_next(iter);
+	}
+
+	/*load USE_PROXY_KEY*/
+	if (iter!=NULL)
+	{
+		if (*(gchar*)iter->data=='0') gconf_client_set_bool(client,USE_PROXY_KEY,FALSE,NULL);\
+		else gconf_client_set_bool(client,USE_PROXY_KEY,TRUE,NULL);\
+		iter=g_slist_next(iter);
+	}
+
+	/*load IGNORE_HOSTS_KEY*/
+	GSList *ignore=NULL;
+	for (;iter!=NULL;iter=g_slist_next(iter))
+	{
+		ignore=g_slist_append(ignore,g_strdup(iter->data));
+	}
+	gconf_client_set_list(client,IGNORE_HOSTS_KEY,GCONF_VALUE_STRING,ignore,NULL);
+	g_slist_foreach(ignore,(GFunc)g_free,NULL);
+	g_slist_free(ignore);
+
+	g_slist_foreach(val,(GFunc)g_free,NULL);
+	g_slist_free(val);
+}
+
+static void
+save_location(GConfClient *client,gchar* key)
+{
+	GSList* list=NULL,*in,*iter;
+	gchar* tstr=NULL;
+	gint t;
+
+	/*Save PROXY_AUTOCONFIG_URL_KEY to list*/
+	tstr=gconf_client_get_string(client,PROXY_AUTOCONFIG_URL_KEY,NULL);
+	list=g_slist_append(list,tstr);
+
+	/*Save SOCKS_PROXY_PORT_KEY to list*/
+	t=gconf_client_get_int(client,SOCKS_PROXY_PORT_KEY,NULL);
+	tstr=g_new(gchar,6);
+	g_snprintf(tstr,6,"%d",t);
+	list=g_slist_append(list,tstr);
+
+	/*Save SOCKS_PROXY_HOST_KEY to list*/
+	tstr=gconf_client_get_string(client,SOCKS_PROXY_HOST_KEY,NULL);
+	list=g_slist_append(list,tstr);
+
+	/*Save FTP_PROXY_PORT_KEY to list*/
+	t=gconf_client_get_int(client,FTP_PROXY_PORT_KEY,NULL);
+	tstr=g_new(gchar,6);
+	g_snprintf(tstr,6,"%d",t);
+	list=g_slist_append(list,tstr);
+
+	/*Save FTP_PROXY_HOST_KEY to list*/
+	tstr=gconf_client_get_string(client,FTP_PROXY_HOST_KEY,NULL);
+	list=g_slist_append(list,tstr);
+
+	/*Save SECURE_PROXY_PORT_KEY to list*/
+	t=gconf_client_get_int(client,SECURE_PROXY_PORT_KEY,NULL);
+	tstr=g_new(gchar,6);
+	g_snprintf(tstr,6,"%d",t);
+	list=g_slist_append(list,tstr);
+
+	/*Save SECURE_PROXY_HOST_KEY to list*/
+	tstr=gconf_client_get_string(client,SECURE_PROXY_HOST_KEY,NULL);
+	list=g_slist_append(list,tstr);
+
+	/*Save PROXY_MODE_KEY to list*/
+	tstr=gconf_client_get_string(client,PROXY_MODE_KEY,NULL);
+	list=g_slist_append(list,tstr);
+
+	/*Save HTTP_AUTH_PASSWD_KEY to list*/
+	tstr=gconf_client_get_string(client,HTTP_AUTH_PASSWD_KEY,NULL);
+	list=g_slist_append(list,tstr);
+
+	/*Save HTTP_AUTH_USER_KEY to list*/
+	tstr=gconf_client_get_string(client,HTTP_AUTH_USER_KEY,NULL);
+	list=g_slist_append(list,tstr);
+
+	/*Save HTTP_USE_AUTH_KEY to list*/
+	t=gconf_client_get_bool(client,HTTP_USE_AUTH_KEY,NULL);
+	tstr=g_new(gchar,6);
+	g_snprintf(tstr,6,"%d",t);
+	list=g_slist_append(list,tstr);
+
+	/*Save HTTP_PROXY_PORT_KEY to list*/
+	t=gconf_client_get_int(client,HTTP_PROXY_PORT_KEY,NULL);
+	tstr=g_new(gchar,6);
+	g_snprintf(tstr,6,"%d",t);
+	list=g_slist_append(list,tstr);
+
+	/*Save HTTP_PROXY_HOST_KEY to list*/
+	tstr=gconf_client_get_string(client,HTTP_PROXY_HOST_KEY,NULL);
+	list=g_slist_append(list,tstr);
+
+	/*Save USE_SAME_PROXY_KEY to list*/
+	t=gconf_client_get_bool(client,USE_SAME_PROXY_KEY,NULL);
+	tstr=g_new(gchar,6);
+	g_snprintf(tstr,6,"%d",t);
+	list=g_slist_append(list,tstr);
+
+	/*Save USE_PROXY_KEY to list*/
+	t=gconf_client_get_bool(client,USE_PROXY_KEY,NULL);
+	tstr=g_new(gchar,6);
+	g_snprintf(tstr,6,"%d",t);
+	list=g_slist_append(list,tstr);
+
+	/*Save IGNORE_HOSTS_KEY to list*/
+	in=gconf_client_get_list(client,IGNORE_HOSTS_KEY,GCONF_VALUE_STRING,NULL);
+	for (iter=in;iter!=NULL;iter=g_slist_next(iter))
+		list=g_slist_append(list,g_strdup(iter->data));
+	g_slist_foreach(in,(GFunc)g_free,NULL);
+	g_slist_free(in);
+
+	gconf_client_set_list(client,key,GCONF_VALUE_STRING,list,NULL);
+	gconf_client_notify(client,LOCATION_DIR);
+	g_slist_foreach(list,(GFunc)g_free,NULL);
+	g_slist_free(list);
+}
+
+static void
+cb_change_location_dir(GConfClient *client,
+						guint cnxn_id,
+						GConfEntry *entry,
+						GladeXML *dialog)
+{
+	int i;
+	GtkComboBox *location=GTK_COMBO_BOX(WID("location_comboboxentry"));
+	GSList *list=gconf_client_all_entries(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))
+	{
+		if (((GConfEntry*)iter->data)->value!=NULL) gtk_combo_box_append_text(location,((GConfEntry*)iter->data)->key+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_comboboxentry")));
+
+	str=g_strconcat(LOCATION_DIR,"/",name,NULL);
+	if ( gconf_valid_key(str,NULL) ) load_location(client,str);
+	else
+	{
+		GtkDialog *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();
+	gchar* name=gtk_combo_box_get_active_text(GTK_COMBO_BOX(WID("location_comboboxentry")));
+	gchar* key_name=g_strconcat(LOCATION_DIR,"/",name,NULL);
+	if ( gconf_valid_key(key_name,NULL) )
+	{
+		save_location(client,key_name);
+	}
+	else
+	{
+		GtkDialog *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);
+	g_free(name);
+	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_comboboxentry")));
+
+	str=g_strconcat(LOCATION_DIR,"/",name,NULL);
+	if ( gconf_valid_key(str,NULL) ) gconf_client_unset(client,str,NULL);
+	else
+	{
+		GtkDialog *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);
+	gtk_entry_set_text(GTK_ENTRY (GTK_BIN (WID("location_comboboxentry"))->child),"");
+
+	g_free(str);
+	g_free(name);
+	g_object_unref(client);
+}
+
+static void
 cb_use_same_proxy_checkbutton_clicked (GtkWidget *checkbutton,
 					GladeXML *dialog)
 {
@@ -445,7 +768,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);
