1/*
2 * Copyright 2016, Rene Gollent, rene@gollent.com.
3 * Distributed under the terms of the MIT License.
4 */
5#include "NetworkConnectionConfigHandler.h"
6
7#include <AutoDeleter.h>
8
9#include "NetworkConnectionConfigView.h"
10#include "TargetHostInterfaceInfo.h"
11
12
13
14NetworkConnectionConfigHandler::NetworkConnectionConfigHandler()
15	:
16	ConnectionConfigHandler("Network")
17{
18}
19
20
21NetworkConnectionConfigHandler::~NetworkConnectionConfigHandler()
22{
23}
24
25
26status_t
27NetworkConnectionConfigHandler::CreateView(TargetHostInterfaceInfo* info,
28	ConnectionConfigView::Listener* listener, ConnectionConfigView*& _view)
29{
30	NetworkConnectionConfigView* view = NULL;
31	try {
32		view = new NetworkConnectionConfigView;
33		ObjectDeleter<BView> viewDeleter(view);
34		status_t error = view->Init(info, listener);
35		if (error != B_OK)
36			return error;
37		viewDeleter.Detach();
38	} catch (...) {
39		return B_NO_MEMORY;
40	}
41
42	_view = view;
43	return B_OK;
44}
45