From ecf28067c4178db989639b7e22b79cd45ab9dd45 Mon Sep 17 00:00:00 2001 From: Christopher Aillon Date: Tue, 16 Aug 2005 15:00:55 +0000 Subject: [PATCH] 2005-08-16 Christopher Aillon * gnome/applet/applet.c: Split markup out of translatable strings and clean up logic a little bit. (fixes #309012) git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@847 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 5 +++++ gnome/applet/applet.c | 43 ++++++++++++++++++++++++++++--------------- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5baee84ab0..0c265ac163 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-08-16 Christopher Aillon + + * gnome/applet/applet.c: Split markup out of translatable strings + and clean up logic a little bit. (fixes #309012) + 2005-08-15 Christopher Aillon * gnome/vpn-properties/nm-vpn-properties.c: diff --git a/gnome/applet/applet.c b/gnome/applet/applet.c index 6953139aa5..d76f3b7ce0 100644 --- a/gnome/applet/applet.c +++ b/gnome/applet/applet.c @@ -476,6 +476,9 @@ static gboolean nmwa_show_vpn_failure_dialog (DialogCBData *cb_data) void nmwa_schedule_vpn_failure_dialog (NMWirelessApplet *applet, const char *member, const char *vpn_name, const char *error_msg) { DialogCBData *cb_data = NULL; + gchar *error_head = NULL; + gchar *error_desc = NULL; + gchar *error_data = NULL; g_return_if_fail (applet != NULL); g_return_if_fail (member != NULL); @@ -487,35 +490,45 @@ void nmwa_schedule_vpn_failure_dialog (NMWirelessApplet *applet, const char *mem if (!strcmp (member, NM_DBUS_VPN_SIGNAL_LOGIN_FAILED)) { - cb_data->msg = g_strdup_printf (_("VPN Login Failure\n\nCould not start the " - "VPN connection '%s' due to a login failure.\n\nThe VPN service said: \"%s\""), vpn_name, error_msg); + error_head = g_strdup (_("VPN Login Failure")); + error_desc = g_strdup_printf (_("Could not start the VPN connection '%s' due to a login failure."), vpn_name); } else if (!strcmp (member, NM_DBUS_VPN_SIGNAL_LAUNCH_FAILED)) { - cb_data->msg = g_strdup_printf (_("VPN Start Failure\n\nCould not start the " - "VPN connection '%s' due to a failure launching the VPN program.\n\nThe VPN service said: \"%s\""), vpn_name, error_msg); + error_head = g_strdup (_("VPN Start Failure")); + error_desc = g_strdup_printf (_("Could not start the VPN connection '%s' due to a failure launching the VPN program."), vpn_name); } else if (!strcmp (member, NM_DBUS_VPN_SIGNAL_CONNECT_FAILED)) { - cb_data->msg = g_strdup_printf (_("VPN Connect Failure\n\nCould not start the " - "VPN connection '%s' due to a connection error.\n\nThe VPN service said: \"%s\""), vpn_name, error_msg); + error_head = g_strdup (_("VPN Connect Failure")); + error_desc = g_strdup_printf (_("Could not start the VPN connection '%s' due to a connection error."), vpn_name); } else if (!strcmp (member, NM_DBUS_VPN_SIGNAL_VPN_CONFIG_BAD)) { - cb_data->msg = g_strdup_printf (_("VPN Configuration Error\n\nThe " - "VPN connection '%s' was not correctly configured.\n\nThe VPN service said: \"%s\""), vpn_name, error_msg); + error_head = g_strdup (_("VPN Configuration Error")); + error_desc = g_strdup_printf (_("The VPN connection '%s' was not correctly configured."), vpn_name); } else if (!strcmp (member, NM_DBUS_VPN_SIGNAL_IP_CONFIG_BAD)) { - cb_data->msg = g_strdup_printf (_("VPN Connect Failure\n\nCould not start the " - "VPN connection '%s' because the VPN server did not return an adequate network configuration.\n\n" - "The VPN service said: \"%s\""), vpn_name, error_msg); + error_head = g_strdup (_("VPN Connect Failure")); + error_desc = g_strdup_printf (_("Could not start the VPN connection '%s' because the VPN server did not return an adequate network configuration."), vpn_name); + } + else + { + free_dialog_cb_data (cb_data); + return; } - if (cb_data->msg) - g_idle_add ((GSourceFunc) nmwa_show_vpn_failure_dialog, cb_data); - else - free_dialog_cb_data (cb_data); + error_data = g_strdup_printf (_("The VPN service said: \"%s\""), error_msg); + + cb_data->msg = g_strdup_printf ("%s\n\n" + "%s\n\n%s", error_head, error_desc, error_data); + + g_free (error_head); + g_free (error_desc); + g_free (error_data); + + g_idle_add ((GSourceFunc) nmwa_show_vpn_failure_dialog, cb_data); }