~ubuntu-branches/ubuntu/precise/network-manager/precise

« back to all changes in this revision

Viewing changes to libnm-glib/nm-vpn-connection.c

  • Committer: Package Import Robot
  • Author(s): Mathieu Trudel-Lapierre
  • Date: 2012-02-09 16:45:41 UTC
  • mfrom: (1.1.53)
  • Revision ID: package-import@ubuntu.com-20120209164541-4h90zknlsfdb7x35
Tags: 0.9.2.0+git201202091925.c721477-0ubuntu1
* upstream snapshot 2012-02-09 19:25:59 (GMT)
  + c721477d11d4fe144111d6d2eec8f93f2e9186c9
* debian/patches/avoid-periodic-disk-wakeups.patch: refreshed.
* debian/patches/nl3-default-ip6-route.patch: refreshed.
* debian/libnm-glib4.symbols: add symbols:
  + nm_active_connection_get_master@Base
  + nm_client_new_async@Base
  + nm_client_new_finish@Base
  + nm_remote_settings_new_async@Base
  + nm_remote_settings_new_finish@Base
  + nm_device_get_state_reason@Base
* debian/libnm-util2.symbols: add symbols:
  + nm_setting_802_1x_get_pac_file@Base
  + nm_setting_infiniband_get_transport_mode@Base

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include "nm-vpn-connection.h"
26
26
#include "NetworkManager.h"
27
27
#include "nm-utils.h"
28
 
#include "nm-vpn-connection-bindings.h"
29
28
#include "nm-marshal.h"
30
29
#include "nm-object-private.h"
31
30
#include "nm-active-connection.h"
100
99
        priv = NM_VPN_CONNECTION_GET_PRIVATE (vpn);
101
100
 
102
101
        /* We need to update vpn_state first in case it's unknown. */
103
 
        nm_vpn_connection_get_vpn_state (vpn);
 
102
        _nm_object_ensure_inited (NM_OBJECT (vpn));
104
103
 
105
104
        if (priv->vpn_state != NM_VPN_CONNECTION_STATE_ACTIVATED)
106
105
                return NULL;
107
106
 
108
 
        if (!priv->banner) {
109
 
                priv->banner = _nm_object_get_string_property (NM_OBJECT (vpn),
110
 
                                                               NM_DBUS_INTERFACE_VPN_CONNECTION,
111
 
                                                               DBUS_PROP_BANNER,
112
 
                                                               NULL);
113
 
                if (priv->banner && !strlen (priv->banner)) {
114
 
                        g_free (priv->banner);
115
 
                        priv->banner = NULL;
116
 
                }
117
 
        }
118
107
        return priv->banner;
119
108
}
120
109
 
129
118
NMVPNConnectionState
130
119
nm_vpn_connection_get_vpn_state (NMVPNConnection *vpn)
131
120
{
132
 
        NMVPNConnectionPrivate *priv;
133
 
 
134
121
        g_return_val_if_fail (NM_IS_VPN_CONNECTION (vpn), NM_VPN_CONNECTION_STATE_UNKNOWN);
135
122
 
136
 
        priv = NM_VPN_CONNECTION_GET_PRIVATE (vpn);
137
 
        if (priv->vpn_state == NM_VPN_CONNECTION_STATE_UNKNOWN) {
138
 
                priv->vpn_state = _nm_object_get_uint_property (NM_OBJECT (vpn),
139
 
                                                                NM_DBUS_INTERFACE_VPN_CONNECTION,
140
 
                                                                DBUS_PROP_VPN_STATE,
141
 
                                                                NULL);
142
 
        }
143
 
        return priv->vpn_state;
 
123
        _nm_object_ensure_inited (NM_OBJECT (vpn));
 
124
        return NM_VPN_CONNECTION_GET_PRIVATE (vpn)->vpn_state;
144
125
}
145
126
 
146
127
static void
168
149
        priv->vpn_state = NM_VPN_CONNECTION_STATE_UNKNOWN;
169
150
}
170
151
 
171
 
static GObject*
172
 
constructor (GType type,
173
 
                   guint n_construct_params,
174
 
                   GObjectConstructParam *construct_params)
175
 
{
176
 
        NMObject *object;
 
152
static void
 
153
register_properties (NMVPNConnection *connection)
 
154
{
 
155
        NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (connection);
 
156
        const NMPropertiesInfo property_info[] = {
 
157
                { NM_VPN_CONNECTION_BANNER,    &priv->banner },
 
158
                { NM_VPN_CONNECTION_VPN_STATE, &priv->vpn_state },
 
159
                { NULL },
 
160
        };
 
161
 
 
162
        _nm_object_register_properties (NM_OBJECT (connection),
 
163
                                        priv->proxy,
 
164
                                        property_info);
 
165
}
 
166
 
 
167
static void
 
168
constructed (GObject *object)
 
169
{
177
170
        NMVPNConnectionPrivate *priv;
178
171
 
179
 
        object = (NMObject *) G_OBJECT_CLASS (nm_vpn_connection_parent_class)->constructor (type,
180
 
                                                                                                                                            n_construct_params,
181
 
                                                                                                                                            construct_params);
182
 
        if (!object)
183
 
                return NULL;
 
172
        G_OBJECT_CLASS (nm_vpn_connection_parent_class)->constructed (object);
184
173
 
185
174
        priv = NM_VPN_CONNECTION_GET_PRIVATE (object);
186
175
 
187
 
        priv->proxy = dbus_g_proxy_new_for_name (nm_object_get_connection (object),
 
176
        priv->proxy = dbus_g_proxy_new_for_name (nm_object_get_connection (NM_OBJECT (object)),
188
177
                                                                         NM_DBUS_SERVICE,
189
 
                                                                         nm_object_get_path (object),
 
178
                                                                         nm_object_get_path (NM_OBJECT (object)),
190
179
                                                                         NM_DBUS_INTERFACE_VPN_CONNECTION);
191
180
 
192
181
        dbus_g_object_register_marshaller (_nm_marshal_VOID__UINT_UINT,
199
188
                                                    G_CALLBACK (vpn_state_changed_proxy),
200
189
                                                    object,
201
190
                                                    NULL);
202
 
        return G_OBJECT (object);
 
191
 
 
192
        register_properties (NM_VPN_CONNECTION (object));
203
193
}
204
194
 
205
195
static void
242
232
        g_type_class_add_private (connection_class, sizeof (NMVPNConnectionPrivate));
243
233
 
244
234
        /* virtual methods */
245
 
        object_class->constructor = constructor;
 
235
        object_class->constructed = constructed;
246
236
        object_class->get_property = get_property;
247
237
        object_class->finalize = finalize;
248
238