[network-manager-applet/bg/vpn-state-rh1442782: 2/4] applet: refactor make_active_failure_message()
- From: Beniamino Galvani <bgalvani src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/bg/vpn-state-rh1442782: 2/4] applet: refactor make_active_failure_message()
- Date: Thu, 20 Apr 2017 13:28:07 +0000 (UTC)
commit 3cf646367fb642e66e0ab4e2b0f8c9549c8676e7
Author: Beniamino Galvani <bgalvani redhat com>
Date: Wed Apr 19 11:25:18 2017 +0200
applet: refactor make_active_failure_message()
src/applet.c | 30 +++++++++++-------------------
1 files changed, 11 insertions(+), 19 deletions(-)
---
diff --git a/src/applet.c b/src/applet.c
index 2c0f3d3..613e126 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]