diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2017-04-19 11:25:18 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2017-04-20 15:28:53 +0200 |
commit | 99d04cf0d48f9cf7584e474906109db23302ed55 (patch) | |
tree | 0aaf88ff80f141d704326ee2c3b9d7f052bd05ed | |
parent | 145dfaecad9b81bb70bf72bde5ed5980f68232b0 (diff) | |
download | network-manager-applet-99d04cf0d48f9cf7584e474906109db23302ed55.tar.gz |
applet: refactor make_active_failure_message()
-rw-r--r-- | src/applet.c | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/src/applet.c b/src/applet.c index 2c0f3d39..613e126e 100644 --- a/src/applet.c +++ b/src/applet.c @@ -868,11 +868,12 @@ make_active_failure_message (NMActiveConnection *active, NMConnection *connection; const GPtrArray *devices; NMDevice *device; - const char *verb; + const char *verb, *id; g_return_val_if_fail (active != NULL, NULL); connection = (NMConnection *) nm_active_connection_get_connection (active); + id = nm_connection_get_id (connection); switch (reason) { case NM_ACTIVE_CONNECTION_STATE_REASON_DEVICE_DISCONNECTED: @@ -883,35 +884,26 @@ make_active_failure_message (NMActiveConnection *active, else verb = "failed"; - return g_strdup_printf (_("\nThe VPN connection “%s” %s because the network connection was interrupted."), - verb, nm_connection_get_id (connection)); + return g_strdup_printf (_("\nThe VPN connection “%s” %s because the network connection was interrupted."), verb, id); case NM_ACTIVE_CONNECTION_STATE_REASON_SERVICE_STOPPED: - return g_strdup_printf (_("\nThe VPN connection “%s” failed because the VPN service stopped unexpectedly."), - nm_connection_get_id (connection)); + return g_strdup_printf (_("\nThe VPN connection “%s” failed because the VPN service stopped unexpectedly."), id); case NM_ACTIVE_CONNECTION_STATE_REASON_IP_CONFIG_INVALID: - return g_strdup_printf (_("\nThe VPN connection “%s” failed because the VPN service returned invalid configuration."), - nm_connection_get_id (connection)); + return g_strdup_printf (_("\nThe VPN connection “%s” failed because the VPN service returned invalid configuration."), id); case NM_ACTIVE_CONNECTION_STATE_REASON_CONNECT_TIMEOUT: - return g_strdup_printf (_("\nThe VPN connection “%s” failed because the connection attempt timed out."), - nm_connection_get_id (connection)); + return g_strdup_printf (_("\nThe VPN connection “%s” failed because the connection attempt timed out."), id); case NM_ACTIVE_CONNECTION_STATE_REASON_SERVICE_START_TIMEOUT: - return g_strdup_printf (_("\nThe VPN connection “%s” failed because the VPN service did not start in time."), - nm_connection_get_id (connection)); + return g_strdup_printf (_("\nThe VPN connection “%s” failed because the VPN service did not start in time."), id); case NM_ACTIVE_CONNECTION_STATE_REASON_SERVICE_START_FAILED: - return g_strdup_printf (_("\nThe VPN connection “%s” failed because the VPN service failed to start."), - nm_connection_get_id (connection)); + return g_strdup_printf (_("\nThe VPN connection “%s” failed because the VPN service failed to start."), id); case NM_ACTIVE_CONNECTION_STATE_REASON_NO_SECRETS: - return g_strdup_printf (_("\nThe VPN connection “%s” failed because there were no valid VPN secrets."), - nm_connection_get_id (connection)); + return g_strdup_printf (_("\nThe VPN connection “%s” failed because there were no valid VPN secrets."), id); case NM_ACTIVE_CONNECTION_STATE_REASON_LOGIN_FAILED: - return g_strdup_printf (_("\nThe VPN connection “%s” failed because of invalid VPN secrets."), - nm_connection_get_id (connection)); - + return g_strdup_printf (_("\nThe VPN connection “%s” failed because of invalid VPN secrets."), id); default: break; } - return g_strdup_printf (_("\nThe VPN connection “%s” failed."), nm_connection_get_id (connection)); + return g_strdup_printf (_("\nThe VPN connection “%s” failed."), id); } static void |