summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/connman/connman-gnome
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2012-04-15 03:01:57 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-04-15 10:28:38 +0100
commitd979ee01b51c5e53cd38228659ff67c780f7efe4 (patch)
tree29cd8d1f9a2e36ae3ead9b786188f1ea58797a1a /meta/recipes-connectivity/connman/connman-gnome
parent9ff001cba1196b91be16ff9290919de820a2d44c (diff)
downloadpoky-d979ee01b51c5e53cd38228659ff67c780f7efe4.tar.gz
connman-gnome: connman 0.79 API fixes
Fix connman-gnome to work with connman 0.79, which made a number of fairly serious DBus API changes. Also switch over to the newly repopulated git repo on kernel.org in which the two previous patches have been merged. Fixes [YOCTO #2202]. (From OE-Core rev: 82744f56f8bfbdcc303034dee3d6e188cf8180b1) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-connectivity/connman/connman-gnome')
-rw-r--r--meta/recipes-connectivity/connman/connman-gnome/0001-Monitor-the-Manager-s-State-property.patch48
-rw-r--r--meta/recipes-connectivity/connman/connman-gnome/0002-Update-for-ConnMan-0.79-API-changes.patch865
-rw-r--r--meta/recipes-connectivity/connman/connman-gnome/0003-Fix-setting-IPv4-configuration.patch85
-rw-r--r--meta/recipes-connectivity/connman/connman-gnome/0004-Handle-WiFi-authentication-using-an-agent.patch923
-rw-r--r--meta/recipes-connectivity/connman/connman-gnome/0005-Remove-all-handling-of-Passphrase-property.patch249
-rw-r--r--meta/recipes-connectivity/connman/connman-gnome/0006-Fix-status-descriptions-in-properties-tree.patch42
-rw-r--r--meta/recipes-connectivity/connman/connman-gnome/3g.patch507
-rw-r--r--meta/recipes-connectivity/connman/connman-gnome/security-type.patch41
8 files changed, 2212 insertions, 548 deletions
diff --git a/meta/recipes-connectivity/connman/connman-gnome/0001-Monitor-the-Manager-s-State-property.patch b/meta/recipes-connectivity/connman/connman-gnome/0001-Monitor-the-Manager-s-State-property.patch
new file mode 100644
index 0000000000..20cbb30c1c
--- /dev/null
+++ b/meta/recipes-connectivity/connman/connman-gnome/0001-Monitor-the-Manager-s-State-property.patch
@@ -0,0 +1,48 @@
1From 56d307993c0a661c73fcdd72b1392c3719a0c297 Mon Sep 17 00:00:00 2001
2Message-Id: <56d307993c0a661c73fcdd72b1392c3719a0c297.1334369310.git.paul.eggleton@linux.intel.com>
3In-Reply-To: <cover.1334369310.git.paul.eggleton@linux.intel.com>
4References: <cover.1334369310.git.paul.eggleton@linux.intel.com>
5From: Joshua Lock <josh@linux.intel.com>
6Date: Tue, 10 Apr 2012 17:54:56 -0700
7Subject: [PATCH 1/6] Monitor the Manager's State property
8
9Monitor the Manager's State property and update global_ready
10appropriately when it changes.
11
12Without this change using the applet with connman 0.79 and
13starting the applet after the daemon no status icon is shown.
14
15With this change this icon displays an appropriate state when
16the applet launches.
17
18Upstream-Status: Submitted
19
20Signed-off-by: Joshua Lock <josh@linux.intel.com>
21---
22 applet/main.c | 10 ++++++++++
23 1 files changed, 10 insertions(+), 0 deletions(-)
24
25diff --git a/applet/main.c b/applet/main.c
26index 224e2fd..68a77b1 100644
27--- a/applet/main.c
28+++ b/applet/main.c
29@@ -111,6 +111,16 @@ static void manager_property_changed(DBusGProxy *proxy, const char *property,
30 iterate_list, &path);
31 update_service(proxy, path);
32 g_free(path);
33+ } else if (g_str_equal(property, "State") == TRUE) {
34+ const gchar *state = g_value_get_string(value);
35+
36+ if (g_strcmp0(state, "ready") == 0 || g_strcmp0(state, "online") == 0) {
37+ global_ready = TRUE;
38+ status_ready(global_strength);
39+ } else {
40+ global_ready = FALSE;
41+ status_offline();
42+ }
43 }
44 }
45
46--
471.7.5.4
48
diff --git a/meta/recipes-connectivity/connman/connman-gnome/0002-Update-for-ConnMan-0.79-API-changes.patch b/meta/recipes-connectivity/connman/connman-gnome/0002-Update-for-ConnMan-0.79-API-changes.patch
new file mode 100644
index 0000000000..fe87b5b71d
--- /dev/null
+++ b/meta/recipes-connectivity/connman/connman-gnome/0002-Update-for-ConnMan-0.79-API-changes.patch
@@ -0,0 +1,865 @@
1From 8b8fd038474def8452354105b40738a402f28d19 Mon Sep 17 00:00:00 2001
2Message-Id: <8b8fd038474def8452354105b40738a402f28d19.1334369310.git.paul.eggleton@linux.intel.com>
3In-Reply-To: <cover.1334369310.git.paul.eggleton@linux.intel.com>
4References: <cover.1334369310.git.paul.eggleton@linux.intel.com>
5From: Paul Eggleton <paul.eggleton@linux.intel.com>
6Date: Thu, 12 Apr 2012 00:35:00 +0100
7Subject: [PATCH 2/6] Update for ConnMan 0.79 API changes
8
9* Use Manager.GetServices method instead of Manager.Services property
10* Use Manager.GetTechnologies / Technology.Powered instead of
11 Manager.EnabledTechnologies method
12* Use Technology.Powered property instead of Manager.EnableTechnology
13 and Manager.DisableTechnology methods
14* Use Technology.Scan method instead of Manager.RequestScan method
15* Listen for ServicesAdded, ServicesRemoved, TechnologyAdded and
16 TechnologyRemoved signals instead of monitoring the old Services
17 and EnabledTechnologies properties
18
19Also remove unused code relating to the old API.
20
21Upstream-Status: Submitted
22
23Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
24---
25 common/connman-client.c | 90 ++-----------
26 common/connman-client.h | 12 +-
27 common/connman-dbus.c | 359 +++++++++++++++++++++++++++--------------------
28 common/connman-dbus.h | 1 +
29 common/connman-dbus.xml | 17 +--
30 common/marshal.list | 2 +
31 properties/cellular.c | 6 +-
32 properties/ethernet.c | 8 +-
33 properties/main.c | 14 +--
34 properties/wifi.c | 8 +-
35 10 files changed, 245 insertions(+), 272 deletions(-)
36
37diff --git a/common/connman-client.c b/common/connman-client.c
38index 407aea0..9d755c4 100644
39--- a/common/connman-client.c
40+++ b/common/connman-client.c
41@@ -112,9 +112,7 @@ static void connman_client_init(ConnmanClient *client)
42 G_TYPE_STRING, /* address */
43 G_TYPE_STRING, /* netmask */
44 G_TYPE_STRING, /* gateway */
45- G_TYPE_BOOLEAN, /* ethernet enabled */
46- G_TYPE_BOOLEAN, /* wifi enabled */
47- G_TYPE_BOOLEAN, /* cellular enabled */
48+ G_TYPE_BOOLEAN, /* powered */
49 G_TYPE_BOOLEAN);/* offline */
50
51 g_object_set_data(G_OBJECT(priv->store),
52@@ -288,7 +286,7 @@ void connman_client_set_powered(ConnmanClient *client, const gchar *device,
53 DBusGProxy *proxy;
54 GValue value = { 0 };
55
56- DBG("client %p", client);
57+ DBG("client %p device %s", client, device);
58
59 if (device == NULL)
60 return;
61@@ -300,64 +298,34 @@ void connman_client_set_powered(ConnmanClient *client, const gchar *device,
62 g_value_init(&value, G_TYPE_BOOLEAN);
63 g_value_set_boolean(&value, powered);
64
65- connman_set_property(proxy, "Powered", &value, NULL);
66-
67- g_object_unref(proxy);
68-}
69-
70-static gboolean device_scan(GtkTreeModel *model, GtkTreePath *path,
71- GtkTreeIter *iter, gpointer user_data)
72-{
73- DBusGProxy *proxy;
74-
75- gtk_tree_model_get(model, iter, CONNMAN_COLUMN_PROXY, &proxy, -1);
76-
77- if (proxy == NULL)
78- return FALSE;
79-
80- if (g_str_equal(dbus_g_proxy_get_interface(proxy),
81- CONNMAN_SERVICE_INTERFACE) == FALSE)
82- return FALSE;
83-
84- connman_propose_scan(proxy, NULL);
85+ GError *error = NULL;
86+ gboolean ret = connman_set_property(proxy, "Powered", &value, &error);
87+ if( error )
88+ fprintf (stderr, "error: %s\n", error->message);
89
90 g_object_unref(proxy);
91-
92- return FALSE;
93 }
94
95-void connman_client_propose_scan(ConnmanClient *client, const gchar *device)
96+void connman_client_scan(ConnmanClient *client, const gchar *device,
97+ connman_scan_reply callback, gpointer user_data)
98 {
99 ConnmanClientPrivate *priv = CONNMAN_CLIENT_GET_PRIVATE(client);
100 DBusGProxy *proxy;
101
102- DBG("client %p", client);
103+ DBG("client %p device %s", client, device);
104
105- if (device == NULL) {
106- gtk_tree_model_foreach(GTK_TREE_MODEL(priv->store),
107- device_scan, NULL);
108+ if (device == NULL)
109 return;
110- }
111
112 proxy = connman_dbus_get_proxy(priv->store, device);
113 if (proxy == NULL)
114 return;
115
116- connman_propose_scan(proxy, NULL);
117+ connman_scan_async(proxy, callback, user_data);
118
119 g_object_unref(proxy);
120 }
121
122-void connman_client_request_scan(ConnmanClient *client, char *scantype,
123- connman_request_scan_reply callback, gpointer userdata)
124-{
125- ConnmanClientPrivate *priv = CONNMAN_CLIENT_GET_PRIVATE(client);
126-
127- DBG("client %p", client);
128-
129- connman_request_scan_async(priv->manager, scantype, callback, userdata);
130-}
131-
132 gboolean connman_client_get_offline_status(ConnmanClient *client)
133 {
134 GHashTable *hash;
135@@ -600,39 +568,3 @@ void connman_client_remove(ConnmanClient *client, const gchar *network)
136
137 g_object_unref(proxy);
138 }
139-
140-void connman_client_enable_technology(ConnmanClient *client, const char *network,
141- const gchar *technology)
142-{
143- ConnmanClientPrivate *priv = CONNMAN_CLIENT_GET_PRIVATE(client);
144- DBusGProxy *proxy;
145-
146- if (network== NULL)
147- return;
148-
149- proxy = connman_dbus_get_proxy(priv->store, network);
150- if (proxy == NULL)
151- return;
152-
153- connman_enable_technology(proxy, technology, NULL);
154-
155- g_object_unref(proxy);
156-}
157-
158-void connman_client_disable_technology(ConnmanClient *client, const char *network,
159- const gchar *technology)
160-{
161- ConnmanClientPrivate *priv = CONNMAN_CLIENT_GET_PRIVATE(client);
162- DBusGProxy *proxy;
163-
164- if (network == NULL)
165- return;
166-
167- proxy = connman_dbus_get_proxy(priv->store, network);
168- if (proxy == NULL)
169- return;
170-
171- connman_disable_technology(proxy, technology, NULL);
172-
173- g_object_unref(proxy);
174-}
175diff --git a/common/connman-client.h b/common/connman-client.h
176index 15fa098..6fe772c 100644
177--- a/common/connman-client.h
178+++ b/common/connman-client.h
179@@ -69,7 +69,8 @@ void connman_client_set_powered(ConnmanClient *client, const gchar *device,
180 gboolean powered);
181 gboolean connman_client_set_ipv4(ConnmanClient *client, const gchar *device,
182 struct ipv4_config *ipv4_config);
183-void connman_client_propose_scan(ConnmanClient *client, const gchar *device);
184+void connman_client_scan(ConnmanClient *client, const gchar *device,
185+ connman_scan_reply callback, gpointer user_data);
186
187 void connman_client_connect(ConnmanClient *client, const gchar *network);
188 void connman_client_disconnect(ConnmanClient *client, const gchar *network);
189@@ -89,8 +90,6 @@ void connman_client_set_callback(ConnmanClient *client,
190
191 void connman_client_remove(ConnmanClient *client, const gchar *network);
192
193-void connman_client_request_scan(ConnmanClient *client, char *scantype,
194- connman_request_scan_reply callback, gpointer userdata);
195 gboolean connman_client_get_offline_status(ConnmanClient *client);
196 void connman_client_set_offlinemode(ConnmanClient *client, gboolean status);
197
198@@ -114,11 +113,8 @@ enum {
199 CONNMAN_COLUMN_ADDRESS, /* G_TYPE_STRING */
200 CONNMAN_COLUMN_NETMASK, /* G_TYPE_STRING */
201 CONNMAN_COLUMN_GATEWAY, /* G_TYPE_STRING */
202-
203- CONNMAN_COLUMN_ETHERNET_ENABLED,/* G_TYPE_STRING */
204- CONNMAN_COLUMN_WIFI_ENABLED, /* G_TYPE_STRING */
205- CONNMAN_COLUMN_CELLULAR_ENABLED,/* G_TYPE_STRING */
206- CONNMAN_COLUMN_OFFLINEMODE, /* G_TYPE_STRING */
207+ CONNMAN_COLUMN_POWERED, /* G_TYPE_BOOLEAN */
208+ CONNMAN_COLUMN_OFFLINEMODE, /* G_TYPE_BOOLEAN */
209
210 _CONNMAN_NUM_COLUMNS
211 };
212diff --git a/common/connman-dbus.c b/common/connman-dbus.c
213index 6669749..4eb77b6 100644
214--- a/common/connman-dbus.c
215+++ b/common/connman-dbus.c
216@@ -28,6 +28,8 @@
217 #include "connman-dbus.h"
218 #include "connman-dbus-glue.h"
219
220+#include "marshal.h"
221+
222 #ifdef DEBUG
223 #define DBG(fmt, arg...) printf("%s:%s() " fmt "\n", __FILE__, __FUNCTION__ , ## arg)
224 #else
225@@ -164,22 +166,6 @@ gboolean connman_dbus_get_iter(GtkTreeStore *store, const gchar *path,
226 return get_iter_from_path(store, iter, path);
227 }
228
229-static void iterate_list(const GValue *value, gpointer user_data)
230-{
231- GSList **list = user_data;
232- gchar *path = g_value_dup_boxed(value);
233-
234- if (path == NULL)
235- return;
236-
237- *list = g_slist_append(*list, path);
238-}
239-
240-static gint compare_path(gconstpointer a, gconstpointer b)
241-{
242- return g_strcmp0(a, b);
243-}
244-
245 static guint get_type(const GValue *value)
246 {
247 const char *type = value ? g_value_get_string(value) : NULL;
248@@ -217,95 +203,76 @@ static const gchar *type2icon(guint type)
249 return NULL;
250 }
251
252-static void enabled_technologies_changed(GtkTreeStore *store, GValue *value)
253+static void tech_changed(DBusGProxy *proxy, const char *property,
254+ GValue *value, gpointer user_data)
255 {
256+ GtkTreeStore *store = user_data;
257+ const char *path = dbus_g_proxy_get_path(proxy);
258 GtkTreeIter iter;
259- gboolean ethernet_enabled_prev, ethernet_enabled = FALSE;
260- gboolean wifi_enabled_prev, wifi_enabled = FALSE;
261- gboolean cellular_enabled_prev, cellular_enabled = FALSE;
262- gchar **tech = g_value_get_boxed (value);
263- guint i;
264
265- if (value == NULL)
266- return;
267-
268- for (i = 0; i < g_strv_length(tech); i++) {
269- DBG("technology: %s", *(tech+i));
270- if (g_str_equal("ethernet", *(tech + i)))
271- ethernet_enabled = TRUE;
272- else if (g_str_equal ("wifi", *(tech + i)))
273- wifi_enabled = TRUE;
274- else if (g_str_equal ("cellular", *(tech + i)))
275- cellular_enabled = TRUE;
276- }
277+ DBG("store %p proxy %p property %s", store, proxy, property);
278
279- get_iter_from_type(store, &iter, CONNMAN_TYPE_LABEL_ETHERNET);
280- gtk_tree_model_get(GTK_TREE_MODEL(store), &iter,
281- CONNMAN_COLUMN_ETHERNET_ENABLED, &ethernet_enabled_prev, -1);
282- if (ethernet_enabled_prev != ethernet_enabled)
283- gtk_tree_store_set(store, &iter,
284- CONNMAN_COLUMN_ETHERNET_ENABLED, ethernet_enabled, -1);
285+ if (property == NULL || value == NULL)
286+ return;
287
288- get_iter_from_type(store, &iter, CONNMAN_TYPE_LABEL_WIFI);
289- gtk_tree_model_get(GTK_TREE_MODEL(store), &iter,
290- CONNMAN_COLUMN_WIFI_ENABLED, &wifi_enabled_prev, -1);
291- if (wifi_enabled_prev != wifi_enabled)
292- gtk_tree_store_set(store, &iter,
293- CONNMAN_COLUMN_WIFI_ENABLED, wifi_enabled, -1);
294+ if (get_iter_from_path(store, &iter, path) == FALSE)
295+ return;
296
297- get_iter_from_type(store, &iter, CONNMAN_TYPE_LABEL_CELLULAR);
298- gtk_tree_model_get(GTK_TREE_MODEL(store), &iter,
299- CONNMAN_COLUMN_CELLULAR_ENABLED, &cellular_enabled_prev, -1);
300- if (cellular_enabled_prev != cellular_enabled)
301+ if (g_str_equal(property, "Powered") == TRUE) {
302+ gboolean powered = g_value_get_boolean(value);
303 gtk_tree_store_set(store, &iter,
304- CONNMAN_COLUMN_CELLULAR_ENABLED, cellular_enabled, -1);
305+ CONNMAN_COLUMN_POWERED, powered, -1);
306+ }
307 }
308
309-static void enabled_technologies_properties(GtkTreeStore *store, DBusGProxy *proxy, GValue *value)
310+static void tech_properties(DBusGProxy *proxy, GHashTable *hash,
311+ GError *error, gpointer user_data)
312 {
313+ GtkTreeStore *store = user_data;
314 GtkTreeIter iter;
315- gboolean ethernet_enabled = FALSE;
316- gboolean wifi_enabled = FALSE;
317- gboolean cellular_enabled = FALSE;
318- gchar **tech = g_value_get_boxed (value);
319- guint i;
320-
321- for (i = 0; i < g_strv_length (tech); i++) {
322- DBG("technology: %s", *(tech+i));
323- if (g_str_equal("ethernet", *(tech + i)))
324- ethernet_enabled = TRUE;
325- else if (g_str_equal ("wifi", *(tech + i)))
326- wifi_enabled = TRUE;
327- else if (g_str_equal ("cellular", *(tech + i)))
328- cellular_enabled = TRUE;
329- }
330+ gboolean powered = FALSE;
331+ GValue *propval = 0;
332+ const char *techtype = 0;
333
334- if (get_iter_from_type(store, &iter, CONNMAN_TYPE_LABEL_ETHERNET) == FALSE)
335- gtk_tree_store_append(store, &iter, NULL);
336+ propval = g_hash_table_lookup(hash, "Type");
337+ techtype = propval ? g_value_get_string(propval) : NULL;
338
339- gtk_tree_store_set(store, &iter,
340- CONNMAN_COLUMN_PROXY, proxy,
341- CONNMAN_COLUMN_ETHERNET_ENABLED, ethernet_enabled,
342- CONNMAN_COLUMN_TYPE, CONNMAN_TYPE_LABEL_ETHERNET,
343- -1);
344+ propval = g_hash_table_lookup(hash, "Powered");
345+ powered = propval ? g_value_get_boolean(propval) : FALSE;
346
347- if (get_iter_from_type(store, &iter, CONNMAN_TYPE_LABEL_WIFI) == FALSE)
348- gtk_tree_store_append(store, &iter, NULL);
349+ if (g_str_equal("ethernet", techtype))
350+ {
351+ if (get_iter_from_type(store, &iter, CONNMAN_TYPE_LABEL_ETHERNET) == FALSE)
352+ gtk_tree_store_append(store, &iter, NULL);
353
354- gtk_tree_store_set(store, &iter,
355- CONNMAN_COLUMN_PROXY, proxy,
356- CONNMAN_COLUMN_WIFI_ENABLED, wifi_enabled,
357- CONNMAN_COLUMN_TYPE, CONNMAN_TYPE_LABEL_WIFI,
358- -1);
359+ gtk_tree_store_set(store, &iter,
360+ CONNMAN_COLUMN_PROXY, proxy,
361+ CONNMAN_COLUMN_POWERED, powered,
362+ CONNMAN_COLUMN_TYPE, CONNMAN_TYPE_LABEL_ETHERNET,
363+ -1);
364+ }
365+ else if (g_str_equal ("wifi", techtype))
366+ {
367+ if (get_iter_from_type(store, &iter, CONNMAN_TYPE_LABEL_WIFI) == FALSE)
368+ gtk_tree_store_append(store, &iter, NULL);
369
370- if (get_iter_from_type(store, &iter, CONNMAN_TYPE_LABEL_CELLULAR) == FALSE)
371- gtk_tree_store_append(store, &iter, NULL);
372+ gtk_tree_store_set(store, &iter,
373+ CONNMAN_COLUMN_PROXY, proxy,
374+ CONNMAN_COLUMN_POWERED, powered,
375+ CONNMAN_COLUMN_TYPE, CONNMAN_TYPE_LABEL_WIFI,
376+ -1);
377+ }
378+ else if (g_str_equal ("3g", techtype))
379+ {
380+ if (get_iter_from_type(store, &iter, CONNMAN_TYPE_LABEL_CELLULAR) == FALSE)
381+ gtk_tree_store_append(store, &iter, NULL);
382
383- gtk_tree_store_set(store, &iter,
384- CONNMAN_COLUMN_PROXY, proxy,
385- CONNMAN_COLUMN_CELLULAR_ENABLED, cellular_enabled,
386- CONNMAN_COLUMN_TYPE, CONNMAN_TYPE_LABEL_CELLULAR,
387- -1);
388+ gtk_tree_store_set(store, &iter,
389+ CONNMAN_COLUMN_PROXY, proxy,
390+ CONNMAN_COLUMN_POWERED, powered,
391+ CONNMAN_COLUMN_TYPE, CONNMAN_TYPE_LABEL_CELLULAR,
392+ -1);
393+ }
394 }
395
396 static void offline_mode_changed(GtkTreeStore *store, GValue *value)
397@@ -319,6 +286,39 @@ static void offline_mode_changed(GtkTreeStore *store, GValue *value)
398 -1);
399 }
400
401+static void tech_added(DBusGProxy *proxy, DBusGObjectPath *path,
402+ GHashTable *hash, gpointer user_data)
403+{
404+ GtkTreeStore *store = user_data;
405+ GtkTreeIter iter;
406+ DBG("store %p proxy %p hash %p", store, proxy, hash);
407+
408+ if (!get_iter_from_path(store, &iter, path)) {
409+ DBusGProxy *tech_proxy = dbus_g_proxy_new_for_name(connection,
410+ CONNMAN_SERVICE, path,
411+ CONNMAN_TECHNOLOGY_INTERFACE);
412+ if (tech_proxy == NULL)
413+ return;
414+
415+ tech_properties(tech_proxy, hash, NULL, user_data);
416+
417+ dbus_g_proxy_add_signal(tech_proxy, "PropertyChanged",
418+ G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID);
419+ dbus_g_proxy_connect_signal(tech_proxy, "PropertyChanged",
420+ G_CALLBACK(tech_changed), store, NULL);
421+ }
422+}
423+
424+static void tech_removed(DBusGProxy *proxy, DBusGObjectPath *path,
425+ gpointer user_data)
426+{
427+ GtkTreeStore *store = user_data;
428+ GtkTreeIter iter;
429+
430+ if (get_iter_from_path(store, &iter, path))
431+ gtk_tree_store_remove(store, &iter);
432+}
433+
434 static void offline_mode_properties(GtkTreeStore *store, DBusGProxy *proxy, GValue *value)
435 {
436 GtkTreeIter iter;
437@@ -401,59 +401,8 @@ static void service_changed(DBusGProxy *proxy, const char *property,
438 }
439 }
440
441-static void property_update(GtkTreeStore *store, const GValue *value,
442- connman_get_properties_reply callback)
443-{
444- GSList *list, *link, *old_list, *new_list = NULL;
445-
446- DBG("store %p", store);
447-
448- old_list = g_object_get_data(G_OBJECT(store), "Services");
449-
450- dbus_g_type_collection_value_iterate(value, iterate_list, &new_list);
451-
452- g_object_set_data(G_OBJECT(store), "Services", new_list);
453-
454- for (list = new_list; list; list = list->next) {
455- gchar *path = list->data;
456- DBusGProxy *proxy;
457-
458- DBG("new path %s", path);
459-
460- link = g_slist_find_custom(old_list, path, compare_path);
461- if (link != NULL) {
462- g_free(link->data);
463- old_list = g_slist_delete_link(old_list, link);
464- }
465-
466- proxy = dbus_g_proxy_new_for_name(connection,
467- CONNMAN_SERVICE, path,
468- CONNMAN_SERVICE_INTERFACE);
469- if (proxy == NULL)
470- continue;
471-
472- DBG("getting %s properties", "Services");
473-
474- connman_get_properties_async(proxy, callback, store);
475- }
476-
477- for (list = old_list; list; list = list->next) {
478- gchar *path = list->data;
479- GtkTreeIter iter;
480-
481- DBG("old path %s", path);
482-
483- if (get_iter_from_path(store, &iter, path) == TRUE)
484- gtk_tree_store_remove(store, &iter);
485-
486- g_free(path);
487- }
488-
489- g_slist_free(old_list);
490-}
491-
492 static void service_properties(DBusGProxy *proxy, GHashTable *hash,
493- GError *error, gpointer user_data)
494+ gpointer user_data)
495 {
496 GtkTreeStore *store = user_data;
497 GValue *value;
498@@ -468,7 +417,7 @@ static void service_properties(DBusGProxy *proxy, GHashTable *hash,
499
500 DBG("store %p proxy %p hash %p", store, proxy, hash);
501
502- if (error != NULL || hash == NULL)
503+ if (hash == NULL)
504 goto done;
505
506 value = g_hash_table_lookup(hash, "Name");
507@@ -572,11 +521,7 @@ static void manager_changed(DBusGProxy *proxy, const char *property,
508 if (property == NULL || value == NULL)
509 return;
510
511- if (g_str_equal(property, "Services") == TRUE)
512- property_update(store, value, service_properties);
513- else if (g_str_equal(property, "EnabledTechnologies") == TRUE)
514- enabled_technologies_changed(store, value);
515- else if (g_str_equal(property, "OfflineMode") == TRUE)
516+ if (g_str_equal(property, "OfflineMode") == TRUE)
517 offline_mode_changed(store, value);
518 }
519
520@@ -591,23 +536,89 @@ static void manager_properties(DBusGProxy *proxy, GHashTable *hash,
521 if (error != NULL || hash == NULL)
522 return;
523
524- value = g_hash_table_lookup(hash, "Services");
525- if (value != NULL)
526- property_update(store, value, service_properties);
527-
528- value = g_hash_table_lookup(hash, "EnabledTechnologies");
529- if (value != NULL)
530- enabled_technologies_properties(store, proxy, value);
531-
532 value = g_hash_table_lookup(hash, "OfflineMode");
533 if (value != NULL)
534 offline_mode_properties(store, proxy, value);
535 }
536
537+static void manager_services(DBusGProxy *proxy, GPtrArray *array,
538+ GError *error, gpointer user_data)
539+{
540+ int i;
541+
542+ DBG("proxy %p array %p", proxy, array);
543+
544+ if (error != NULL || array == NULL)
545+ return;
546+
547+ for (i = 0; i < array->len; i++)
548+ {
549+ GValueArray *item = g_ptr_array_index(array, i);
550+
551+ DBusGObjectPath *path = (DBusGObjectPath *)g_value_get_boxed(g_value_array_get_nth(item, 0));
552+ DBusGProxy *service_proxy = dbus_g_proxy_new_for_name(connection,
553+ CONNMAN_SERVICE, path,
554+ CONNMAN_SERVICE_INTERFACE);
555+ if (service_proxy == NULL)
556+ continue;
557+
558+ GHashTable *props = (GHashTable *)g_value_get_boxed(g_value_array_get_nth(item, 1));
559+ service_properties(service_proxy, props, user_data);
560+ }
561+}
562+
563+static void manager_technologies(DBusGProxy *proxy, GPtrArray *array,
564+ GError *error, gpointer user_data)
565+{
566+ int i;
567+
568+ DBG("proxy %p array %p", proxy, array);
569+
570+ if (error != NULL || array == NULL)
571+ return;
572+
573+ for (i = 0; i < array->len; i++)
574+ {
575+ GValueArray *item = g_ptr_array_index(array, i);
576+
577+ DBusGObjectPath *path = (DBusGObjectPath *)g_value_get_boxed(g_value_array_get_nth(item, 0));
578+ GHashTable *props = (GHashTable *)g_value_get_boxed(g_value_array_get_nth(item, 1));
579+
580+ tech_added(proxy, path, props, user_data);
581+ }
582+}
583+
584+static void services_added(DBusGProxy *proxy, GPtrArray *array,
585+ gpointer user_data)
586+{
587+ DBG("proxy %p array %p", proxy, array);
588+
589+ manager_services(proxy, array, NULL, user_data);
590+}
591+
592+static void services_removed(DBusGProxy *proxy, GPtrArray *array,
593+ gpointer user_data)
594+{
595+ GtkTreeStore *store = user_data;
596+ GtkTreeIter iter;
597+ int i;
598+
599+ DBG("store %p proxy %p array %p", store, proxy, array);
600+
601+ for (i = 0; i < array->len; i++)
602+ {
603+ DBusGObjectPath *path = (DBusGObjectPath *)g_ptr_array_index(array, i);
604+
605+ if (get_iter_from_path(store, &iter, path))
606+ gtk_tree_store_remove(store, &iter);
607+ }
608+}
609+
610 DBusGProxy *connman_dbus_create_manager(DBusGConnection *conn,
611 GtkTreeStore *store)
612 {
613 DBusGProxy *proxy;
614+ GType otype;
615
616 connection = dbus_g_connection_ref(conn);
617
618@@ -620,11 +631,49 @@ DBusGProxy *connman_dbus_create_manager(DBusGConnection *conn,
619 G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID);
620 dbus_g_proxy_connect_signal(proxy, "PropertyChanged",
621 G_CALLBACK(manager_changed), store, NULL);
622-
623+
624+ otype = dbus_g_type_get_struct("GValueArray", DBUS_TYPE_G_OBJECT_PATH, DBUS_TYPE_G_DICTIONARY, G_TYPE_INVALID);
625+ otype = dbus_g_type_get_collection("GPtrArray", otype);
626+ dbus_g_object_register_marshaller(marshal_VOID__BOXED, G_TYPE_NONE, otype, G_TYPE_INVALID);
627+
628+ dbus_g_proxy_add_signal(proxy, "ServicesAdded",
629+ otype, G_TYPE_INVALID);
630+ dbus_g_proxy_connect_signal(proxy, "ServicesAdded",
631+ G_CALLBACK(services_added), store, NULL);
632+
633+ otype = DBUS_TYPE_G_OBJECT_PATH_ARRAY;
634+ dbus_g_object_register_marshaller(marshal_VOID__BOXED, G_TYPE_NONE, otype, G_TYPE_INVALID);
635+
636+ dbus_g_proxy_add_signal(proxy, "ServicesRemoved",
637+ otype, G_TYPE_INVALID);
638+ dbus_g_proxy_connect_signal(proxy, "ServicesRemoved",
639+ G_CALLBACK(services_removed), store, NULL);
640+
641+ dbus_g_object_register_marshaller(marshal_VOID__STRING_BOXED, G_TYPE_NONE, DBUS_TYPE_G_OBJECT_PATH, DBUS_TYPE_G_DICTIONARY, G_TYPE_INVALID);
642+ dbus_g_proxy_add_signal(proxy, "TechnologyAdded",
643+ DBUS_TYPE_G_OBJECT_PATH, DBUS_TYPE_G_DICTIONARY, G_TYPE_INVALID);
644+ dbus_g_proxy_connect_signal(proxy, "TechnologyAdded",
645+ G_CALLBACK(tech_added), store, NULL);
646+
647+ dbus_g_object_register_marshaller(marshal_VOID__STRING, G_TYPE_NONE, DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID);
648+ dbus_g_proxy_add_signal(proxy, "TechnologyRemoved",
649+ DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID);
650+ dbus_g_proxy_connect_signal(proxy, "TechnologyRemoved",
651+ G_CALLBACK(tech_removed), store, NULL);
652+
653+
654 DBG("getting manager properties");
655
656 connman_get_properties_async(proxy, manager_properties, store);
657
658+ DBG("getting technologies");
659+
660+ connman_get_technologies_async(proxy, manager_technologies, store);
661+
662+ DBG("getting services");
663+
664+ connman_get_services_async(proxy, manager_services, store);
665+
666 return proxy;
667 }
668
669diff --git a/common/connman-dbus.h b/common/connman-dbus.h
670index cfca50e..c1b5091 100644
671--- a/common/connman-dbus.h
672+++ b/common/connman-dbus.h
673@@ -32,6 +32,7 @@
674
675 #define CONNMAN_PROFILE_INTERFACE CONNMAN_SERVICE ".Profile"
676 #define CONNMAN_SERVICE_INTERFACE CONNMAN_SERVICE ".Service"
677+#define CONNMAN_TECHNOLOGY_INTERFACE CONNMAN_SERVICE ".Technology"
678
679 DBusGProxy *connman_dbus_create_manager(DBusGConnection *connection,
680 GtkTreeStore *store);
681diff --git a/common/connman-dbus.xml b/common/connman-dbus.xml
682index e20cb3b..56b9582 100644
683--- a/common/connman-dbus.xml
684+++ b/common/connman-dbus.xml
685@@ -5,26 +5,23 @@
686 <method name="GetProperties">
687 <arg type="a{sv}" direction="out"/>
688 </method>
689+ <method name="GetServices">
690+ <arg type="a(oa{sv})" direction="out"/>
691+ </method>
692+ <method name="GetTechnologies">
693+ <arg type="a(oa{sv})" direction="out"/>
694+ </method>
695 <method name="SetProperty">
696 <arg type="s"/>
697 <arg type="v"/>
698 </method>
699- <method name="ProposeScan">
700- </method>
701 <method name="Connect">
702 </method>
703 <method name="Disconnect">
704 </method>
705 <method name="Remove">
706 </method>
707- <method name="RequestScan">
708- <arg type="s"/>
709- </method>
710- <method name="EnableTechnology">
711- <arg type="s"/>
712- </method>
713- <method name="DisableTechnology">
714- <arg type="s"/>
715+ <method name="Scan">
716 </method>
717 </interface>
718 </node>
719diff --git a/common/marshal.list b/common/marshal.list
720index e72aa4b..8b174d0 100644
721--- a/common/marshal.list
722+++ b/common/marshal.list
723@@ -1 +1,3 @@
724 VOID:STRING,BOXED
725+VOID:BOXED
726+VOID:STRING
727diff --git a/properties/cellular.c b/properties/cellular.c
728index 7bbfb89..4d27e0e 100644
729--- a/properties/cellular.c
730+++ b/properties/cellular.c
731@@ -59,9 +59,9 @@ static void switch_callback(GtkWidget *editable, gpointer user_data)
732 const gchar *label = gtk_button_get_label(GTK_BUTTON(data->cellular_button));
733
734 if (g_str_equal(label, "Disable"))
735- connman_client_disable_technology(data->client, data->device, "cellular");
736+ connman_client_set_powered(data->client, data->device, FALSE);
737 else
738- connman_client_enable_technology(data->client, data->device, "cellular");
739+ connman_client_set_powered(data->client, data->device, TRUE);
740 }
741
742 void add_cellular_switch_button(GtkWidget *mainbox, GtkTreeIter *iter,
743@@ -75,7 +75,7 @@ void add_cellular_switch_button(GtkWidget *mainbox, GtkTreeIter *iter,
744 gboolean cellular_enabled;
745
746 gtk_tree_model_get(data->model, iter,
747- CONNMAN_COLUMN_CELLULAR_ENABLED, &cellular_enabled,
748+ CONNMAN_COLUMN_POWERED, &cellular_enabled,
749 -1);
750
751 vbox = gtk_vbox_new(TRUE, 0);
752diff --git a/properties/ethernet.c b/properties/ethernet.c
753index d7f91d9..31db7a0 100644
754--- a/properties/ethernet.c
755+++ b/properties/ethernet.c
756@@ -59,9 +59,9 @@ static void switch_callback(GtkWidget *editable, gpointer user_data)
757 struct config_data *data = user_data;
758 const gchar *label = gtk_button_get_label(GTK_BUTTON(data->ethernet_button));
759 if (g_str_equal(label, "Disable"))
760- connman_client_disable_technology(data->client, data->device, "ethernet");
761- else if (g_str_equal(label, "Enable"))
762- connman_client_enable_technology(data->client, data->device, "ethernet");
763+ connman_client_set_powered(data->client, data->device, FALSE);
764+ else
765+ connman_client_set_powered(data->client, data->device, TRUE);
766 }
767
768 void add_ethernet_switch_button(GtkWidget *mainbox, GtkTreeIter *iter,
769@@ -75,7 +75,7 @@ void add_ethernet_switch_button(GtkWidget *mainbox, GtkTreeIter *iter,
770 gboolean ethernet_enabled;
771
772 gtk_tree_model_get(data->model, iter,
773- CONNMAN_COLUMN_ETHERNET_ENABLED, &ethernet_enabled,
774+ CONNMAN_COLUMN_POWERED, &ethernet_enabled,
775 -1);
776
777 vbox = gtk_vbox_new(TRUE, 0);
778diff --git a/properties/main.c b/properties/main.c
779index 088684a..e266f03 100644
780--- a/properties/main.c
781+++ b/properties/main.c
782@@ -40,18 +40,14 @@ static void status_update(GtkTreeModel *model, GtkTreePath *path,
783 struct config_data *data = user_data;
784 guint type;
785 const char *name = NULL, *_name = NULL, *state = NULL;
786- gboolean ethernet_enabled;
787- gboolean wifi_enabled;
788- gboolean cellular_enabled;
789+ gboolean powered;
790 gboolean offline_mode;
791
792 gtk_tree_model_get(model, iter,
793 CONNMAN_COLUMN_STATE, &state,
794 CONNMAN_COLUMN_NAME, &name,
795 CONNMAN_COLUMN_TYPE, &type,
796- CONNMAN_COLUMN_ETHERNET_ENABLED, &ethernet_enabled,
797- CONNMAN_COLUMN_WIFI_ENABLED, &wifi_enabled,
798- CONNMAN_COLUMN_CELLULAR_ENABLED, &cellular_enabled,
799+ CONNMAN_COLUMN_POWERED, &powered,
800 CONNMAN_COLUMN_OFFLINEMODE, &offline_mode,
801 -1);
802
803@@ -103,14 +99,14 @@ static void status_update(GtkTreeModel *model, GtkTreePath *path,
804 } else if (type == CONNMAN_TYPE_LABEL_ETHERNET) {
805 if (!data->ethernet_button)
806 return;
807- if (ethernet_enabled)
808+ if (powered)
809 gtk_button_set_label(GTK_BUTTON(data->ethernet_button), _("Disable"));
810 else
811 gtk_button_set_label(GTK_BUTTON(data->ethernet_button), _("Enable"));
812 } else if (type == CONNMAN_TYPE_LABEL_WIFI) {
813 if (!data->wifi_button)
814 return;
815- if (wifi_enabled) {
816+ if (powered) {
817 gtk_button_set_label(GTK_BUTTON(data->wifi_button), _("Disable"));
818 gtk_widget_set_sensitive(data->scan_button, 1);
819 } else {
820@@ -120,7 +116,7 @@ static void status_update(GtkTreeModel *model, GtkTreePath *path,
821 } else if (type == CONNMAN_TYPE_LABEL_CELLULAR) {
822 if (!data->cellular_button)
823 return;
824- if (cellular_enabled)
825+ if (powered)
826 gtk_button_set_label(GTK_BUTTON(data->cellular_button), _("Disable"));
827 else
828 gtk_button_set_label(GTK_BUTTON(data->cellular_button), _("Enable"));
829diff --git a/properties/wifi.c b/properties/wifi.c
830index 85922a3..038d35a 100644
831--- a/properties/wifi.c
832+++ b/properties/wifi.c
833@@ -96,9 +96,9 @@ static void switch_callback(GtkWidget *editable, gpointer user_data)
834 const gchar *label = gtk_button_get_label(GTK_BUTTON(data->wifi_button));
835
836 if (g_str_equal(label, "Disable"))
837- connman_client_disable_technology(data->client, data->device, "wifi");
838+ connman_client_set_powered(data->client, data->device, FALSE);
839 else
840- connman_client_enable_technology(data->client, data->device, "wifi");
841+ connman_client_set_powered(data->client, data->device, TRUE);
842 }
843
844 static void scan_reply_cb(DBusGProxy *proxy, GError *error,
845@@ -115,7 +115,7 @@ static void scan_callback(GtkWidget *button, gpointer user_data)
846 {
847 struct config_data *data = user_data;
848 gtk_widget_set_sensitive(button, 0);
849- connman_client_request_scan(data->client, "", scan_reply_cb, button);
850+ connman_client_scan(data->client, data->device, scan_reply_cb, button);
851 }
852
853 void add_wifi_switch_button(GtkWidget *mainbox, GtkTreeIter *iter,
854@@ -129,7 +129,7 @@ void add_wifi_switch_button(GtkWidget *mainbox, GtkTreeIter *iter,
855 gboolean wifi_enabled;
856
857 gtk_tree_model_get(data->model, iter,
858- CONNMAN_COLUMN_WIFI_ENABLED, &wifi_enabled,
859+ CONNMAN_COLUMN_POWERED, &wifi_enabled,
860 -1);
861
862 vbox = gtk_vbox_new(TRUE, 0);
863--
8641.7.5.4
865
diff --git a/meta/recipes-connectivity/connman/connman-gnome/0003-Fix-setting-IPv4-configuration.patch b/meta/recipes-connectivity/connman/connman-gnome/0003-Fix-setting-IPv4-configuration.patch
new file mode 100644
index 0000000000..a25ffd9cfa
--- /dev/null
+++ b/meta/recipes-connectivity/connman/connman-gnome/0003-Fix-setting-IPv4-configuration.patch
@@ -0,0 +1,85 @@
1From 8594fb5e2fc347984457e2e46b175eb3cf57951f Mon Sep 17 00:00:00 2001
2Message-Id: <8594fb5e2fc347984457e2e46b175eb3cf57951f.1334369310.git.paul.eggleton@linux.intel.com>
3In-Reply-To: <cover.1334369310.git.paul.eggleton@linux.intel.com>
4References: <cover.1334369310.git.paul.eggleton@linux.intel.com>
5From: Paul Eggleton <paul.eggleton@linux.intel.com>
6Date: Sat, 14 Apr 2012 01:11:53 +0100
7Subject: [PATCH 3/6] Fix setting IPv4 configuration
8
9Values in the hashtable for IPv4.Configuration need to be variants, not
10strings, and don't pass address entries if the method is dhcp.
11
12Upstream-Status: Submitted
13
14Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
15---
16 common/connman-client.c | 32 +++++++++++++++++++++++++-------
17 1 files changed, 25 insertions(+), 7 deletions(-)
18
19diff --git a/common/connman-client.c b/common/connman-client.c
20index 9d755c4..e4441ad 100644
21--- a/common/connman-client.c
22+++ b/common/connman-client.c
23@@ -39,6 +39,11 @@
24 #define CONNMAN_CLIENT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
25 CONNMAN_TYPE_CLIENT, ConnmanClientPrivate))
26
27+#ifndef DBUS_TYPE_G_DICTIONARY
28+#define DBUS_TYPE_G_DICTIONARY \
29+ (dbus_g_type_get_map("GHashTable", G_TYPE_STRING, G_TYPE_VALUE))
30+#endif
31+
32 typedef struct _ConnmanClientPrivate ConnmanClientPrivate;
33
34 struct _ConnmanClientPrivate {
35@@ -248,6 +253,16 @@ GtkTreeModel *connman_client_get_device_model(ConnmanClient *client)
36 return model;
37 }
38
39+void hash_table_value_string_insert( GHashTable *hash, gpointer key, const char *str )
40+{
41+ GValue *itemvalue;
42+
43+ itemvalue = g_slice_new0(GValue);
44+ g_value_init(itemvalue, G_TYPE_STRING);
45+ g_value_set_string(itemvalue, str);
46+ g_hash_table_insert(hash, key, itemvalue);
47+}
48+
49 gboolean connman_client_set_ipv4(ConnmanClient *client, const gchar *device,
50 struct ipv4_config *ipv4_config)
51 {
52@@ -255,12 +270,7 @@ gboolean connman_client_set_ipv4(ConnmanClient *client, const gchar *device,
53 DBusGProxy *proxy;
54 GValue value = { 0 };
55 gboolean ret;
56- GHashTable *ipv4 = g_hash_table_new(g_str_hash, g_str_equal);
57-
58- g_hash_table_insert(ipv4, "Method", (gpointer)ipv4_config->method);
59- g_hash_table_insert(ipv4, "Address", (gpointer)ipv4_config->address);
60- g_hash_table_insert(ipv4, "Netmask", (gpointer)ipv4_config->netmask);
61- g_hash_table_insert(ipv4, "Gateway", (gpointer)ipv4_config->gateway);
62+ GHashTable *ipv4 = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free);
63
64 DBG("client %p", client);
65
66@@ -270,7 +280,15 @@ gboolean connman_client_set_ipv4(ConnmanClient *client, const gchar *device,
67 proxy = connman_dbus_get_proxy(priv->store, device);
68 if (proxy == NULL)
69 return FALSE;
70- g_value_init(&value, DBUS_TYPE_G_STRING_STRING_HASHTABLE);
71+
72+ hash_table_value_string_insert(ipv4, "Method", ipv4_config->method);
73+ if( g_strcmp0(ipv4_config->method, "dhcp" ) != 0 ) {
74+ hash_table_value_string_insert(ipv4, "Address", ipv4_config->address);
75+ hash_table_value_string_insert(ipv4, "Netmask", ipv4_config->netmask);
76+ hash_table_value_string_insert(ipv4, "Gateway", ipv4_config->gateway);
77+ }
78+
79+ g_value_init(&value, DBUS_TYPE_G_DICTIONARY);
80 g_value_set_boxed(&value, ipv4);
81 ret = connman_set_property(proxy, "IPv4.Configuration", &value, NULL);
82
83--
841.7.5.4
85
diff --git a/meta/recipes-connectivity/connman/connman-gnome/0004-Handle-WiFi-authentication-using-an-agent.patch b/meta/recipes-connectivity/connman/connman-gnome/0004-Handle-WiFi-authentication-using-an-agent.patch
new file mode 100644
index 0000000000..98230525b6
--- /dev/null
+++ b/meta/recipes-connectivity/connman/connman-gnome/0004-Handle-WiFi-authentication-using-an-agent.patch
@@ -0,0 +1,923 @@
1From c742b40860851f1659e801d0a652f854f6783bd1 Mon Sep 17 00:00:00 2001
2Message-Id: <c742b40860851f1659e801d0a652f854f6783bd1.1334369310.git.paul.eggleton@linux.intel.com>
3In-Reply-To: <cover.1334369310.git.paul.eggleton@linux.intel.com>
4References: <cover.1334369310.git.paul.eggleton@linux.intel.com>
5From: Paul Eggleton <paul.eggleton@linux.intel.com>
6Date: Sat, 14 Apr 2012 02:32:43 +0100
7Subject: [PATCH 4/6] Handle WiFi authentication using an agent
8
9Register an agent within the applet which shows an appropriate dialog
10when credentials are requested upon connecting to a secured wireless
11network.
12
13Thanks to Julien Massot for providing the underlying agent library code.
14
15Upstream-Status: Submitted
16
17Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
18---
19 applet/Makefile.am | 3 +-
20 applet/agent.c | 209 +++++++++++++++++++++++
21 applet/agent.h | 29 +++
22 applet/main.c | 3 +
23 common/Makefile.am | 13 +-
24 common/connman-agent.c | 426 ++++++++++++++++++++++++++++++++++++++++++++++
25 common/connman-agent.h | 77 +++++++++
26 common/connman-agent.xml | 26 +++
27 common/marshal.list | 2 +
28 9 files changed, 783 insertions(+), 5 deletions(-)
29 create mode 100644 applet/agent.c
30 create mode 100644 applet/agent.h
31 create mode 100644 common/connman-agent.c
32 create mode 100644 common/connman-agent.h
33 create mode 100644 common/connman-agent.xml
34
35diff --git a/applet/Makefile.am b/applet/Makefile.am
36index fe582ef..2e7c157 100644
37--- a/applet/Makefile.am
38+++ b/applet/Makefile.am
39@@ -2,7 +2,8 @@
40 bin_PROGRAMS = connman-applet
41
42 connman_applet_SOURCES = main.c \
43- properties.h properties.c status.h status.c
44+ properties.h properties.c status.h \
45+ status.c agent.h agent.c
46
47 connman_applet_LDADD = $(top_builddir)/common/libcommon.a \
48 @GTK_LIBS@ @DBUS_LIBS@
49diff --git a/applet/agent.c b/applet/agent.c
50new file mode 100644
51index 0000000..b12d337
52--- /dev/null
53+++ b/applet/agent.c
54@@ -0,0 +1,209 @@
55+/*
56+ *
57+ * Connection Manager
58+ *
59+ * Agent implementation based on code from bluez-gnome
60+ *
61+ * Copyright (C) 2005-2008 Marcel Holtmann <marcel@holtmann.org>
62+ * Copyright (C) 2006-2007 Bastien Nocera <hadess@hadess.net>
63+ * Copyright (C) 2012 Intel Corporation
64+ *
65+ *
66+ * This program is free software; you can redistribute it and/or modify
67+ * it under the terms of the GNU General Public License as published by
68+ * the Free Software Foundation; either version 2 of the License, or
69+ * (at your option) any later version.
70+ *
71+ * This program is distributed in the hope that it will be useful,
72+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
73+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
74+ * GNU General Public License for more details.
75+ *
76+ * You should have received a copy of the GNU General Public License
77+ * along with this program; if not, write to the Free Software
78+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
79+ *
80+ */
81+
82+#ifdef HAVE_CONFIG_H
83+#include <config.h>
84+#endif
85+
86+#include <stdlib.h>
87+
88+#include <glib/gi18n.h>
89+#include <gtk/gtk.h>
90+
91+#include <dbus/dbus-glib.h>
92+
93+#include <connman-agent.h>
94+
95+#include "agent.h"
96+
97+struct input_data {
98+ gboolean numeric;
99+ gpointer request_data;
100+ GtkWidget *dialog;
101+ GHashTable *entries;
102+};
103+
104+static struct input_data *input_data_inst = NULL;
105+
106+static void input_free(struct input_data *input)
107+{
108+ gtk_widget_destroy(input->dialog);
109+
110+ g_hash_table_destroy(input->entries);
111+
112+ if( input_data_inst == input )
113+ input_data_inst = NULL;
114+
115+ g_free(input);
116+}
117+
118+static void request_input_callback(GtkWidget *dialog,
119+ gint response, gpointer user_data)
120+{
121+ GHashTableIter iter;
122+ gpointer key, value;
123+ GValue *retvalue = NULL;
124+ const gchar *text;
125+ struct input_data *input = user_data;
126+
127+ if (response == GTK_RESPONSE_OK) {
128+ GHashTable *reply = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
129+ g_hash_table_iter_init (&iter, input->entries);
130+ while (g_hash_table_iter_next (&iter, &key, &value)) {
131+ text = gtk_entry_get_text((GtkEntry *)value);
132+ if(strlen(text)) {
133+ retvalue = g_slice_new0(GValue);
134+ g_value_init(retvalue, G_TYPE_STRING);
135+ g_value_set_string(retvalue, text);
136+ g_hash_table_insert(reply, g_strdup(key), retvalue);
137+ }
138+ }
139+
140+ connman_agent_request_input_set_reply(input->request_data, reply);
141+ } else {
142+ connman_agent_request_input_abort(input->request_data);
143+ }
144+
145+ input_free(input);
146+}
147+
148+static void show_dialog(gpointer data, gpointer user_data)
149+{
150+ struct input_data *input = data;
151+
152+ gtk_widget_show_all(input->dialog);
153+
154+ gtk_window_present(GTK_WINDOW(input->dialog));
155+}
156+
157+static void request_input_dialog(GHashTable *request,
158+ gpointer request_data)
159+{
160+ GtkWidget *dialog;
161+ GtkWidget *label;
162+ GtkWidget *table;
163+ GtkWidget *entry;
164+ struct input_data *input;
165+ GHashTableIter iter;
166+ gpointer key, value;
167+ int elems, i;
168+
169+ input = g_try_malloc0(sizeof(*input));
170+ if (!input)
171+ return;
172+
173+ input->request_data = request_data;
174+
175+ input->entries = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
176+
177+ dialog = gtk_dialog_new();
178+ gtk_window_set_title(GTK_WINDOW(dialog), _("Connection Manager"));
179+ gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
180+ gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER);
181+ gtk_window_set_keep_above(GTK_WINDOW(dialog), TRUE);
182+ gtk_window_set_urgency_hint(GTK_WINDOW(dialog), TRUE);
183+ gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);
184+ input->dialog = dialog;
185+
186+ gtk_dialog_add_button(GTK_DIALOG(dialog),
187+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
188+ gtk_dialog_add_button(GTK_DIALOG(dialog),
189+ GTK_STOCK_OK, GTK_RESPONSE_OK);
190+
191+ elems = g_hash_table_size(request);
192+ table = gtk_table_new(elems+1, 2, FALSE);
193+ gtk_table_set_row_spacings(GTK_TABLE(table), 4);
194+ gtk_table_set_col_spacings(GTK_TABLE(table), 20);
195+ gtk_container_set_border_width(GTK_CONTAINER(table), 12);
196+ gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), table);
197+
198+ label = gtk_label_new(_("Please provide some network information:"));
199+ gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
200+ gtk_table_attach(GTK_TABLE(table), label, 0, 2, 0, 1,
201+ GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
202+
203+ g_hash_table_iter_init (&iter, request);
204+ i=1;
205+ while (g_hash_table_iter_next (&iter, &key, &value)) {
206+ label = gtk_label_new((const char *)key);
207+ gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
208+ gtk_table_attach(GTK_TABLE(table), label, 0, 1, i, i+1,
209+ GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
210+
211+ entry = gtk_entry_new();
212+ gtk_entry_set_max_length(GTK_ENTRY(entry), 64);
213+ gtk_entry_set_width_chars(GTK_ENTRY(entry), 16);
214+ gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
215+ gtk_table_attach(GTK_TABLE(table), entry, 1, 2, i, i+1,
216+ GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
217+ g_hash_table_insert(input->entries, g_strdup(key), entry);
218+
219+ i++;
220+ }
221+
222+ input_data_inst = input;
223+
224+ g_signal_connect(G_OBJECT(dialog), "response",
225+ G_CALLBACK(request_input_callback), input);
226+
227+ show_dialog(input, NULL);
228+}
229+
230+static void request_input(const char *service_id,
231+ GHashTable *request, gpointer request_data, gpointer user_data)
232+{
233+ request_input_dialog(request, request_data);
234+}
235+
236+static gboolean cancel_request(DBusGMethodInvocation *context,
237+ gpointer user_data)
238+{
239+ if( input_data_inst ) {
240+ connman_agent_request_input_abort(input_data_inst->request_data);
241+
242+ input_free(input_data_inst);
243+ }
244+
245+ return TRUE;
246+}
247+
248+int setup_agents(void)
249+{
250+ ConnmanAgent *agent = connman_agent_new();
251+ connman_agent_setup(agent, "/org/gnome/connman/applet");
252+
253+ connman_agent_set_request_input_func(agent, request_input, agent);
254+ connman_agent_set_cancel_func(agent, cancel_request, agent);
255+
256+ connman_agent_register(agent);
257+
258+ return 0;
259+}
260+
261+void cleanup_agents(void)
262+{
263+}
264diff --git a/applet/agent.h b/applet/agent.h
265new file mode 100644
266index 0000000..d85676b
267--- /dev/null
268+++ b/applet/agent.h
269@@ -0,0 +1,29 @@
270+/*
271+ *
272+ * Connection Manager
273+ *
274+ * Agent implementation based on code from bluez-gnome
275+ *
276+ * Copyright (C) 2005-2008 Marcel Holtmann <marcel@holtmann.org>
277+ * Copyright (C) 2006-2007 Bastien Nocera <hadess@hadess.net>
278+ * Copyright (C) 2012 Intel Corporation
279+ *
280+ *
281+ * This program is free software; you can redistribute it and/or modify
282+ * it under the terms of the GNU General Public License as published by
283+ * the Free Software Foundation; either version 2 of the License, or
284+ * (at your option) any later version.
285+ *
286+ * This program is distributed in the hope that it will be useful,
287+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
288+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
289+ * GNU General Public License for more details.
290+ *
291+ * You should have received a copy of the GNU General Public License
292+ * along with this program; if not, write to the Free Software
293+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
294+ *
295+ */
296+
297+int setup_agents(void);
298+void cleanup_agents(void);
299diff --git a/applet/main.c b/applet/main.c
300index 68a77b1..d06ce60 100644
301--- a/applet/main.c
302+++ b/applet/main.c
303@@ -32,6 +32,7 @@
304
305 #include "properties.h"
306 #include "status.h"
307+#include "agent.h"
308
309 static gboolean global_ready = FALSE;
310 static gint global_strength = -1;
311@@ -132,6 +133,7 @@ static void manager_init(DBusGConnection *connection)
312 "/", "net.connman.Manager");
313
314 properties_create(manager, manager_property_changed, NULL);
315+ setup_agents();
316 }
317
318 static void manager_cleanup(void)
319@@ -148,6 +150,7 @@ static void name_owner_changed(DBusGProxy *proxy, const char *name,
320 if (*new != '\0') {
321 status_offline();
322 properties_enable(manager);
323+ setup_agents();
324 } else {
325 properties_disable(manager);
326 status_unavailable();
327diff --git a/common/Makefile.am b/common/Makefile.am
328index ef1267a..5bfff19 100644
329--- a/common/Makefile.am
330+++ b/common/Makefile.am
331@@ -3,19 +3,21 @@ noinst_LIBRARIES = libcommon.a
332
333 libcommon_a_SOURCES = connman-dbus.c connman-dbus.h connman-dbus-glue.h \
334 connman-client.h connman-client.c \
335- instance.h instance.c
336+ instance.h instance.c \
337+ connman-agent.h connman-agent.c
338
339 BUILT_SOURCES = marshal.h marshal.c \
340 connman-dbus-glue.h \
341- instance-glue.h
342+ instance-glue.h \
343+ connman-agent-glue.h
344
345-nodist_libcommon_a_SOURCES = connman-dbus-glue.h instance-glue.h
346+nodist_libcommon_a_SOURCES = connman-dbus-glue.h instance-glue.h connman-agent-glue.h
347
348 CLEANFILES = $(BUILT_SOURCES)
349
350 AM_CFLAGS = @DBUS_CFLAGS@ @GTK_CFLAGS@
351
352-EXTRA_DIST = marshal.list instance.xml connman-dbus.xml
353+EXTRA_DIST = marshal.list instance.xml connman-dbus.xml connman-agent.xml
354
355 MAINTAINERCLEANFILES = Makefile.in
356
357@@ -30,3 +32,6 @@ instance-glue.h: instance.xml
358
359 connman-dbus-glue.h: connman-dbus.xml
360 $(DBUS_BINDING_TOOL) --prefix=connman --mode=glib-client --output=$@ $<
361+
362+connman-agent-glue.h: connman-agent.xml
363+ $(DBUS_BINDING_TOOL) --prefix=connman_agent --mode=glib-server --output=$@ $<
364diff --git a/common/connman-agent.c b/common/connman-agent.c
365new file mode 100644
366index 0000000..769bf27
367--- /dev/null
368+++ b/common/connman-agent.c
369@@ -0,0 +1,426 @@
370+/*
371+ * Connection Manager Agent implementation
372+ *
373+ * Author(s):
374+ * - Julien MASSOT <jmassot@aldebaran-robotics.com>
375+ * - Paul Eggleton <paul.eggleton@linux.intel.com>
376+ *
377+ * Copyright (C) 2012 Aldebaran Robotics
378+ * Copyright (C) 2012 Intel Corporation
379+ *
380+ * This library is free software; you can redistribute it and/or
381+ * modify it under the terms of the GNU Lesser General Public
382+ * License version 2.1 as published by the Free Software Foundation.
383+ *
384+ * This library is distributed in the hope that it will be useful,
385+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
386+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
387+ * Lesser General Public License for more details.
388+ *
389+ * You should have received a copy of the GNU Lesser General Public
390+ * License along with this library; if not, write to the Free Software
391+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
392+ */
393+
394+#include <dbus/dbus-glib.h>
395+#include <dbus/dbus-glib-lowlevel.h>
396+#include <stdio.h>
397+
398+#include "connman-agent.h"
399+#include "connman-dbus.h"
400+
401+#define CONNMAN_AGENT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
402+ CONNMAN_TYPE_AGENT, ConnmanAgentPrivate))
403+
404+typedef enum {
405+ AGENT_ERROR_REJECT,
406+ AGENT_ERROR_RETRY
407+} AgentError;
408+
409+#define AGENT_ERROR (agent_error_quark())
410+
411+#define AGENT_ERROR_TYPE (agent_error_get_type())
412+
413+static GQuark agent_error_quark(void)
414+{
415+ static GQuark quark = 0;
416+ if (!quark)
417+ quark = g_quark_from_static_string("Agent");
418+
419+ return quark;
420+}
421+
422+#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
423+
424+static GType agent_error_get_type(void)
425+{
426+ static GType etype = 0;
427+ if (etype == 0) {
428+ static const GEnumValue values[] = {
429+ ENUM_ENTRY(AGENT_ERROR_REJECT, "Rejected"),
430+ ENUM_ENTRY(AGENT_ERROR_RETRY, "Retry"),
431+ { 0, 0, 0 }
432+ };
433+
434+ etype = g_enum_register_static("Agent", values);
435+ }
436+
437+ return etype;
438+}
439+
440+typedef struct _ConnmanAgentPrivate ConnmanAgentPrivate;
441+
442+typedef struct _PendingRequest PendingRequest;
443+
444+struct _PendingRequest {
445+ DBusGMethodInvocation *context;
446+ ConnmanAgent *agent;
447+};
448+
449+struct _ConnmanAgentPrivate {
450+ gchar *busname;
451+ gchar *path;
452+ DBusGConnection *connection;
453+ DBusGProxy *connman_proxy;
454+
455+ ConnmanAgentRequestInputFunc input_func;
456+ gpointer input_data;
457+
458+ ConnmanAgentCancelFunc cancel_func;
459+ gpointer cancel_data;
460+
461+ ConnmanAgentReleaseFunc release_func;
462+ gpointer release_data;
463+
464+ ConnmanAgentDebugFunc debug_func;
465+ gpointer debug_data;
466+
467+};
468+
469+G_DEFINE_TYPE(ConnmanAgent, connman_agent, G_TYPE_OBJECT)
470+
471+static inline void debug(ConnmanAgent *agent, const char *format, ...)
472+{
473+ char str[256];
474+ va_list ap;
475+ ConnmanAgentPrivate *priv = CONNMAN_AGENT_GET_PRIVATE(agent);
476+
477+ if (priv->debug_func == NULL)
478+ return;
479+
480+ va_start(ap, format);
481+
482+ if (vsnprintf(str, sizeof(str), format, ap) > 0)
483+ priv->debug_func(str, priv->debug_data);
484+
485+ va_end(ap);
486+}
487+
488+gboolean connman_agent_request_input_set_reply(gpointer request_data, GHashTable *reply)
489+{
490+ PendingRequest *pendingrequest = request_data;
491+
492+ if (request_data == NULL)
493+ return FALSE;
494+
495+ dbus_g_method_return(pendingrequest->context, reply);
496+
497+ g_free(pendingrequest);
498+
499+ return FALSE;
500+}
501+
502+gboolean connman_agent_request_input_abort(gpointer request_data)
503+{
504+ PendingRequest *pendingrequest = request_data;
505+ GError *result;
506+ if (request_data == NULL)
507+ return FALSE;
508+
509+ result = g_error_new(AGENT_ERROR, AGENT_ERROR_REJECT,
510+ "Input request rejected");
511+ dbus_g_method_return_error(pendingrequest->context, result);
512+ g_clear_error(&result);
513+ g_free(pendingrequest);
514+
515+ return FALSE;
516+}
517+
518+static gboolean connman_agent_request_input_cb(const GHashTable *reply, gpointer user_data)
519+{
520+
521+ PendingRequest *pendingrequest = user_data;
522+
523+ dbus_g_method_return(pendingrequest->context, reply);
524+
525+ g_free(pendingrequest);
526+ return FALSE;
527+}
528+
529+gboolean connman_agent_report_error(ConnmanAgent *agent,
530+ const char *path, const char *error,
531+ DBusGMethodInvocation *context)
532+{
533+ GError *result;
534+ ConnmanAgentPrivate *priv = CONNMAN_AGENT_GET_PRIVATE(agent);
535+
536+ debug(agent, "connection %s, reports an error: %s", path, error);
537+ result = g_error_new(AGENT_ERROR, AGENT_ERROR_RETRY,
538+ "Retry");
539+ dbus_g_method_return_error(context, result);
540+ g_clear_error(&result);
541+
542+ return FALSE;
543+}
544+
545+gboolean connman_agent_request_input(ConnmanAgent *agent,
546+ const char *path, GHashTable *fields,
547+ DBusGMethodInvocation *context)
548+{
549+ ConnmanAgentPrivate *priv = CONNMAN_AGENT_GET_PRIVATE(agent);
550+ const char *sender = dbus_g_method_get_sender(context);
551+ char *name = NULL, *type = NULL;
552+ char **id = NULL;
553+ PendingRequest *pendingrequest = NULL;
554+
555+ debug(agent, "request %s, sender %s", path, sender);
556+
557+ if (fields == NULL)
558+ return FALSE;
559+
560+ if (priv->input_func != NULL) {
561+ id = g_strsplit(path, "/net/connman/service/", 2);
562+ if (g_strv_length(id) == 2) {
563+ pendingrequest = g_try_new0(PendingRequest, 1);
564+ pendingrequest->context = context;
565+ pendingrequest->agent = agent;
566+ priv->input_func(id[1], fields, pendingrequest, priv->input_data);
567+ }
568+ g_strfreev(id);
569+ }
570+
571+ return FALSE;
572+}
573+
574+gboolean connman_agent_cancel(ConnmanAgent *agent,
575+ DBusGMethodInvocation *context)
576+{
577+ ConnmanAgentPrivate *priv = CONNMAN_AGENT_GET_PRIVATE(agent);
578+ const char *sender = dbus_g_method_get_sender(context);
579+ gboolean result = FALSE;
580+
581+ debug(agent, "Request Canceled %s", sender);
582+
583+ if (g_str_equal(sender, priv->busname) == FALSE)
584+ return FALSE;
585+
586+ if (priv->cancel_func)
587+ result = priv->cancel_func(context, priv->cancel_data);
588+
589+ return result;
590+}
591+
592+gboolean connman_agent_release(ConnmanAgent *agent,
593+ DBusGMethodInvocation *context)
594+{
595+ ConnmanAgentPrivate *priv = CONNMAN_AGENT_GET_PRIVATE(agent);
596+ const char *sender = dbus_g_method_get_sender(context);
597+
598+ debug(agent, "agent %p sender %s", agent, sender);
599+
600+ if (g_str_equal(sender, priv->busname) == FALSE)
601+ return FALSE;
602+
603+ dbus_g_method_return(context);
604+
605+ return TRUE;
606+}
607+
608+#include "connman-agent-glue.h"
609+
610+static void connman_agent_init(ConnmanAgent *agent)
611+{
612+ debug(agent, "agent %p", agent);
613+}
614+
615+static void connman_agent_finalize(GObject *agent)
616+{
617+ ConnmanAgentPrivate *priv = CONNMAN_AGENT_GET_PRIVATE(agent);
618+
619+ if (priv->connman_proxy != NULL) {
620+ g_object_unref(priv->connman_proxy);
621+ }
622+
623+ g_free(priv->path);
624+ g_free(priv->busname);
625+ dbus_g_connection_unref(priv->connection);
626+
627+ G_OBJECT_CLASS(connman_agent_parent_class)->finalize(agent);
628+}
629+
630+static void connman_agent_class_init(ConnmanAgentClass *klass)
631+{
632+ GObjectClass *object_class = (GObjectClass *) klass;
633+
634+ g_type_class_add_private(klass, sizeof(ConnmanAgentPrivate));
635+
636+ object_class->finalize = connman_agent_finalize;
637+
638+ dbus_g_object_type_install_info(CONNMAN_TYPE_AGENT,
639+ &dbus_glib_connman_agent_object_info);
640+}
641+
642+ConnmanAgent *connman_agent_new(void)
643+{
644+ ConnmanAgent *agent;
645+ g_type_init();
646+
647+ agent = CONNMAN_AGENT(g_object_new(CONNMAN_TYPE_AGENT, NULL));
648+
649+ return agent;
650+}
651+
652+gboolean connman_agent_setup(ConnmanAgent *agent, const char *path)
653+{
654+ ConnmanAgentPrivate *priv = CONNMAN_AGENT_GET_PRIVATE(agent);
655+ DBusGProxy *proxy;
656+ GObject *object;
657+ GError *error = NULL;
658+
659+ debug(agent, "agent_setup %p", agent);
660+
661+ if (priv->path != NULL)
662+ return FALSE;
663+
664+ priv->path = g_strdup(path);
665+ priv->connection = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
666+ if (error != NULL) {
667+ g_printerr("Connecting to system bus failed: %s\n",
668+ error->message);
669+ g_error_free(error);
670+ return FALSE;
671+ }
672+
673+ proxy = dbus_g_proxy_new_for_name_owner(priv->connection, CONNMAN_SERVICE,
674+ CONNMAN_MANAGER_PATH, CONNMAN_MANAGER_INTERFACE, NULL);
675+
676+ g_free(priv->busname);
677+
678+ if (proxy != NULL) {
679+ priv->busname = g_strdup(dbus_g_proxy_get_bus_name(proxy));
680+ g_object_unref(proxy);
681+ } else
682+ priv->busname = NULL;
683+
684+ object = dbus_g_connection_lookup_g_object(priv->connection, priv->path);
685+ if (object != NULL)
686+ g_object_unref(object);
687+
688+ return TRUE;
689+}
690+
691+
692+gboolean connman_agent_register(ConnmanAgent *agent)
693+{
694+ ConnmanAgentPrivate *priv = CONNMAN_AGENT_GET_PRIVATE(agent);
695+ DBusGProxy *proxy;
696+ GObject *object;
697+ GError *error = NULL;
698+ gchar *path;
699+
700+ debug(agent, "register agent %p", agent);
701+
702+ if (priv->connman_proxy != NULL)
703+ return FALSE;
704+
705+ priv->connman_proxy = dbus_g_proxy_new_for_name_owner(priv->connection, CONNMAN_SERVICE,
706+ CONNMAN_MANAGER_PATH, CONNMAN_MANAGER_INTERFACE, NULL);
707+
708+ g_free(priv->busname);
709+
710+ priv->busname = g_strdup(dbus_g_proxy_get_bus_name(priv->connman_proxy));
711+
712+ object = dbus_g_connection_lookup_g_object(priv->connection, priv->path);
713+ if (object != NULL)
714+ g_object_unref(object);
715+
716+ dbus_g_connection_register_g_object(priv->connection,
717+ priv->path, G_OBJECT(agent));
718+
719+ dbus_g_proxy_call(priv->connman_proxy, "RegisterAgent", &error,
720+ DBUS_TYPE_G_OBJECT_PATH, priv->path,
721+ G_TYPE_INVALID, G_TYPE_INVALID);
722+
723+ if (error != NULL) {
724+ g_printerr("Agent registration failed: %s\n",
725+ error->message);
726+ g_error_free(error);
727+ return FALSE;
728+ }
729+
730+ return TRUE;
731+}
732+
733+gboolean connman_agent_unregister(ConnmanAgent *agent)
734+{
735+ ConnmanAgentPrivate *priv = CONNMAN_AGENT_GET_PRIVATE(agent);
736+ GError *error = NULL;
737+
738+ debug(agent, "unregister agent %p", agent);
739+
740+ if (priv->connman_proxy == NULL)
741+ return FALSE;
742+
743+ dbus_g_proxy_call(priv->connman_proxy, "UnregisterAgent", &error,
744+ DBUS_TYPE_G_OBJECT_PATH, priv->path,
745+ G_TYPE_INVALID, G_TYPE_INVALID);
746+
747+ if (error != NULL) {
748+ g_printerr("Agent unregistration failed: %s\n",
749+ error->message);
750+ g_error_free(error);
751+ }
752+
753+ g_object_unref(priv->connman_proxy);
754+ priv->connman_proxy = NULL;
755+
756+ g_free(priv->path);
757+ priv->path = NULL;
758+
759+ return TRUE;
760+}
761+
762+void connman_agent_set_request_input_func(ConnmanAgent *agent,
763+ ConnmanAgentRequestInputFunc func, gpointer data)
764+{
765+ ConnmanAgentPrivate *priv = CONNMAN_AGENT_GET_PRIVATE(agent);
766+
767+ priv->input_func = func;
768+ priv->input_data = data;
769+}
770+
771+void connman_agent_set_cancel_func(ConnmanAgent *agent,
772+ ConnmanAgentCancelFunc func, gpointer data)
773+{
774+ ConnmanAgentPrivate *priv = CONNMAN_AGENT_GET_PRIVATE(agent);
775+
776+ priv->cancel_func = func;
777+ priv->cancel_data = data;
778+}
779+
780+void connman_agent_set_release_func(ConnmanAgent *agent,
781+ ConnmanAgentReleaseFunc func, gpointer data)
782+{
783+ ConnmanAgentPrivate *priv = CONNMAN_AGENT_GET_PRIVATE(agent);
784+
785+ priv->release_func = func;
786+ priv->release_data = data;
787+}
788+
789+void connman_agent_set_debug_func(ConnmanAgent *agent, ConnmanAgentDebugFunc func, gpointer data)
790+{
791+ ConnmanAgentPrivate *priv = CONNMAN_AGENT_GET_PRIVATE(agent);
792+
793+ priv->debug_func = func;
794+ priv->debug_data = data;
795+}
796diff --git a/common/connman-agent.h b/common/connman-agent.h
797new file mode 100644
798index 0000000..0a1aa92
799--- /dev/null
800+++ b/common/connman-agent.h
801@@ -0,0 +1,77 @@
802+/*
803+ * Connection Manager Agent implementation
804+ *
805+ * Author(s):
806+ * - Julien MASSOT <jmassot@aldebaran-robotics.com>
807+ * - Paul Eggleton <paul.eggleton@linux.intel.com>
808+ *
809+ * Copyright (C) 2012 Aldebaran Robotics
810+ * Copyright (C) 2012 Intel Corporation
811+ *
812+ * This library is free software; you can redistribute it and/or
813+ * modify it under the terms of the GNU Lesser General Public
814+ * License version 2.1 as published by the Free Software Foundation.
815+ *
816+ * This library is distributed in the hope that it will be useful,
817+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
818+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
819+ * Lesser General Public License for more details.
820+ *
821+ * You should have received a copy of the GNU Lesser General Public
822+ * License along with this library; if not, write to the Free Software
823+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
824+ */
825+
826+#ifndef CONNMAN_AGENT_H_
827+# define CONNMAN_AGENT_H_
828+
829+#include <glib-object.h>
830+#include <dbus/dbus-glib.h>
831+
832+G_BEGIN_DECLS
833+
834+#define CONNMAN_TYPE_AGENT (connman_agent_get_type())
835+#define CONNMAN_AGENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \
836+ CONNMAN_TYPE_AGENT, ConnmanAgent))
837+#define CONNMAN_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \
838+ CONNMAN_TYPE_AGENT, ConnmanAgentClass))
839+#define CONNMAN_IS_AGENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
840+ CONNMAN_TYPE_AGENT))
841+#define CONNMAN_IS_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), \
842+ CONNMAN_TYPE_AGENT))
843+#define CONNMAN_GET_AGENT_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), \
844+ CONNMAN_TYPE_AGENT, ConnmanAgentClass))
845+
846+typedef struct _ConnmanAgent ConnmanAgent;
847+typedef struct _ConnmanAgentClass ConnmanAgentClass;
848+
849+struct _ConnmanAgent {
850+ GObject parent;
851+};
852+
853+struct _ConnmanAgentClass {
854+ GObjectClass parent_class;
855+};
856+
857+GType connman_agent_get_type(void);
858+
859+ConnmanAgent *connman_agent_new(void);
860+
861+gboolean connman_agent_setup(ConnmanAgent *agent, const char *path);
862+
863+gboolean connman_agent_register(ConnmanAgent *agent);
864+gboolean connman_agent_unregister(ConnmanAgent *agent);
865+gboolean connman_agent_request_input_set_reply(gpointer request_data, GHashTable *reply);
866+gboolean connman_agent_request_input_abort(gpointer request_data);
867+
868+typedef void (*ConnmanAgentRequestInputFunc) (const char *service_id, GHashTable *request, gpointer request_data, gpointer user_data);
869+typedef gboolean (*ConnmanAgentCancelFunc) (DBusGMethodInvocation *context, gpointer data);
870+typedef gboolean (*ConnmanAgentReleaseFunc) (DBusGMethodInvocation *context, gpointer data);
871+typedef void (*ConnmanAgentDebugFunc) (const char *str, gpointer user_data);
872+
873+void connman_agent_set_request_input_func(ConnmanAgent *agent, ConnmanAgentRequestInputFunc func, gpointer data);
874+void connman_agent_set_cancel_func(ConnmanAgent *agent, ConnmanAgentCancelFunc func, gpointer data);
875+void connman_agent_set_debug_func(ConnmanAgent *agent, ConnmanAgentDebugFunc func, gpointer data);
876+
877+G_END_DECLS
878+#endif /* !CONNMAN_AGENT_H_ */
879diff --git a/common/connman-agent.xml b/common/connman-agent.xml
880new file mode 100644
881index 0000000..ed9ee8b
882--- /dev/null
883+++ b/common/connman-agent.xml
884@@ -0,0 +1,26 @@
885+<?xml version="1.0" encoding="UTF-8" ?>
886+
887+<node name="/net/connman/Agent">
888+ <interface name="net.connman.Agent">
889+ <method name="ReportError">
890+ <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
891+ <arg type="o" direction="in"/>
892+ <arg type="s" direction="in"/>
893+ </method>
894+
895+ <method name="RequestInput">
896+ <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
897+ <arg type="o" direction="in"/>
898+ <arg type="a{sv}" direction="in"/>
899+ <arg type="a{sv}" direction="out"/>
900+ </method>
901+
902+ <method name="Cancel">
903+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
904+ </method>
905+
906+ <method name="Release">
907+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
908+ </method>
909+ </interface>
910+</node>
911diff --git a/common/marshal.list b/common/marshal.list
912index 8b174d0..3c6317b 100644
913--- a/common/marshal.list
914+++ b/common/marshal.list
915@@ -1,3 +1,5 @@
916 VOID:STRING,BOXED
917+VOID:OBJECT,BOXED
918+VOID:OBJECT
919 VOID:BOXED
920 VOID:STRING
921--
9221.7.5.4
923
diff --git a/meta/recipes-connectivity/connman/connman-gnome/0005-Remove-all-handling-of-Passphrase-property.patch b/meta/recipes-connectivity/connman/connman-gnome/0005-Remove-all-handling-of-Passphrase-property.patch
new file mode 100644
index 0000000000..bcc435f081
--- /dev/null
+++ b/meta/recipes-connectivity/connman/connman-gnome/0005-Remove-all-handling-of-Passphrase-property.patch
@@ -0,0 +1,249 @@
1From f24d6e26f81e205769cecf0dae7e6cf90b23f9e9 Mon Sep 17 00:00:00 2001
2Message-Id: <f24d6e26f81e205769cecf0dae7e6cf90b23f9e9.1334369310.git.paul.eggleton@linux.intel.com>
3In-Reply-To: <cover.1334369310.git.paul.eggleton@linux.intel.com>
4References: <cover.1334369310.git.paul.eggleton@linux.intel.com>
5From: Paul Eggleton <paul.eggleton@linux.intel.com>
6Date: Sat, 14 Apr 2012 02:37:55 +0100
7Subject: [PATCH 5/6] Remove all handling of Passphrase property
8
9Services no longer have a Passphrase property in ConnMan 0.79 -
10credentials are handled entirely through the agent.
11
12Upstream-Status: Submitted
13
14Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
15---
16 common/connman-client.c | 51 -----------------------------------------------
17 common/connman-client.h | 4 ---
18 common/connman-dbus.c | 11 +---------
19 properties/advanced.h | 1 -
20 properties/wifi.c | 48 --------------------------------------------
21 5 files changed, 1 insertions(+), 114 deletions(-)
22
23diff --git a/common/connman-client.c b/common/connman-client.c
24index e4441ad..dec9867 100644
25--- a/common/connman-client.c
26+++ b/common/connman-client.c
27@@ -112,7 +112,6 @@ static void connman_client_init(ConnmanClient *client)
28 G_TYPE_BOOLEAN, /* favorite */
29 G_TYPE_UINT, /* strength */
30 G_TYPE_STRING, /* security */
31- G_TYPE_STRING, /* passphrase */
32 G_TYPE_STRING, /* method */
33 G_TYPE_STRING, /* address */
34 G_TYPE_STRING, /* netmask */
35@@ -501,56 +500,6 @@ gchar *connman_client_get_security(ConnmanClient *client, const gchar *network)
36 return security;
37 }
38
39-gchar *connman_client_get_passphrase(ConnmanClient *client, const gchar *network)
40-{
41- ConnmanClientPrivate *priv = CONNMAN_CLIENT_GET_PRIVATE(client);
42- GtkTreeIter iter;
43- gchar *passphrase;
44-
45- DBG("client %p", client);
46-
47- if (network == NULL)
48- return NULL;
49-
50- if (connman_dbus_get_iter(priv->store, network, &iter) == FALSE)
51- return NULL;
52-
53- gtk_tree_model_get(GTK_TREE_MODEL(priv->store), &iter,
54- CONNMAN_COLUMN_PASSPHRASE, &passphrase, -1);
55-
56- return passphrase;
57-}
58-
59-gboolean connman_client_set_passphrase(ConnmanClient *client, const gchar *network,
60- const gchar *passphrase)
61-{
62- ConnmanClientPrivate *priv = CONNMAN_CLIENT_GET_PRIVATE(client);
63- DBusGProxy *proxy;
64- GValue value = { 0 };
65- gboolean ret = FALSE;
66-
67- DBG("client %p", client);
68-
69- if (network == NULL)
70- goto done;
71-
72- proxy = connman_dbus_get_proxy(priv->store, network);
73- if (proxy == NULL)
74- goto done;
75-
76- g_value_init(&value, G_TYPE_STRING);
77- g_value_set_string(&value, passphrase);
78-
79- ret = connman_set_property(proxy, "Passphrase", &value, NULL);
80-
81- g_value_unset(&value);
82-
83- g_object_unref(proxy);
84-
85-done:
86- return ret;
87-}
88-
89 void connman_client_set_callback(ConnmanClient *client,
90 ConnmanClientCallback callback, gpointer user_data)
91 {
92diff --git a/common/connman-client.h b/common/connman-client.h
93index 6fe772c..bb36a2f 100644
94--- a/common/connman-client.h
95+++ b/common/connman-client.h
96@@ -77,9 +77,6 @@ void connman_client_disconnect(ConnmanClient *client, const gchar *network);
97 gchar *connman_client_get_security(ConnmanClient *client, const gchar *network);
98 void connman_client_connect_async(ConnmanClient *client, const gchar *network,
99 connman_connect_reply callback, gpointer userdata);
100-gchar *connman_client_get_passphrase(ConnmanClient *client, const gchar *network);
101-gboolean connman_client_set_passphrase(ConnmanClient *client, const gchar *network,
102- const gchar *passphrase);
103 void connman_client_set_remember(ConnmanClient *client, const gchar *network,
104 gboolean remember);
105
106@@ -108,7 +105,6 @@ enum {
107 CONNMAN_COLUMN_FAVORITE, /* G_TYPE_BOOLEAN */
108 CONNMAN_COLUMN_STRENGTH, /* G_TYPE_UINT */
109 CONNMAN_COLUMN_SECURITY, /* G_TYPE_STRING */
110- CONNMAN_COLUMN_PASSPHRASE, /* G_TYPE_STRING */
111 CONNMAN_COLUMN_METHOD, /* G_TYPE_STRING */
112 CONNMAN_COLUMN_ADDRESS, /* G_TYPE_STRING */
113 CONNMAN_COLUMN_NETMASK, /* G_TYPE_STRING */
114diff --git a/common/connman-dbus.c b/common/connman-dbus.c
115index 4eb77b6..f46a750 100644
116--- a/common/connman-dbus.c
117+++ b/common/connman-dbus.c
118@@ -389,11 +389,6 @@ static void service_changed(DBusGProxy *proxy, const char *property,
119 gtk_tree_store_set(store, &iter,
120 CONNMAN_COLUMN_SECURITY, security,
121 -1);
122- } else if (g_str_equal(property, "PassPhrase") == TRUE) {
123- const char *passphrase = value ? g_value_get_string(value) : NULL;
124- gtk_tree_store_set(store, &iter,
125- CONNMAN_COLUMN_PASSPHRASE, passphrase,
126- -1);
127 } else if (g_str_equal(property, "Strength") == TRUE) {
128 guint strength = g_value_get_uchar(value);
129 gtk_tree_store_set(store, &iter,
130@@ -406,7 +401,7 @@ static void service_properties(DBusGProxy *proxy, GHashTable *hash,
131 {
132 GtkTreeStore *store = user_data;
133 GValue *value;
134- const gchar *name, *icon, *passphrase, *security, *state;
135+ const gchar *name, *icon, *security, *state;
136 guint type, strength;
137 gboolean favorite;
138 GtkTreeIter iter;
139@@ -439,9 +434,6 @@ static void service_properties(DBusGProxy *proxy, GHashTable *hash,
140 value = g_hash_table_lookup(hash, "Security");
141 security = value ? g_strjoinv(" ", g_value_get_boxed(value)) : NULL;
142
143- value = g_hash_table_lookup(hash, "PassPhrase");
144- passphrase = value ? g_value_get_string(value) : NULL;
145-
146 DBG("name %s type %d icon %s", name, type, icon);
147
148 value = g_hash_table_lookup(hash, "IPv4.Configuration");
149@@ -499,7 +491,6 @@ static void service_properties(DBusGProxy *proxy, GHashTable *hash,
150 CONNMAN_COLUMN_STATE, state,
151 CONNMAN_COLUMN_FAVORITE, favorite,
152 CONNMAN_COLUMN_SECURITY, security,
153- CONNMAN_COLUMN_PASSPHRASE, passphrase,
154 CONNMAN_COLUMN_STRENGTH, strength,
155 CONNMAN_COLUMN_METHOD, method,
156 CONNMAN_COLUMN_ADDRESS, addr,
157diff --git a/properties/advanced.h b/properties/advanced.h
158index d8f4117..553a15e 100644
159--- a/properties/advanced.h
160+++ b/properties/advanced.h
161@@ -53,7 +53,6 @@ struct config_data {
162 GtkWidget *name;
163 GtkWidget *security;
164 GtkWidget *strength;
165- GtkWidget *passphrase;
166 GtkWidget *connect_info;
167 GtkWidget *connect;
168 GtkWidget *disconnect;
169diff --git a/properties/wifi.c b/properties/wifi.c
170index 038d35a..bd325ef 100644
171--- a/properties/wifi.c
172+++ b/properties/wifi.c
173@@ -57,17 +57,6 @@ static void connect_callback(GtkWidget *editable, gpointer user_data)
174 gboolean ret;
175 gint active;
176
177- if (data->wifi.passphrase) {
178- char *passphrase;
179- passphrase = (gchar *)gtk_entry_get_text(GTK_ENTRY(data->wifi.passphrase));
180- ret = connman_client_set_passphrase(data->client, data->device,
181- passphrase);
182-
183- if (ret == FALSE) {
184- return;
185- }
186- }
187-
188 active = gtk_combo_box_get_active(GTK_COMBO_BOX(data->policy.config));
189 data->ipv4_config.method = active ? "manual" : "dhcp";
190 data->ipv4_config.address = active ? gtk_entry_get_text(GTK_ENTRY(data->ipv4.entry[0])) : NULL;
191@@ -250,22 +239,11 @@ static void wifi_ipconfig(GtkWidget *table, struct config_data *data, GtkTreeIte
192 G_CALLBACK(changed_callback), data);
193 }
194
195-static void toggled_callback(GtkWidget *button, gpointer user_data)
196-{
197- GtkWidget *entry = user_data;
198- gboolean mode;
199-
200- mode = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
201-
202- gtk_entry_set_visibility(GTK_ENTRY(entry), mode);
203-}
204-
205 void add_wifi_service(GtkWidget *mainbox, GtkTreeIter *iter, struct config_data *data)
206 {
207 GtkWidget *vbox;
208 GtkWidget *table;
209 GtkWidget *label;
210- GtkWidget *entry;
211 GtkWidget *button;
212
213 const char *name, *security, *icon, *state;
214@@ -308,32 +286,6 @@ void add_wifi_service(GtkWidget *mainbox, GtkTreeIter *iter, struct config_data
215 gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
216 data->wifi.security = label;
217
218- label = gtk_label_new(_("Passphrase:"));
219- gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, 2, 3);
220-
221- if (g_str_equal(security, "none") != TRUE &&
222- g_str_equal(security, "unknown") != TRUE) {
223- entry = gtk_entry_new();
224- gtk_entry_set_max_length (GTK_ENTRY (entry), 64);
225- gtk_table_attach_defaults(GTK_TABLE(table), entry, 2, 4, 2, 3);
226- gtk_entry_set_visibility(GTK_ENTRY(entry), 0);
227- data->wifi.passphrase = entry;
228-
229- button = gtk_check_button_new_with_label(_("Show input"));
230- gtk_table_attach_defaults(GTK_TABLE(table), button, 4, 5, 2, 3);
231-
232- g_signal_connect(G_OBJECT(button), "toggled",
233- G_CALLBACK(toggled_callback), entry);
234-
235-
236- } else {
237- label = gtk_label_new(_("none"));
238- gtk_table_attach_defaults(GTK_TABLE(table), label, 2, 4, 2, 3);
239- gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
240- gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
241- data->wifi.passphrase = NULL;
242- }
243-
244 label = gtk_label_new(_(""));
245 gtk_table_attach_defaults(GTK_TABLE(table), label, 2, 3, 8, 9);
246 gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
247--
2481.7.5.4
249
diff --git a/meta/recipes-connectivity/connman/connman-gnome/0006-Fix-status-descriptions-in-properties-tree.patch b/meta/recipes-connectivity/connman/connman-gnome/0006-Fix-status-descriptions-in-properties-tree.patch
new file mode 100644
index 0000000000..99a2df81d2
--- /dev/null
+++ b/meta/recipes-connectivity/connman/connman-gnome/0006-Fix-status-descriptions-in-properties-tree.patch
@@ -0,0 +1,42 @@
1From ce510179cba98c906974bdbd6bda2b586b6058c1 Mon Sep 17 00:00:00 2001
2Message-Id: <ce510179cba98c906974bdbd6bda2b586b6058c1.1334369310.git.paul.eggleton@linux.intel.com>
3In-Reply-To: <cover.1334369310.git.paul.eggleton@linux.intel.com>
4References: <cover.1334369310.git.paul.eggleton@linux.intel.com>
5From: Paul Eggleton <paul.eggleton@linux.intel.com>
6Date: Sat, 14 Apr 2012 02:39:15 +0100
7Subject: [PATCH 6/6] Fix status descriptions in properties tree
8
9* configurating -> configuring
10* connnected -> connected
11* Use i18n wrappers
12
13Upstream-Status: Submitted
14
15Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
16---
17 properties/main.c | 6 +++---
18 1 files changed, 3 insertions(+), 3 deletions(-)
19
20diff --git a/properties/main.c b/properties/main.c
21index e266f03..c05f443 100644
22--- a/properties/main.c
23+++ b/properties/main.c
24@@ -332,12 +332,12 @@ static void device_to_text(GtkTreeViewColumn *column, GtkCellRenderer *cell,
25 /* Show the AP name */
26 title = N_(name);
27 if (g_str_equal(state, "association") == TRUE)
28- state = "associating...";
29+ state = _("associating...");
30 else if (g_str_equal(state, "configuration") == TRUE)
31- state = "configurating...";
32+ state = _("configuring...");
33 else if (g_str_equal(state, "ready") == TRUE ||
34 g_str_equal(state, "online") == TRUE)
35- state = "connnected";
36+ state = _("connected");
37 else
38 state = "";
39 markup = g_strdup_printf(" %s\n %s", title, state);
40--
411.7.5.4
42
diff --git a/meta/recipes-connectivity/connman/connman-gnome/3g.patch b/meta/recipes-connectivity/connman/connman-gnome/3g.patch
deleted file mode 100644
index 58fa5e6783..0000000000
--- a/meta/recipes-connectivity/connman/connman-gnome/3g.patch
+++ /dev/null
@@ -1,507 +0,0 @@
1Upstream-Status: Pending
2
3commit 15852e826b0b47f577718ada4b68b63515387f4d
4Author: dongxiao <dongxiao@dongxiao-osel.(none)>
5Date: Wed Jun 1 14:56:16 2011 +0800
6
7 connman-gnome: Add cellular network config option.
8
9 Add cellular network config option in connman-gnome.
10
11 Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
12
13diff --git a/common/connman-client.c b/common/connman-client.c
14index e907cc2..d6be363 100644
15--- a/common/connman-client.c
16+++ b/common/connman-client.c
17@@ -112,9 +112,10 @@ static void connman_client_init(ConnmanClient *client)
18 G_TYPE_STRING, /* address */
19 G_TYPE_STRING, /* netmask */
20 G_TYPE_STRING, /* gateway */
21- G_TYPE_BOOLEAN, /* gateway */
22- G_TYPE_BOOLEAN, /* gateway */
23- G_TYPE_BOOLEAN);/* gateway */
24+ G_TYPE_BOOLEAN, /* ethernet enabled */
25+ G_TYPE_BOOLEAN, /* wifi enabled */
26+ G_TYPE_BOOLEAN, /* cellular enabled */
27+ G_TYPE_BOOLEAN);/* offline */
28
29 g_object_set_data(G_OBJECT(priv->store),
30 "State", g_strdup("unavailable"));
31@@ -218,6 +219,7 @@ static gboolean device_filter(GtkTreeModel *model,
32 switch (type) {
33 case CONNMAN_TYPE_LABEL_ETHERNET:
34 case CONNMAN_TYPE_LABEL_WIFI:
35+ case CONNMAN_TYPE_LABEL_CELLULAR:
36 case CONNMAN_TYPE_SYSCONFIG:
37 return TRUE;
38 }
39diff --git a/common/connman-client.h b/common/connman-client.h
40index 37e86d0..15fa098 100644
41--- a/common/connman-client.h
42+++ b/common/connman-client.h
43@@ -117,6 +117,7 @@ enum {
44
45 CONNMAN_COLUMN_ETHERNET_ENABLED,/* G_TYPE_STRING */
46 CONNMAN_COLUMN_WIFI_ENABLED, /* G_TYPE_STRING */
47+ CONNMAN_COLUMN_CELLULAR_ENABLED,/* G_TYPE_STRING */
48 CONNMAN_COLUMN_OFFLINEMODE, /* G_TYPE_STRING */
49
50 _CONNMAN_NUM_COLUMNS
51@@ -132,6 +133,7 @@ enum {
52
53 CONNMAN_TYPE_LABEL_ETHERNET,
54 CONNMAN_TYPE_LABEL_WIFI,
55+ CONNMAN_TYPE_LABEL_CELLULAR,
56 CONNMAN_TYPE_SYSCONFIG,
57
58 _CONNMAN_NUM_TYPE,
59diff --git a/common/connman-dbus.c b/common/connman-dbus.c
60index b5a635c..0f4e1db 100644
61--- a/common/connman-dbus.c
62+++ b/common/connman-dbus.c
63@@ -208,6 +208,8 @@ static const gchar *type2icon(guint type)
64 case CONNMAN_TYPE_WIFI:
65 case CONNMAN_TYPE_WIMAX:
66 return "network-wireless";
67+ case CONNMAN_TYPE_CELLULAR:
68+ return "network-cellular";
69 case CONNMAN_TYPE_BLUETOOTH:
70 return "bluetooth";
71 }
72@@ -220,6 +222,7 @@ static void enabled_technologies_changed(GtkTreeStore *store, GValue *value)
73 GtkTreeIter iter;
74 gboolean ethernet_enabled_prev, ethernet_enabled = FALSE;
75 gboolean wifi_enabled_prev, wifi_enabled = FALSE;
76+ gboolean cellular_enabled_prev, cellular_enabled = FALSE;
77 gchar **tech = g_value_get_boxed (value);
78 guint i;
79
80@@ -227,10 +230,13 @@ static void enabled_technologies_changed(GtkTreeStore *store, GValue *value)
81 return;
82
83 for (i = 0; i < g_strv_length(tech); i++) {
84+ DBG("technology: %s", *(tech+i));
85 if (g_str_equal("ethernet", *(tech + i)))
86 ethernet_enabled = TRUE;
87 else if (g_str_equal ("wifi", *(tech + i)))
88 wifi_enabled = TRUE;
89+ else if (g_str_equal ("cellular", *(tech + i)))
90+ cellular_enabled = TRUE;
91 }
92
93 get_iter_from_type(store, &iter, CONNMAN_TYPE_LABEL_ETHERNET);
94@@ -246,6 +252,13 @@ static void enabled_technologies_changed(GtkTreeStore *store, GValue *value)
95 if (wifi_enabled_prev != wifi_enabled)
96 gtk_tree_store_set(store, &iter,
97 CONNMAN_COLUMN_WIFI_ENABLED, wifi_enabled, -1);
98+
99+ get_iter_from_type(store, &iter, CONNMAN_TYPE_LABEL_CELLULAR);
100+ gtk_tree_model_get(GTK_TREE_MODEL(store), &iter,
101+ CONNMAN_COLUMN_CELLULAR_ENABLED, &cellular_enabled_prev, -1);
102+ if (cellular_enabled_prev != cellular_enabled)
103+ gtk_tree_store_set(store, &iter,
104+ CONNMAN_COLUMN_CELLULAR_ENABLED, cellular_enabled, -1);
105 }
106
107 static void enabled_technologies_properties(GtkTreeStore *store, DBusGProxy *proxy, GValue *value)
108@@ -253,14 +266,18 @@ static void enabled_technologies_properties(GtkTreeStore *store, DBusGProxy *pro
109 GtkTreeIter iter;
110 gboolean ethernet_enabled = FALSE;
111 gboolean wifi_enabled = FALSE;
112+ gboolean cellular_enabled = FALSE;
113 gchar **tech = g_value_get_boxed (value);
114 guint i;
115
116 for (i = 0; i < g_strv_length (tech); i++) {
117+ DBG("technology: %s", *(tech+i));
118 if (g_str_equal("ethernet", *(tech + i)))
119 ethernet_enabled = TRUE;
120 else if (g_str_equal ("wifi", *(tech + i)))
121 wifi_enabled = TRUE;
122+ else if (g_str_equal ("cellular", *(tech + i)))
123+ cellular_enabled = TRUE;
124 }
125
126 if (get_iter_from_type(store, &iter, CONNMAN_TYPE_LABEL_ETHERNET) == FALSE)
127@@ -280,6 +297,15 @@ static void enabled_technologies_properties(GtkTreeStore *store, DBusGProxy *pro
128 CONNMAN_COLUMN_WIFI_ENABLED, wifi_enabled,
129 CONNMAN_COLUMN_TYPE, CONNMAN_TYPE_LABEL_WIFI,
130 -1);
131+
132+ if (get_iter_from_type(store, &iter, CONNMAN_TYPE_LABEL_CELLULAR) == FALSE)
133+ gtk_tree_store_append(store, &iter, NULL);
134+
135+ gtk_tree_store_set(store, &iter,
136+ CONNMAN_COLUMN_PROXY, proxy,
137+ CONNMAN_COLUMN_CELLULAR_ENABLED, cellular_enabled,
138+ CONNMAN_COLUMN_TYPE, CONNMAN_TYPE_LABEL_CELLULAR,
139+ -1);
140 }
141
142 static void offline_mode_changed(GtkTreeStore *store, GValue *value)
143@@ -497,6 +523,9 @@ static void service_properties(DBusGProxy *proxy, GHashTable *hash,
144 case CONNMAN_TYPE_WIFI:
145 label_type = CONNMAN_TYPE_LABEL_WIFI;
146 break;
147+ case CONNMAN_TYPE_CELLULAR:
148+ label_type = CONNMAN_TYPE_LABEL_CELLULAR;
149+ break;
150 default:
151 label_type = CONNMAN_TYPE_UNKNOWN;
152 break;
153diff --git a/icons/connman-type-cellular.png b/icons/connman-type-cellular.png
154new file mode 100644
155index 0000000..386abd5
156Binary files /dev/null and b/icons/connman-type-cellular.png differ
157diff --git a/properties/Makefile.am b/properties/Makefile.am
158index fc1b8c6..30ae442 100644
159--- a/properties/Makefile.am
160+++ b/properties/Makefile.am
161@@ -1,7 +1,7 @@
162
163 bin_PROGRAMS = connman-properties
164
165-connman_properties_SOURCES = main.c advanced.h ethernet.c wifi.c
166+connman_properties_SOURCES = main.c advanced.h ethernet.c wifi.c cellular.c
167
168 connman_properties_LDADD = $(top_builddir)/common/libcommon.a \
169 @GTK_LIBS@ @DBUS_LIBS@
170diff --git a/properties/advanced.h b/properties/advanced.h
171index 79a1c3c..d8f4117 100644
172--- a/properties/advanced.h
173+++ b/properties/advanced.h
174@@ -59,10 +59,18 @@ struct config_data {
175 GtkWidget *disconnect;
176 } wifi;
177
178+ struct {
179+ GtkWidget *name;
180+ GtkWidget *strength;
181+ GtkWidget *connect_info;
182+ GtkWidget *connect;
183+ GtkWidget *disconnect;
184+ } cellular;
185+
186 GtkWidget *ethernet_button;
187 GtkWidget *wifi_button;
188-
189 GtkWidget *scan_button;
190+ GtkWidget *cellular_button;
191 GtkWidget *offline_button;
192 };
193
194@@ -88,8 +96,11 @@ void update_ethernet_ipv4(struct config_data *data, guint policy);
195 void add_wifi_service(GtkWidget *mainbox, GtkTreeIter *iter, struct config_data *data);
196 void update_wifi_policy(struct config_data *data, guint policy);
197
198+void add_cellular_service(GtkWidget *mainbox, GtkTreeIter *iter, struct config_data *data);
199 void add_ethernet_switch_button(GtkWidget *mainbox, GtkTreeIter *iter,
200 struct config_data *data);
201
202 void add_wifi_switch_button(GtkWidget *mainbox, GtkTreeIter *iter,
203 struct config_data *data);
204+void add_cellular_switch_button(GtkWidget *mainbox, GtkTreeIter *iter,
205+ struct config_data *data);
206diff --git a/properties/cellular.c b/properties/cellular.c
207new file mode 100644
208index 0000000..7bbfb89
209--- /dev/null
210+++ b/properties/cellular.c
211@@ -0,0 +1,175 @@
212+/*
213+ *
214+ * Connection Manager
215+ *
216+ * Copyright (C) 2011 Intel Corporation. All rights reserved.
217+ *
218+ * This program is free software; you can redistribute it and/or modify
219+ * it under the terms of the GNU General Public License version 2 as
220+ * published by the Free Software Foundation.
221+ *
222+ * This program is distributed in the hope that it will be useful,
223+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
224+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
225+ * GNU General Public License for more details.
226+ *
227+ * You should have received a copy of the GNU General Public License
228+ * along with this program; if not, write to the Free Software
229+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
230+ *
231+ */
232+
233+#ifdef HAVE_CONFIG_H
234+#include <config.h>
235+#endif
236+
237+#include <dbus/dbus-glib.h>
238+#include <glib/gi18n.h>
239+#include <gtk/gtk.h>
240+
241+#include "connman-client.h"
242+
243+#include "advanced.h"
244+
245+static void connect_reply_cb(DBusGProxy *proxy, GError *error,
246+ gpointer user_data)
247+{
248+ if (error)
249+ g_error_free(error);
250+}
251+
252+static void connect_callback(GtkWidget *editable, gpointer user_data)
253+{
254+ struct config_data *data = user_data;
255+
256+ connman_client_connect_async(data->client, data->device, connect_reply_cb, data);
257+}
258+
259+
260+static void disconnect_callback(GtkWidget *editable, gpointer user_data)
261+{
262+ struct config_data *data = user_data;
263+
264+ connman_client_disconnect(data->client, data->device);
265+}
266+
267+static void switch_callback(GtkWidget *editable, gpointer user_data)
268+{
269+ struct config_data *data = user_data;
270+ const gchar *label = gtk_button_get_label(GTK_BUTTON(data->cellular_button));
271+
272+ if (g_str_equal(label, "Disable"))
273+ connman_client_disable_technology(data->client, data->device, "cellular");
274+ else
275+ connman_client_enable_technology(data->client, data->device, "cellular");
276+}
277+
278+void add_cellular_switch_button(GtkWidget *mainbox, GtkTreeIter *iter,
279+ struct config_data *data)
280+{
281+ GtkWidget *vbox;
282+ GtkWidget *table;
283+ GtkWidget *label;
284+ GtkWidget *buttonbox;
285+ GtkWidget *button;
286+ gboolean cellular_enabled;
287+
288+ gtk_tree_model_get(data->model, iter,
289+ CONNMAN_COLUMN_CELLULAR_ENABLED, &cellular_enabled,
290+ -1);
291+
292+ vbox = gtk_vbox_new(TRUE, 0);
293+ gtk_container_set_border_width(GTK_CONTAINER(vbox), 24);
294+ gtk_box_pack_start(GTK_BOX(mainbox), vbox, FALSE, FALSE, 0);
295+
296+ table = gtk_table_new(1, 1, TRUE);
297+ gtk_table_set_row_spacings(GTK_TABLE(table), 10);
298+ gtk_table_set_col_spacings(GTK_TABLE(table), 10);
299+ gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
300+
301+ label = gtk_label_new(_("Configure Cellular Networks."));
302+ gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1);
303+
304+ buttonbox = gtk_hbutton_box_new();
305+ gtk_button_box_set_layout(GTK_BUTTON_BOX(buttonbox), GTK_BUTTONBOX_CENTER);
306+ gtk_box_pack_start(GTK_BOX(mainbox), buttonbox, FALSE, FALSE, 0);
307+
308+ button = gtk_button_new();
309+ data->cellular_button = button;
310+
311+ if (cellular_enabled)
312+ gtk_button_set_label(GTK_BUTTON(button), _("Disable"));
313+ else
314+ gtk_button_set_label(GTK_BUTTON(button), _("Enable"));
315+
316+ gtk_container_add(GTK_CONTAINER(buttonbox), button);
317+ g_signal_connect(G_OBJECT(button), "clicked",
318+ G_CALLBACK(switch_callback), data);
319+}
320+
321+void add_cellular_service(GtkWidget *mainbox, GtkTreeIter *iter, struct config_data *data)
322+{
323+ GtkWidget *vbox;
324+ GtkWidget *table;
325+ GtkWidget *label;
326+ GtkWidget *button;
327+
328+ const char *name, *icon, *state;
329+ guint strength;
330+
331+ gtk_tree_model_get(data->model, iter,
332+ CONNMAN_COLUMN_NAME, &name,
333+ CONNMAN_COLUMN_ICON, &icon,
334+ CONNMAN_COLUMN_STATE, &state,
335+ CONNMAN_COLUMN_STRENGTH, &strength,
336+ -1);
337+
338+ if (g_str_equal(state, "failure") == TRUE)
339+ connman_client_remove(data->client, data->device);
340+
341+ vbox = gtk_vbox_new(TRUE, 0);
342+ gtk_container_set_border_width(GTK_CONTAINER(vbox), 24);
343+ gtk_box_pack_start(GTK_BOX(mainbox), vbox, FALSE, FALSE, 0);
344+
345+ table = gtk_table_new(4, 8, TRUE);
346+ gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
347+ data->table = table;
348+
349+ label = gtk_label_new(_("Access Point:"));
350+ gtk_table_attach_defaults(GTK_TABLE(table), label, 3, 4, 0, 1);
351+
352+ label = gtk_label_new(_(name));
353+ gtk_table_attach_defaults(GTK_TABLE(table), label, 4, 5, 0, 1);
354+ gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
355+ gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
356+ data->cellular.name = label;
357+
358+ label = gtk_label_new(_(""));
359+ gtk_table_attach_defaults(GTK_TABLE(table), label, 3, 5, 2, 3);
360+ gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
361+ gtk_widget_hide(label);
362+ data->cellular.connect_info = label;
363+
364+ button = gtk_button_new_with_label(_("Connect"));
365+ gtk_table_attach_defaults(GTK_TABLE(table), button, 3, 5, 3, 4);
366+ g_signal_connect(G_OBJECT(button), "clicked",
367+ G_CALLBACK(connect_callback), data);
368+ gtk_widget_set_no_show_all(button, TRUE);
369+ data->cellular.connect = button;
370+
371+ button = gtk_button_new_with_label(_("Disconnect"));
372+ gtk_table_attach_defaults(GTK_TABLE(table), button, 3, 5, 3, 4);
373+ g_signal_connect(G_OBJECT(button), "clicked",
374+ G_CALLBACK(disconnect_callback), data);
375+ data->cellular.disconnect = button;
376+ gtk_widget_set_no_show_all(button, TRUE);
377+
378+ if (g_str_equal(state, "failure") == TRUE
379+ || g_str_equal(state, "idle") == TRUE) {
380+ gtk_widget_show(data->cellular.connect);
381+ gtk_widget_hide(data->cellular.disconnect);
382+ } else {
383+ gtk_widget_hide(data->cellular.connect);
384+ gtk_widget_show(data->cellular.disconnect);
385+ }
386+}
387diff --git a/properties/main.c b/properties/main.c
388index a09c721..ec36aef 100644
389--- a/properties/main.c
390+++ b/properties/main.c
391@@ -42,6 +42,7 @@ static void status_update(GtkTreeModel *model, GtkTreePath *path,
392 const char *name = NULL, *_name = NULL, *state = NULL;
393 gboolean ethernet_enabled;
394 gboolean wifi_enabled;
395+ gboolean cellular_enabled;
396 gboolean offline_mode;
397
398 gtk_tree_model_get(model, iter,
399@@ -50,6 +51,7 @@ static void status_update(GtkTreeModel *model, GtkTreePath *path,
400 CONNMAN_COLUMN_TYPE, &type,
401 CONNMAN_COLUMN_ETHERNET_ENABLED, &ethernet_enabled,
402 CONNMAN_COLUMN_WIFI_ENABLED, &wifi_enabled,
403+ CONNMAN_COLUMN_CELLULAR_ENABLED, &cellular_enabled,
404 CONNMAN_COLUMN_OFFLINEMODE, &offline_mode,
405 -1);
406
407@@ -75,6 +77,29 @@ static void status_update(GtkTreeModel *model, GtkTreePath *path,
408 gtk_widget_hide(data->wifi.connect);
409 gtk_widget_show(data->wifi.disconnect);
410 }
411+ } else if (type == CONNMAN_TYPE_CELLULAR) {
412+ if (data->cellular.name)
413+ _name = gtk_label_get_text(GTK_LABEL(data->cellular.name));
414+
415+ if (!(name && _name && g_str_equal(name, _name)))
416+ return;
417+
418+ if (g_str_equal(state, "failure") == TRUE) {
419+ gtk_label_set_text(GTK_LABEL(data->cellular.connect_info),
420+ _("connection failed"));
421+ gtk_widget_show(data->cellular.connect_info);
422+ gtk_widget_show(data->cellular.connect);
423+ gtk_widget_hide(data->cellular.disconnect);
424+ } else if (g_str_equal(state, "idle") == TRUE) {
425+ gtk_widget_hide(data->cellular.connect_info);
426+ gtk_widget_show(data->cellular.connect);
427+ gtk_widget_hide(data->cellular.disconnect);
428+ } else {
429+ gtk_widget_hide(data->cellular.connect_info);
430+ gtk_widget_hide(data->cellular.connect);
431+ gtk_widget_show(data->cellular.disconnect);
432+ }
433+
434 } else if (type == CONNMAN_TYPE_LABEL_ETHERNET) {
435 if (!data->ethernet_button)
436 return;
437@@ -92,6 +117,13 @@ static void status_update(GtkTreeModel *model, GtkTreePath *path,
438 gtk_button_set_label(GTK_BUTTON(data->wifi_button), _("Enable"));
439 gtk_widget_set_sensitive(data->scan_button, 0);
440 }
441+ } else if (type == CONNMAN_TYPE_LABEL_CELLULAR) {
442+ if (!data->cellular_button)
443+ return;
444+ if (cellular_enabled)
445+ gtk_button_set_label(GTK_BUTTON(data->cellular_button), _("Disable"));
446+ else
447+ gtk_button_set_label(GTK_BUTTON(data->cellular_button), _("Enable"));
448 } else if (type == CONNMAN_TYPE_SYSCONFIG) {
449 if (!data->offline_button)
450 return;
451@@ -100,7 +132,6 @@ static void status_update(GtkTreeModel *model, GtkTreePath *path,
452 else
453 gtk_button_set_label(GTK_BUTTON(data->offline_button), _("OfflineMode"));
454 }
455-
456 }
457
458 static void set_offline_callback(GtkWidget *button, gpointer user_data)
459@@ -207,12 +238,18 @@ static struct config_data *create_config(GtkTreeModel *model,
460 case CONNMAN_TYPE_WIFI:
461 add_wifi_service(mainbox, iter, data);
462 break;
463+ case CONNMAN_TYPE_CELLULAR:
464+ add_cellular_service(mainbox, iter, data);
465+ break;
466 case CONNMAN_TYPE_LABEL_ETHERNET:
467 add_ethernet_switch_button(mainbox, iter, data);
468 break;
469 case CONNMAN_TYPE_LABEL_WIFI:
470 add_wifi_switch_button(mainbox, iter, data);
471 break;
472+ case CONNMAN_TYPE_LABEL_CELLULAR:
473+ add_cellular_switch_button(mainbox, iter, data);
474+ break;
475 case CONNMAN_TYPE_SYSCONFIG:
476 add_system_config(mainbox, iter, data);
477 break;
478@@ -295,6 +332,7 @@ static void device_to_text(GtkTreeViewColumn *column, GtkCellRenderer *cell,
479 markup = g_strdup_printf(" %s\n", title);
480 break;
481 case CONNMAN_TYPE_WIFI:
482+ case CONNMAN_TYPE_CELLULAR:
483 /* Show the AP name */
484 title = N_(name);
485 if (g_str_equal(state, "association") == TRUE)
486@@ -324,6 +362,10 @@ static void device_to_text(GtkTreeViewColumn *column, GtkCellRenderer *cell,
487 title = N_("Wireless Networks");
488 markup = g_strdup_printf("<b>\n%s\n</b>", title);
489 break;
490+ case CONNMAN_TYPE_LABEL_CELLULAR:
491+ title = N_("Cellular Networks");
492+ markup = g_strdup_printf("<b>\n%s\n</b>", title);
493+ break;
494 case CONNMAN_TYPE_SYSCONFIG:
495 title = N_("System Configuration");
496 markup = g_strdup_printf("<b>\n%s\n</b>", title);
497@@ -362,6 +404,10 @@ static void type_to_icon(GtkTreeViewColumn *column, GtkCellRenderer *cell,
498 g_object_set(cell, "icon-name", "network-wireless",
499 "stock-size", 4, NULL);
500 break;
501+ case CONNMAN_TYPE_LABEL_CELLULAR:
502+ g_object_set(cell, "icon-name", "network-cellular",
503+ "stock-size", 4, NULL);
504+ break;
505 default:
506 g_object_set(cell, "icon-name", NULL, NULL);
507 break;
diff --git a/meta/recipes-connectivity/connman/connman-gnome/security-type.patch b/meta/recipes-connectivity/connman/connman-gnome/security-type.patch
deleted file mode 100644
index a75d696f05..0000000000
--- a/meta/recipes-connectivity/connman/connman-gnome/security-type.patch
+++ /dev/null
@@ -1,41 +0,0 @@
1From ec36df9d1fbb6dcbf0d1e79245ffe213049ecd5a Mon Sep 17 00:00:00 2001
2From: Dongxiao Xu <dongxiao.xu@intel.com>
3Date: Wed, 3 Aug 2011 14:33:07 +0800
4Subject: [PATCH] connman-dbus: fix security type mismatch
5
6Latest connman change the Security type to be array{String}, fix
7connman-gnome accordingly.
8
9Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
10---
11 common/connman-dbus.c | 5 +++--
12 1 files changed, 3 insertions(+), 2 deletions(-)
13
14Upstream-Status: Pending
15
16diff --git a/common/connman-dbus.c b/common/connman-dbus.c
17index 0f4e1db..0ac8ed5 100644
18--- a/common/connman-dbus.c
19+++ b/common/connman-dbus.c
20@@ -384,7 +384,8 @@ static void service_changed(DBusGProxy *proxy, const char *property,
21 gtk_tree_store_set(store, &iter,
22 CONNMAN_COLUMN_FAVORITE, favorite, -1);
23 } else if (g_str_equal(property, "Security") == TRUE) {
24- const char *security = value ? g_value_get_string(value) : NULL;
25+ const char **array = value ? g_value_get_boxed(value) : NULL;
26+ const char *security = g_strjoinv(" ", array);
27 gtk_tree_store_set(store, &iter,
28 CONNMAN_COLUMN_SECURITY, security,
29 -1);
30@@ -487,7 +488,7 @@ static void service_properties(DBusGProxy *proxy, GHashTable *hash,
31 strength = value ? g_value_get_uchar(value) : 0;
32
33 value = g_hash_table_lookup(hash, "Security");
34- security = value ? g_value_get_string(value) : NULL;
35+ security = value ? g_strjoinv(" ", g_value_get_boxed(value)) : NULL;
36
37 value = g_hash_table_lookup(hash, "PassPhrase");
38 passphrase = value ? g_value_get_string(value) : NULL;
39--
401.7.1
41