device: renew dhcp leases on awake for software devices
[NetworkManager.git] / libnm-util / nm-setting-template.c
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2
3 /*
4  * Tambet Ingo <tambet@gmail.com>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301 USA.
20  *
21  * (C) Copyright 2007 - 2008 Novell, Inc.
22  */
23
24 /* This file is just a template - it's not built nor included in the tarball.
25    It's sole purpose is to make the process of creating new settings easier.
26    Just replace 'template' with new setting name (preserving the case),
27    remove this comment, and you're almost done.
28 */
29
30 #include "nm-default.h"
31
32 #include "nm-setting-template.h"
33
34 G_DEFINE_TYPE (NMSettingTemplate, nm_setting_template, NM_TYPE_SETTING)
35
36 enum {
37         PROP_0,
38
39         LAST_PROP
40 };
41
42 NMSetting *
43 nm_setting_template_new (void)
44 {
45         return (NMSetting *) g_object_new (NM_TYPE_SETTING_TEMPLATE, NULL);
46 }
47
48 static gboolean
49 verify (NMSetting *setting, GSList *all_settings)
50 {
51         NMSettingTemplate *self = NM_SETTING_TEMPLATE (setting);
52         return TRUE;
53 }
54
55 static void
56 nm_setting_template_init (NMSettingTemplate *setting)
57 {
58 }
59
60 static void
61 finalize (GObject *object)
62 {
63         NMSettingTemplate *self = NM_SETTING_TEMPLATE (object);
64
65         G_OBJECT_CLASS (nm_setting_template_parent_class)->finalize (object);
66 }
67
68 static void
69 set_property (GObject *object, guint prop_id,
70                     const GValue *value, GParamSpec *pspec)
71 {
72         NMSettingTemplate *setting = NM_SETTING_TEMPLATE (object);
73
74         switch (prop_id) {
75         default:
76                 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
77                 break;
78         }
79 }
80
81 static void
82 get_property (GObject *object, guint prop_id,
83                     GValue *value, GParamSpec *pspec)
84 {
85         NMSettingTemplate *setting = NM_SETTING_TEMPLATE (object);
86
87         switch (prop_id) {
88         default:
89                 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
90                 break;
91         }
92 }
93
94 static void
95 nm_setting_template_class_init (NMSettingTemplateClass *setting_class)
96 {
97         GObjectClass *object_class = G_OBJECT_CLASS (setting_class);
98         NMSettingClass *parent_class = NM_SETTING_CLASS (setting_class);
99
100         /* virtual methods */
101         object_class->set_property = set_property;
102         object_class->get_property = get_property;
103         object_class->finalize     = finalize;
104         parent_class->verify       = verify;
105
106         /* Properties */
107 }