device: renew dhcp leases on awake for software devices
[NetworkManager.git] / libnm / nm-vpn-editor.h
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /*
3  * This library is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public
5  * License as published by the Free Software Foundation; either
6  * version 2 of the License, or (at your option) any later version.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the
15  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  * Boston, MA 02110-1301 USA.
17  *
18  * Copyright 2008 Novell, Inc.
19  * Copyright 2008 - 2015 Red Hat, Inc.
20  */
21
22 #ifndef __NM_VPN_EDITOR_H__
23 #define __NM_VPN_EDITOR_H__
24
25 #if !defined (__NETWORKMANAGER_H_INSIDE__) && !defined (NETWORKMANAGER_COMPILATION)
26 #error "Only <NetworkManager.h> can be included directly."
27 #endif
28
29 #include <glib.h>
30 #include <glib-object.h>
31 #include <nm-types.h>
32
33 #include "nm-vpn-editor-plugin.h"
34
35 G_BEGIN_DECLS
36
37 /**************************************************/
38 /* Editor interface                               */
39 /**************************************************/
40
41 #define NM_TYPE_VPN_EDITOR               (nm_vpn_editor_get_type ())
42 #define NM_VPN_EDITOR(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_VPN_EDITOR, NMVpnEditor))
43 #define NM_IS_VPN_EDITOR(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_VPN_EDITOR))
44 #define NM_VPN_EDITOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NM_TYPE_VPN_EDITOR, NMVpnEditorInterface))
45
46 /**
47  * NMVpnEditorInterface:
48  * @g_iface: the parent interface
49  * @get_widget: return the #GtkWidget for the VPN editor's UI
50  * @placeholder: not currently used
51  * @update_connection: called to save the user-entered options to the connection
52  *   object.  Should return %FALSE and set @error if the current options are
53  *   invalid.  @error should contain enough information for the plugin to
54  *   determine which UI widget is invalid at a later point in time.  For
55  *   example, creating unique error codes for what error occurred and populating
56  *   the message field of @error with the name of the invalid property.
57  * @changed: emitted when the value of a UI widget changes.  May trigger a
58  *   validity check via @update_connection to write values to the connection.
59  *
60  * Interface for editing a specific #NMConnection
61  */
62 typedef struct {
63         GTypeInterface g_iface;
64
65         GObject * (*get_widget) (NMVpnEditor *editor);
66
67         void (*placeholder) (void);
68
69         gboolean (*update_connection) (NMVpnEditor *editor,
70                                        NMConnection *connection,
71                                        GError **error);
72
73         void (*changed) (NMVpnEditor *editor);
74 } NMVpnEditorInterface;
75
76 GType nm_vpn_editor_get_type (void);
77
78 GObject * nm_vpn_editor_get_widget (NMVpnEditor *editor);
79
80 gboolean nm_vpn_editor_update_connection (NMVpnEditor *editor,
81                                           NMConnection *connection,
82                                           GError **error);
83
84 G_END_DECLS
85
86 #endif  /* __NM_VPN_EDITOR_H__ */