Merge lp:~kvalo/indicator-network/bug-686356 into lp:~indicator-applet-developers/indicator-network/indicator-network
- bug-686356
- Merge into indicator-network
Proposed by
Kalle Valo
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 174 | ||||
Proposed branch: | lp:~kvalo/indicator-network/bug-686356 | ||||
Merge into: | lp:~indicator-applet-developers/indicator-network/indicator-network | ||||
Diff against target: |
1103 lines (+816/-6) 10 files modified
.bzrignore (+1/-0) src/libconnman/Connman-1.0.vapi (+33/-0) src/libconnman/Makefile.am (+3/-1) src/libconnman/connman-ipv6.c (+315/-0) src/libconnman/connman-ipv6.h (+93/-0) src/libconnman/connman-service.c (+243/-5) src/libconnman/connman-service.h (+5/-0) src/libconnman/connman.h (+2/-0) src/libconnman/generate_vapi (+1/-0) src/settings/frontend/widgets/dialogs/edit-connection.vala (+120/-0) |
||||
To merge this branch: | bzr merge lp:~kvalo/indicator-network/bug-686356 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mikkel Kamstrup Erlandsen (community) | Approve | ||
Review via email: mp+53980@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file '.bzrignore' |
2 | --- .bzrignore 2011-03-09 13:29:43 +0000 |
3 | +++ .bzrignore 2011-03-18 12:46:25 +0000 |
4 | @@ -121,3 +121,4 @@ |
5 | src/indicator/toggleswitch.c |
6 | src/indicator/toggleswitch.h |
7 | src/indicator/toggleswitch.stamp |
8 | +src/libconnman/libconnman_la-connman-ipv6.lo |
9 | |
10 | === modified file 'src/libconnman/Connman-1.0.vapi' |
11 | --- src/libconnman/Connman-1.0.vapi 2011-02-22 13:57:51 +0000 |
12 | +++ src/libconnman/Connman-1.0.vapi 2011-03-18 12:46:25 +0000 |
13 | @@ -20,6 +20,22 @@ |
14 | public uint method { get; construct; } |
15 | public string netmask { get; construct; } |
16 | } |
17 | + [CCode (cheader_filename = "connman-ipv6.h")] |
18 | + public class IPv6 : GLib.Object { |
19 | + [CCode (has_construct_function = false)] |
20 | + public IPv6 (Connman.IPv6Method method, string address, uint8 prefix_length, string gateway) throws GLib.Error; |
21 | + public unowned string get_address (); |
22 | + public unowned string get_gateway (); |
23 | + public Connman.IPv6Method get_method (); |
24 | + public unowned string get_method_as_string (); |
25 | + public uint8 get_prefix_length (); |
26 | + [CCode (has_construct_function = false)] |
27 | + public IPv6.with_strings (string method, string address, uint8 prefix_length, string gateway) throws GLib.Error; |
28 | + public string address { get; construct; } |
29 | + public string gateway { get; construct; } |
30 | + public uint method { get; construct; } |
31 | + public uint8 prefix_length { get; construct; } |
32 | + } |
33 | [CCode (cheader_filename = "connman-manager.h")] |
34 | public class Manager : GLib.Object { |
35 | public weak GLib.Object parent; |
36 | @@ -63,6 +79,8 @@ |
37 | public bool get_immutable (); |
38 | public unowned Connman.IPv4 get_ipv4 (); |
39 | public unowned Connman.IPv4 get_ipv4_configuration (); |
40 | + public unowned Connman.IPv6 get_ipv6 (); |
41 | + public unowned Connman.IPv6 get_ipv6_configuration (); |
42 | public bool get_login_required (); |
43 | public unowned string get_mcc (); |
44 | public unowned string get_mnc (); |
45 | @@ -87,6 +105,7 @@ |
46 | public void set_autoconnect (bool autoconnect); |
47 | public void set_domains_configuration ([CCode (array_length = false, array_null_terminated = true)] string[] domains); |
48 | public void set_ipv4_configuration (Connman.IPv4 ipv4); |
49 | + public void set_ipv6_configuration (Connman.IPv6 ipv6); |
50 | public void set_nameservers_configuration ([CCode (array_length = false, array_null_terminated = true)] string[] nameservers); |
51 | public void set_passphrase (string passphrase); |
52 | public static unowned string state2str (Connman.ServiceState state); |
53 | @@ -104,6 +123,8 @@ |
54 | public bool immutable { get; } |
55 | public Connman.IPv4 ipv4 { get; } |
56 | public Connman.IPv4 ipv4_configuration { get; set; } |
57 | + public Connman.IPv6 ipv6 { get; } |
58 | + public Connman.IPv6 ipv6_configuration { get; set; } |
59 | public bool login_required { get; } |
60 | public string mcc { get; } |
61 | public string mnc { get; } |
62 | @@ -132,6 +153,18 @@ |
63 | FIXED, |
64 | DHCP |
65 | } |
66 | + [CCode (cprefix = "CONNMAN_IPV6_ERROR_INVALID_", cheader_filename = "connman-ipv6.h")] |
67 | + public enum IPv6Error { |
68 | + METHOD, |
69 | + SETTINGS |
70 | + } |
71 | + [CCode (cprefix = "CONNMAN_IPV6_METHOD_", cheader_filename = "connman-ipv6.h")] |
72 | + public enum IPv6Method { |
73 | + OFF, |
74 | + MANUAL, |
75 | + FIXED, |
76 | + AUTO |
77 | + } |
78 | [CCode (cprefix = "CONNMAN_SERVICE_MODE_", cheader_filename = "connman-service.h")] |
79 | public enum ServiceMode { |
80 | MANAGED, |
81 | |
82 | === modified file 'src/libconnman/Makefile.am' |
83 | --- src/libconnman/Makefile.am 2011-02-02 13:50:19 +0000 |
84 | +++ src/libconnman/Makefile.am 2011-03-18 12:46:25 +0000 |
85 | @@ -7,7 +7,9 @@ |
86 | connman-service.c \ |
87 | connman-service.h \ |
88 | connman-ipv4.c \ |
89 | - connman-ipv4.h |
90 | + connman-ipv4.h \ |
91 | + connman-ipv6.c \ |
92 | + connman-ipv6.h |
93 | |
94 | libconnman_la_LIBADD = \ |
95 | $(GLIB_LIBS) \ |
96 | |
97 | === added file 'src/libconnman/connman-ipv6.c' |
98 | --- src/libconnman/connman-ipv6.c 1970-01-01 00:00:00 +0000 |
99 | +++ src/libconnman/connman-ipv6.c 2011-03-18 12:46:25 +0000 |
100 | @@ -0,0 +1,315 @@ |
101 | +/* |
102 | + * indicator-network - user interface for connman |
103 | + * Copyright 2011 Canonical Ltd. |
104 | + * |
105 | + * Authors: |
106 | + * Kalle Valo <kalle.valo@canonical.com> |
107 | + * |
108 | + * This program is free software: you can redistribute it and/or modify it |
109 | + * under the terms of the GNU General Public License version 3, as published |
110 | + * by the Free Software Foundation. |
111 | + * |
112 | + * This program is distributed in the hope that it will be useful, but |
113 | + * WITHOUT ANY WARRANTY; without even the implied warranties of |
114 | + * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
115 | + * PURPOSE. See the GNU General Public License for more details. |
116 | + * |
117 | + * You should have received a copy of the GNU General Public License along |
118 | + * with this program. If not, see <http://www.gnu.org/licenses/>. |
119 | + */ |
120 | + |
121 | +#include "connman-ipv6.h" |
122 | + |
123 | +#include <string.h> |
124 | + |
125 | +G_DEFINE_TYPE(ConnmanIPv6, connman_ipv6, G_TYPE_OBJECT) |
126 | + |
127 | +#define GET_PRIVATE(o) \ |
128 | + (G_TYPE_INSTANCE_GET_PRIVATE((o), CONNMAN_TYPE_IPV6, \ |
129 | + ConnmanIPv6Private)) |
130 | + |
131 | +typedef struct _ConnmanIPv6Private ConnmanIPv6Private; |
132 | + |
133 | +struct _ConnmanIPv6Private { |
134 | + ConnmanIPv6Method method; |
135 | + gchar *address; |
136 | + guchar prefix_length; |
137 | + gchar *gateway; |
138 | +}; |
139 | + |
140 | +enum |
141 | +{ |
142 | + /* reserved */ |
143 | + PROP_0, |
144 | + |
145 | + PROP_METHOD, |
146 | + PROP_ADDRESS, |
147 | + PROP_PREFIX_LENGTH, |
148 | + PROP_GATEWAY, |
149 | +}; |
150 | + |
151 | +struct ipv6_method_entry |
152 | +{ |
153 | + const gchar *str; |
154 | + ConnmanIPv6Method method; |
155 | +}; |
156 | + |
157 | +static const struct ipv6_method_entry method_map[] = { |
158 | + { "off", CONNMAN_IPV6_METHOD_OFF }, |
159 | + { "manual", CONNMAN_IPV6_METHOD_MANUAL }, |
160 | + { "fixed", CONNMAN_IPV6_METHOD_FIXED }, |
161 | + { "auto", CONNMAN_IPV6_METHOD_AUTO }, |
162 | +}; |
163 | + |
164 | +static ConnmanIPv6Method str2method(const gchar *state) |
165 | +{ |
166 | + const struct ipv6_method_entry *s; |
167 | + guint i; |
168 | + |
169 | + for (i = 0; i < G_N_ELEMENTS(method_map); i++) { |
170 | + s = &method_map[i]; |
171 | + if (g_strcmp0(s->str, state) == 0) |
172 | + return s->method; |
173 | + } |
174 | + |
175 | + g_warning("unknown ipv6 method: %s", state); |
176 | + |
177 | + return CONNMAN_IPV6_METHOD_AUTO; |
178 | +} |
179 | + |
180 | +static const gchar *method2str(ConnmanIPv6Method method) |
181 | +{ |
182 | + const struct ipv6_method_entry *s; |
183 | + guint i; |
184 | + |
185 | + for (i = 0; i < G_N_ELEMENTS(method_map); i++) { |
186 | + s = &method_map[i]; |
187 | + if (s->method == method) |
188 | + return s->str; |
189 | + } |
190 | + |
191 | + g_warning("%s(): unknown ipv6 method %d", __func__, method); |
192 | + |
193 | + return "auto"; |
194 | +} |
195 | + |
196 | +ConnmanIPv6Method connman_ipv6_get_method(ConnmanIPv6 *self) |
197 | +{ |
198 | + ConnmanIPv6Private *priv = GET_PRIVATE(self); |
199 | + |
200 | + g_return_val_if_fail(CONNMAN_IS_IPV6(self), CONNMAN_IPV6_METHOD_OFF); |
201 | + g_return_val_if_fail(priv != NULL, CONNMAN_IPV6_METHOD_OFF); |
202 | + |
203 | + return priv->method; |
204 | +} |
205 | + |
206 | +const gchar *connman_ipv6_get_method_as_string(ConnmanIPv6 *self) |
207 | +{ |
208 | + ConnmanIPv6Private *priv = GET_PRIVATE(self); |
209 | + |
210 | + g_return_val_if_fail(CONNMAN_IS_IPV6(self), CONNMAN_IPV6_METHOD_OFF); |
211 | + g_return_val_if_fail(priv != NULL, CONNMAN_IPV6_METHOD_OFF); |
212 | + |
213 | + return method2str(priv->method); |
214 | +} |
215 | + |
216 | + |
217 | +const gchar *connman_ipv6_get_address(ConnmanIPv6 *self) |
218 | +{ |
219 | + ConnmanIPv6Private *priv = GET_PRIVATE(self); |
220 | + |
221 | + g_return_val_if_fail(CONNMAN_IS_IPV6(self), NULL); |
222 | + g_return_val_if_fail(priv != NULL, NULL); |
223 | + |
224 | + return priv->address; |
225 | +} |
226 | + |
227 | +guchar connman_ipv6_get_prefix_length(ConnmanIPv6 *self) |
228 | +{ |
229 | + ConnmanIPv6Private *priv = GET_PRIVATE(self); |
230 | + |
231 | + g_return_val_if_fail(CONNMAN_IS_IPV6(self), 0); |
232 | + g_return_val_if_fail(priv != NULL, 0); |
233 | + |
234 | + return priv->prefix_length; |
235 | +} |
236 | + |
237 | +const gchar *connman_ipv6_get_gateway(ConnmanIPv6 *self) |
238 | +{ |
239 | + ConnmanIPv6Private *priv = GET_PRIVATE(self); |
240 | + |
241 | + g_return_val_if_fail(CONNMAN_IS_IPV6(self), NULL); |
242 | + g_return_val_if_fail(priv != NULL, NULL); |
243 | + |
244 | + return priv->gateway; |
245 | +} |
246 | + |
247 | +static void connman_ipv6_set_property(GObject *object, guint property_id, |
248 | + const GValue *value, GParamSpec *pspec) |
249 | +{ |
250 | + ConnmanIPv6 *self = CONNMAN_IPV6(object); |
251 | + ConnmanIPv6Private *priv = GET_PRIVATE(self); |
252 | + |
253 | + g_return_if_fail(priv != NULL); |
254 | + |
255 | + switch(property_id) { |
256 | + case PROP_METHOD: |
257 | + priv->method = g_value_get_uint(value); |
258 | + break; |
259 | + case PROP_ADDRESS: |
260 | + g_free(priv->address); |
261 | + priv->address = g_value_dup_string(value); |
262 | + break; |
263 | + case PROP_PREFIX_LENGTH: |
264 | + priv->prefix_length = g_value_get_uchar(value); |
265 | + break; |
266 | + case PROP_GATEWAY: |
267 | + g_free(priv->gateway); |
268 | + priv->gateway = g_value_dup_string(value); |
269 | + break; |
270 | + default: |
271 | + /* We don't have any other property... */ |
272 | + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); |
273 | + break; |
274 | + } |
275 | +} |
276 | + |
277 | +static void connman_ipv6_get_property(GObject *object, guint property_id, |
278 | + GValue *value, GParamSpec *pspec) |
279 | +{ |
280 | + ConnmanIPv6 *self = CONNMAN_IPV6(object); |
281 | + ConnmanIPv6Private *priv = GET_PRIVATE(self); |
282 | + |
283 | + g_return_if_fail(priv != NULL); |
284 | + |
285 | + switch(property_id) { |
286 | + case PROP_METHOD: |
287 | + g_value_set_uint(value, priv->method); |
288 | + break; |
289 | + case PROP_ADDRESS: |
290 | + g_value_set_string(value, priv->address); |
291 | + break; |
292 | + case PROP_PREFIX_LENGTH: |
293 | + g_value_set_uchar(value, priv->prefix_length); |
294 | + break; |
295 | + case PROP_GATEWAY: |
296 | + g_value_set_string(value, priv->gateway); |
297 | + break; |
298 | + default: |
299 | + /* We don't have any other property... */ |
300 | + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); |
301 | + break; |
302 | + } |
303 | +} |
304 | + |
305 | +static void connman_ipv6_dispose(GObject *object) |
306 | +{ |
307 | + G_OBJECT_CLASS(connman_ipv6_parent_class)->dispose(object); |
308 | +} |
309 | + |
310 | +static void connman_ipv6_finalize(GObject *object) |
311 | +{ |
312 | + ConnmanIPv6 *self = CONNMAN_IPV6(object); |
313 | + ConnmanIPv6Private *priv = GET_PRIVATE(self); |
314 | + |
315 | + g_free(priv->address); |
316 | + g_free(priv->gateway); |
317 | + |
318 | + G_OBJECT_CLASS(connman_ipv6_parent_class)->finalize(object); |
319 | +} |
320 | + |
321 | +static void connman_ipv6_class_init(ConnmanIPv6Class *klass) |
322 | +{ |
323 | + GObjectClass *gobject_class = G_OBJECT_CLASS(klass); |
324 | + GParamSpec *pspec; |
325 | + |
326 | + g_type_class_add_private(klass, sizeof(ConnmanIPv6Private)); |
327 | + |
328 | + gobject_class->dispose = connman_ipv6_dispose; |
329 | + gobject_class->finalize = connman_ipv6_finalize; |
330 | + gobject_class->set_property = connman_ipv6_set_property; |
331 | + gobject_class->get_property = connman_ipv6_get_property; |
332 | + |
333 | + pspec = g_param_spec_uint("method", |
334 | + "ConnmanIPv6's method property", |
335 | + "The ipv6 method", |
336 | + 0, G_MAXUINT, |
337 | + CONNMAN_IPV6_METHOD_OFF, |
338 | + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); |
339 | + g_object_class_install_property(gobject_class, PROP_METHOD, pspec); |
340 | + |
341 | + pspec = g_param_spec_string("address", |
342 | + "ConnmanIPv6's address", |
343 | + "IPv6 address", |
344 | + NULL, |
345 | + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); |
346 | + g_object_class_install_property(gobject_class, PROP_ADDRESS, pspec); |
347 | + |
348 | + pspec = g_param_spec_uchar("prefix-length", |
349 | + "ConnmanIPv6's prefix length", |
350 | + "IPv6 prefix length", |
351 | + 0, |
352 | + 128, |
353 | + 0, |
354 | + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); |
355 | + g_object_class_install_property(gobject_class, PROP_PREFIX_LENGTH, pspec); |
356 | + |
357 | + pspec = g_param_spec_string("gateway", |
358 | + "ConnmanIPv6's gateway", |
359 | + "IPv6 gateway", |
360 | + NULL, |
361 | + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); |
362 | + g_object_class_install_property(gobject_class, PROP_GATEWAY, pspec); |
363 | +} |
364 | + |
365 | +static void connman_ipv6_init(ConnmanIPv6 *self) |
366 | +{ |
367 | +} |
368 | + |
369 | +ConnmanIPv6 *connman_ipv6_new(ConnmanIPv6Method method, |
370 | + const gchar *address, |
371 | + guchar prefix_length, |
372 | + const gchar *gateway, |
373 | + GError **error) |
374 | +{ |
375 | + g_return_val_if_fail(error == NULL || *error == NULL, NULL); |
376 | + |
377 | + return g_object_new(CONNMAN_TYPE_IPV6, |
378 | + "method", method, |
379 | + "address", address, |
380 | + "prefix-length", prefix_length, |
381 | + "gateway", gateway, |
382 | + NULL); |
383 | +} |
384 | + |
385 | +ConnmanIPv6 *connman_ipv6_new_with_strings(const gchar *method, |
386 | + const gchar *address, |
387 | + guchar prefix_length, |
388 | + const gchar *gateway, |
389 | + GError **error) |
390 | +{ |
391 | + const struct ipv6_method_entry *s; |
392 | + gboolean valid = FALSE; |
393 | + guint i; |
394 | + |
395 | + g_return_val_if_fail(error == NULL || *error == NULL, NULL); |
396 | + |
397 | + /* check that method is valid and if not, throw an error */ |
398 | + for (i = 0; i < G_N_ELEMENTS(method_map); i++) { |
399 | + s = &method_map[i]; |
400 | + if (g_strcmp0(s->str, method) == 0) { |
401 | + valid = TRUE; |
402 | + break; |
403 | + } |
404 | + } |
405 | + |
406 | + if (valid == FALSE) { |
407 | + g_set_error(error, CONNMAN_IPV6_ERROR, |
408 | + CONNMAN_IPV6_ERROR_INVALID_METHOD, |
409 | + "Invalid ipv6 method: %s", method); |
410 | + return NULL; |
411 | + } |
412 | + |
413 | + return connman_ipv6_new(str2method(method), address, prefix_length, gateway, |
414 | + error); |
415 | +} |
416 | |
417 | === added file 'src/libconnman/connman-ipv6.h' |
418 | --- src/libconnman/connman-ipv6.h 1970-01-01 00:00:00 +0000 |
419 | +++ src/libconnman/connman-ipv6.h 2011-03-18 12:46:25 +0000 |
420 | @@ -0,0 +1,93 @@ |
421 | +/* |
422 | + * indicator-network - user interface for connman |
423 | + * Copyright 2011 Canonical Ltd. |
424 | + * |
425 | + * Authors: |
426 | + * Kalle Valo <kalle.valo@canonical.com> |
427 | + * |
428 | + * This program is free software: you can redistribute it and/or modify it |
429 | + * under the terms of the GNU General Public License version 3, as published |
430 | + * by the Free Software Foundation. |
431 | + * |
432 | + * This program is distributed in the hope that it will be useful, but |
433 | + * WITHOUT ANY WARRANTY; without even the implied warranties of |
434 | + * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
435 | + * PURPOSE. See the GNU General Public License for more details. |
436 | + * |
437 | + * You should have received a copy of the GNU General Public License along |
438 | + * with this program. If not, see <http://www.gnu.org/licenses/>. |
439 | + */ |
440 | + |
441 | +#ifndef _CONNMAN_IPV6_H_ |
442 | +#define _CONNMAN_IPV6_H_ |
443 | + |
444 | +#include <glib-object.h> |
445 | + |
446 | +G_BEGIN_DECLS |
447 | + |
448 | +#define CONNMAN_TYPE_IPV6 connman_ipv6_get_type() |
449 | + |
450 | +#define CONNMAN_IPV6(obj) \ |
451 | + (G_TYPE_CHECK_INSTANCE_CAST((obj), CONNMAN_TYPE_IPV6, \ |
452 | + ConnmanIPv6)) |
453 | + |
454 | +#define CONNMAN_IPV6_CLASS(klass) \ |
455 | + (G_TYPE_CHECK_CLASS_CAST((klass), CONNMAN_TYPE_IPV6, \ |
456 | + ConnmanIPv6Class)) |
457 | + |
458 | +#define CONNMAN_IS_IPV6(obj) \ |
459 | + (G_TYPE_CHECK_INSTANCE_TYPE((obj), CONNMAN_TYPE_IPV6)) |
460 | + |
461 | +#define CONNMAN_IS_IPV6_CLASS(klass) \ |
462 | + (G_TYPE_CHECK_CLASS_TYPE((klass), CONNMAN_TYPE_IPV6)) |
463 | + |
464 | +#define CONNMAN_IPV6_GET_CLASS(obj) \ |
465 | + (G_TYPE_INSTANCE_GET_CLASS((obj), CONNMAN_TYPE_IPV6, \ |
466 | + ConnmanIPv6Class)) |
467 | + |
468 | +typedef struct { |
469 | + GObject parent; |
470 | +} ConnmanIPv6; |
471 | + |
472 | +typedef struct { |
473 | + GObjectClass parent_class; |
474 | +} ConnmanIPv6Class; |
475 | + |
476 | +#define CONNMAN_IPV6_ERROR connman_ipv6_error_quark() |
477 | + |
478 | +static inline GQuark connman_ipv6_error_quark(void) |
479 | +{ |
480 | + return g_quark_from_static_string ("connman-ipv6-error-quark"); |
481 | +} |
482 | + |
483 | +typedef enum { |
484 | + CONNMAN_IPV6_ERROR_INVALID_METHOD, |
485 | + CONNMAN_IPV6_ERROR_INVALID_SETTINGS, |
486 | +} ConnmanIPv6Error; |
487 | + |
488 | +typedef enum { |
489 | + CONNMAN_IPV6_METHOD_OFF, |
490 | + CONNMAN_IPV6_METHOD_MANUAL, |
491 | + CONNMAN_IPV6_METHOD_FIXED, |
492 | + CONNMAN_IPV6_METHOD_AUTO, |
493 | +} ConnmanIPv6Method; |
494 | + |
495 | +GType connman_ipv6_get_type(void); |
496 | + |
497 | +ConnmanIPv6Method connman_ipv6_get_method(ConnmanIPv6 *self); |
498 | +const gchar *connman_ipv6_get_method_as_string(ConnmanIPv6 *self); |
499 | +const gchar *connman_ipv6_get_address(ConnmanIPv6 *self); |
500 | +guchar connman_ipv6_get_prefix_length(ConnmanIPv6 *self); |
501 | +const gchar *connman_ipv6_get_gateway(ConnmanIPv6 *self); |
502 | +ConnmanIPv6 *connman_ipv6_new(ConnmanIPv6Method method, |
503 | + const gchar *address, |
504 | + guchar prefix_length, |
505 | + const gchar *gateway, |
506 | + GError **error); |
507 | +ConnmanIPv6 *connman_ipv6_new_with_strings(const gchar *method, |
508 | + const gchar *address, |
509 | + guchar prefix_length, |
510 | + const gchar *gateway, |
511 | + GError **error); |
512 | + |
513 | +#endif |
514 | |
515 | === modified file 'src/libconnman/connman-service.c' |
516 | --- src/libconnman/connman-service.c 2011-02-21 16:24:29 +0000 |
517 | +++ src/libconnman/connman-service.c 2011-03-18 12:46:25 +0000 |
518 | @@ -65,6 +65,8 @@ |
519 | gchar **domains_configuration; |
520 | ConnmanIPv4 *ipv4; |
521 | ConnmanIPv4 *ipv4_configuration; |
522 | + ConnmanIPv6 *ipv6; |
523 | + ConnmanIPv6 *ipv6_configuration; |
524 | }; |
525 | |
526 | enum |
527 | @@ -99,8 +101,8 @@ |
528 | PROP_DOMAINS_CONFIGURATION, /* rw */ |
529 | PROP_IPV4, |
530 | PROP_IPV4_CONFIGURATION, /* rw */ |
531 | - /* PROP_IPV6, */ |
532 | - /* PROP_IPV6_CONFIGURATION, /\* rw *\/ */ |
533 | + PROP_IPV6, |
534 | + PROP_IPV6_CONFIGURATION, /* rw */ |
535 | /* PROP_PROXY, */ |
536 | /* PROP_PROXY_CONFIGURATION, /\* rw *\/ */ |
537 | /* PROP_PROVIDER, */ |
538 | @@ -647,6 +649,53 @@ |
539 | g_object_set(self, "ipv4-configuration", ipv4, NULL); |
540 | } |
541 | |
542 | +/** |
543 | + * connman_service_get_ipv6: |
544 | + * |
545 | + * @self: self |
546 | + * |
547 | + * Returns: (transfer none): Current ipv6 settings. The caller must |
548 | + * take a reference. |
549 | + */ |
550 | +ConnmanIPv6 *connman_service_get_ipv6(ConnmanService *self) |
551 | +{ |
552 | + ConnmanServicePrivate *priv = GET_PRIVATE(self); |
553 | + |
554 | + g_return_val_if_fail(CONNMAN_IS_SERVICE(self), NULL); |
555 | + g_return_val_if_fail(priv != NULL, NULL); |
556 | + |
557 | + return priv->ipv6; |
558 | +} |
559 | + |
560 | +/** |
561 | + * connman_service_get_ipv6_configuration: |
562 | + * |
563 | + * @self: self |
564 | + * |
565 | + * Returns: (transfer none): Current configured ipv6 settings. The caller must |
566 | + * take a reference. |
567 | + */ |
568 | +ConnmanIPv6 *connman_service_get_ipv6_configuration(ConnmanService *self) |
569 | +{ |
570 | + ConnmanServicePrivate *priv = GET_PRIVATE(self); |
571 | + |
572 | + g_return_val_if_fail(CONNMAN_IS_SERVICE(self), NULL); |
573 | + g_return_val_if_fail(priv != NULL, NULL); |
574 | + |
575 | + return priv->ipv6_configuration; |
576 | +} |
577 | + |
578 | +void connman_service_set_ipv6_configuration(ConnmanService *self, |
579 | + ConnmanIPv6 *ipv6) |
580 | +{ |
581 | + ConnmanServicePrivate *priv = GET_PRIVATE(self); |
582 | + |
583 | + g_return_if_fail(CONNMAN_IS_SERVICE(self)); |
584 | + g_return_if_fail(priv != NULL); |
585 | + |
586 | + g_object_set(self, "ipv6-configuration", ipv6, NULL); |
587 | +} |
588 | + |
589 | const gchar *connman_service_get_path(ConnmanService *self) |
590 | { |
591 | ConnmanServicePrivate *priv = GET_PRIVATE(self); |
592 | @@ -1109,6 +1158,11 @@ |
593 | |
594 | out: |
595 | g_object_notify(G_OBJECT(self), "ipv4"); |
596 | + |
597 | + g_free(method); |
598 | + g_free(address); |
599 | + g_free(netmask); |
600 | + g_free(gateway); |
601 | } |
602 | |
603 | static void ipv4_configuration_updated(ConnmanService *self, GVariant *variant) |
604 | @@ -1120,9 +1174,9 @@ |
605 | GVariantIter iter; |
606 | GVariant *value; |
607 | |
608 | - if (priv->ipv4 != NULL) { |
609 | - g_object_unref(priv->ipv4); |
610 | - priv->ipv4 = NULL; |
611 | + if (priv->ipv4_configuration != NULL) { |
612 | + g_object_unref(priv->ipv4_configuration); |
613 | + priv->ipv4_configuration = NULL; |
614 | } |
615 | |
616 | g_variant_iter_init(&iter, variant); |
617 | @@ -1162,6 +1216,121 @@ |
618 | |
619 | out: |
620 | g_object_notify(G_OBJECT(self), "ipv4-configuration"); |
621 | + |
622 | + g_free(method); |
623 | + g_free(address); |
624 | + g_free(netmask); |
625 | + g_free(gateway); |
626 | +} |
627 | + |
628 | +static void ipv6_updated(ConnmanService *self, GVariant *variant) |
629 | +{ |
630 | + ConnmanServicePrivate *priv = GET_PRIVATE(self); |
631 | + gchar *method = NULL, *address = NULL, *gateway = NULL, *key; |
632 | + guchar prefix_len = 0; |
633 | + GError *error = NULL; |
634 | + GVariantIter iter; |
635 | + GVariant *value; |
636 | + |
637 | + if (priv->ipv6 != NULL) { |
638 | + g_object_unref(priv->ipv6); |
639 | + priv->ipv6 = NULL; |
640 | + } |
641 | + |
642 | + g_variant_iter_init(&iter, variant); |
643 | + |
644 | + while (g_variant_iter_next(&iter, "{sv}", &key, &value)) { |
645 | + if (g_strcmp0(key, "Method") == 0) |
646 | + method = g_variant_dup_string(value, NULL); |
647 | + else if (g_strcmp0(key, "Address") == 0) |
648 | + address = g_variant_dup_string(value, NULL); |
649 | + else if (g_strcmp0(key, "PrefixLength") == 0) |
650 | + prefix_len = g_variant_get_byte(value); |
651 | + else if (g_strcmp0(key, "Gateway") == 0) |
652 | + gateway = g_variant_dup_string(value, NULL); |
653 | + else |
654 | + g_warning("Unknown ipv6 property: %s", key); |
655 | + |
656 | + g_free(key); |
657 | + g_variant_unref(value); |
658 | + } |
659 | + |
660 | + if (method == NULL && address == NULL && |
661 | + prefix_len == 0 && gateway == NULL) |
662 | + /* some cases, like with bluetooth, ipv6 dict is just empty */ |
663 | + goto out; |
664 | + |
665 | + priv->ipv6 = connman_ipv6_new_with_strings(method, address, prefix_len, |
666 | + gateway, &error); |
667 | + if (error != NULL) { |
668 | + g_warning("Received invalid ipv6 settings: %s", error->message); |
669 | + g_error_free(error); |
670 | + return; |
671 | + } |
672 | + |
673 | + out: |
674 | + g_object_notify(G_OBJECT(self), "ipv6"); |
675 | + |
676 | + g_free(method); |
677 | + g_free(address); |
678 | + g_free(gateway); |
679 | +} |
680 | + |
681 | +static void ipv6_configuration_updated(ConnmanService *self, GVariant *variant) |
682 | +{ |
683 | + ConnmanServicePrivate *priv = GET_PRIVATE(self); |
684 | + gchar *method = NULL, *address = NULL, *gateway = NULL, *key; |
685 | + guchar prefix_len = 0; |
686 | + GError *error = NULL; |
687 | + GVariantIter iter; |
688 | + GVariant *value; |
689 | + |
690 | + if (priv->ipv6_configuration != NULL) { |
691 | + g_object_unref(priv->ipv6_configuration); |
692 | + priv->ipv6_configuration = NULL; |
693 | + } |
694 | + |
695 | + g_variant_iter_init(&iter, variant); |
696 | + |
697 | + while (g_variant_iter_next(&iter, "{sv}", &key, &value)) { |
698 | + if (g_strcmp0(key, "Method") == 0) |
699 | + method = g_variant_dup_string(value, NULL); |
700 | + else if (g_strcmp0(key, "Address") == 0) |
701 | + address = g_variant_dup_string(value, NULL); |
702 | + else if (g_strcmp0(key, "PrefixLength") == 0) |
703 | + prefix_len = g_variant_get_byte(value); |
704 | + else if (g_strcmp0(key, "Gateway") == 0) |
705 | + gateway = g_variant_dup_string(value, NULL); |
706 | + else |
707 | + g_warning("Unknown ipv6 property: %s", key); |
708 | + |
709 | + g_free(key); |
710 | + g_variant_unref(value); |
711 | + } |
712 | + |
713 | + if (method == NULL && address == NULL && |
714 | + prefix_len == 0 && gateway == NULL) |
715 | + /* some cases, like with bluetooth, ipv6 dict is just empty */ |
716 | + goto out; |
717 | + |
718 | + priv->ipv6_configuration = connman_ipv6_new_with_strings(method, |
719 | + address, |
720 | + prefix_len, |
721 | + gateway, |
722 | + &error); |
723 | + if (error != NULL) { |
724 | + g_warning("Received invalid ipv6 configuration settings: %s", |
725 | + error->message); |
726 | + g_error_free(error); |
727 | + return; |
728 | + } |
729 | + |
730 | + out: |
731 | + g_object_notify(G_OBJECT(self), "ipv6-configuration"); |
732 | + |
733 | + g_free(method); |
734 | + g_free(address); |
735 | + g_free(gateway); |
736 | } |
737 | |
738 | struct property_map |
739 | @@ -1195,6 +1364,8 @@ |
740 | { CONNMAN_PROPERTY_DOMAINS_CONFIGURATION, domains_configuration_updated }, |
741 | { CONNMAN_PROPERTY_IPV4, ipv4_updated }, |
742 | { CONNMAN_PROPERTY_IPV4_CONFIGURATION, ipv4_configuration_updated }, |
743 | + { CONNMAN_PROPERTY_IPV6, ipv6_updated }, |
744 | + { CONNMAN_PROPERTY_IPV6_CONFIGURATION, ipv6_configuration_updated }, |
745 | }; |
746 | |
747 | static void property_updated(ConnmanService *self, const gchar *property, |
748 | @@ -1505,6 +1676,37 @@ |
749 | set_service_property(self, "IPv4.Configuration", value); |
750 | } |
751 | |
752 | +static void update_ipv6_configuration(ConnmanService *self) |
753 | +{ |
754 | + ConnmanServicePrivate *priv = GET_PRIVATE(self); |
755 | + GVariantBuilder builder; |
756 | + gchar prefix_length[10]; |
757 | + ConnmanIPv6 *ipv6; |
758 | + GVariant *value; |
759 | + |
760 | + if (priv->ipv6_configuration == NULL) |
761 | + return; |
762 | + |
763 | + ipv6 = priv->ipv6_configuration; |
764 | + |
765 | + g_variant_builder_init(&builder, G_VARIANT_TYPE("a{ss}")); |
766 | + |
767 | + g_variant_builder_add(&builder, "{ss}", "Method", |
768 | + connman_ipv6_get_method_as_string(ipv6)); |
769 | + g_variant_builder_add(&builder, "{ss}", "Address", |
770 | + connman_ipv6_get_address(ipv6)); |
771 | + |
772 | + g_snprintf(prefix_length, sizeof(prefix_length), "%d", |
773 | + connman_ipv6_get_prefix_length(ipv6)); |
774 | + g_variant_builder_add(&builder, "{ss}", "PrefixLength", prefix_length); |
775 | + g_variant_builder_add(&builder, "{ss}", "Gateway", |
776 | + connman_ipv6_get_gateway(ipv6)); |
777 | + |
778 | + value = g_variant_new("a{ss}", &builder); |
779 | + |
780 | + set_service_property(self, "IPv6.Configuration", value); |
781 | +} |
782 | + |
783 | static void connman_service_set_property(GObject *object, |
784 | guint property_id, |
785 | const GValue *value, |
786 | @@ -1611,6 +1813,17 @@ |
787 | priv->ipv4_configuration = g_value_dup_object(value); |
788 | update_ipv4_configuration(self); |
789 | break; |
790 | + case PROP_IPV6: |
791 | + if (priv->ipv6 != NULL) |
792 | + g_object_unref(priv->ipv6); |
793 | + priv->ipv6 = g_value_dup_object(value); |
794 | + break; |
795 | + case PROP_IPV6_CONFIGURATION: |
796 | + if (priv->ipv6_configuration != NULL) |
797 | + g_object_unref(priv->ipv6_configuration); |
798 | + priv->ipv6_configuration = g_value_dup_object(value); |
799 | + update_ipv6_configuration(self); |
800 | + break; |
801 | default: |
802 | /* We don't have any other property... */ |
803 | G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); |
804 | @@ -1727,6 +1940,16 @@ |
805 | g_object_unref(priv->ipv4_configuration); |
806 | priv->ipv4_configuration = NULL; |
807 | } |
808 | + |
809 | + if (priv->ipv6 != NULL) { |
810 | + g_object_unref(priv->ipv6); |
811 | + priv->ipv6 = NULL; |
812 | + } |
813 | + |
814 | + if (priv->ipv6_configuration != NULL) { |
815 | + g_object_unref(priv->ipv6_configuration); |
816 | + priv->ipv6_configuration = NULL; |
817 | + } |
818 | } |
819 | |
820 | static void connman_service_finalize(GObject *object) |
821 | @@ -1956,6 +2179,21 @@ |
822 | G_PARAM_READWRITE); |
823 | g_object_class_install_property(gobject_class, PROP_IPV4_CONFIGURATION, |
824 | pspec); |
825 | + |
826 | + pspec = g_param_spec_object("ipv6", |
827 | + "ConnmanService's ipv6 property", |
828 | + "ConnmanIPv6 object", |
829 | + CONNMAN_TYPE_IPV6, |
830 | + G_PARAM_READABLE); |
831 | + g_object_class_install_property(gobject_class, PROP_IPV6, pspec); |
832 | + |
833 | + pspec = g_param_spec_object("ipv6-configuration", |
834 | + "ConnmanService's ipv6-configuration property", |
835 | + "ConnmanIPv6 object", |
836 | + CONNMAN_TYPE_IPV6, |
837 | + G_PARAM_READWRITE); |
838 | + g_object_class_install_property(gobject_class, PROP_IPV6_CONFIGURATION, |
839 | + pspec); |
840 | } |
841 | |
842 | static void connman_service_init(ConnmanService *self) |
843 | |
844 | === modified file 'src/libconnman/connman-service.h' |
845 | --- src/libconnman/connman-service.h 2011-02-21 16:24:29 +0000 |
846 | +++ src/libconnman/connman-service.h 2011-03-18 12:46:25 +0000 |
847 | @@ -22,6 +22,7 @@ |
848 | #define _CONNMAN_SERVICE_H_ |
849 | |
850 | #include "connman-ipv4.h" |
851 | +#include "connman-ipv6.h" |
852 | |
853 | #include <glib-object.h> |
854 | #include <gio/gio.h> |
855 | @@ -129,6 +130,10 @@ |
856 | ConnmanIPv4 *connman_service_get_ipv4_configuration(ConnmanService *self); |
857 | void connman_service_set_ipv4_configuration(ConnmanService *self, |
858 | ConnmanIPv4 *ipv4); |
859 | +ConnmanIPv6 *connman_service_get_ipv6(ConnmanService *self); |
860 | +ConnmanIPv6 *connman_service_get_ipv6_configuration(ConnmanService *self); |
861 | +void connman_service_set_ipv6_configuration(ConnmanService *self, |
862 | + ConnmanIPv6 *ipv6); |
863 | |
864 | /* methods */ |
865 | void connman_service_connect(ConnmanService *self, |
866 | |
867 | === modified file 'src/libconnman/connman.h' |
868 | --- src/libconnman/connman.h 2011-02-22 13:57:51 +0000 |
869 | +++ src/libconnman/connman.h 2011-03-18 12:46:25 +0000 |
870 | @@ -74,6 +74,8 @@ |
871 | #define CONNMAN_PROPERTY_DOMAINS_CONFIGURATION "Domains.Configuration" |
872 | #define CONNMAN_PROPERTY_IPV4 "IPv4" |
873 | #define CONNMAN_PROPERTY_IPV4_CONFIGURATION "IPv4.Configuration" |
874 | +#define CONNMAN_PROPERTY_IPV6 "IPv6" |
875 | +#define CONNMAN_PROPERTY_IPV6_CONFIGURATION "IPv6.Configuration" |
876 | #define CONNMAN_PROPERTY_TECHNOLOGIES "Technologies" |
877 | #define CONNMAN_PROPERTY_OFFLINE_MODE "OfflineMode" |
878 | |
879 | |
880 | === modified file 'src/libconnman/generate_vapi' |
881 | --- src/libconnman/generate_vapi 2011-02-02 13:50:19 +0000 |
882 | +++ src/libconnman/generate_vapi 2011-03-18 12:46:25 +0000 |
883 | @@ -18,6 +18,7 @@ |
884 | connman.h connman-manager.c connman-manager.h \ |
885 | connman-service.c connman-service.h \ |
886 | connman-ipv4.c connman-ipv4.h \ |
887 | + connman-ipv6.c connman-ipv6.h \ |
888 | libconnman.la |
889 | |
890 | vapigen \ |
891 | |
892 | === modified file 'src/settings/frontend/widgets/dialogs/edit-connection.vala' |
893 | --- src/settings/frontend/widgets/dialogs/edit-connection.vala 2011-03-17 13:28:03 +0000 |
894 | +++ src/settings/frontend/widgets/dialogs/edit-connection.vala 2011-03-18 12:46:25 +0000 |
895 | @@ -55,6 +55,15 @@ |
896 | private Gtk.TreeIter ipv4_manual_iter; |
897 | private Gtk.TreeIter ipv4_dhcp_iter; |
898 | |
899 | + /* ipv6 */ |
900 | + private Gtk.ComboBox combobox_ipv6_method; |
901 | + private Gtk.Entry entry_ipv6_address; |
902 | + private Gtk.Entry entry_ipv6_prefix_length; |
903 | + private Gtk.Entry entry_ipv6_gateway; |
904 | + private Gtk.TreeIter ipv6_off_iter; |
905 | + private Gtk.TreeIter ipv6_manual_iter; |
906 | + private Gtk.TreeIter ipv6_auto_iter; |
907 | + |
908 | private Gtk.Entry entry_nameservers; |
909 | private Gtk.Entry entry_domains; |
910 | |
911 | @@ -153,6 +162,7 @@ |
912 | }); |
913 | } |
914 | |
915 | + /* ipv4 combobox */ |
916 | var store = new Gtk.ListStore(2, typeof(int), typeof(string)); |
917 | Gtk.TreeIter iter; |
918 | |
919 | @@ -173,6 +183,27 @@ |
920 | store.append(out iter); |
921 | store.set(iter, 0, Connman.IPv4Method.DHCP, 1, "DHCP"); |
922 | this.ipv4_dhcp_iter = iter; |
923 | + |
924 | + /* ipv6 combobox */ |
925 | + store = new Gtk.ListStore(2, typeof(int), typeof(string)); |
926 | + |
927 | + this.combobox_ipv6_method.model = store; |
928 | + |
929 | + cell = new Gtk.CellRendererText(); |
930 | + this.combobox_ipv6_method.pack_start(cell, false); |
931 | + this.combobox_ipv6_method.set_attributes(cell, "text", 1); |
932 | + |
933 | + store.append(out iter); |
934 | + store.set(iter, 0, Connman.IPv6Method.OFF, 1, "Off"); |
935 | + this.ipv6_off_iter = iter; |
936 | + |
937 | + store.append(out iter); |
938 | + store.set(iter, 0, Connman.IPv6Method.MANUAL, 1, "Manual"); |
939 | + this.ipv6_manual_iter = iter; |
940 | + |
941 | + store.append(out iter); |
942 | + store.set(iter, 0, Connman.IPv6Method.AUTO, 1, "Auto"); |
943 | + this.ipv6_auto_iter = iter; |
944 | } |
945 | |
946 | private void get_widgets() { |
947 | @@ -203,6 +234,16 @@ |
948 | this.entry_ipv4_gateway = b.get_object("entry_ipv4_gateway") |
949 | as Gtk.Entry; |
950 | |
951 | + /* ipv6 */ |
952 | + this.combobox_ipv6_method = b.get_object("combobox_ipv6_method") |
953 | + as Gtk.ComboBox; |
954 | + this.entry_ipv6_address = b.get_object("entry_ipv6_address") |
955 | + as Gtk.Entry; |
956 | + this.entry_ipv6_prefix_length = b.get_object("entry_ipv6_prefix_length") |
957 | + as Gtk.Entry; |
958 | + this.entry_ipv6_gateway = b.get_object("entry_ipv6_gateway") |
959 | + as Gtk.Entry; |
960 | + |
961 | /* dns */ |
962 | this.entry_nameservers = b.get_object("entry_nameservers") as Gtk.Entry; |
963 | this.entry_domains = b.get_object("entry_domains") as Gtk.Entry; |
964 | @@ -214,6 +255,7 @@ |
965 | this.button_save.clicked.connect(this.on_button_save_clicked); |
966 | this.button_cancel.clicked.connect(this.on_button_cancel_clicked); |
967 | this.combobox_ipv4_method.changed.connect(ipv4_method_changed); |
968 | + this.combobox_ipv6_method.changed.connect(ipv6_method_changed); |
969 | } |
970 | |
971 | private void ipv4_method_changed(Gtk.ComboBox box) { |
972 | @@ -243,6 +285,33 @@ |
973 | } |
974 | } |
975 | |
976 | + private void ipv6_method_changed(Gtk.ComboBox box) { |
977 | + Gtk.TreeIter iter; |
978 | + Gtk.ListStore store; |
979 | + Connman.IPv6Method method; |
980 | + |
981 | + if (this.combobox_ipv6_method.get_active_iter(out iter) == false) |
982 | + return; |
983 | + |
984 | + store = this.combobox_ipv6_method.model as Gtk.ListStore; |
985 | + store.get(iter, 0, out method); |
986 | + |
987 | + switch (method) { |
988 | + case Connman.IPv6Method.MANUAL: |
989 | + this.entry_ipv6_address.sensitive = true; |
990 | + this.entry_ipv6_prefix_length.sensitive = true; |
991 | + this.entry_ipv6_gateway.sensitive = true; |
992 | + break; |
993 | + case Connman.IPv6Method.OFF: |
994 | + case Connman.IPv6Method.AUTO: |
995 | + default: |
996 | + this.entry_ipv6_address.sensitive = false; |
997 | + this.entry_ipv6_prefix_length.sensitive = false; |
998 | + this.entry_ipv6_gateway.sensitive = false; |
999 | + break; |
1000 | + } |
1001 | + } |
1002 | + |
1003 | private void update_mode() { |
1004 | string mode = ""; |
1005 | |
1006 | @@ -345,6 +414,51 @@ |
1007 | } |
1008 | } |
1009 | |
1010 | + private void update_ipv6() { |
1011 | + var ipv6 = this.connection.get_ipv6_configuration(); |
1012 | + Gtk.TreeIter iter; |
1013 | + |
1014 | + switch (ipv6.method) { |
1015 | + case Connman.IPv6Method.OFF: |
1016 | + iter = this.ipv6_off_iter; |
1017 | + break; |
1018 | + case Connman.IPv6Method.MANUAL: |
1019 | + iter = this.ipv6_manual_iter; |
1020 | + this.entry_ipv6_address.text = ipv6.address; |
1021 | + this.entry_ipv6_prefix_length.text = ipv6.prefix_length.to_string(); |
1022 | + this.entry_ipv6_gateway.text = ipv6.gateway; |
1023 | + break; |
1024 | + case Connman.IPv6Method.AUTO: |
1025 | + default: |
1026 | + iter = this.ipv6_auto_iter; |
1027 | + break; |
1028 | + } |
1029 | + |
1030 | + this.combobox_ipv6_method.set_active_iter(iter); |
1031 | + } |
1032 | + |
1033 | + private void save_ipv6() { |
1034 | + Gtk.TreeIter iter; |
1035 | + Connman.IPv6Method method; |
1036 | + Connman.IPv6 ipv6; |
1037 | + |
1038 | + var store = this.combobox_ipv6_method.model as Gtk.ListStore; |
1039 | + |
1040 | + this.combobox_ipv6_method.get_active_iter(out iter); |
1041 | + store.get(iter, 0, out method); |
1042 | + |
1043 | + var address = this.entry_ipv6_address.text; |
1044 | + uint8 prefix_length = (uint8) uint64.parse(this.entry_ipv6_prefix_length.text); |
1045 | + var gateway = this.entry_ipv6_gateway.text; |
1046 | + |
1047 | + try { |
1048 | + ipv6 = new Connman.IPv6(method, address, prefix_length, gateway); |
1049 | + this.connection.set_ipv6_configuration(ipv6); |
1050 | + } catch (GLib.Error e) { |
1051 | + stderr.printf("Failed to create ipv6 object: %s", e.message); |
1052 | + } |
1053 | + } |
1054 | + |
1055 | private void update_nameservers() { |
1056 | string s = string.joinv(" ", this.connection.get_nameservers_configuration()); |
1057 | this.entry_nameservers.set_text(s); |
1058 | @@ -386,6 +500,7 @@ |
1059 | update_security(); |
1060 | update_passphrase(); |
1061 | update_ipv4(); |
1062 | + update_ipv6(); |
1063 | update_nameservers(); |
1064 | update_domains(); |
1065 | break; |
1066 | @@ -393,6 +508,7 @@ |
1067 | update_name(); |
1068 | update_autoconnect(); |
1069 | update_ipv4(); |
1070 | + update_ipv6(); |
1071 | update_nameservers(); |
1072 | update_domains(); |
1073 | break; |
1074 | @@ -400,6 +516,7 @@ |
1075 | update_name(); |
1076 | update_autoconnect(); |
1077 | update_ipv4(); |
1078 | + update_ipv6(); |
1079 | update_nameservers(); |
1080 | update_domains(); |
1081 | break; |
1082 | @@ -412,18 +529,21 @@ |
1083 | save_autoconnect(); |
1084 | save_passphrase(); |
1085 | save_ipv4(); |
1086 | + save_ipv6(); |
1087 | save_nameservers(); |
1088 | save_domains(); |
1089 | break; |
1090 | case Connman.ServiceType.ETHERNET: |
1091 | save_autoconnect(); |
1092 | save_ipv4(); |
1093 | + save_ipv6(); |
1094 | save_nameservers(); |
1095 | save_domains(); |
1096 | break; |
1097 | case Connman.ServiceType.BLUETOOTH: |
1098 | save_autoconnect(); |
1099 | save_ipv4(); |
1100 | + save_ipv6(); |
1101 | save_nameservers(); |
1102 | save_domains(); |
1103 | break; |
Really really tight work Kalle.