From c91717e1bf330d8e32a6a0a244fae9f4ad29e88c Mon Sep 17 00:00:00 2001 From: Robert Love Date: Mon, 10 Apr 2006 20:15:31 +0000 Subject: [PATCH] 2006-04-10 Robert Love * properties/nm-openvpn.c: Report error if writing out of exported configuration fails. The silent treatment might work for me and my wife, but not for failed I/O. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1679 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- vpn-daemons/openvpn/ChangeLog | 7 ++++++- vpn-daemons/openvpn/properties/nm-openvpn.c | 21 +++++++++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/vpn-daemons/openvpn/ChangeLog b/vpn-daemons/openvpn/ChangeLog index df9749aec..ab27a6af3 100644 --- a/vpn-daemons/openvpn/ChangeLog +++ b/vpn-daemons/openvpn/ChangeLog @@ -1,3 +1,9 @@ +2006-04-10 Robert Love + + * properties/nm-openvpn.c: Report error if writing out of exported + configuration fails. The silent treatment might work for me and my + wife, but not for failed I/O. + 2006-03-30 Robert Love Patch by Crispin Flowerday : @@ -14,7 +20,6 @@ * configure.in: Added pt_BR to ALL_LINGUAS. 2006-02-28 Ilkka Tuohela - * configure.in: Added fi to ALL_LINGUAS. 2006-02-16 Francisco Javier F. Serrador diff --git a/vpn-daemons/openvpn/properties/nm-openvpn.c b/vpn-daemons/openvpn/properties/nm-openvpn.c index 4e60c65d6..35ce6614b 100644 --- a/vpn-daemons/openvpn/properties/nm-openvpn.c +++ b/vpn-daemons/openvpn/properties/nm-openvpn.c @@ -1018,7 +1018,7 @@ impl_import_file (NetworkManagerVpnUI *self, const char *path) return import_from_file (impl, path); } -static void +static gboolean export_to_file (NetworkManagerVpnUIImpl *impl, const char *path, GSList *properties, GSList *routes, const char *connection_name) { @@ -1037,6 +1037,7 @@ export_to_file (NetworkManagerVpnUIImpl *impl, const char *path, const char *remote_ip = NULL; const char *username = NULL; char *routes_str = NULL; + gboolean ret; /*printf ("in export_to_file; path='%s'\n", path);*/ @@ -1129,8 +1130,12 @@ export_to_file (NetworkManagerVpnUIImpl *impl, const char *path, /* X-NM-Routes */ routes_str != NULL ? routes_str : ""); fclose (f); + ret = TRUE; } + else + ret = FALSE; g_free (routes_str); + return ret; } @@ -1181,7 +1186,19 @@ impl_export (NetworkManagerVpnUI *self, GSList *properties, GSList *routes, cons response = gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); if (response == GTK_RESPONSE_OK) - export_to_file (impl, path, properties, routes, connection_name); + if (!export_to_file (impl, path, properties, routes, connection_name)) { + GtkWidget *dialog; + + dialog = gtk_message_dialog_new (NULL, + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_WARNING, + GTK_BUTTONS_CLOSE, + _("Failed to export configuration")); + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), + _("Failed to save file %s"), path); + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + } } }