2006-04-10 Robert Love <rml@novell.com>

* properties/nm-vpnc.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@1678 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Robert Love 2006-04-10 20:05:31 +00:00 committed by Robert Love
parent aa93d507ad
commit 3a736cfdb6
3 changed files with 29 additions and 6 deletions

View file

@ -1,3 +1,9 @@
2006-04-10 Robert Love <rml@novell.com>
* properties/nm-vpnc.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-29 Robert Love <rml@novell.com>
* src/nm-vpnc-service.c: New eigth argument to DBUS VPN method, the

View file

@ -261,7 +261,7 @@ main (int argc, char *argv[])
gnome_program_init ("nm-vpnc-auth-dialog", VERSION, LIBGNOMEUI_MODULE,
argc, argv,
GNOME_PARAM_NONE);
GNOME_PARAM_NONE, GNOME_PARAM_NONE);
passwords = get_passwords (vpn_name, vpn_service, retry);
if (passwords == NULL)

View file

@ -627,7 +627,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)
{
@ -638,6 +638,7 @@ export_to_file (NetworkManagerVpnUIImpl *impl, const char *path,
const char *username = NULL;
const char *domain = NULL;
char *routes_str = NULL;
gboolean ret = TRUE;
/*printf ("in export_to_file; path='%s'\n", path);*/
@ -681,7 +682,10 @@ export_to_file (NetworkManagerVpnUIImpl *impl, const char *path,
f = fopen (path, "w");
if (f == NULL)
{
ret = FALSE;
goto out;
}
fprintf (f,
"[main]\n"
@ -730,8 +734,9 @@ export_to_file (NetworkManagerVpnUIImpl *impl, const char *path,
fclose (f);
out:
g_free (routes_str);
return ret;
}
@ -763,7 +768,7 @@ impl_export (NetworkManagerVpnUI *self, GSList *properties, GSList *routes, cons
/*printf ("User selected '%s'\n", path);*/
}
gtk_widget_destroy (dialog);
if (path != NULL) {
@ -785,8 +790,20 @@ impl_export (NetworkManagerVpnUI *self, GSList *properties, GSList *routes, cons
goto out;
}
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);
}
}
out:
g_free (path);