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
17#include "nm-vpn-editor-plugin.h"
18
19G_BEGIN_DECLS
20
21/*****************************************************************************/
22/* Editor interface */
23/*****************************************************************************/
24
25#define NM_TYPE_VPN_EDITOR (nm_vpn_editor_get_type())
26#define NM_VPN_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), NM_TYPE_VPN_EDITOR, NMVpnEditor))
27#define NM_IS_VPN_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), NM_TYPE_VPN_EDITOR))
28#define NM_VPN_EDITOR_GET_INTERFACE(obj) \
29 (G_TYPE_INSTANCE_GET_INTERFACE((obj), NM_TYPE_VPN_EDITOR, NMVpnEditorInterface))
30
31/**
32 * NMVpnEditorInterface:
33 * @g_iface: the parent interface
34 * @get_widget: return the #GtkWidget for the VPN editor's UI
35 * @placeholder: not currently used
36 * @update_connection: called to save the user-entered options to the connection
37 * object. Should return %FALSE and set @error if the current options are
38 * invalid. @error should contain enough information for the plugin to
39 * determine which UI widget is invalid at a later point in time. For
40 * example, creating unique error codes for what error occurred and populating
41 * the message field of @error with the name of the invalid property.
42 * @changed: emitted when the value of a UI widget changes. May trigger a
43 * validity check via @update_connection to write values to the connection.
44 *
45 * Interface for editing a specific #NMConnection
46 */
47typedef struct {
48 GTypeInterface g_iface;
49
50 GObject *(*get_widget)(NMVpnEditor *editor);
51
52 void (*placeholder)(void);
53
54 gboolean (*update_connection)(NMVpnEditor *editor, NMConnection *connection, GError **error);
55
56 void (*changed)(NMVpnEditor *editor);
57} NMVpnEditorInterface;
58
59GType nm_vpn_editor_get_type(void);
60
61GObject *nm_vpn_editor_get_widget(NMVpnEditor *editor);
62
63gboolean
64nm_vpn_editor_update_connection(NMVpnEditor *editor, NMConnection *connection, GError **error);
65
66G_END_DECLS
67
68#endif /* __NM_VPN_EDITOR_H__ */
69

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