[PATCH] default VPN import/export path to home directory


In previous versions of nm-applet on Ubuntu we could notice the
default path for import and export of VPN configs being the user's
home directory.

Looking again, this doesn't appear to be the case in Oneiric, possibly
because of changes in GTK. The attached patch defines the current
directory as the user's home when
the file chooser is being created for import and export.

Mathieu Trudel-Lapierre <mathieu-tl ubuntu com>
Freenode: cyphermox, Jabber: mathieu tl gmail com
4096R/EE018C93 1967 8F7D 03A1 8F38 732E  FF82 C126 33E1 EE01 8C93
From: Mathieu Trudel-Lapierre <mathieu trudel-lapierre canonical com>
Subject: Select the user's home directory by default as path for import/export
Bug-Ubuntu: http://bugs.launchpad.net/bugs/634913

It makes it one fewer click for most use cases when trying to import or export
a connection; since the home directory is the most likely place to find a
connection to import, or where to drop the file.

Index: network-manager-applet-
--- network-manager-applet-	2011-07-27 12:10:41.000000000 -0400
+++ network-manager-applet-	2011-09-20 16:22:16.054655325 -0400
@@ -257,6 +257,7 @@
 	GtkWidget *dialog;
 	ActionInfo *info;
+	const char *home_folder;
 	dialog = gtk_file_chooser_dialog_new (_("Select file to import"),
@@ -264,6 +265,9 @@
 	                                      GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
 	                                      GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+        home_folder = g_get_home_dir ();
+        gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), home_folder);
 	info = g_malloc0 (sizeof (ActionInfo));
 	info->callback = callback;
 	info->user_data = user_data;
@@ -373,6 +377,7 @@
 	NMVpnPluginUiInterface *plugin;
 	NMSettingVPN *s_vpn = NULL;
 	const char *service_type;
+	const char *home_folder;
 	s_vpn = NM_SETTING_VPN (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN));
 	service_type = s_vpn ? nm_setting_vpn_get_service_type (s_vpn) : NULL;
@@ -388,6 +393,8 @@
 	                                      GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
 	                                      GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
+	home_folder = g_get_home_dir ();
+	gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), home_folder);
 	plugin = vpn_get_plugin_by_service (service_type);
 	if (plugin) {

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