static void apply_edits (NetConnectionEditor *editor) { update_connection (editor); if (editor->is_new_connection) { nm_remote_settings_add_connection (editor->settings, editor->orig_connection, added_connection_cb, editor); } else { nm_remote_connection_commit_changes (NM_REMOTE_CONNECTION (editor->orig_connection), updated_connection_cb, editor); } }
static void save_connection_and_exit (NmtNewtButton *button, gpointer user_data) { NmtEditor *editor = user_data; NmtEditorPrivate *priv = NMT_EDITOR_GET_PRIVATE (editor); NmtSyncOp op; GError *error = NULL; if (!nm_connection_replace_settings_from_connection (priv->orig_connection, priv->edit_connection, &error)) { nmt_newt_message_dialog (_("Error saving connection: %s"), error->message); g_error_free (error); return; } nmt_sync_op_init (&op); if (NM_IS_REMOTE_CONNECTION (priv->orig_connection)) { nm_remote_connection_commit_changes (NM_REMOTE_CONNECTION (priv->orig_connection), connection_updated, &op); if (!nmt_sync_op_wait_boolean (&op, &error)) { nmt_newt_message_dialog (_("Unable to save connection: %s"), error->message); g_error_free (error); return; } /* Clear secrets so they don't lay around in memory; they'll get * requested again anyway next time the connection is edited. */ nm_connection_clear_secrets (priv->orig_connection); } else { nm_remote_settings_add_connection (nm_settings, priv->orig_connection, connection_added, &op); if (!nmt_sync_op_wait_boolean (&op, &error)) { nmt_newt_message_dialog (_("Unable to add new connection: %s"), error->message); g_error_free (error); return; } } nmt_newt_form_quit (NMT_NEWT_FORM (editor)); }