diff --git a/cli/src/connections.c b/cli/src/connections.c index 5302b5178e..cf8f31d047 100644 --- a/cli/src/connections.c +++ b/cli/src/connections.c @@ -1297,11 +1297,10 @@ active_connection_state_cb (NMActiveConnection *active, GParamSpec *pspec, gpoin state = nm_active_connection_get_state (active); if (state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) { - if (nmc->print_output == NMC_PRINT_PRETTY) { + if (nmc->print_output == NMC_PRINT_PRETTY) nmc_terminal_erase_line (); - printf (_("Connection successfully activated (D-Bus active path: %s)\n"), - nm_object_get_path (NM_OBJECT (active))); - } + printf (_("Connection successfully activated (D-Bus active path: %s)\n"), + nm_object_get_path (NM_OBJECT (active))); quit (); } else if ( state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATED || state == NM_ACTIVE_CONNECTION_STATE_UNKNOWN) { @@ -1328,11 +1327,10 @@ vpn_connection_state_cb (NMVPNConnection *vpn, break; case NM_VPN_CONNECTION_STATE_ACTIVATED: - if (nmc->print_output == NMC_PRINT_PRETTY) { + if (nmc->print_output == NMC_PRINT_PRETTY) nmc_terminal_erase_line (); - printf (_("VPN connection successfully activated (D-Bus active path: %s)\n"), - nm_object_get_path (NM_OBJECT (vpn))); - } + printf (_("VPN connection successfully activated (D-Bus active path: %s)\n"), + nm_object_get_path (NM_OBJECT (vpn))); quit (); break; @@ -1456,8 +1454,9 @@ activate_connection_cb (NMClient *client, NMActiveConnection *active, GError *er if (nmc->nowait_flag || state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) { /* User doesn't want to wait or already activated */ - if (state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED && nmc->print_output == NMC_PRINT_PRETTY) { - nmc_terminal_erase_line (); + if (state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) { + if (nmc->print_output == NMC_PRINT_PRETTY) + nmc_terminal_erase_line (); printf (_("Connection successfully activated (D-Bus active path: %s)\n"), nm_object_get_path (NM_OBJECT (active))); } @@ -4139,10 +4138,9 @@ add_connection_cb (NMRemoteSettings *settings, info->con_name, error->code, error->message); nmc->return_value = NMC_RESULT_ERROR_CON_ACTIVATION; } else { - if (nmc->print_output == NMC_PRINT_PRETTY) - printf (_("Connection '%s' (%s) successfully added.\n"), - nm_connection_get_id (NM_CONNECTION (connection)), - nm_connection_get_uuid (NM_CONNECTION (connection))); + printf (_("Connection '%s' (%s) successfully added.\n"), + nm_connection_get_id (NM_CONNECTION (connection)), + nm_connection_get_uuid (NM_CONNECTION (connection))); } g_free (info->con_name); diff --git a/cli/src/devices.c b/cli/src/devices.c index e6602d4879..47ae792046 100644 --- a/cli/src/devices.c +++ b/cli/src/devices.c @@ -1197,8 +1197,9 @@ disconnect_device_cb (NMDevice *device, GError *error, gpointer user_data) if (nmc->nowait_flag || state == NM_DEVICE_STATE_DISCONNECTED) { /* Don't want to wait or device already disconnected */ - if (state == NM_DEVICE_STATE_DISCONNECTED && nmc->print_output == NMC_PRINT_PRETTY) { - nmc_terminal_erase_line (); + if (state == NM_DEVICE_STATE_DISCONNECTED) { + if (nmc->print_output == NMC_PRINT_PRETTY) + nmc_terminal_erase_line (); printf (_("Device '%s' has been disconnected.\n"), nm_device_get_iface (device)); } quit (); @@ -1539,13 +1540,12 @@ monitor_device_state_cb (NMDevice *device, GParamSpec *pspec, gpointer user_data state = nm_device_get_state_reason (device, &reason); if (state == NM_DEVICE_STATE_ACTIVATED) { - if (nmc->print_output == NMC_PRINT_PRETTY) { - NMActiveConnection *active = nm_device_get_active_connection (device); + NMActiveConnection *active = nm_device_get_active_connection (device); + if (nmc->print_output == NMC_PRINT_PRETTY) nmc_terminal_erase_line (); - printf (_("Connection with UUID '%s' created and activated on device '%s'\n"), - nm_active_connection_get_uuid (active), nm_device_get_iface (device)); - } + printf (_("Connection with UUID '%s' created and activated on device '%s'\n"), + nm_active_connection_get_uuid (active), nm_device_get_iface (device)); quit (); } else if (state == NM_DEVICE_STATE_FAILED) { g_string_printf (nmc->return_text, _("Error: Connection activation failed: (%d) %s."), @@ -1588,7 +1588,9 @@ add_and_activate_cb (NMClient *client, if (nmc->nowait_flag || state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) { /* User doesn't want to wait or already activated */ - if (state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED && nmc->print_output == NMC_PRINT_PRETTY) { + if (state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) { + if (nmc->print_output == NMC_PRINT_PRETTY) + nmc_terminal_erase_line (); printf (_("Connection with UUID '%s' created and activated on device '%s'\n"), nm_active_connection_get_uuid (active), nm_device_get_iface (device)); }