1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2/*
3 * Copyright (C) 2008 Novell, Inc.
4 * Copyright (C) 2008 - 2015 Red Hat, Inc.
5 */
6
7#ifndef __NM_VPN_EDITOR_H__
8#define __NM_VPN_EDITOR_H__
9
10#if !defined(__NETWORKMANAGER_H_INSIDE__) && !defined(NETWORKMANAGER_COMPILATION)
11#error "Only <NetworkManager.h> can be included directly."
12#endif
13
14#include <glib.h>
15#include <glib-object.h>
16#include "nm-types.h"
17
18#include "nm-vpn-editor-plugin.h"
19
20G_BEGIN_DECLS
21
22/*****************************************************************************/
23/* Editor interface */
24/*****************************************************************************/
25
26#define NM_TYPE_VPN_EDITOR (nm_vpn_editor_get_type())
27#define NM_VPN_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), NM_TYPE_VPN_EDITOR, NMVpnEditor))
28#define NM_IS_VPN_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), NM_TYPE_VPN_EDITOR))
29#define NM_VPN_EDITOR_GET_INTERFACE(obj) \
30 (G_TYPE_INSTANCE_GET_INTERFACE((obj), NM_TYPE_VPN_EDITOR, NMVpnEditorInterface))
31
32/**
33 * NMVpnEditorInterface:
34 * @g_iface: the parent interface
35 * @get_widget: return the #GtkWidget for the VPN editor's UI
36 * @placeholder: not currently used
37 * @update_connection: called to save the user-entered options to the connection
38 * object. Should return %FALSE and set @error if the current options are
39 * invalid. @error should contain enough information for the plugin to
40 * determine which UI widget is invalid at a later point in time. For
41 * example, creating unique error codes for what error occurred and populating
42 * the message field of @error with the name of the invalid property.
43 * @changed: emitted when the value of a UI widget changes. May trigger a
44 * validity check via @update_connection to write values to the connection.
45 *
46 * Interface for editing a specific #NMConnection
47 */
48typedef struct {
49 GTypeInterface g_iface;
50
51 GObject *(*get_widget)(NMVpnEditor *editor);
52
53 void (*placeholder)(void);
54
55 gboolean (*update_connection)(NMVpnEditor *editor, NMConnection *connection, GError **error);
56
57 void (*changed)(NMVpnEditor *editor);
58} NMVpnEditorInterface;
59
60GType nm_vpn_editor_get_type(void);
61
62GObject *nm_vpn_editor_get_widget(NMVpnEditor *editor);
63
64gboolean
65nm_vpn_editor_update_connection(NMVpnEditor *editor, NMConnection *connection, GError **error);
66
67G_END_DECLS
68
69#endif /* __NM_VPN_EDITOR_H__ */
70

source code of include/libnm/nm-vpn-editor.h