summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/connman
diff options
context:
space:
mode:
authorDongxiao Xu <dongxiao.xu@intel.com>2010-09-10 08:49:14 (GMT)
committerRichard Purdie <rpurdie@linux.intel.com>2010-09-10 10:52:50 (GMT)
commit30c2b0bb84f215b2aed43d774120c70712b59729 (patch)
treebaccf810252efbc3feb7f938d57c3bb6bae03a95 /meta/recipes-connectivity/connman
parent566de26cf56d6aaea017315cb927d42ed00b3c96 (diff)
downloadpoky-30c2b0bb84f215b2aed43d774120c70712b59729.tar.gz
connman-gnome: Add some functionality.
Add offline mode. Add ethernet/wifi enable/disable functionality. Classify each service (ethernet, wifi) into certain group. Do some code clean up. Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
Diffstat (limited to 'meta/recipes-connectivity/connman')
-rw-r--r--meta/recipes-connectivity/connman/connman-gnome/connman-gnome.patch1716
-rw-r--r--meta/recipes-connectivity/connman/connman-gnome_0.5.bb2
2 files changed, 1134 insertions, 584 deletions
diff --git a/meta/recipes-connectivity/connman/connman-gnome/connman-gnome.patch b/meta/recipes-connectivity/connman/connman-gnome/connman-gnome.patch
index 52b105e..2fe8bb8 100644
--- a/meta/recipes-connectivity/connman/connman-gnome/connman-gnome.patch
+++ b/meta/recipes-connectivity/connman/connman-gnome/connman-gnome.patch
@@ -12,13 +12,23 @@ end user.
12Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com> 12Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
13 13
14diff --git a/applet/main.c b/applet/main.c 14diff --git a/applet/main.c b/applet/main.c
15index 2a9b36e..1243a41 100644 15index 2a9b36e..08d394c 100644
16--- a/applet/main.c 16--- a/applet/main.c
17+++ b/applet/main.c 17+++ b/applet/main.c
18@@ -108,138 +108,8 @@ static void toggled_callback(GtkWidget *button, gpointer user_data) 18@@ -98,279 +98,21 @@ static void settings_callback(GtkWidget *item, gpointer user_data)
19 gtk_entry_set_visibility(GTK_ENTRY(entry), mode); 19 g_printerr("Couldn't execute command: %s\n", command);
20 } 20 }
21 21
22-static void toggled_callback(GtkWidget *button, gpointer user_data)
23-{
24- GtkWidget *entry = user_data;
25- gboolean mode;
26-
27- mode = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
28-
29- gtk_entry_set_visibility(GTK_ENTRY(entry), mode);
30-}
31-
22-static void passphrase_dialog(const char *path, const char *name) 32-static void passphrase_dialog(const char *path, const char *name)
23-{ 33-{
24- GtkWidget *dialog; 34- GtkWidget *dialog;
@@ -149,25 +159,49 @@ index 2a9b36e..1243a41 100644
149- return menu; 159- return menu;
150-} 160-}
151- 161-
152 static GtkWidget *append_menuitem(GtkMenu *menu, const char *ssid, 162-static GtkWidget *append_menuitem(GtkMenu *menu, const char *ssid,
153- guint security, guint strength) 163- guint security, guint strength)
154+ gchar *security, guint strength) 164-{
155 { 165- GtkWidget *item;
156 GtkWidget *item; 166- GtkWidget *hbox;
157 GtkWidget *hbox; 167- GtkWidget *label;
158@@ -263,7 +133,7 @@ static GtkWidget *append_menuitem(GtkMenu *menu, const char *ssid, 168- GtkWidget *image;
159 image = gtk_image_new_from_stock(GTK_STOCK_DIALOG_AUTHENTICATION, 169- GtkWidget *progress;
160 GTK_ICON_SIZE_MENU); 170-
161 gtk_misc_set_alignment(GTK_MISC(image), 1.0, 0.5); 171- item = gtk_check_menu_item_new();
172- gtk_check_menu_item_set_draw_as_radio(GTK_CHECK_MENU_ITEM(item), TRUE);
173-
174- hbox = gtk_hbox_new(FALSE, 6);
175- gtk_container_add(GTK_CONTAINER(item), hbox);
176- gtk_widget_show(hbox);
177-
178- label = gtk_label_new(NULL);
179- gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
180- gtk_label_set_text(GTK_LABEL(label), ssid);
181- gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0);
182- gtk_widget_show(label);
183-
184- image = gtk_image_new_from_stock(GTK_STOCK_DIALOG_AUTHENTICATION,
185- GTK_ICON_SIZE_MENU);
186- gtk_misc_set_alignment(GTK_MISC(image), 1.0, 0.5);
162- if (security != CONNMAN_SECURITY_NONE) { 187- if (security != CONNMAN_SECURITY_NONE) {
163+ if (security && g_str_equal(security, "none") != TRUE) { 188- gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0);
164 gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0); 189- gtk_widget_show(image);
165 gtk_widget_show(image); 190- }
166 } 191-
167@@ -281,96 +151,21 @@ static GtkWidget *append_menuitem(GtkMenu *menu, const char *ssid, 192- progress = gtk_progress_bar_new();
168 return item; 193- gtk_widget_set_size_request(progress, 100, -1);
169 } 194- gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress),
170 195- (double) strength / 100);
196- gtk_box_pack_end(GTK_BOX(hbox), progress, FALSE, TRUE, 0);
197- gtk_widget_show(progress);
198-
199- gtk_widget_show(item);
200- gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
201-
202- return item;
203-}
204-
171-static void enumerate_networks(GtkMenu *menu, 205-static void enumerate_networks(GtkMenu *menu,
172- GtkTreeModel *model, GtkTreeIter *parent) 206- GtkTreeModel *model, GtkTreeIter *parent)
173-{ 207-{
@@ -265,7 +299,7 @@ index 2a9b36e..1243a41 100644
265 gtk_widget_show(item); 299 gtk_widget_show(item);
266 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); 300 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
267 301
268@@ -387,16 +182,17 @@ static void update_status(GtkTreeModel *model) 302@@ -387,16 +129,17 @@ static void update_status(GtkTreeModel *model)
269 cont = gtk_tree_model_get_iter_first(model, &iter); 303 cont = gtk_tree_model_get_iter_first(model, &iter);
270 304
271 while (cont == TRUE) { 305 while (cont == TRUE) {
@@ -286,7 +320,7 @@ index 2a9b36e..1243a41 100644
286 break; 320 break;
287 321
288 cont = gtk_tree_model_iter_next(model, &iter); 322 cont = gtk_tree_model_iter_next(model, &iter);
289@@ -453,7 +249,7 @@ int main(int argc, char *argv[]) 323@@ -453,7 +196,7 @@ int main(int argc, char *argv[])
290 324
291 g_set_application_name(_("Connection Manager")); 325 g_set_application_name(_("Connection Manager"));
292 326
@@ -393,10 +427,10 @@ index ff3a996..8d74a46 100644
393 connman-dbus-glue.h \ 427 connman-dbus-glue.h \
394 instance-glue.h 428 instance-glue.h
395diff --git a/common/connman-client.c b/common/connman-client.c 429diff --git a/common/connman-client.c b/common/connman-client.c
396index aad0a22..96f9388 100644 430index aad0a22..4f9cf64 100644
397--- a/common/connman-client.c 431--- a/common/connman-client.c
398+++ b/common/connman-client.c 432+++ b/common/connman-client.c
399@@ -98,10 +98,9 @@ static void connman_client_init(ConnmanClient *client) 433@@ -98,13 +98,13 @@ static void connman_client_init(ConnmanClient *client)
400 434
401 priv->store = gtk_tree_store_new(_CONNMAN_NUM_COLUMNS, G_TYPE_OBJECT, 435 priv->store = gtk_tree_store_new(_CONNMAN_NUM_COLUMNS, G_TYPE_OBJECT,
402 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT, 436 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT,
@@ -406,11 +440,33 @@ index aad0a22..96f9388 100644
406- G_TYPE_STRING); 440- G_TYPE_STRING);
407+ G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING, 441+ G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING,
408+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, 442+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
409+ G_TYPE_STRING, G_TYPE_STRING); 443+ G_TYPE_STRING, G_TYPE_STRING,
444+ G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN);
410 445
411 g_object_set_data(G_OBJECT(priv->store), 446 g_object_set_data(G_OBJECT(priv->store),
412 "State", g_strdup("unavailable")); 447- "State", g_strdup("unavailable"));
413@@ -197,7 +196,7 @@ static gboolean device_filter(GtkTreeModel *model, 448+ "State", g_strdup("unavailable"));
449
450 priv->dbus = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS,
451 DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
452@@ -191,13 +191,23 @@ static gboolean device_filter(GtkTreeModel *model,
453 {
454 DBusGProxy *proxy;
455 gboolean active;
456+ guint type;
457
458- gtk_tree_model_get(model, iter, CONNMAN_COLUMN_PROXY, &proxy, -1);
459+ gtk_tree_model_get(model, iter, CONNMAN_COLUMN_PROXY, &proxy,
460+ CONNMAN_COLUMN_TYPE, &type,
461+ -1);
462+
463+ switch (type) {
464+ case CONNMAN_TYPE_LABEL_ETHERNET:
465+ case CONNMAN_TYPE_LABEL_WIFI:
466+ case CONNMAN_TYPE_SYSCONFIG:
467+ return TRUE;
468+ }
469
414 if (proxy == NULL) 470 if (proxy == NULL)
415 return FALSE; 471 return FALSE;
416 472
@@ -419,7 +475,7 @@ index aad0a22..96f9388 100644
419 dbus_g_proxy_get_interface(proxy)); 475 dbus_g_proxy_get_interface(proxy));
420 476
421 g_object_unref(proxy); 477 g_object_unref(proxy);
422@@ -231,10 +230,10 @@ static gboolean device_network_filter(GtkTreeModel *model, 478@@ -231,10 +241,10 @@ static gboolean device_network_filter(GtkTreeModel *model,
423 if (proxy == NULL) 479 if (proxy == NULL)
424 return FALSE; 480 return FALSE;
425 481
@@ -432,7 +488,7 @@ index aad0a22..96f9388 100644
432 dbus_g_proxy_get_interface(proxy)); 488 dbus_g_proxy_get_interface(proxy));
433 489
434 g_object_unref(proxy); 490 g_object_unref(proxy);
435@@ -277,7 +276,7 @@ GtkTreeModel *connman_client_get_network_model(ConnmanClient *client, 491@@ -277,7 +287,7 @@ GtkTreeModel *connman_client_get_network_model(ConnmanClient *client,
436 gtk_tree_model_get(GTK_TREE_MODEL(priv->store), &iter, 492 gtk_tree_model_get(GTK_TREE_MODEL(priv->store), &iter,
437 CONNMAN_COLUMN_PROXY, &proxy, -1); 493 CONNMAN_COLUMN_PROXY, &proxy, -1);
438 494
@@ -441,7 +497,7 @@ index aad0a22..96f9388 100644
441 dbus_g_proxy_get_interface(proxy)) == TRUE) 497 dbus_g_proxy_get_interface(proxy)) == TRUE)
442 found = g_str_has_prefix(dbus_g_proxy_get_path(proxy), 498 found = g_str_has_prefix(dbus_g_proxy_get_path(proxy),
443 device); 499 device);
444@@ -314,7 +313,7 @@ static gboolean connection_filter(GtkTreeModel *model, 500@@ -314,7 +324,7 @@ static gboolean connection_filter(GtkTreeModel *model,
445 if (proxy == NULL) 501 if (proxy == NULL)
446 return FALSE; 502 return FALSE;
447 503
@@ -450,13 +506,13 @@ index aad0a22..96f9388 100644
450 dbus_g_proxy_get_interface(proxy)); 506 dbus_g_proxy_get_interface(proxy));
451 507
452 g_object_unref(proxy); 508 g_object_unref(proxy);
453@@ -337,12 +336,19 @@ GtkTreeModel *connman_client_get_connection_model(ConnmanClient *client) 509@@ -337,28 +347,37 @@ GtkTreeModel *connman_client_get_connection_model(ConnmanClient *client)
454 return model; 510 return model;
455 } 511 }
456 512
457-void connman_client_set_policy(ConnmanClient *client, const gchar *device, 513-void connman_client_set_policy(ConnmanClient *client, const gchar *device,
458- const gchar *policy) 514- const gchar *policy)
459+void connman_client_set_ipv4(ConnmanClient *client, const gchar *device, 515+gboolean connman_client_set_ipv4(ConnmanClient *client, const gchar *device,
460+ struct ipv4_config *ipv4_config) 516+ struct ipv4_config *ipv4_config)
461 { 517 {
462 ConnmanClientPrivate *priv = CONNMAN_CLIENT_GET_PRIVATE(client); 518 ConnmanClientPrivate *priv = CONNMAN_CLIENT_GET_PRIVATE(client);
@@ -472,9 +528,14 @@ index aad0a22..96f9388 100644
472 528
473 DBG("client %p", client); 529 DBG("client %p", client);
474 530
475@@ -353,10 +359,10 @@ void connman_client_set_policy(ConnmanClient *client, const gchar *device, 531 if (device == NULL)
532- return;
533+ return FALSE;
534
535 proxy = connman_dbus_get_proxy(priv->store, device);
476 if (proxy == NULL) 536 if (proxy == NULL)
477 return; 537- return;
538+ return FALSE;
478 539
479- g_value_init(&value, G_TYPE_STRING); 540- g_value_init(&value, G_TYPE_STRING);
480- g_value_set_string(&value, policy); 541- g_value_set_string(&value, policy);
@@ -485,43 +546,96 @@ index aad0a22..96f9388 100644
485+ ret = connman_set_property(proxy, "IPv4.Configuration", &value, NULL); 546+ ret = connman_set_property(proxy, "IPv4.Configuration", &value, NULL);
486 547
487 g_object_unref(proxy); 548 g_object_unref(proxy);
549+
550+ return ret;
488 } 551 }
489@@ -389,26 +395,22 @@ static gboolean device_scan(GtkTreeModel *model, GtkTreePath *path, 552
490 GtkTreeIter *iter, gpointer user_data) 553 void connman_client_set_powered(ConnmanClient *client, const gchar *device,
554@@ -385,98 +404,128 @@ void connman_client_set_powered(ConnmanClient *client, const gchar *device,
555 g_object_unref(proxy);
556 }
557
558-static gboolean device_scan(GtkTreeModel *model, GtkTreePath *path,
559- GtkTreeIter *iter, gpointer user_data)
560+void connman_client_request_scan(ConnmanClient *client, char *scantype,
561+ connman_request_scan_reply callback, gpointer userdata)
491 { 562 {
492 DBusGProxy *proxy; 563- DBusGProxy *proxy;
493- gboolean enabled; 564- gboolean enabled;
565+ ConnmanClientPrivate *priv = CONNMAN_CLIENT_GET_PRIVATE(client);
494 566
495 gtk_tree_model_get(model, iter, CONNMAN_COLUMN_PROXY, &proxy, 567- gtk_tree_model_get(model, iter, CONNMAN_COLUMN_PROXY, &proxy,
496- CONNMAN_COLUMN_ENABLED, &enabled, -1); 568- CONNMAN_COLUMN_ENABLED, &enabled, -1);
497+ -1); 569+ DBG("client %p", client);
498 570
499 if (proxy == NULL) 571- if (proxy == NULL)
500 return FALSE; 572- return FALSE;
573+ connman_request_scan_async(priv->manager, scantype, callback, userdata);
574+}
501 575
502 if (g_str_equal(dbus_g_proxy_get_interface(proxy), 576- if (g_str_equal(dbus_g_proxy_get_interface(proxy),
503- CONNMAN_DEVICE_INTERFACE) == FALSE) 577- CONNMAN_DEVICE_INTERFACE) == FALSE)
504- return FALSE; 578- return FALSE;
505- 579+gboolean connman_client_get_offline_status(ConnmanClient *client)
580+{
581+ GHashTable *hash;
582+ GValue *value;
583+ ConnmanClientPrivate *priv = CONNMAN_CLIENT_GET_PRIVATE(client);
584+ gboolean ret;
585
506- if (enabled == FALSE) 586- if (enabled == FALSE)
507+ CONNMAN_SERVICE_INTERFACE) == FALSE) 587- return FALSE;
508 return FALSE; 588+ DBG("client %p", client);
509 589
510 connman_propose_scan(proxy, NULL); 590- connman_propose_scan(proxy, NULL);
591+ ret = connman_get_properties(priv->manager, &hash, NULL);
511 592
512 g_object_unref(proxy); 593- g_object_unref(proxy);
594+ if (ret == FALSE)
595+ goto done;
596+
597+ value = g_hash_table_lookup(hash, "OfflineMode");
598+ ret = value ? g_value_get_boolean(value) : FALSE;
599+
600+done:
601+ return ret;
513 602
514- return FALSE; 603- return FALSE;
515+ return TRUE;
516 } 604 }
517 605
518 void connman_client_propose_scan(ConnmanClient *client, const gchar *device) 606-void connman_client_propose_scan(ConnmanClient *client, const gchar *device)
519@@ -437,46 +439,85 @@ static gboolean network_disconnect(GtkTreeModel *model, GtkTreePath *path, 607+void connman_client_set_offlinemode(ConnmanClient *client, gboolean status)
608 {
609 ConnmanClientPrivate *priv = CONNMAN_CLIENT_GET_PRIVATE(client);
610- DBusGProxy *proxy;
611+ GValue value = { 0 };
612
613 DBG("client %p", client);
614
615- if (device == NULL) {
616- gtk_tree_model_foreach(GTK_TREE_MODEL(priv->store),
617- device_scan, NULL);
618- return;
619- }
620-
621- proxy = connman_dbus_get_proxy(priv->store, device);
622- if (proxy == NULL)
623- return;
624-
625- connman_propose_scan(proxy, NULL);
626+ g_value_init(&value, G_TYPE_BOOLEAN);
627+ g_value_set_boolean(&value, status);
628
629- g_object_unref(proxy);
630+ connman_set_property(priv->manager, "OfflineMode", &value, NULL);
631 }
632
633 static gboolean network_disconnect(GtkTreeModel *model, GtkTreePath *path,
520 GtkTreeIter *iter, gpointer user_data) 634 GtkTreeIter *iter, gpointer user_data)
521 { 635 {
522 DBusGProxy *proxy; 636 DBusGProxy *proxy;
523- gboolean enabled; 637- gboolean enabled;
524+ gchar *name; 638+ char *name;
525+ guint type; 639+ guint type;
526 640
527 gtk_tree_model_get(model, iter, CONNMAN_COLUMN_PROXY, &proxy, 641 gtk_tree_model_get(model, iter, CONNMAN_COLUMN_PROXY, &proxy,
@@ -600,20 +714,14 @@ index aad0a22..96f9388 100644
600+ if (proxy == NULL) 714+ if (proxy == NULL)
601+ goto done; 715+ goto done;
602+ 716+
603+ /* Set an unusually long timeout because the Connect
604+ * method doesn't return until there has been either
605+ * success or an error.
606+ */
607+ dbus_g_proxy_set_default_timeout(proxy, 120000);
608+ connman_connect_async(proxy, callback, userdata); 717+ connman_connect_async(proxy, callback, userdata);
609+ dbus_g_proxy_set_default_timeout(proxy, -1);
610+ 718+
611+done: 719+done:
612+ return; 720+ return;
613 } 721 }
614 722
615 static void connman_client_disconnect_all(ConnmanClient *client) 723 static void connman_client_disconnect_all(ConnmanClient *client)
616@@ -487,32 +528,37 @@ static void connman_client_disconnect_all(ConnmanClient *client) 724@@ -487,32 +536,37 @@ static void connman_client_disconnect_all(ConnmanClient *client)
617 network_disconnect, NULL); 725 network_disconnect, NULL);
618 } 726 }
619 727
@@ -657,7 +765,7 @@ index aad0a22..96f9388 100644
657 765
658 DBG("client %p", client); 766 DBG("client %p", client);
659 767
660@@ -548,56 +594,37 @@ gchar *connman_client_get_passphrase(ConnmanClient *client, const gchar *network 768@@ -548,41 +602,60 @@ gchar *connman_client_get_passphrase(ConnmanClient *client, const gchar *network
661 return passphrase; 769 return passphrase;
662 } 770 }
663 771
@@ -682,51 +790,114 @@ index aad0a22..96f9388 100644
682- return; 790- return;
683+ goto done; 791+ goto done;
684 792
685+ DBG("passphrase %s", passphrase);
686 g_value_init(&value, G_TYPE_STRING); 793 g_value_init(&value, G_TYPE_STRING);
687 g_value_set_string(&value, passphrase); 794 g_value_set_string(&value, passphrase);
688 795
689- connman_set_property(proxy, "WiFi.Passphrase", &value, NULL); 796- connman_set_property(proxy, "WiFi.Passphrase", &value, NULL);
690- 797+ ret = connman_set_property(proxy, "Passphrase", &value, NULL);
691- g_value_unset(&value); 798
692- 799 g_value_unset(&value);
693- g_object_unref(proxy); 800
694-} 801 g_object_unref(proxy);
695- 802+done:
803+ return ret;
804 }
805
696-void connman_client_set_remember(ConnmanClient *client, const gchar *network, 806-void connman_client_set_remember(ConnmanClient *client, const gchar *network,
697- gboolean remember) 807- gboolean remember)
698-{ 808+void connman_client_set_callback(ConnmanClient *client,
699- ConnmanClientPrivate *priv = CONNMAN_CLIENT_GET_PRIVATE(client); 809+ ConnmanClientCallback callback, gpointer user_data)
810 {
811 ConnmanClientPrivate *priv = CONNMAN_CLIENT_GET_PRIVATE(client);
700- DBusGProxy *proxy; 812- DBusGProxy *proxy;
701- GValue value = { 0 }; 813- GValue value = { 0 };
702- 814+ gchar *state;
703- DBG("client %p", client); 815
704- 816 DBG("client %p", client);
705- if (network == NULL) 817
706- return; 818+ priv->callback = callback;
707- 819+ priv->userdata = user_data;
708- proxy = connman_dbus_get_proxy(priv->store, network); 820+
709- if (proxy == NULL) 821+ g_object_set_data(G_OBJECT(priv->store), "callback", callback);
710- return; 822+ g_object_set_data(G_OBJECT(priv->store), "userdata", user_data);
711- 823+
824+ state = g_object_get_data(G_OBJECT(priv->store), "State");
825+ if (state != NULL && priv->callback != NULL)
826+ priv->callback(state, priv->userdata);
827+}
828+
829+void connman_client_remove(ConnmanClient *client, const gchar *network)
830+{
831+ ConnmanClientPrivate *priv = CONNMAN_CLIENT_GET_PRIVATE(client);
832+ DBusGProxy *proxy;
833+
834 if (network == NULL)
835 return;
836
837@@ -590,31 +663,46 @@ void connman_client_set_remember(ConnmanClient *client, const gchar *network,
838 if (proxy == NULL)
839 return;
840
712- g_value_init(&value, G_TYPE_BOOLEAN); 841- g_value_init(&value, G_TYPE_BOOLEAN);
713- g_value_set_boolean(&value, remember); 842- g_value_set_boolean(&value, remember);
714- 843+ connman_remove(proxy, NULL);
844+
845+ g_object_unref(proxy);
846+}
847+
848+void connman_client_enable_technology(ConnmanClient *client, const char *network,
849+ const gchar *technology)
850+{
851+ ConnmanClientPrivate *priv = CONNMAN_CLIENT_GET_PRIVATE(client);
852+ DBusGProxy *proxy;
853+ int ret;
854
715- connman_set_property(proxy, "Remember", &value, NULL); 855- connman_set_property(proxy, "Remember", &value, NULL);
716+ ret = connman_set_property(proxy, "Passphrase", &value, NULL); 856+ if (network== NULL)
717+ DBG("passphrase setting succeeded? %d", ret); 857+ return;
718+ DBG("false is ? %d", FALSE);
719 858
720 g_value_unset(&value); 859- g_value_unset(&value);
860+ proxy = connman_dbus_get_proxy(priv->store, network);
861+ if (proxy == NULL)
862+ return;
863+
864+ ret = connman_enable_technology(proxy, technology, NULL);
721 865
722 g_object_unref(proxy); 866 g_object_unref(proxy);
723+done:
724+ return ret;
725 } 867 }
726 868
727 void connman_client_set_callback(ConnmanClient *client, 869-void connman_client_set_callback(ConnmanClient *client,
870- ConnmanClientCallback callback, gpointer user_data)
871+void connman_client_disable_technology(ConnmanClient *client, const char *network,
872+ const gchar *technology)
873 {
874 ConnmanClientPrivate *priv = CONNMAN_CLIENT_GET_PRIVATE(client);
875- gchar *state;
876+ DBusGProxy *proxy;
877+ int ret;
878
879- DBG("client %p", client);
880
881- priv->callback = callback;
882- priv->userdata = user_data;
883+ if (network == NULL)
884+ return;
885
886- g_object_set_data(G_OBJECT(priv->store), "callback", callback);
887- g_object_set_data(G_OBJECT(priv->store), "userdata", user_data);
888+ proxy = connman_dbus_get_proxy(priv->store, network);
889+ if (proxy == NULL)
890+ return;
891
892- state = g_object_get_data(G_OBJECT(priv->store), "State");
893- if (state != NULL && priv->callback != NULL)
894- priv->callback(state, priv->userdata);
895+ ret = connman_disable_technology(proxy, technology, NULL);
896+
897+ g_object_unref(proxy);
898 }
728diff --git a/common/connman-client.h b/common/connman-client.h 899diff --git a/common/connman-client.h b/common/connman-client.h
729index f30dae4..f3ac1d3 100644 900index f30dae4..00c328a 100644
730--- a/common/connman-client.h 901--- a/common/connman-client.h
731+++ b/common/connman-client.h 902+++ b/common/connman-client.h
732@@ -23,6 +23,7 @@ 903@@ -23,6 +23,7 @@
@@ -778,15 +949,26 @@ index f30dae4..f3ac1d3 100644
778 const gchar *passphrase); 949 const gchar *passphrase);
779 void connman_client_set_remember(ConnmanClient *client, const gchar *network, 950 void connman_client_set_remember(ConnmanClient *client, const gchar *network,
780 gboolean remember); 951 gboolean remember);
781@@ -81,22 +91,27 @@ typedef void (* ConnmanClientCallback) (const char *status, void *user_data); 952@@ -81,37 +91,63 @@ typedef void (* ConnmanClientCallback) (const char *status, void *user_data);
782 void connman_client_set_callback(ConnmanClient *client, 953 void connman_client_set_callback(ConnmanClient *client,
783 ConnmanClientCallback callback, gpointer user_data); 954 ConnmanClientCallback callback, gpointer user_data);
784 955
785+void connman_client_set_ipv4(ConnmanClient *client, const gchar *device, 956+gboolean connman_client_set_ipv4(ConnmanClient *client, const gchar *device,
786+ struct ipv4_config *ipv4_config); 957+ struct ipv4_config *ipv4_config);
787+ 958+
788+gboolean connman_dbus_get_iter(GtkTreeStore *store, const gchar *path, 959+gboolean connman_dbus_get_iter(GtkTreeStore *store, const gchar *path,
789+ GtkTreeIter *iter); 960+ GtkTreeIter *iter);
961+void connman_client_remove(ConnmanClient *client, const gchar *network);
962+
963+void connman_client_request_scan(ConnmanClient *client, char *scantype,
964+ connman_request_scan_reply callback, gpointer userdata);
965+gboolean connman_client_get_offline_status(ConnmanClient *client);
966+void connman_client_set_offlinemode(ConnmanClient *client, gboolean status);
967+
968+void connman_client_enable_technology(ConnmanClient *client, const char *network,
969+ const gchar *technology);
970+void connman_client_disable_technology(ConnmanClient *client, const char *network,
971+ const gchar *technology);
790 enum { 972 enum {
791 CONNMAN_COLUMN_PROXY, /* G_TYPE_OBJECT */ 973 CONNMAN_COLUMN_PROXY, /* G_TYPE_OBJECT */
792+ CONNMAN_COLUMN_STATE, /* G_TYPE_STRING */ 974+ CONNMAN_COLUMN_STATE, /* G_TYPE_STRING */
@@ -811,12 +993,29 @@ index f30dae4..f3ac1d3 100644
811+ CONNMAN_COLUMN_ADDRESS, /* G_TYPE_STRING */ 993+ CONNMAN_COLUMN_ADDRESS, /* G_TYPE_STRING */
812+ CONNMAN_COLUMN_NETMASK, /* G_TYPE_STRING */ 994+ CONNMAN_COLUMN_NETMASK, /* G_TYPE_STRING */
813+ CONNMAN_COLUMN_GATEWAY, /* G_TYPE_STRING */ 995+ CONNMAN_COLUMN_GATEWAY, /* G_TYPE_STRING */
996+
997+ CONNMAN_COLUMN_ETHERNET_ENABLED, /* G_TYPE_BOOLEAN */
998+ CONNMAN_COLUMN_WIFI_ENABLED, /* G_TYPE_BOOLEAN */
999+
1000+ CONNMAN_COLUMN_OFFLINEMODE, /* G_TYPE_BOOLEAN */
1001+
814+ _CONNMAN_NUM_COLUMNS, 1002+ _CONNMAN_NUM_COLUMNS,
815+ 1003+
816 }; 1004 };
817 1005
818 enum { 1006 enum {
819@@ -108,10 +123,7 @@ enum { 1007 CONNMAN_TYPE_UNKNOWN,
1008+
1009 CONNMAN_TYPE_ETHERNET,
1010 CONNMAN_TYPE_WIFI,
1011 CONNMAN_TYPE_WIMAX,
1012 CONNMAN_TYPE_BLUETOOTH,
1013+
1014+ CONNMAN_TYPE_LABEL_ETHERNET,
1015+ CONNMAN_TYPE_LABEL_WIFI,
1016+
1017+ CONNMAN_TYPE_SYSCONFIG,
1018+ _CONNMAN_NUM_TYPE,
820 }; 1019 };
821 1020
822 enum { 1021 enum {
@@ -829,25 +1028,38 @@ index f30dae4..f3ac1d3 100644
829 }; 1028 };
830 1029
831diff --git a/common/connman-dbus.c b/common/connman-dbus.c 1030diff --git a/common/connman-dbus.c b/common/connman-dbus.c
832index 9eba7ae..83f4e57 100644 1031index 9eba7ae..bf1778f 100644
833--- a/common/connman-dbus.c 1032--- a/common/connman-dbus.c
834+++ b/common/connman-dbus.c 1033+++ b/common/connman-dbus.c
835@@ -159,20 +159,22 @@ static gint compare_path(gconstpointer a, gconstpointer b) 1034@@ -137,6 +137,27 @@ DBusGProxy *connman_dbus_get_proxy(GtkTreeStore *store, const gchar *path)
836 return g_strcmp0(a, b); 1035 return proxy;
837 } 1036 }
838 1037
839+static gint compare_list(gchar *path_a, gchar *path_b, gpointer user_data) 1038+static gboolean compare_type(GtkTreeStore *store, GtkTreeIter *iter,
1039+ gconstpointer user_data)
840+{ 1040+{
841+ return g_strcmp0(path_a, path_b); 1041+ guint type_target = GPOINTER_TO_UINT(user_data);
1042+ guint type;
1043+ gboolean found = FALSE;
1044+
1045+ gtk_tree_model_get(GTK_TREE_MODEL(store), iter,
1046+ CONNMAN_COLUMN_TYPE, &type, -1);
1047+
1048+ if (type != CONNMAN_TYPE_UNKNOWN)
1049+ found = (type == type_target);
1050+
1051+ return found;
842+} 1052+}
843+ 1053+
1054+static gboolean get_iter_from_type(GtkTreeStore *store, GtkTreeIter *iter, guint type)
1055+{
1056+ return iter_search(store, iter, NULL, compare_type, GUINT_TO_POINTER(type));
1057+}
844+ 1058+
845 static void property_update(GtkTreeStore *store, const GValue *value, 1059 gboolean connman_dbus_get_iter(GtkTreeStore *store, const gchar *path,
846 const char *key, connman_get_properties_reply callback) 1060 GtkTreeIter *iter)
847 { 1061 {
848- GSList *list, *link, *old_list, *new_list = NULL; 1062@@ -167,12 +188,7 @@ static void property_update(GtkTreeStore *store, const GValue *value,
849+ GSList *list, *link, *old_list, *new_list = NULL, *sorted_list = NULL;
850 const char *iface;
851 1063
852 DBG("store %p key %s", store, key); 1064 DBG("store %p key %s", store, key);
853 1065
@@ -857,25 +1069,11 @@ index 9eba7ae..83f4e57 100644
857- iface = CONNMAN_DEVICE_INTERFACE; 1069- iface = CONNMAN_DEVICE_INTERFACE;
858- else 1070- else
859- iface = CONNMAN_NETWORK_INTERFACE; 1071- iface = CONNMAN_NETWORK_INTERFACE;
860+ if (g_str_equal(key, "Services") == TRUE) 1072+ iface = CONNMAN_SERVICE_INTERFACE;
861+ iface = CONNMAN_SERVICE_INTERFACE;
862 1073
863 old_list = g_object_get_data(G_OBJECT(store), key); 1074 old_list = g_object_get_data(G_OBJECT(store), key);
864 1075
865@@ -180,7 +182,11 @@ static void property_update(GtkTreeStore *store, const GValue *value, 1076@@ -205,25 +221,12 @@ static void property_update(GtkTreeStore *store, const GValue *value,
866
867 g_object_set_data(G_OBJECT(store), key, new_list);
868
869- for (list = new_list; list; list = list->next) {
870+ sorted_list = g_slist_sort_with_data(new_list,
871+ (GCompareDataFunc)compare_list, store);
872+ g_object_set_data(G_OBJECT(store), "Services", sorted_list);
873+
874+ for (list = sorted_list; list; list = list->next) {
875 gchar *path = list->data;
876 DBusGProxy *proxy;
877
878@@ -205,25 +211,12 @@ static void property_update(GtkTreeStore *store, const GValue *value,
879 for (list = old_list; list; list = list->next) { 1077 for (list = old_list; list; list = list->next) {
880 gchar *path = list->data; 1078 gchar *path = list->data;
881 GtkTreeIter iter; 1079 GtkTreeIter iter;
@@ -902,7 +1100,7 @@ index 9eba7ae..83f4e57 100644
902 g_free(path); 1100 g_free(path);
903 } 1101 }
904 1102
905@@ -263,48 +256,19 @@ static const gchar *type2icon(guint type) 1103@@ -263,155 +266,115 @@ static const gchar *type2icon(guint type)
906 return NULL; 1104 return NULL;
907 } 1105 }
908 1106
@@ -943,26 +1141,34 @@ index 9eba7ae..83f4e57 100644
943-} 1141-}
944- 1142-
945-static void network_changed(DBusGProxy *proxy, const char *property, 1143-static void network_changed(DBusGProxy *proxy, const char *property,
946+static void service_changed(DBusGProxy *proxy, const char *property, 1144- GValue *value, gpointer user_data)
947 GValue *value, gpointer user_data) 1145+static void enabled_technologies_changed(GtkTreeStore *store, GValue *value)
948 { 1146 {
949 GtkTreeStore *store = user_data; 1147- GtkTreeStore *store = user_data;
950 const char *path = dbus_g_proxy_get_path(proxy); 1148- const char *path = dbus_g_proxy_get_path(proxy);
951 GtkTreeIter iter; 1149 GtkTreeIter iter;
952+ GHashTable *ipv4; 1150+ gboolean ethernet_enabled_prev, ethernet_enabled = FALSE;
953+ const gchar *method, *addr, *netmask, *gateway; 1151+ gboolean wifi_enabled_prev, wifi_enabled = FALSE;
954+ GValue *ipv4_method, *ipv4_address, *ipv4_netmask, *ipv4_gateway; 1152+ gchar **tech = g_value_get_boxed (value);
955+ 1153+ gint i;
956+ const gchar *state, *icon, *name, *security, *passphrase; 1154+ gboolean ret;
957+ guint strength, type;
958+
959
960 DBG("store %p proxy %p property %s", store, proxy, property);
961 1155
962@@ -314,141 +278,92 @@ static void network_changed(DBusGProxy *proxy, const char *property, 1156- DBG("store %p proxy %p property %s", store, proxy, property);
963 if (get_iter_from_path(store, &iter, path) == FALSE) 1157-
1158- if (property == NULL || value == NULL)
1159+ if (value == NULL)
964 return; 1160 return;
965 1161
1162- if (get_iter_from_path(store, &iter, path) == FALSE)
1163- return;
1164+ for (i = 0; i < g_strv_length (tech); i++)
1165+ {
1166+ if (g_str_equal("ethernet", *(tech + i)))
1167+ ethernet_enabled = TRUE;
1168+ else if (g_str_equal ("wifi", *(tech + i)))
1169+ wifi_enabled = TRUE;
1170+ }
1171
966- if (g_str_equal(property, "Connected") == TRUE) { 1172- if (g_str_equal(property, "Connected") == TRUE) {
967- gboolean connected = g_value_get_boolean(value); 1173- gboolean connected = g_value_get_boolean(value);
968- gtk_tree_store_set(store, &iter, 1174- gtk_tree_store_set(store, &iter,
@@ -973,18 +1179,30 @@ index 9eba7ae..83f4e57 100644
973- CONNMAN_COLUMN_INRANGE, inrange, -1); 1179- CONNMAN_COLUMN_INRANGE, inrange, -1);
974- } else if (g_str_equal(property, "Remember") == TRUE) { 1180- } else if (g_str_equal(property, "Remember") == TRUE) {
975- gboolean remember = g_value_get_boolean(value); 1181- gboolean remember = g_value_get_boolean(value);
976- gtk_tree_store_set(store, &iter, 1182+ get_iter_from_type(store, &iter, CONNMAN_TYPE_LABEL_ETHERNET);
1183+ gtk_tree_model_get(GTK_TREE_MODEL(store), &iter,
1184+ CONNMAN_COLUMN_ETHERNET_ENABLED, &ethernet_enabled_prev, -1);
1185+ if (ethernet_enabled_prev != ethernet_enabled)
1186 gtk_tree_store_set(store, &iter,
977- CONNMAN_COLUMN_REMEMBER, remember, -1); 1187- CONNMAN_COLUMN_REMEMBER, remember, -1);
978- } else if (g_str_equal(property, "Strength") == TRUE) { 1188- } else if (g_str_equal(property, "Strength") == TRUE) {
979- guint strength = g_value_get_uchar(value); 1189- guint strength = g_value_get_uchar(value);
980- gtk_tree_store_set(store, &iter, 1190+ CONNMAN_COLUMN_ETHERNET_ENABLED, ethernet_enabled, -1);
1191+
1192+ ret = get_iter_from_type(store, &iter, CONNMAN_TYPE_LABEL_WIFI);
1193+ gtk_tree_model_get(GTK_TREE_MODEL(store), &iter,
1194+ CONNMAN_COLUMN_WIFI_ENABLED, &wifi_enabled_prev, -1);
1195+ if (wifi_enabled_prev != wifi_enabled)
1196 gtk_tree_store_set(store, &iter,
981- CONNMAN_COLUMN_STRENGTH, strength, -1); 1197- CONNMAN_COLUMN_STRENGTH, strength, -1);
982- } 1198- }
983-} 1199+ CONNMAN_COLUMN_WIFI_ENABLED, wifi_enabled, -1);
984- 1200 }
1201
985-static void network_properties(DBusGProxy *proxy, GHashTable *hash, 1202-static void network_properties(DBusGProxy *proxy, GHashTable *hash,
986- GError *error, gpointer user_data) 1203- GError *error, gpointer user_data)
987-{ 1204+static void enabled_technologies_properties(GtkTreeStore *store, DBusGProxy *proxy, GValue *value)
1205 {
988- GtkTreeStore *store = user_data; 1206- GtkTreeStore *store = user_data;
989- GValue *value; 1207- GValue *value;
990- const gchar *device, *name, *secret; 1208- const gchar *device, *name, *secret;
@@ -999,131 +1217,130 @@ index 9eba7ae..83f4e57 100644
999- 1217-
1000- value = g_hash_table_lookup(hash, "Device"); 1218- value = g_hash_table_lookup(hash, "Device");
1001- device = value ? g_value_get_boxed(value) : NULL; 1219- device = value ? g_value_get_boxed(value) : NULL;
1002+ if (g_str_equal(property, "IPv4") == TRUE) { 1220-
1003
1004- value = g_hash_table_lookup(hash, "Name"); 1221- value = g_hash_table_lookup(hash, "Name");
1005- name = value ? g_value_get_string(value) : NULL; 1222- name = value ? g_value_get_string(value) : NULL;
1006- 1223-
1007- value = g_hash_table_lookup(hash, "Connected"); 1224- value = g_hash_table_lookup(hash, "Connected");
1008- connected = value ? g_value_get_boolean(value) : FALSE; 1225- connected = value ? g_value_get_boolean(value) : FALSE;
1009+ ipv4 = g_value_get_boxed (value); 1226-
1010+ if (!ipv4)
1011+ return;
1012
1013- value = g_hash_table_lookup(hash, "Available"); 1227- value = g_hash_table_lookup(hash, "Available");
1014- inrange = value ? g_value_get_boolean(value) : FALSE; 1228- inrange = value ? g_value_get_boolean(value) : FALSE;
1015+ ipv4_method = g_hash_table_lookup (ipv4, "Method"); 1229+ GtkTreeIter iter;
1016+ method = ipv4_method ? g_value_get_string(ipv4_method) : NULL; 1230+ gboolean ethernet_enabled = FALSE;
1231+ gboolean wifi_enabled = FALSE;
1232+ gchar **tech = g_value_get_boxed (value);
1233+ gint i;
1234+
1235+ for (i = 0; i < g_strv_length (tech); i++)
1236+ {
1237+ if (g_str_equal("ethernet", *(tech + i)))
1238+ ethernet_enabled = TRUE;
1239+ else if (g_str_equal ("wifi", *(tech + i)))
1240+ wifi_enabled = TRUE;
1241+ }
1017 1242
1018- value = g_hash_table_lookup(hash, "Remember"); 1243- value = g_hash_table_lookup(hash, "Remember");
1019- remember = value ? g_value_get_boolean(value) : FALSE; 1244- remember = value ? g_value_get_boolean(value) : FALSE;
1020+ ipv4_address = g_hash_table_lookup (ipv4, "Address"); 1245+ if (get_iter_from_type(store, &iter, CONNMAN_TYPE_LABEL_ETHERNET) == FALSE)
1021+ addr = ipv4_address ? g_value_get_string(ipv4_address) : NULL; 1246+ gtk_tree_store_append(store, &iter, NULL);
1022 1247
1023- value = g_hash_table_lookup(hash, "Strength"); 1248- value = g_hash_table_lookup(hash, "Strength");
1024- strength = value ? g_value_get_uchar(value) : 0; 1249- strength = value ? g_value_get_uchar(value) : 0;
1025+ ipv4_netmask = g_hash_table_lookup (ipv4, "Netmask"); 1250+ gtk_tree_store_set(store, &iter,
1026+ netmask = ipv4_netmask ? g_value_get_string(ipv4_netmask) : NULL; 1251+ CONNMAN_COLUMN_PROXY, proxy,
1252+ CONNMAN_COLUMN_ETHERNET_ENABLED, ethernet_enabled,
1253+ CONNMAN_COLUMN_TYPE, CONNMAN_TYPE_LABEL_ETHERNET,
1254+ -1);
1027 1255
1028- value = g_hash_table_lookup(hash, "WiFi.Security"); 1256- value = g_hash_table_lookup(hash, "WiFi.Security");
1029- security = get_security(value); 1257- security = get_security(value);
1030+ ipv4_gateway = g_hash_table_lookup (ipv4, "Gateway"); 1258+ if (get_iter_from_type(store, &iter, CONNMAN_TYPE_LABEL_WIFI) == FALSE)
1031+ gateway = ipv4_gateway ? g_value_get_string(ipv4_gateway) : NULL; 1259+ gtk_tree_store_append(store, &iter, NULL);
1032 1260
1033- value = g_hash_table_lookup(hash, "WiFi.Passphrase"); 1261- value = g_hash_table_lookup(hash, "WiFi.Passphrase");
1034- secret = value ? g_value_get_string(value) : NULL; 1262- secret = value ? g_value_get_string(value) : NULL;
1035- 1263+ gtk_tree_store_set(store, &iter,
1264+ CONNMAN_COLUMN_PROXY, proxy,
1265+ CONNMAN_COLUMN_WIFI_ENABLED, wifi_enabled,
1266+ CONNMAN_COLUMN_TYPE, CONNMAN_TYPE_LABEL_WIFI,
1267+ -1);
1268+}
1269
1036- DBG("name %s strength %d", name, strength); 1270- DBG("name %s strength %d", name, strength);
1037- 1271+static void offline_mode_changed(GtkTreeStore *store, GValue *value)
1272+{
1273+ GtkTreeIter iter;
1274+ gboolean offline_mode = g_value_get_boolean(value);
1275
1038- if (get_iter_from_path(store, &parent, device) == FALSE) 1276- if (get_iter_from_path(store, &parent, device) == FALSE)
1039- return; 1277- return;
1040- 1278+ get_iter_from_type(store, &iter, CONNMAN_TYPE_SYSCONFIG);
1279+ gtk_tree_store_set(store, &iter,
1280+ CONNMAN_COLUMN_OFFLINEMODE, offline_mode,
1281+ -1);
1282+}
1283
1041- if (get_iter_from_proxy(store, &iter, proxy) == FALSE) { 1284- if (get_iter_from_proxy(store, &iter, proxy) == FALSE) {
1042- gtk_tree_store_insert_with_values(store, &iter, &parent, -1, 1285- gtk_tree_store_insert_with_values(store, &iter, &parent, -1,
1043- CONNMAN_COLUMN_PROXY, proxy, 1286- CONNMAN_COLUMN_PROXY, proxy,
1044+ gtk_tree_store_set(store, &iter, 1287- CONNMAN_COLUMN_NAME, name,
1045+ CONNMAN_COLUMN_METHOD, method,
1046+ CONNMAN_COLUMN_ADDRESS, addr,
1047+ CONNMAN_COLUMN_NETMASK, netmask,
1048+ CONNMAN_COLUMN_GATEWAY, gateway,
1049+ -1);
1050+
1051+ } else if (g_str_equal(property, "State") == TRUE) {
1052+ state = value ? g_value_get_string(value) : NULL;
1053+ gtk_tree_store_set(store, &iter,
1054+ CONNMAN_COLUMN_STATE, state,
1055+ -1);
1056+ } else if (g_str_equal(property, "Name") == TRUE) {
1057+ name = value ? g_value_get_string(value) : NULL;
1058+ gtk_tree_store_set(store, &iter,
1059 CONNMAN_COLUMN_NAME, name,
1060- CONNMAN_COLUMN_ENABLED, connected, 1288- CONNMAN_COLUMN_ENABLED, connected,
1061- CONNMAN_COLUMN_INRANGE, inrange, 1289- CONNMAN_COLUMN_INRANGE, inrange,
1062- CONNMAN_COLUMN_REMEMBER, remember, 1290- CONNMAN_COLUMN_REMEMBER, remember,
1063- CONNMAN_COLUMN_STRENGTH, strength, 1291- CONNMAN_COLUMN_STRENGTH, strength,
1064+ -1); 1292- CONNMAN_COLUMN_SECURITY, security,
1065+ } else if (g_str_equal(property, "Type") == TRUE) {
1066+ type = get_type(value);
1067+ icon = type2icon(type);
1068+ gtk_tree_store_set(store, &iter,
1069+ CONNMAN_COLUMN_TYPE, type,
1070+ CONNMAN_COLUMN_ICON, icon,
1071+ -1);
1072+ } else if (g_str_equal(property, "Security") == TRUE) {
1073+ security = value ? g_value_get_string(value) : NULL;
1074+ gtk_tree_store_set(store, &iter,
1075 CONNMAN_COLUMN_SECURITY, security,
1076- CONNMAN_COLUMN_PASSPHRASE, secret, -1); 1293- CONNMAN_COLUMN_PASSPHRASE, secret, -1);
1077- 1294+static void offline_mode_properties(GtkTreeStore *store, DBusGProxy *proxy, GValue *value)
1295+{
1296+ GtkTreeIter iter;
1297+ gboolean offline_mode = g_value_get_boolean(value);
1298
1078- dbus_g_proxy_add_signal(proxy, "PropertyChanged", 1299- dbus_g_proxy_add_signal(proxy, "PropertyChanged",
1079- G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID); 1300- G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID);
1080- dbus_g_proxy_connect_signal(proxy, "PropertyChanged", 1301- dbus_g_proxy_connect_signal(proxy, "PropertyChanged",
1081- G_CALLBACK(network_changed), store, NULL); 1302- G_CALLBACK(network_changed), store, NULL);
1082- } else 1303- } else
1083+ -1); 1304- gtk_tree_store_set(store, &iter,
1084+ } else if (g_str_equal(property, "PassPhrase") == TRUE) {
1085+ passphrase = value ? g_value_get_string(value) : NULL;
1086+ gtk_tree_store_set(store, &iter,
1087+ CONNMAN_COLUMN_PASSPHRASE, passphrase,
1088+ -1);
1089+ } else if (g_str_equal(property, "Strength") == TRUE) {
1090+ strength = value ? g_value_get_uchar(value) : 0;
1091 gtk_tree_store_set(store, &iter,
1092- CONNMAN_COLUMN_NAME, name, 1305- CONNMAN_COLUMN_NAME, name,
1093- CONNMAN_COLUMN_ENABLED, connected, 1306- CONNMAN_COLUMN_ENABLED, connected,
1094- CONNMAN_COLUMN_INRANGE, inrange, 1307- CONNMAN_COLUMN_INRANGE, inrange,
1095- CONNMAN_COLUMN_REMEMBER, remember, 1308- CONNMAN_COLUMN_REMEMBER, remember,
1096 CONNMAN_COLUMN_STRENGTH, strength, 1309- CONNMAN_COLUMN_STRENGTH, strength,
1097- CONNMAN_COLUMN_SECURITY, security, 1310- CONNMAN_COLUMN_SECURITY, security,
1098- CONNMAN_COLUMN_PASSPHRASE, secret, -1); 1311- CONNMAN_COLUMN_PASSPHRASE, secret, -1);
1099- 1312+ if (get_iter_from_type(store, &iter, CONNMAN_TYPE_SYSCONFIG) == FALSE)
1313+ gtk_tree_store_insert(store, &iter, NULL, 0);
1314
1100-done: 1315-done:
1101- g_object_unref(proxy); 1316- g_object_unref(proxy);
1102+ -1); 1317+ gtk_tree_store_set(store, &iter,
1103+ } 1318+ CONNMAN_COLUMN_PROXY, proxy,
1319+ CONNMAN_COLUMN_TYPE, CONNMAN_TYPE_SYSCONFIG,
1320+ CONNMAN_COLUMN_OFFLINEMODE, offline_mode,
1321+ -1);
1104 } 1322 }
1105 1323
1106-static void device_changed(DBusGProxy *proxy, const char *property, 1324-static void device_changed(DBusGProxy *proxy, const char *property,
1107- GValue *value, gpointer user_data) 1325+static void service_changed(DBusGProxy *proxy, const char *property,
1108+static void service_properties(DBusGProxy *proxy, GHashTable *hash, 1326 GValue *value, gpointer user_data)
1109+ GError *error, gpointer user_data)
1110 { 1327 {
1111 GtkTreeStore *store = user_data; 1328 GtkTreeStore *store = user_data;
1112 const char *path = dbus_g_proxy_get_path(proxy); 1329 const char *path = dbus_g_proxy_get_path(proxy);
1113- GtkTreeIter iter; 1330 GtkTreeIter iter;
1114
1115- DBG("store %p proxy %p property %s", store, proxy, property);
1116+ const gchar *state, *icon, *name, *security, *passphrase;
1117+ guint strength, type;
1118
1119- if (property == NULL || value == NULL)
1120- return;
1121-
1122- if (get_iter_from_path(store, &iter, path) == FALSE)
1123- return;
1124+ GHashTable *ipv4; 1331+ GHashTable *ipv4;
1332+ const char *method, *addr, *netmask, *gateway;
1125+ GValue *ipv4_method, *ipv4_address, *ipv4_netmask, *ipv4_gateway; 1333+ GValue *ipv4_method, *ipv4_address, *ipv4_netmask, *ipv4_gateway;
1126+ const gchar *method, *addr, *netmask, *gateway; 1334+
1335+ const char *state, *icon, *name, *security, *passphrase;
1336+ guint strength, type;
1337+
1338
1339 DBG("store %p proxy %p property %s", store, proxy, property);
1340
1341@@ -421,165 +384,167 @@ static void device_changed(DBusGProxy *proxy, const char *property,
1342 if (get_iter_from_path(store, &iter, path) == FALSE)
1343 return;
1127 1344
1128- if (g_str_equal(property, "Policy") == TRUE) { 1345- if (g_str_equal(property, "Policy") == TRUE) {
1129- guint policy = get_policy(value); 1346- guint policy = get_policy(value);
@@ -1136,44 +1353,47 @@ index 9eba7ae..83f4e57 100644
1136- } else if (g_str_equal(property, "Networks") == TRUE) 1353- } else if (g_str_equal(property, "Networks") == TRUE)
1137- property_update(store, value, path, network_properties); 1354- property_update(store, value, path, network_properties);
1138-} 1355-}
1139+ GtkTreeIter iter; 1356-
1140
1141-static void device_properties(DBusGProxy *proxy, GHashTable *hash, 1357-static void device_properties(DBusGProxy *proxy, GHashTable *hash,
1142- GError *error, gpointer user_data) 1358- GError *error, gpointer user_data)
1143-{ 1359-{
1144- GtkTreeStore *store = user_data; 1360- GtkTreeStore *store = user_data;
1145- const char *path = dbus_g_proxy_get_path(proxy); 1361- const char *path = dbus_g_proxy_get_path(proxy);
1146 GValue *value; 1362- GValue *value;
1147- const gchar *name, *icon; 1363- const gchar *name, *icon;
1148- guint type, policy; 1364- guint type, policy;
1149- gboolean powered; 1365- gboolean powered;
1150- GtkTreeIter iter; 1366- GtkTreeIter iter;
1367-
1368- DBG("store %p proxy %p hash %p", store, proxy, hash);
1369+ if (g_str_equal(property, "IPv4") == TRUE) {
1151 1370
1152 DBG("store %p proxy %p hash %p", store, proxy, hash); 1371- if (error != NULL || hash == NULL)
1153+ DBG("path %s", path); 1372- goto done;
1154 1373-
1155 if (error != NULL || hash == NULL) 1374- value = g_hash_table_lookup(hash, "Name");
1156 goto done; 1375- name = value ? g_value_get_string(value) : NULL;
1157 1376-
1158+ value = g_hash_table_lookup(hash, "State"); 1377- value = g_hash_table_lookup(hash, "Type");
1159+ state = value ? g_value_get_string(value) : NULL; 1378- type = get_type(value);
1160+ 1379- icon = type2icon(type);
1161 value = g_hash_table_lookup(hash, "Name"); 1380+ ipv4 = g_value_get_boxed (value);
1162 name = value ? g_value_get_string(value) : NULL; 1381+ if (!ipv4)
1163 1382+ return;
1164@@ -456,129 +371,69 @@ static void device_properties(DBusGProxy *proxy, GHashTable *hash,
1165 type = get_type(value);
1166 icon = type2icon(type);
1167 1383
1168- value = g_hash_table_lookup(hash, "Policy"); 1384- value = g_hash_table_lookup(hash, "Policy");
1169- policy = get_policy(value); 1385- policy = get_policy(value);
1170- 1386+ ipv4_method = g_hash_table_lookup (ipv4, "Method");
1387+ method = ipv4_method ? g_value_get_string(ipv4_method) : NULL;
1388
1171- value = g_hash_table_lookup(hash, "Powered"); 1389- value = g_hash_table_lookup(hash, "Powered");
1172- powered = value ? g_value_get_boolean(value) : FALSE; 1390- powered = value ? g_value_get_boolean(value) : FALSE;
1173- 1391+ ipv4_address = g_hash_table_lookup (ipv4, "Address");
1392+ addr = ipv4_address ? g_value_get_string(ipv4_address) : NULL;
1393
1174- DBG("name %s type %d icon %s", name, type, icon); 1394- DBG("name %s type %d icon %s", name, type, icon);
1175+ value = g_hash_table_lookup(hash, "Security"); 1395+ ipv4_netmask = g_hash_table_lookup (ipv4, "Netmask");
1176+ security = value ? g_value_get_string(value) : NULL; 1396+ netmask = ipv4_netmask ? g_value_get_string(ipv4_netmask) : NULL;
1177 1397
1178- if (get_iter_from_proxy(store, &iter, proxy) == FALSE) { 1398- if (get_iter_from_proxy(store, &iter, proxy) == FALSE) {
1179- gtk_tree_store_insert_with_values(store, &iter, NULL, -1, 1399- gtk_tree_store_insert_with_values(store, &iter, NULL, -1,
@@ -1183,16 +1403,37 @@ index 9eba7ae..83f4e57 100644
1183- CONNMAN_COLUMN_TYPE, type, 1403- CONNMAN_COLUMN_TYPE, type,
1184- CONNMAN_COLUMN_ENABLED, powered, 1404- CONNMAN_COLUMN_ENABLED, powered,
1185- CONNMAN_COLUMN_POLICY, policy, -1); 1405- CONNMAN_COLUMN_POLICY, policy, -1);
1186- 1406+ ipv4_gateway = g_hash_table_lookup (ipv4, "Gateway");
1407+ gateway = ipv4_gateway ? g_value_get_string(ipv4_gateway) : NULL;
1408
1187- dbus_g_proxy_add_signal(proxy, "PropertyChanged", 1409- dbus_g_proxy_add_signal(proxy, "PropertyChanged",
1188- G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID); 1410- G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID);
1189- dbus_g_proxy_connect_signal(proxy, "PropertyChanged", 1411- dbus_g_proxy_connect_signal(proxy, "PropertyChanged",
1190- G_CALLBACK(device_changed), store, NULL); 1412- G_CALLBACK(device_changed), store, NULL);
1191- } else 1413- } else
1192- gtk_tree_store_set(store, &iter, 1414+ gtk_tree_store_set(store, &iter,
1193- CONNMAN_COLUMN_NAME, name, 1415+ CONNMAN_COLUMN_METHOD, method,
1416+ CONNMAN_COLUMN_ADDRESS, addr,
1417+ CONNMAN_COLUMN_NETMASK, netmask,
1418+ CONNMAN_COLUMN_GATEWAY, gateway,
1419+ -1);
1420+
1421+ } else if (g_str_equal(property, "State") == TRUE) {
1422+ state = value ? g_value_get_string(value) : NULL;
1423+ gtk_tree_store_set(store, &iter,
1424+ CONNMAN_COLUMN_STATE, state,
1425+ -1);
1426+ } else if (g_str_equal(property, "Name") == TRUE) {
1427+ name = value ? g_value_get_string(value) : NULL;
1428 gtk_tree_store_set(store, &iter,
1429 CONNMAN_COLUMN_NAME, name,
1194- CONNMAN_COLUMN_ICON, icon, 1430- CONNMAN_COLUMN_ICON, icon,
1195- CONNMAN_COLUMN_TYPE, type, 1431+ -1);
1432+ } else if (g_str_equal(property, "Type") == TRUE) {
1433+ type = get_type(value);
1434+ icon = type2icon(type);
1435+ gtk_tree_store_set(store, &iter,
1436 CONNMAN_COLUMN_TYPE, type,
1196- CONNMAN_COLUMN_ENABLED, powered, 1437- CONNMAN_COLUMN_ENABLED, powered,
1197- CONNMAN_COLUMN_POLICY, policy, -1); 1438- CONNMAN_COLUMN_POLICY, policy, -1);
1198- 1439-
@@ -1215,123 +1456,175 @@ index 9eba7ae..83f4e57 100644
1215- 1456-
1216- if (property == NULL || value == NULL) 1457- if (property == NULL || value == NULL)
1217- return; 1458- return;
1218+ value = g_hash_table_lookup(hash, "PassPhrase"); 1459-
1219+ passphrase = value ? g_value_get_string(value) : NULL;
1220
1221- if (get_iter_from_path(store, &iter, path) == FALSE) 1460- if (get_iter_from_path(store, &iter, path) == FALSE)
1222- return; 1461- return;
1223- 1462-
1224- if (g_str_equal(property, "Default") == TRUE) { 1463- if (g_str_equal(property, "Default") == TRUE) {
1225- gboolean enabled = g_value_get_boolean(value); 1464- gboolean enabled = g_value_get_boolean(value);
1226- gtk_tree_store_set(store, &iter, 1465+ CONNMAN_COLUMN_ICON, icon,
1466+ -1);
1467+ } else if (g_str_equal(property, "Security") == TRUE) {
1468+ security = value ? g_value_get_string(value) : NULL;
1469+ gtk_tree_store_set(store, &iter,
1470+ CONNMAN_COLUMN_SECURITY, security,
1471+ -1);
1472+ } else if (g_str_equal(property, "PassPhrase") == TRUE) {
1473+ passphrase = value ? g_value_get_string(value) : NULL;
1474 gtk_tree_store_set(store, &iter,
1227- CONNMAN_COLUMN_ENABLED, enabled, -1); 1475- CONNMAN_COLUMN_ENABLED, enabled, -1);
1228- } else if (g_str_equal(property, "Strength") == TRUE) { 1476+ CONNMAN_COLUMN_PASSPHRASE, passphrase,
1477+ -1);
1478 } else if (g_str_equal(property, "Strength") == TRUE) {
1229- guint strength = g_value_get_uchar(value); 1479- guint strength = g_value_get_uchar(value);
1230- gtk_tree_store_set(store, &iter, 1480+ strength = value ? g_value_get_uchar(value) : 0;
1481 gtk_tree_store_set(store, &iter,
1231- CONNMAN_COLUMN_STRENGTH, strength, -1); 1482- CONNMAN_COLUMN_STRENGTH, strength, -1);
1232- } 1483+ CONNMAN_COLUMN_STRENGTH, strength,
1233-} 1484+ -1);
1234- 1485 }
1486 }
1487
1235-static void connection_properties(DBusGProxy *proxy, GHashTable *hash, 1488-static void connection_properties(DBusGProxy *proxy, GHashTable *hash,
1236- GError *error, gpointer user_data) 1489+static void service_properties(DBusGProxy *proxy, GHashTable *hash,
1237-{ 1490 GError *error, gpointer user_data)
1238- GtkTreeStore *store = user_data; 1491 {
1492 GtkTreeStore *store = user_data;
1239- GValue *value; 1493- GValue *value;
1240- guint type, strength; 1494- guint type, strength;
1241- gboolean enabled; 1495- gboolean enabled;
1242- const char *device, *address; 1496- const char *device, *address;
1243- GtkTreeIter iter; 1497+
1244+ value = g_hash_table_lookup(hash, "Strength"); 1498+ const char *state, *icon, *name, *security, *passphrase;
1245+ strength = value ? g_value_get_uchar(value) : 0; 1499+ guint strength, type;
1500+
1501+ GHashTable *ipv4;
1502+ GValue *ipv4_method, *ipv4_address, *ipv4_netmask, *ipv4_gateway;
1503+ const char *method, *addr, *netmask, *gateway;
1504+
1505 GtkTreeIter iter;
1246 1506
1247- DBG("store %p proxy %p hash %p", store, proxy, hash); 1507+ GValue *value;
1248+ value = g_hash_table_lookup(hash, "IPv4.Configuration"); 1508+
1249+ ipv4 = g_value_get_boxed (value); 1509 DBG("store %p proxy %p hash %p", store, proxy, hash);
1250 1510
1251- if (error != NULL || hash == NULL) 1511 if (error != NULL || hash == NULL)
1252+ if (!ipv4)
1253 goto done; 1512 goto done;
1254 1513
1255- value = g_hash_table_lookup(hash, "Type"); 1514+ value = g_hash_table_lookup(hash, "State");
1256- type = get_type(value); 1515+ state = value ? g_value_get_string(value) : NULL;
1257+ ipv4_method = g_hash_table_lookup (ipv4, "Method"); 1516+
1258+ method = ipv4_method ? g_value_get_string(ipv4_method) : NULL; 1517+ value = g_hash_table_lookup(hash, "Name");
1518+ name = value ? g_value_get_string(value) : NULL;
1519+
1520 value = g_hash_table_lookup(hash, "Type");
1521 type = get_type(value);
1522+ icon = type2icon(type);
1523+
1524+ value = g_hash_table_lookup(hash, "Security");
1525+ security = value ? g_value_get_string(value) : NULL;
1526+
1527+ value = g_hash_table_lookup(hash, "PassPhrase");
1528+ passphrase = value ? g_value_get_string(value) : NULL;
1259 1529
1260- value = g_hash_table_lookup(hash, "Strength"); 1530 value = g_hash_table_lookup(hash, "Strength");
1261- strength = value ? g_value_get_uchar(value) : 0; 1531 strength = value ? g_value_get_uchar(value) : 0;
1262+ ipv4_address = g_hash_table_lookup (ipv4, "Address");
1263+ addr = ipv4_address ? g_value_get_string(ipv4_address) : NULL;
1264 1532
1265- value = g_hash_table_lookup(hash, "Default"); 1533- value = g_hash_table_lookup(hash, "Default");
1266- enabled = value ? g_value_get_boolean(value) : FALSE; 1534- enabled = value ? g_value_get_boolean(value) : FALSE;
1267+ ipv4_netmask = g_hash_table_lookup (ipv4, "Netmask"); 1535+ value = g_hash_table_lookup(hash, "IPv4.Configuration");
1268+ netmask = ipv4_netmask ? g_value_get_string(ipv4_netmask) : NULL; 1536+ ipv4 = g_value_get_boxed (value);
1269 1537
1270- value = g_hash_table_lookup(hash, "IPv4.Address"); 1538- value = g_hash_table_lookup(hash, "IPv4.Address");
1271- address = value ? g_value_get_string(value) : NULL; 1539- address = value ? g_value_get_string(value) : NULL;
1272+ ipv4_gateway = g_hash_table_lookup (ipv4, "Gateway"); 1540+ if (!ipv4)
1273+ gateway = ipv4_gateway ? g_value_get_string(ipv4_gateway) : NULL; 1541+ goto done;
1274 1542
1275- DBG("type %d address %s", type, address); 1543- DBG("type %d address %s", type, address);
1276+ DBG("name %s type %d icon %s state %s", name, type, icon, state); 1544+ ipv4_method = g_hash_table_lookup (ipv4, "Method");
1545+ method = ipv4_method ? g_value_get_string(ipv4_method) : NULL;
1277 1546
1278 if (get_iter_from_proxy(store, &iter, proxy) == FALSE) { 1547- if (get_iter_from_proxy(store, &iter, proxy) == FALSE) {
1279 gtk_tree_store_insert_with_values(store, &iter, NULL, -1, 1548- gtk_tree_store_insert_with_values(store, &iter, NULL, -1,
1280 CONNMAN_COLUMN_PROXY, proxy, 1549- CONNMAN_COLUMN_PROXY, proxy,
1281+ CONNMAN_COLUMN_NAME, name, 1550- CONNMAN_COLUMN_TYPE, type,
1282+ CONNMAN_COLUMN_ICON, icon,
1283 CONNMAN_COLUMN_TYPE, type,
1284- CONNMAN_COLUMN_ENABLED, enabled, 1551- CONNMAN_COLUMN_ENABLED, enabled,
1285+ CONNMAN_COLUMN_STATE, state, 1552- CONNMAN_COLUMN_STRENGTH, strength,
1286+ CONNMAN_COLUMN_SECURITY, security,
1287+ CONNMAN_COLUMN_PASSPHRASE, passphrase,
1288 CONNMAN_COLUMN_STRENGTH, strength,
1289- CONNMAN_COLUMN_ADDRESS, address, -1); 1553- CONNMAN_COLUMN_ADDRESS, address, -1);
1290+ CONNMAN_COLUMN_METHOD, method, 1554+ ipv4_address = g_hash_table_lookup (ipv4, "Address");
1291+ CONNMAN_COLUMN_ADDRESS, addr, 1555+ addr = ipv4_address ? g_value_get_string(ipv4_address) : NULL;
1292+ CONNMAN_COLUMN_NETMASK, netmask,
1293+ CONNMAN_COLUMN_GATEWAY, gateway,
1294+ -1);
1295 1556
1296 dbus_g_proxy_add_signal(proxy, "PropertyChanged", 1557- dbus_g_proxy_add_signal(proxy, "PropertyChanged",
1297 G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID); 1558- G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID);
1298 dbus_g_proxy_connect_signal(proxy, "PropertyChanged", 1559- dbus_g_proxy_connect_signal(proxy, "PropertyChanged",
1299- G_CALLBACK(connection_changed), store, NULL); 1560- G_CALLBACK(connection_changed), store, NULL);
1300+ G_CALLBACK(service_changed), store, NULL); 1561- } else
1301 } else 1562- gtk_tree_store_set(store, &iter,
1302 gtk_tree_store_set(store, &iter, 1563- CONNMAN_COLUMN_TYPE, type,
1303+ CONNMAN_COLUMN_NAME, name,
1304+ CONNMAN_COLUMN_ICON, icon,
1305 CONNMAN_COLUMN_TYPE, type,
1306- CONNMAN_COLUMN_ENABLED, enabled, 1564- CONNMAN_COLUMN_ENABLED, enabled,
1307- CONNMAN_COLUMN_STRENGTH, strength, -1); 1565- CONNMAN_COLUMN_STRENGTH, strength, -1);
1308- 1566+ ipv4_netmask = g_hash_table_lookup (ipv4, "Netmask");
1567+ netmask = ipv4_netmask ? g_value_get_string(ipv4_netmask) : NULL;
1568
1309- value = g_hash_table_lookup(hash, "Device"); 1569- value = g_hash_table_lookup(hash, "Device");
1310- device = value ? g_value_get_boxed(value) : NULL; 1570- device = value ? g_value_get_boxed(value) : NULL;
1311- 1571+ ipv4_gateway = g_hash_table_lookup (ipv4, "Gateway");
1572+ gateway = ipv4_gateway ? g_value_get_string(ipv4_gateway) : NULL;
1573
1312- DBG("device %s", device); 1574- DBG("device %s", device);
1313- 1575+ DBG("name %s type %d icon %s state %s", name, type, icon, state);
1576
1314- gtk_tree_store_set(store, &iter, CONNMAN_COLUMN_DEVICE, device, -1); 1577- gtk_tree_store_set(store, &iter, CONNMAN_COLUMN_DEVICE, device, -1);
1315- 1578+ if (get_iter_from_proxy(store, &iter, proxy) == FALSE) {
1579+ GtkTreeIter label_iter;
1580+ guint label_type;
1581
1316- if (get_iter_from_path(store, &iter, device) == TRUE) { 1582- if (get_iter_from_path(store, &iter, device) == TRUE) {
1317- gtk_tree_store_set(store, &iter, 1583- gtk_tree_store_set(store, &iter,
1318- CONNMAN_COLUMN_DEVICE, device, 1584- CONNMAN_COLUMN_DEVICE, device,
1319- CONNMAN_COLUMN_INRANGE, TRUE, 1585- CONNMAN_COLUMN_INRANGE, TRUE,
1320- CONNMAN_COLUMN_ADDRESS, address, -1); 1586- CONNMAN_COLUMN_ADDRESS, address, -1);
1321- } 1587+ switch (type) {
1322+ CONNMAN_COLUMN_STATE, state, 1588+ case CONNMAN_TYPE_ETHERNET:
1323+ CONNMAN_COLUMN_SECURITY, security, 1589+ label_type = CONNMAN_TYPE_LABEL_ETHERNET;
1324+ CONNMAN_COLUMN_PASSPHRASE, passphrase, 1590+ break;
1325+ CONNMAN_COLUMN_STRENGTH, strength, 1591+ case CONNMAN_TYPE_WIFI:
1326+ CONNMAN_COLUMN_METHOD, method, 1592+ label_type = CONNMAN_TYPE_LABEL_WIFI;
1327+ CONNMAN_COLUMN_ADDRESS, addr, 1593+ break;
1328+ CONNMAN_COLUMN_NETMASK, netmask, 1594+ default:
1329+ CONNMAN_COLUMN_GATEWAY, gateway, 1595+ label_type = CONNMAN_TYPE_UNKNOWN;
1330+ -1); 1596+ break;
1597+ }
1598+
1599+ get_iter_from_type(store, &label_iter, label_type);
1600+
1601+ gtk_tree_store_insert_after(store, &iter, NULL, &label_iter);
1602+
1603+ dbus_g_proxy_add_signal(proxy, "PropertyChanged",
1604+ G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID);
1605+ dbus_g_proxy_connect_signal(proxy, "PropertyChanged",
1606+ G_CALLBACK(service_changed), store, NULL);
1607 }
1331 1608
1609+ gtk_tree_store_set(store, &iter,
1610+ CONNMAN_COLUMN_PROXY, proxy,
1611+ CONNMAN_COLUMN_NAME, name,
1612+ CONNMAN_COLUMN_ICON, icon,
1613+ CONNMAN_COLUMN_TYPE, type,
1614+ CONNMAN_COLUMN_STATE, state,
1615+ CONNMAN_COLUMN_SECURITY, security,
1616+ CONNMAN_COLUMN_PASSPHRASE, passphrase,
1617+ CONNMAN_COLUMN_STRENGTH, strength,
1618+ CONNMAN_COLUMN_METHOD, method,
1619+ CONNMAN_COLUMN_ADDRESS, addr,
1620+ CONNMAN_COLUMN_NETMASK, netmask,
1621+ CONNMAN_COLUMN_GATEWAY, gateway,
1622+ -1);
1623+
1332 done: 1624 done:
1333 g_object_unref(proxy); 1625 g_object_unref(proxy);
1334@@ -594,25 +449,8 @@ static void manager_changed(DBusGProxy *proxy, const char *property, 1626 }
1627@@ -594,25 +559,12 @@ static void manager_changed(DBusGProxy *proxy, const char *property,
1335 if (property == NULL || value == NULL) 1628 if (property == NULL || value == NULL)
1336 return; 1629 return;
1337 1630
@@ -1356,10 +1649,14 @@ index 9eba7ae..83f4e57 100644
1356- property_update(store, value, property, device_properties); 1649- property_update(store, value, property, device_properties);
1357+ if (g_str_equal(property, "Services") == TRUE) { 1650+ if (g_str_equal(property, "Services") == TRUE) {
1358+ property_update(store, value, property, service_properties); 1651+ property_update(store, value, property, service_properties);
1652+ } else if (g_str_equal(property, "EnabledTechnologies") == TRUE) {
1653+ enabled_technologies_changed(store, value);
1654+ } else if (g_str_equal(property, "OfflineMode") == TRUE) {
1655+ offline_mode_changed(store, value);
1359 } 1656 }
1360 } 1657 }
1361 1658
1362@@ -620,31 +458,16 @@ static void manager_properties(DBusGProxy *proxy, GHashTable *hash, 1659@@ -620,31 +572,24 @@ static void manager_properties(DBusGProxy *proxy, GHashTable *hash,
1363 GError *error, gpointer user_data) 1660 GError *error, gpointer user_data)
1364 { 1661 {
1365 GtkTreeStore *store = user_data; 1662 GtkTreeStore *store = user_data;
@@ -1379,39 +1676,59 @@ index 9eba7ae..83f4e57 100644
1379- callback = g_object_get_data(G_OBJECT(store), "callback"); 1676- callback = g_object_get_data(G_OBJECT(store), "callback");
1380- if (callback) 1677- if (callback)
1381- callback(state, NULL); 1678- callback(state, NULL);
1382- 1679+ value = g_hash_table_lookup(hash, "Services");
1680+ if (value != NULL)
1681+ property_update(store, value, "Services", service_properties);
1682
1383- value = g_hash_table_lookup(hash, "Devices"); 1683- value = g_hash_table_lookup(hash, "Devices");
1384- if (value != NULL) 1684+ value = g_hash_table_lookup(hash, "EnabledTechnologies");
1685 if (value != NULL)
1385- property_update(store, value, "Devices", device_properties); 1686- property_update(store, value, "Devices", device_properties);
1386- 1687+ enabled_technologies_properties(store, proxy, value);
1688
1387- value = g_hash_table_lookup(hash, "Connections"); 1689- value = g_hash_table_lookup(hash, "Connections");
1388+ value = g_hash_table_lookup(hash, "Services"); 1690+ value = g_hash_table_lookup(hash, "OfflineMode");
1389 if (value != NULL) 1691 if (value != NULL)
1390- property_update(store, value, 1692- property_update(store, value,
1391- "Connections", connection_properties); 1693- "Connections", connection_properties);
1392+ property_update(store, value, "Services", service_properties); 1694+ offline_mode_properties(store, proxy, value);
1393 } 1695 }
1394 1696
1395 DBusGProxy *connman_dbus_create_manager(DBusGConnection *conn, 1697 DBusGProxy *connman_dbus_create_manager(DBusGConnection *conn,
1396diff --git a/common/connman-dbus.h b/common/connman-dbus.h 1698diff --git a/common/connman-dbus.h b/common/connman-dbus.h
1397index a9fa51c..47179da 100644 1699index a9fa51c..dc07650 100644
1398--- a/common/connman-dbus.h 1700--- a/common/connman-dbus.h
1399+++ b/common/connman-dbus.h 1701+++ b/common/connman-dbus.h
1400@@ -30,10 +30,10 @@ 1702@@ -31,7 +31,7 @@
1401 #define CONNMAN_MANAGER_INTERFACE CONNMAN_SERVICE ".Manager"
1402 #define CONNMAN_MANAGER_PATH "/" 1703 #define CONNMAN_MANAGER_PATH "/"
1403 1704
1404-#define CONNMAN_PROFILE_INTERFACE CONNMAN_SERVICE ".Profile" 1705 #define CONNMAN_PROFILE_INTERFACE CONNMAN_SERVICE ".Profile"
1405-#define CONNMAN_DEVICE_INTERFACE CONNMAN_SERVICE ".Device" 1706-#define CONNMAN_DEVICE_INTERFACE CONNMAN_SERVICE ".Device"
1406-#define CONNMAN_NETWORK_INTERFACE CONNMAN_SERVICE ".Network"
1407-#define CONNMAN_CONNECTION_INTERFACE CONNMAN_SERVICE ".Connection"
1408+//#define CONNMAN_PROFILE_INTERFACE CONNMAN_SERVICE ".Profile"
1409+#define CONNMAN_SERVICE_INTERFACE CONNMAN_SERVICE ".Service" 1707+#define CONNMAN_SERVICE_INTERFACE CONNMAN_SERVICE ".Service"
1410+//#define CONNMAN_NETWORK_INTERFACE CONNMAN_SERVICE ".Network" 1708 #define CONNMAN_NETWORK_INTERFACE CONNMAN_SERVICE ".Network"
1411+//#define CONNMAN_CONNECTION_INTERFACE CONNMAN_SERVICE ".Connection" 1709 #define CONNMAN_CONNECTION_INTERFACE CONNMAN_SERVICE ".Connection"
1412 1710
1413 DBusGProxy *connman_dbus_create_manager(DBusGConnection *connection, 1711diff --git a/common/connman-dbus.xml b/common/connman-dbus.xml
1414 GtkTreeStore *store); 1712index 9fefd55..e20cb3b 100644
1713--- a/common/connman-dbus.xml
1714+++ b/common/connman-dbus.xml
1715@@ -15,5 +15,16 @@
1716 </method>
1717 <method name="Disconnect">
1718 </method>
1719+ <method name="Remove">
1720+ </method>
1721+ <method name="RequestScan">
1722+ <arg type="s"/>
1723+ </method>
1724+ <method name="EnableTechnology">
1725+ <arg type="s"/>
1726+ </method>
1727+ <method name="DisableTechnology">
1728+ <arg type="s"/>
1729+ </method>
1730 </interface>
1731 </node>
1415diff --git a/common/demo.c b/common/demo.c 1732diff --git a/common/demo.c b/common/demo.c
1416deleted file mode 100644 1733deleted file mode 100644
1417index 5e3924f..0000000 1734index 5e3924f..0000000
@@ -2451,7 +2768,7 @@ index 1eb1c3d..0000000
2451- data->dialog = dialog; 2768- data->dialog = dialog;
2452-} 2769-}
2453diff --git a/properties/advanced.h b/properties/advanced.h 2770diff --git a/properties/advanced.h b/properties/advanced.h
2454index f85f10d..a180b98 100644 2771index f85f10d..42b439f 100644
2455--- a/properties/advanced.h 2772--- a/properties/advanced.h
2456+++ b/properties/advanced.h 2773+++ b/properties/advanced.h
2457@@ -23,6 +23,7 @@ struct config_data { 2774@@ -23,6 +23,7 @@ struct config_data {
@@ -2462,11 +2779,13 @@ index f85f10d..a180b98 100644
2462 GtkWidget *title; 2779 GtkWidget *title;
2463 GtkWidget *label; 2780 GtkWidget *label;
2464 GtkWidget *button; 2781 GtkWidget *button;
2465@@ -45,15 +46,26 @@ struct config_data { 2782@@ -45,15 +46,34 @@ struct config_data {
2466 GtkWidget *value[3]; 2783 GtkWidget *value[3];
2467 GtkWidget *entry[3]; 2784 GtkWidget *entry[3];
2468 } ipv4; 2785 } ipv4;
2469+ 2786-};
2787
2788-void create_advanced_dialog(struct config_data *data, guint type);
2470+ struct ipv4_config ipv4_config; 2789+ struct ipv4_config ipv4_config;
2471+ 2790+
2472+ struct { 2791+ struct {
@@ -2478,25 +2797,32 @@ index f85f10d..a180b98 100644
2478+ GtkWidget *connect; 2797+ GtkWidget *connect;
2479+ GtkWidget *disconnect; 2798+ GtkWidget *disconnect;
2480+ } wifi; 2799+ } wifi;
2481+
2482+ gboolean connecting;
2483 };
2484
2485 void create_advanced_dialog(struct config_data *data, guint type);
2486 2800
2487-void add_ethernet_policy(GtkWidget *mainbox, struct config_data *data); 2801-void add_ethernet_policy(GtkWidget *mainbox, struct config_data *data);
2488-void update_ethernet_policy(struct config_data *data, guint policy); 2802-void update_ethernet_policy(struct config_data *data, guint policy);
2489+void add_ethernet_policy(GtkWidget *mainbox, GtkTreeIter *iter, struct config_data *data); 2803+ GtkWidget *ethernet_button;
2490+void update_ethernet_ipv4(struct config_data *data, guint policy); 2804+ GtkWidget *wifi_button;
2491 2805
2492-void add_wifi_policy(GtkWidget *mainbox, struct config_data *data); 2806-void add_wifi_policy(GtkWidget *mainbox, struct config_data *data);
2807+ GtkWidget *scan_button;
2808+ GtkWidget *offline_button;
2809+};
2810+
2811+void add_ethernet_policy(GtkWidget *mainbox, GtkTreeIter *iter, struct config_data *data);
2812+void update_ethernet_ipv4(struct config_data *data, guint policy);
2813+
2493+void add_wifi_policy(GtkWidget *mainbox, GtkTreeIter *iter, struct config_data *data); 2814+void add_wifi_policy(GtkWidget *mainbox, GtkTreeIter *iter, struct config_data *data);
2494 void update_wifi_policy(struct config_data *data, guint policy); 2815 void update_wifi_policy(struct config_data *data, guint policy);
2495- 2816
2496-gboolean separator_function(GtkTreeModel *model, 2817-gboolean separator_function(GtkTreeModel *model,
2497- GtkTreeIter *iter, gpointer user_data); 2818- GtkTreeIter *iter, gpointer user_data);
2819+void add_ethernet_switch_button(GtkWidget *mainbox, GtkTreeIter *iter,
2820+ struct config_data *data);
2821+
2822+void add_wifi_switch_button(GtkWidget *mainbox, GtkTreeIter *iter,
2823+ struct config_data *data);
2498diff --git a/properties/ethernet.c b/properties/ethernet.c 2824diff --git a/properties/ethernet.c b/properties/ethernet.c
2499index d5c948d..1901ee6 100644 2825index d5c948d..d443ca1 100644
2500--- a/properties/ethernet.c 2826--- a/properties/ethernet.c
2501+++ b/properties/ethernet.c 2827+++ b/properties/ethernet.c
2502@@ -23,6 +23,7 @@ 2828@@ -23,6 +23,7 @@
@@ -2507,7 +2833,7 @@ index d5c948d..1901ee6 100644
2507 #include <glib/gi18n.h> 2833 #include <glib/gi18n.h>
2508 #include <gtk/gtk.h> 2834 #include <gtk/gtk.h>
2509 2835
2510@@ -30,93 +31,167 @@ 2836@@ -30,93 +31,220 @@
2511 2837
2512 #include "advanced.h" 2838 #include "advanced.h"
2513 2839
@@ -2562,17 +2888,68 @@ index d5c948d..1901ee6 100644
2562+ data->ipv4_config.gateway = active ? gtk_entry_get_text(GTK_ENTRY(data->ipv4.entry[2])) : NULL; 2888+ data->ipv4_config.gateway = active ? gtk_entry_get_text(GTK_ENTRY(data->ipv4.entry[2])) : NULL;
2563+ 2889+
2564+ connman_client_set_ipv4(data->client, data->device, &data->ipv4_config); 2890+ connman_client_set_ipv4(data->client, data->device, &data->ipv4_config);
2891+}
2892+
2893+static void switch_callback(GtkWidget *editable, gpointer user_data)
2894+{
2895+ struct config_data *data = user_data;
2896+ const gchar *label = gtk_button_get_label(GTK_BUTTON(data->ethernet_button));
2897+ if (g_str_equal(label, "Disable"))
2898+ connman_client_disable_technology(data->client, data->device, "ethernet");
2899+ else if (g_str_equal(label, "Enable"))
2900+ connman_client_enable_technology(data->client, data->device, "ethernet");
2565 } 2901 }
2566 2902
2567-void add_ethernet_policy(GtkWidget *mainbox, struct config_data *data) 2903-void add_ethernet_policy(GtkWidget *mainbox, struct config_data *data)
2904+void add_ethernet_switch_button(GtkWidget *mainbox, GtkTreeIter *iter,
2905+ struct config_data *data)
2906+{
2907+ GtkWidget *vbox;
2908+ GtkWidget *table;
2909+ GtkWidget *label;
2910+ GtkWidget *buttonbox;
2911+ GtkWidget *button;
2912+ gboolean ethernet_enabled;
2913+
2914+ gtk_tree_model_get(data->model, iter,
2915+ CONNMAN_COLUMN_ETHERNET_ENABLED, &ethernet_enabled,
2916+ -1);
2917+
2918+ vbox = gtk_vbox_new(TRUE, 0);
2919+ gtk_container_set_border_width(GTK_CONTAINER(vbox), 24);
2920+ gtk_box_pack_start(GTK_BOX(mainbox), vbox, FALSE, FALSE, 0);
2921+
2922+ table = gtk_table_new(1, 1, TRUE);
2923+ gtk_table_set_row_spacings(GTK_TABLE(table), 10);
2924+ gtk_table_set_col_spacings(GTK_TABLE(table), 10);
2925+ gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
2926+
2927+ label = gtk_label_new(_("Enable/Disable Wired Networks."));
2928+ gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1);
2929+
2930+ buttonbox = gtk_hbutton_box_new();
2931+ gtk_button_box_set_layout(GTK_BUTTON_BOX(buttonbox), GTK_BUTTONBOX_CENTER);
2932+ gtk_box_pack_start(GTK_BOX(mainbox), buttonbox, FALSE, FALSE, 0);
2933+
2934+ button = gtk_button_new();
2935+ data->ethernet_button = button;
2936+
2937+ if (ethernet_enabled)
2938+ gtk_button_set_label(GTK_BUTTON(button), _("Disable"));
2939+ else
2940+ gtk_button_set_label(GTK_BUTTON(button), _("Enable"));
2941+
2942+ gtk_container_add(GTK_CONTAINER(buttonbox), button);
2943+ g_signal_connect(G_OBJECT(button), "clicked",
2944+ G_CALLBACK(switch_callback), data);
2945+}
2946+
2568+void add_ethernet_policy(GtkWidget *mainbox, GtkTreeIter *iter, struct config_data *data) 2947+void add_ethernet_policy(GtkWidget *mainbox, GtkTreeIter *iter, struct config_data *data)
2569 { 2948 {
2570 GtkWidget *vbox; 2949 GtkWidget *vbox;
2571 GtkWidget *table; 2950 GtkWidget *table;
2572 GtkWidget *label; 2951 GtkWidget *label;
2573 GtkWidget *combo; 2952 GtkWidget *combo;
2574-
2575- vbox = gtk_vbox_new(FALSE, 0);
2576+ GtkWidget *entry; 2953+ GtkWidget *entry;
2577+ GtkWidget *button; 2954+ GtkWidget *button;
2578+ 2955+
@@ -2589,7 +2966,8 @@ index d5c948d..1901ee6 100644
2589+ CONNMAN_COLUMN_NETMASK, &ipv4_config.netmask, 2966+ CONNMAN_COLUMN_NETMASK, &ipv4_config.netmask,
2590+ CONNMAN_COLUMN_GATEWAY, &ipv4_config.gateway, 2967+ CONNMAN_COLUMN_GATEWAY, &ipv4_config.gateway,
2591+ -1); 2968+ -1);
2592+ 2969
2970- vbox = gtk_vbox_new(FALSE, 0);
2593+ vbox = gtk_vbox_new(TRUE, 0); 2971+ vbox = gtk_vbox_new(TRUE, 0);
2594 gtk_container_set_border_width(GTK_CONTAINER(vbox), 24); 2972 gtk_container_set_border_width(GTK_CONTAINER(vbox), 24);
2595 gtk_box_pack_start(GTK_BOX(mainbox), vbox, FALSE, FALSE, 0); 2973 gtk_box_pack_start(GTK_BOX(mainbox), vbox, FALSE, FALSE, 0);
@@ -2725,7 +3103,7 @@ index d5c948d..1901ee6 100644
2725 break; 3103 break;
2726 default: 3104 default:
2727 gtk_combo_box_set_active(GTK_COMBO_BOX(combo), -1); 3105 gtk_combo_box_set_active(GTK_COMBO_BOX(combo), -1);
2728@@ -124,9 +199,5 @@ void update_ethernet_policy(struct config_data *data, guint policy) 3106@@ -124,9 +252,5 @@ void update_ethernet_policy(struct config_data *data, guint policy)
2729 } 3107 }
2730 3108
2731 g_signal_handlers_unblock_by_func(G_OBJECT(combo), 3109 g_signal_handlers_unblock_by_func(G_OBJECT(combo),
@@ -2737,22 +3115,24 @@ index d5c948d..1901ee6 100644
2737+ G_CALLBACK(changed_callback), data); 3115+ G_CALLBACK(changed_callback), data);
2738 } 3116 }
2739diff --git a/properties/main.c b/properties/main.c 3117diff --git a/properties/main.c b/properties/main.c
2740index 01439e6..3701f16 100644 3118index 01439e6..6b389bc 100644
2741--- a/properties/main.c 3119--- a/properties/main.c
2742+++ b/properties/main.c 3120+++ b/properties/main.c
2743@@ -33,102 +33,54 @@ 3121@@ -32,103 +32,139 @@
3122
2744 static ConnmanClient *client; 3123 static ConnmanClient *client;
2745 static GtkWidget *interface_notebook; 3124 static GtkWidget *interface_notebook;
3125+static struct config_data *current_data;
2746 3126
2747-static void update_status(struct config_data *data, 3127-static void update_status(struct config_data *data,
2748- guint type, gboolean inrange, guint policy, 3128- guint type, gboolean inrange, guint policy,
2749- const gchar *network, const gchar *address) 3129- const gchar *network, const gchar *address)
2750+static void get_state_realtime(GtkTreeModel *model, GtkTreePath *path, 3130+static void status_update(GtkTreeModel *model, GtkTreePath *path,
2751+ GtkTreeIter *iter, gpointer user_data) 3131+ GtkTreeIter *iter, gpointer user_data)
2752 { 3132 {
2753- const char *str; 3133- const char *str;
2754- gchar *markup, *info = NULL; 3134- gchar *markup, *info = NULL;
2755- 3135
2756- switch (type) { 3136- switch (type) {
2757- case CONNMAN_TYPE_ETHERNET: 3137- case CONNMAN_TYPE_ETHERNET:
2758- if (inrange == TRUE) { 3138- if (inrange == TRUE) {
@@ -2760,60 +3140,91 @@ index 01439e6..3701f16 100644
2760- info = g_strdup_printf(_("%s is currently active " 3140- info = g_strdup_printf(_("%s is currently active "
2761- "and has the IP address %s."), 3141- "and has the IP address %s."),
2762- N_("Ethernet"), address); 3142- N_("Ethernet"), address);
3143- } else {
3144- str = N_("Cable Unplugged");
3145- info = g_strdup_printf(_("The cable for %s is "
3146- "not plugged in."), N_("Ethernet"));
3147- }
3148- break;
2763+ struct config_data *data = user_data; 3149+ struct config_data *data = user_data;
2764+ guint type, strength; 3150+ guint type;
2765+ const gchar *name = NULL, *_name = NULL, *state = NULL; 3151+ const char *name = NULL, *_name = NULL, *state = NULL;
2766+ 3152+ gboolean ethernet_enabled;
2767+ if (data->wifi.name) 3153+ gboolean wifi_enabled;
2768+ _name = gtk_label_get_text(GTK_LABEL(data->wifi.name)); 3154+ gboolean offline_mode;
2769+ 3155
2770+ gtk_tree_model_get(model, iter, CONNMAN_COLUMN_STRENGTH, &strength, 3156- case CONNMAN_TYPE_WIFI:
3157- if (inrange == TRUE) {
3158- str = N_("Connected");
3159- info = g_strdup_printf(_("%s is currently active "
3160- "and has the IP address %s."),
3161- N_("Wireless"), address);
3162- } else
3163- str = N_("Not Connected");
3164- break;
3165+ gtk_tree_model_get(model, iter,
2771+ CONNMAN_COLUMN_STATE, &state, 3166+ CONNMAN_COLUMN_STATE, &state,
2772+ CONNMAN_COLUMN_NAME, &name, 3167+ CONNMAN_COLUMN_NAME, &name,
2773+ CONNMAN_COLUMN_TYPE, &type, 3168+ CONNMAN_COLUMN_TYPE, &type,
3169+ CONNMAN_COLUMN_ETHERNET_ENABLED, &ethernet_enabled,
3170+ CONNMAN_COLUMN_WIFI_ENABLED, &wifi_enabled,
3171+ CONNMAN_COLUMN_OFFLINEMODE, &offline_mode,
2774+ -1); 3172+ -1);
2775+ 3173+
2776+ if (name && _name && g_str_equal(name, _name) == TRUE && data->connecting) { 3174+ if (type == CONNMAN_TYPE_WIFI) {
3175+ if (data->wifi.name)
3176+ _name = gtk_label_get_text(GTK_LABEL(data->wifi.name));
3177+
3178+ if (!(name && _name && g_str_equal(name, _name)))
3179+ return;
3180
3181- default:
3182- if (inrange == TRUE)
3183- str = N_("Connected");
2777+ if (g_str_equal(state, "failure") == TRUE) { 3184+ if (g_str_equal(state, "failure") == TRUE) {
2778+ gtk_label_set_text(GTK_LABEL(data->wifi.connect_info), 3185+ gtk_label_set_text(GTK_LABEL(data->wifi.connect_info),
2779+ _("connection failed")); 3186+ _("connection failed"));
2780+ gtk_widget_show(data->wifi.connect_info); 3187+ gtk_widget_show(data->wifi.connect_info);
2781+ gtk_widget_show(data->wifi.connect); 3188+ gtk_widget_show(data->wifi.connect);
2782+ gtk_widget_hide(data->wifi.disconnect); 3189+ gtk_widget_hide(data->wifi.disconnect);
2783+ data->connecting = 0;
2784+ } else if (g_str_equal(state, "idle") == TRUE) { 3190+ } else if (g_str_equal(state, "idle") == TRUE) {
2785+ gtk_widget_hide(data->wifi.connect_info); 3191+ gtk_widget_hide(data->wifi.connect_info);
2786+ gtk_widget_show(data->wifi.connect); 3192+ gtk_widget_show(data->wifi.connect);
2787+ gtk_widget_hide(data->wifi.disconnect); 3193+ gtk_widget_hide(data->wifi.disconnect);
2788+ data->connecting = 0; 3194+ } else {
2789 } else {
2790- str = N_("Cable Unplugged");
2791- info = g_strdup_printf(_("The cable for %s is "
2792- "not plugged in."), N_("Ethernet"));
2793+ gtk_widget_hide(data->wifi.connect_info); 3195+ gtk_widget_hide(data->wifi.connect_info);
2794+ gtk_widget_hide(data->wifi.connect); 3196+ gtk_widget_hide(data->wifi.connect);
2795+ gtk_widget_show(data->wifi.disconnect); 3197+ gtk_widget_show(data->wifi.disconnect);
2796 } 3198+ }
2797- break; 3199+ } else if (type == CONNMAN_TYPE_LABEL_ETHERNET) {
2798- 3200+ if (!data->ethernet_button)
2799- case CONNMAN_TYPE_WIFI: 3201+ return;
2800- if (inrange == TRUE) { 3202+ if (ethernet_enabled)
2801- str = N_("Connected"); 3203+ gtk_button_set_label(GTK_BUTTON(data->ethernet_button), _("Disable"));
2802- info = g_strdup_printf(_("%s is currently active " 3204 else
2803- "and has the IP address %s."),
2804- N_("Wireless"), address);
2805- } else
2806- str = N_("Not Connected");
2807- break;
2808-
2809- default:
2810- if (inrange == TRUE)
2811- str = N_("Connected");
2812- else
2813- str = N_("Not Connected"); 3205- str = N_("Not Connected");
2814- break; 3206- break;
3207+ gtk_button_set_label(GTK_BUTTON(data->ethernet_button), _("Enable"));
3208+ } else if (type == CONNMAN_TYPE_LABEL_WIFI) {
3209+ if (!data->wifi_button)
3210+ return;
3211+ if (wifi_enabled) {
3212+ gtk_button_set_label(GTK_BUTTON(data->wifi_button), _("Disable"));
3213+ gtk_widget_set_sensitive(data->scan_button, 1);
3214+ } else {
3215+ gtk_button_set_label(GTK_BUTTON(data->wifi_button), _("Enable"));
3216+ gtk_widget_set_sensitive(data->scan_button, 0);
3217+ }
3218+ } else if (type == CONNMAN_TYPE_SYSCONFIG) {
3219+ if (!data->offline_button)
3220+ return;
3221+ if (offline_mode)
3222+ gtk_button_set_label(GTK_BUTTON(data->offline_button), _("OnlineMode"));
3223+ else
3224+ gtk_button_set_label(GTK_BUTTON(data->offline_button), _("OfflineMode"));
2815 } 3225 }
2816- 3226+}
3227
2817- markup = g_strdup_printf("<b>%s</b>", str); 3228- markup = g_strdup_printf("<b>%s</b>", str);
2818- gtk_label_set_markup(GTK_LABEL(data->title), markup); 3229- gtk_label_set_markup(GTK_LABEL(data->title), markup);
2819- g_free(markup); 3230- g_free(markup);
@@ -2832,30 +3243,72 @@ index 01439e6..3701f16 100644
2832- default: 3243- default:
2833- break; 3244- break;
2834- } 3245- }
2835-} 3246+static void set_offline_callback(GtkWidget *button, gpointer user_data)
2836- 3247+{
3248+ struct config_data *data = user_data;
3249+ const gchar *label = gtk_button_get_label(GTK_BUTTON(data->offline_button));
3250+ if (g_str_equal(label, "OnlineMode"))
3251+ connman_client_set_offlinemode(client, 0);
3252+ else if (g_str_equal(label, "OfflineMode"))
3253+ connman_client_set_offlinemode(client, 1);
3254 }
3255
2837-static void update_config(struct config_data *data) 3256-static void update_config(struct config_data *data)
2838-{ 3257+static void add_system_config(GtkWidget *mainbox, GtkTreeIter *iter,
3258+ struct config_data *data)
3259 {
2839- GtkTreeIter iter; 3260- GtkTreeIter iter;
2840- guint type; 3261- guint type;
2841- gchar *network; 3262- gchar *network;
2842- 3263+ GtkWidget *vbox;
3264+ GtkWidget *table;
3265+ GtkWidget *label;
3266+ GtkWidget *buttonbox;
3267+ GtkWidget *button;
3268+ gboolean offline_mode;
3269
2843- if (gtk_tree_model_get_iter_from_string(data->model, 3270- if (gtk_tree_model_get_iter_from_string(data->model,
2844- &iter, data->index) == FALSE) 3271- &iter, data->index) == FALSE)
2845- return; 3272- return;
2846- 3273+ vbox = gtk_vbox_new(TRUE, 0);
3274+ gtk_container_set_border_width(GTK_CONTAINER(vbox), 24);
3275+ gtk_box_pack_start(GTK_BOX(mainbox), vbox, FALSE, FALSE, 0);
3276
2847- gtk_tree_model_get(data->model, &iter, 3277- gtk_tree_model_get(data->model, &iter,
2848- CONNMAN_COLUMN_TYPE, &type, 3278- CONNMAN_COLUMN_TYPE, &type,
2849- CONNMAN_COLUMN_NAME, &network, -1); 3279- CONNMAN_COLUMN_NAME, &network, -1);
2850- 3280+ table = gtk_table_new(1, 1, TRUE);
3281+ gtk_table_set_row_spacings(GTK_TABLE(table), 10);
3282+ gtk_table_set_col_spacings(GTK_TABLE(table), 10);
3283+ gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
3284
2851- g_free(network); 3285- g_free(network);
2852-} 3286-}
2853- 3287+ label = gtk_label_new(_("System Configuration"));
3288+ gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1);
3289
2854-static void advanced_callback(GtkWidget *button, gpointer user_data) 3290-static void advanced_callback(GtkWidget *button, gpointer user_data)
2855-{ 3291-{
2856- struct config_data *data = user_data; 3292- struct config_data *data = user_data;
2857- 3293+ buttonbox = gtk_hbutton_box_new();
3294+ gtk_button_box_set_layout(GTK_BUTTON_BOX(buttonbox), GTK_BUTTONBOX_CENTER);
3295+ gtk_box_pack_start(GTK_BOX(mainbox), buttonbox, FALSE, FALSE, 0);
3296+
3297+ gtk_tree_model_get(data->model, iter,
3298+ CONNMAN_COLUMN_OFFLINEMODE, &offline_mode,
3299+ -1);
3300+
3301+ button = gtk_button_new();
3302+ data->offline_button = button;
3303+ if (offline_mode)
3304+ gtk_button_set_label(GTK_BUTTON(button), _("OnlineMode"));
3305+ else
3306+ gtk_button_set_label(GTK_BUTTON(button), _("OfflineMode"));
3307
2858- gtk_widget_show_all(data->dialog); 3308- gtk_widget_show_all(data->dialog);
3309+ gtk_container_add(GTK_CONTAINER(buttonbox), button);
3310+ g_signal_connect(G_OBJECT(button), "clicked",
3311+ G_CALLBACK(set_offline_callback), data);
2859 } 3312 }
2860 3313
2861 static struct config_data *create_config(GtkTreeModel *model, 3314 static struct config_data *create_config(GtkTreeModel *model,
@@ -2873,12 +3326,11 @@ index 01439e6..3701f16 100644
2873- gchar *markup, *vendor = NULL, *product = NULL; 3326- gchar *markup, *vendor = NULL, *product = NULL;
2874- gchar *network = NULL, *address = NULL; 3327- gchar *network = NULL, *address = NULL;
2875+ guint type; 3328+ guint type;
2876+ gchar *vendor = NULL, *product = NULL; 3329+ char *state = NULL;
2877+ gchar *address = NULL, *state = NULL;
2878 3330
2879 data = g_try_new0(struct config_data, 1); 3331 data = g_try_new0(struct config_data, 1);
2880 if (data == NULL) 3332 if (data == NULL)
2881@@ -137,14 +89,16 @@ static struct config_data *create_config(GtkTreeModel *model, 3333@@ -137,15 +173,10 @@ static struct config_data *create_config(GtkTreeModel *model,
2882 data->client = client; 3334 data->client = client;
2883 3335
2884 gtk_tree_model_get(model, iter, 3336 gtk_tree_model_get(model, iter,
@@ -2888,24 +3340,25 @@ index 01439e6..3701f16 100644
2888- CONNMAN_COLUMN_NETWORK, &network, 3340- CONNMAN_COLUMN_NETWORK, &network,
2889- CONNMAN_COLUMN_ADDRESS, &address, 3341- CONNMAN_COLUMN_ADDRESS, &address,
2890- CONNMAN_COLUMN_POLICY, &policy, -1); 3342- CONNMAN_COLUMN_POLICY, &policy, -1);
3343-
3344- data->device = g_strdup(dbus_g_proxy_get_path(proxy));
3345- g_object_unref(proxy);
2891+ CONNMAN_COLUMN_PROXY, &proxy, 3346+ CONNMAN_COLUMN_PROXY, &proxy,
2892+ CONNMAN_COLUMN_TYPE, &type, 3347+ CONNMAN_COLUMN_TYPE, &type,
2893+ CONNMAN_COLUMN_ADDRESS, &address,
2894+ CONNMAN_COLUMN_STATE, &state, 3348+ CONNMAN_COLUMN_STATE, &state,
2895+ -1); 3349+ -1);
2896 3350
2897 data->device = g_strdup(dbus_g_proxy_get_path(proxy));
2898+ data->model = model;
2899+ data->index = gtk_tree_model_get_string_from_iter(model, iter);
2900+
2901 g_object_unref(proxy);
2902
2903 mainbox = gtk_vbox_new(FALSE, 6); 3351 mainbox = gtk_vbox_new(FALSE, 6);
2904@@ -163,12 +117,14 @@ static struct config_data *create_config(GtkTreeModel *model, 3352 data->widget = mainbox;
3353@@ -163,12 +194,27 @@ static struct config_data *create_config(GtkTreeModel *model,
2905 gtk_box_pack_start(GTK_BOX(mainbox), label, FALSE, FALSE, 0); 3354 gtk_box_pack_start(GTK_BOX(mainbox), label, FALSE, FALSE, 0);
2906 data->label = label; 3355 data->label = label;
2907 3356
2908+ data->window = user_data; 3357+ data->window = user_data;
3358+ data->model = model;
3359+ data->index = gtk_tree_model_get_string_from_iter(model, iter);
3360+ data->device = g_strdup(dbus_g_proxy_get_path(proxy));
3361+ g_object_unref(proxy);
2909+ 3362+
2910 switch (type) { 3363 switch (type) {
2911 case CONNMAN_TYPE_ETHERNET: 3364 case CONNMAN_TYPE_ETHERNET:
@@ -2915,10 +3368,19 @@ index 01439e6..3701f16 100644
2915 case CONNMAN_TYPE_WIFI: 3368 case CONNMAN_TYPE_WIFI:
2916- add_wifi_policy(mainbox, data); 3369- add_wifi_policy(mainbox, data);
2917+ add_wifi_policy(mainbox, iter, data); 3370+ add_wifi_policy(mainbox, iter, data);
3371+ break;
3372+ case CONNMAN_TYPE_LABEL_ETHERNET:
3373+ add_ethernet_switch_button(mainbox, iter, data);
3374+ break;
3375+ case CONNMAN_TYPE_LABEL_WIFI:
3376+ add_wifi_switch_button(mainbox, iter, data);
3377+ break;
3378+ case CONNMAN_TYPE_SYSCONFIG:
3379+ add_system_config(mainbox, iter, data);
2918 break; 3380 break;
2919 default: 3381 default:
2920 break; 3382 break;
2921@@ -183,32 +139,12 @@ static struct config_data *create_config(GtkTreeModel *model, 3383@@ -183,34 +229,10 @@ static struct config_data *create_config(GtkTreeModel *model,
2922 gtk_misc_set_alignment(GTK_MISC(label), 0.0, 1.0); 3384 gtk_misc_set_alignment(GTK_MISC(label), 0.0, 1.0);
2923 gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0); 3385 gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0);
2924 3386
@@ -2941,19 +3403,21 @@ index 01439e6..3701f16 100644
2941- update_status(data, type, inrange, policy, network, address); 3403- update_status(data, type, inrange, policy, network, address);
2942- 3404-
2943- g_free(network); 3405- g_free(network);
2944 g_free(address); 3406- g_free(address);
2945 3407-
2946- data->model = model; 3408- data->model = model;
2947- data->index = gtk_tree_model_get_string_from_iter(model, iter); 3409- data->index = gtk_tree_model_get_string_from_iter(model, iter);
2948- 3410-
2949 gtk_widget_show_all(mainbox); 3411 gtk_widget_show_all(mainbox);
2950 3412
3413- g_free(product);
3414- g_free(vendor);
2951+ g_signal_connect(G_OBJECT(model), "row-changed", 3415+ g_signal_connect(G_OBJECT(model), "row-changed",
2952+ G_CALLBACK(get_state_realtime), data); 3416+ G_CALLBACK(status_update), data);
2953 g_free(product);
2954 g_free(vendor);
2955 3417
2956@@ -230,67 +166,56 @@ static void select_callback(GtkTreeSelection *selection, gpointer user_data) 3418 return data;
3419 }
3420@@ -230,112 +252,108 @@ static void select_callback(GtkTreeSelection *selection, gpointer user_data)
2957 return; 3421 return;
2958 } 3422 }
2959 3423
@@ -2961,42 +3425,50 @@ index 01439e6..3701f16 100644
2961- data = create_config(model, &iter, user_data); 3425- data = create_config(model, &iter, user_data);
2962- if (data == NULL) 3426- if (data == NULL)
2963- return; 3427- return;
2964- 3428+ if (current_data) {
3429+ g_signal_handlers_disconnect_by_func(G_OBJECT(model),
3430+ G_CALLBACK(status_update), current_data);
3431+ g_free(current_data);
3432+ }
3433+ data = create_config(model, &iter, user_data);
3434+ if (data == NULL)
3435+ return;
3436
2965- page = gtk_notebook_append_page(GTK_NOTEBOOK(notebook), 3437- page = gtk_notebook_append_page(GTK_NOTEBOOK(notebook),
2966- data->widget, NULL); 3438- data->widget, NULL);
2967- } else { 3439- } else {
2968- update_config(data); 3440- update_config(data);
2969- 3441+ current_data = data;
3442
2970- page = gtk_notebook_page_num(GTK_NOTEBOOK(notebook), 3443- page = gtk_notebook_page_num(GTK_NOTEBOOK(notebook),
2971- data->widget); 3444- data->widget);
2972- } 3445- }
2973+ data = create_config(model, &iter, user_data);
2974+ if (data == NULL)
2975+ return;
2976
2977+ page = gtk_notebook_append_page(GTK_NOTEBOOK(notebook), 3446+ page = gtk_notebook_append_page(GTK_NOTEBOOK(notebook),
2978+ data->widget, NULL); 3447+ data->widget, NULL);
2979 gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), page);
2980 3448
3449 gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), page);
3450-
2981 gtk_widget_show(notebook); 3451 gtk_widget_show(notebook);
2982 } 3452 }
2983 3453
2984-static void row_changed(GtkTreeModel *model, GtkTreePath *path, 3454-static void row_changed(GtkTreeModel *model, GtkTreePath *path,
2985- GtkTreeIter *iter, gpointer user_data) 3455- GtkTreeIter *iter, gpointer user_data)
2986-{ 3456+static void device_to_text(GtkTreeViewColumn *column, GtkCellRenderer *cell,
2987- guint type; 3457+ GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
3458 {
3459 guint type;
2988- gboolean powered, inrange; 3460- gboolean powered, inrange;
2989- 3461+ char *markup, *name, *state;
2990- gtk_tree_model_get(model, iter, CONNMAN_COLUMN_TYPE, &type, 3462+ const char *title;
3463
3464 gtk_tree_model_get(model, iter, CONNMAN_COLUMN_TYPE, &type,
2991- CONNMAN_COLUMN_ENABLED, &powered, 3465- CONNMAN_COLUMN_ENABLED, &powered,
2992- CONNMAN_COLUMN_INRANGE, &inrange, -1); 3466- CONNMAN_COLUMN_INRANGE, &inrange, -1);
2993-} 3467-}
2994- 3468-
2995-static void state_to_icon(GtkTreeViewColumn *column, GtkCellRenderer *cell, 3469-static void state_to_icon(GtkTreeViewColumn *column, GtkCellRenderer *cell,
2996- GtkTreeModel *model, GtkTreeIter *iter, gpointer data) 3470- GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
2997+static void strength_to_icon(GtkTreeViewColumn *column, GtkCellRenderer *cell, 3471-{
2998+ GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
2999 {
3000- gboolean inrange; 3472- gboolean inrange;
3001- 3473-
3002- gtk_tree_model_get(model, iter, CONNMAN_COLUMN_INRANGE, &inrange, -1); 3474- gtk_tree_model_get(model, iter, CONNMAN_COLUMN_INRANGE, &inrange, -1);
@@ -3005,36 +3477,17 @@ index 01439e6..3701f16 100644
3005- g_object_set(cell, "icon-name", GTK_STOCK_YES, NULL); 3477- g_object_set(cell, "icon-name", GTK_STOCK_YES, NULL);
3006- else 3478- else
3007- g_object_set(cell, "icon-name", NULL, NULL); 3479- g_object_set(cell, "icon-name", NULL, NULL);
3008+ GdkPixbuf *pix; 3480-}
3009+ guint strength, type; 3481-
3010+ gchar *name;
3011+
3012+ gtk_tree_model_get(model, iter, CONNMAN_COLUMN_STRENGTH, &strength,
3013+ CONNMAN_COLUMN_TYPE, &type,
3014+ -1);
3015+
3016+ if (type == CONNMAN_TYPE_WIFI) {
3017+ name = (gchar *)g_strdup_printf("%s/connman-signal-0%d.png",
3018+ ICONDIR, (strength-1)/20+1);
3019+ pix = gdk_pixbuf_new_from_file(name, NULL);
3020+ g_object_set(cell, "pixbuf", pix, NULL);
3021+ } else
3022+ g_object_set(cell, "pixbuf", NULL, NULL);
3023 }
3024
3025-static void type_to_text(GtkTreeViewColumn *column, GtkCellRenderer *cell, 3482-static void type_to_text(GtkTreeViewColumn *column, GtkCellRenderer *cell,
3026- GtkTreeModel *model, GtkTreeIter *iter, gpointer data) 3483- GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
3027+static void device_to_text(GtkTreeViewColumn *column, GtkCellRenderer *cell, 3484-{
3028+ GtkTreeModel *model, GtkTreeIter *iter, gpointer data) 3485- guint type;
3029 {
3030 guint type;
3031- gboolean powered, inrange; 3486- gboolean powered, inrange;
3032- gchar *markup; 3487- gchar *markup;
3033- const char *title, *info; 3488- const char *title, *info;
3034+ gchar *markup, *name, *state; 3489-
3035+ const char *title; 3490- gtk_tree_model_get(model, iter, CONNMAN_COLUMN_TYPE, &type,
3036
3037 gtk_tree_model_get(model, iter, CONNMAN_COLUMN_TYPE, &type,
3038- CONNMAN_COLUMN_ENABLED, &powered, 3491- CONNMAN_COLUMN_ENABLED, &powered,
3039- CONNMAN_COLUMN_INRANGE, &inrange, -1); 3492- CONNMAN_COLUMN_INRANGE, &inrange, -1);
3040+ CONNMAN_COLUMN_NAME, &name, 3493+ CONNMAN_COLUMN_NAME, &name,
@@ -3044,70 +3497,102 @@ index 01439e6..3701f16 100644
3044 switch (type) { 3497 switch (type) {
3045 case CONNMAN_TYPE_ETHERNET: 3498 case CONNMAN_TYPE_ETHERNET:
3046 title = N_("Ethernet"); 3499 title = N_("Ethernet");
3500+ markup = g_strdup_printf(" %s\n", title);
3047 break; 3501 break;
3048 case CONNMAN_TYPE_WIFI: 3502 case CONNMAN_TYPE_WIFI:
3049- title = N_("Wireless"); 3503- title = N_("Wireless");
3050+ /* Show the AP name */ 3504+ /* Show the AP name */
3051+ title = N_(name); 3505+ title = N_(name);
3506+ if (g_str_equal(state, "association") == TRUE)
3507+ state = "associating...";
3508+ else if (g_str_equal(state, "configuration") == TRUE)
3509+ state = "configurating...";
3510+ else if (g_str_equal(state, "ready") == TRUE ||
3511+ g_str_equal(state, "online") == TRUE)
3512+ state = "connnected";
3513+ else
3514+ state = "";
3515+ markup = g_strdup_printf(" %s\n %s", title, state);
3516+
3052 break; 3517 break;
3053 case CONNMAN_TYPE_WIMAX: 3518 case CONNMAN_TYPE_WIMAX:
3054 title = N_("WiMAX"); 3519 title = N_("WiMAX");
3055@@ -303,21 +228,27 @@ static void type_to_text(GtkTreeViewColumn *column, GtkCellRenderer *cell, 3520+ markup = g_strdup_printf(" %s\n", title);
3521 break;
3522 case CONNMAN_TYPE_BLUETOOTH:
3523 title = N_("Bluetooth");
3524+ markup = g_strdup_printf(" %s\n", title);
3525+ break;
3526+ case CONNMAN_TYPE_LABEL_ETHERNET:
3527+ title = N_("Wired Networks");
3528+ markup = g_strdup_printf("<b>\n%s\n</b>", title);
3529+ break;
3530+ case CONNMAN_TYPE_LABEL_WIFI:
3531+ title = N_("Wireless Networks");
3532+ markup = g_strdup_printf("<b>\n%s\n</b>", title);
3533+ break;
3534+ case CONNMAN_TYPE_SYSCONFIG:
3535+ title = N_("System Configuration");
3536+ markup = g_strdup_printf("<b>\n%s\n</b>", title);
3537 break;
3538 default:
3539 title = N_("Unknown");
3540+ markup = g_strdup_printf(" %s\n", title);
3056 break; 3541 break;
3057 } 3542 }
3058 3543
3059- if (powered == TRUE) { 3544- if (powered == TRUE) {
3060- if (inrange == TRUE) 3545- if (inrange == TRUE)
3061- info = N_("Connected"); 3546- info = N_("Connected");
3062+ /* Set wifi connection status. */ 3547- else
3063+ if (type == CONNMAN_TYPE_WIFI) {
3064+ if (g_str_equal(state, "association") == TRUE)
3065+ state = "associating...";
3066+ else if (g_str_equal(state, "configuration") == TRUE)
3067+ state = "configurating...";
3068+ else if (g_str_equal(state, "ready") == TRUE ||
3069+ g_str_equal(state, "online") == TRUE)
3070+ state = "connnected";
3071 else
3072- info = N_("Not Connected"); 3548- info = N_("Not Connected");
3073+ state = ""; 3549- } else
3074+ markup = g_strdup_printf("<b>%s</b>\n%s\n", title, state);
3075 } else
3076- info = N_("Disabled"); 3550- info = N_("Disabled");
3077+ markup = g_strdup_printf("<b>%s</b>\n", title); 3551-
3078
3079- markup = g_strdup_printf("<b>%s</b>\n<small>%s</small>", title, info); 3552- markup = g_strdup_printf("<b>%s</b>\n<small>%s</small>", title, info);
3080 g_object_set(cell, "markup", markup, NULL); 3553 g_object_set(cell, "markup", markup, NULL);
3081 g_free(markup); 3554- g_free(markup);
3082 } 3555 }
3083 3556
3084 static void type_to_icon(GtkTreeViewColumn *column, GtkCellRenderer *cell, 3557 static void type_to_icon(GtkTreeViewColumn *column, GtkCellRenderer *cell,
3085- GtkTreeModel *model, GtkTreeIter *iter, gpointer data) 3558- GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
3086+ GtkTreeModel *model, GtkTreeIter *iter, gpointer data) 3559+ GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
3087 { 3560 {
3088 guint type; 3561- guint type;
3562+ guint type, strength;
3563+ char *name;
3564
3565- gtk_tree_model_get(model, iter, CONNMAN_COLUMN_TYPE, &type, -1);
3566+ gtk_tree_model_get(model, iter, CONNMAN_COLUMN_TYPE, &type,
3567+ CONNMAN_COLUMN_STRENGTH, &strength,
3568+ -1);
3089 3569
3090@@ -326,16 +257,16 @@ static void type_to_icon(GtkTreeViewColumn *column, GtkCellRenderer *cell,
3091 switch (type) { 3570 switch (type) {
3092 case CONNMAN_TYPE_ETHERNET: 3571- case CONNMAN_TYPE_ETHERNET:
3572+ case CONNMAN_TYPE_WIFI:
3573+ name = g_strdup_printf("connman-signal-0%d", (strength-1)/20+1);
3574+ g_object_set(cell, "icon-name", name,
3575+ "stock-size", 4, NULL);
3576+ break;
3577+ case CONNMAN_TYPE_LABEL_ETHERNET:
3093 g_object_set(cell, "icon-name", "network-wired", 3578 g_object_set(cell, "icon-name", "network-wired",
3094- "stock-size", 5, NULL); 3579- "stock-size", 5, NULL);
3095+ "stock-size", 5, NULL); 3580+ "stock-size", 4, NULL);
3096 break; 3581 break;
3097 case CONNMAN_TYPE_WIFI: 3582- case CONNMAN_TYPE_WIFI:
3098 case CONNMAN_TYPE_WIMAX: 3583- case CONNMAN_TYPE_WIMAX:
3584+ case CONNMAN_TYPE_LABEL_WIFI:
3099 g_object_set(cell, "icon-name", "network-wireless", 3585 g_object_set(cell, "icon-name", "network-wireless",
3100- "stock-size", 5, NULL); 3586- "stock-size", 5, NULL);
3101+ "stock-size", 5, NULL); 3587- break;
3102 break; 3588- case CONNMAN_TYPE_BLUETOOTH:
3103 case CONNMAN_TYPE_BLUETOOTH: 3589- g_object_set(cell, "icon-name", "bluetooth",
3104 g_object_set(cell, "icon-name", "bluetooth",
3105- "stock-size", 5, NULL); 3590- "stock-size", 5, NULL);
3106+ "stock-size", 5, NULL); 3591+ "stock-size", 4, NULL);
3107 break; 3592 break;
3108 default: 3593 default:
3109 g_object_set(cell, "icon-name", NULL, NULL); 3594 g_object_set(cell, "icon-name", NULL, NULL);
3110@@ -362,9 +293,9 @@ static GtkWidget *create_interfaces(GtkWidget *window) 3595@@ -362,40 +380,34 @@ static GtkWidget *create_interfaces(GtkWidget *window)
3111 3596
3112 scrolled = gtk_scrolled_window_new(NULL, NULL); 3597 scrolled = gtk_scrolled_window_new(NULL, NULL);
3113 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), 3598 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
@@ -3119,7 +3604,18 @@ index 01439e6..3701f16 100644
3119 gtk_box_pack_start(GTK_BOX(hbox), scrolled, FALSE, TRUE, 0); 3604 gtk_box_pack_start(GTK_BOX(hbox), scrolled, FALSE, TRUE, 0);
3120 3605
3121 tree = gtk_tree_view_new(); 3606 tree = gtk_tree_view_new();
3122@@ -381,21 +312,19 @@ static GtkWidget *create_interfaces(GtkWidget *window) 3607 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), FALSE);
3608 gtk_tree_view_set_show_expanders(GTK_TREE_VIEW(tree), FALSE);
3609 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(tree), TRUE);
3610- gtk_widget_set_size_request(tree, 180, -1);
3611+ gtk_widget_set_size_request(tree, 220, -1);
3612 gtk_container_add(GTK_CONTAINER(scrolled), tree);
3613
3614
3615 column = gtk_tree_view_column_new();
3616 gtk_tree_view_column_set_expand(column, TRUE);
3617 gtk_tree_view_column_set_spacing(column, 4);
3618+ gtk_tree_view_column_set_alignment(column, 0);
3123 gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column); 3619 gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
3124 3620
3125 renderer = gtk_cell_renderer_pixbuf_new(); 3621 renderer = gtk_cell_renderer_pixbuf_new();
@@ -3127,28 +3623,30 @@ index 01439e6..3701f16 100644
3127 gtk_tree_view_column_pack_start(column, renderer, FALSE); 3623 gtk_tree_view_column_pack_start(column, renderer, FALSE);
3128 gtk_tree_view_column_set_cell_data_func(column, renderer, 3624 gtk_tree_view_column_set_cell_data_func(column, renderer,
3129- state_to_icon, NULL, NULL); 3625- state_to_icon, NULL, NULL);
3130- 3626+ type_to_icon, NULL, NULL);
3131- renderer = gtk_cell_renderer_text_new(); 3627
3628 renderer = gtk_cell_renderer_text_new();
3132- gtk_tree_view_column_pack_start(column, renderer, TRUE); 3629- gtk_tree_view_column_pack_start(column, renderer, TRUE);
3133- gtk_tree_view_column_set_cell_data_func(column, renderer, 3630- gtk_tree_view_column_set_cell_data_func(column, renderer,
3134- type_to_text, NULL, NULL); 3631- type_to_text, NULL, NULL);
3135+ strength_to_icon, NULL, NULL); 3632-
3136 3633- renderer = gtk_cell_renderer_pixbuf_new();
3137 renderer = gtk_cell_renderer_pixbuf_new();
3138- gtk_tree_view_column_pack_end(column, renderer, FALSE); 3634- gtk_tree_view_column_pack_end(column, renderer, FALSE);
3139+ gtk_tree_view_column_pack_start(column, renderer, FALSE); 3635+ gtk_tree_view_column_pack_start(column, renderer, FALSE);
3140 gtk_tree_view_column_set_cell_data_func(column, renderer, 3636 gtk_tree_view_column_set_cell_data_func(column, renderer,
3141- type_to_icon, NULL, NULL); 3637- type_to_icon, NULL, NULL);
3142+ type_to_icon, NULL, NULL); 3638-
3143
3144+ renderer = gtk_cell_renderer_text_new();
3145+ gtk_tree_view_column_pack_start(column, renderer, FALSE);
3146+ gtk_tree_view_column_set_cell_data_func(column, renderer,
3147+ device_to_text, NULL, NULL); 3639+ device_to_text, NULL, NULL);
3148 3640
3149 interface_notebook = gtk_notebook_new(); 3641 interface_notebook = gtk_notebook_new();
3150 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(interface_notebook), FALSE); 3642 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(interface_notebook), FALSE);
3151@@ -410,16 +339,13 @@ static GtkWidget *create_interfaces(GtkWidget *window) 3643@@ -405,21 +417,19 @@ static GtkWidget *create_interfaces(GtkWidget *window)
3644
3645 model = connman_client_get_device_model(client);
3646 gtk_tree_view_set_model(GTK_TREE_VIEW(tree), model);
3647+
3648 g_object_unref(model);
3649
3152 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); 3650 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree));
3153 gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE); 3651 gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);
3154 g_signal_connect(G_OBJECT(selection), "changed", 3652 g_signal_connect(G_OBJECT(selection), "changed",
@@ -3167,7 +3665,7 @@ index 01439e6..3701f16 100644
3167 { 3665 {
3168 gtk_widget_destroy(window); 3666 gtk_widget_destroy(window);
3169 3667
3170@@ -451,7 +377,7 @@ static GtkWidget *create_window(void) 3668@@ -451,7 +461,7 @@ static GtkWidget *create_window(void)
3171 gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); 3669 gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
3172 gtk_window_set_default_size(GTK_WINDOW(window), 580, 380); 3670 gtk_window_set_default_size(GTK_WINDOW(window), 580, 380);
3173 g_signal_connect(G_OBJECT(window), "delete-event", 3671 g_signal_connect(G_OBJECT(window), "delete-event",
@@ -3176,7 +3674,7 @@ index 01439e6..3701f16 100644
3176 3674
3177 vbox = gtk_vbox_new(FALSE, 12); 3675 vbox = gtk_vbox_new(FALSE, 12);
3178 gtk_container_set_border_width(GTK_CONTAINER(vbox), 12); 3676 gtk_container_set_border_width(GTK_CONTAINER(vbox), 12);
3179@@ -467,12 +393,12 @@ static GtkWidget *create_window(void) 3677@@ -467,12 +477,12 @@ static GtkWidget *create_window(void)
3180 button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); 3678 button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
3181 gtk_container_add(GTK_CONTAINER(buttonbox), button); 3679 gtk_container_add(GTK_CONTAINER(buttonbox), button);
3182 g_signal_connect(G_OBJECT(button), "clicked", 3680 g_signal_connect(G_OBJECT(button), "clicked",
@@ -3191,8 +3689,17 @@ index 01439e6..3701f16 100644
3191 3689
3192 gtk_widget_show_all(window); 3690 gtk_widget_show_all(window);
3193 3691
3692@@ -487,6 +497,8 @@ int main(int argc, char *argv[])
3693 bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
3694 textdomain(GETTEXT_PACKAGE);
3695
3696+ current_data = NULL;
3697+
3698 gtk_init(&argc, &argv);
3699
3700 gtk_window_set_default_icon_name("network-wireless");
3194diff --git a/properties/wifi.c b/properties/wifi.c 3701diff --git a/properties/wifi.c b/properties/wifi.c
3195index 320dce4..3d3cee8 100644 3702index 320dce4..42fe7d2 100644
3196--- a/properties/wifi.c 3703--- a/properties/wifi.c
3197+++ b/properties/wifi.c 3704+++ b/properties/wifi.c
3198@@ -23,6 +23,7 @@ 3705@@ -23,6 +23,7 @@
@@ -3228,7 +3735,7 @@ index 320dce4..3d3cee8 100644
3228 static void changed_callback(GtkWidget *editable, gpointer user_data) 3735 static void changed_callback(GtkWidget *editable, gpointer user_data)
3229 { 3736 {
3230 struct config_data *data = user_data; 3737 struct config_data *data = user_data;
3231@@ -37,98 +56,310 @@ static void changed_callback(GtkWidget *editable, gpointer user_data) 3738@@ -37,98 +56,357 @@ static void changed_callback(GtkWidget *editable, gpointer user_data)
3232 3739
3233 active = gtk_combo_box_get_active(GTK_COMBO_BOX(data->policy.config)); 3740 active = gtk_combo_box_get_active(GTK_COMBO_BOX(data->policy.config));
3234 3741
@@ -3251,92 +3758,163 @@ index 320dce4..3d3cee8 100644
3251+static void connect_reply_cb(DBusGProxy *proxy, GError *error, 3758+static void connect_reply_cb(DBusGProxy *proxy, GError *error,
3252+ gpointer user_data) 3759+ gpointer user_data)
3253+{ 3760+{
3254+ struct config_data *data = user_data;
3255+ if (error) 3761+ if (error)
3256+ {
3257+ gtk_label_set_text(GTK_LABEL(data->wifi.connect_info),
3258+ _("connection failed"));
3259+ gtk_widget_show(data->wifi.connect_info);
3260+ gtk_widget_show(data->wifi.connect);
3261+ gtk_widget_hide(data->wifi.disconnect);
3262+ data->connecting = 0;
3263+ g_error_free(error); 3762+ g_error_free(error);
3264+ }
3265+} 3763+}
3266+ 3764+
3267+static void connect_callback(GtkWidget *editable, gpointer user_data) 3765+static void connect_callback(GtkWidget *editable, gpointer user_data)
3268+{ 3766+{
3269+ struct config_data *data = user_data; 3767+ struct config_data *data = user_data;
3270+ 3768+
3271+ const gchar *passphrase;
3272+
3273+ gboolean ret; 3769+ gboolean ret;
3274+ gint active; 3770+ gint active;
3275+ 3771+
3276+ gtk_widget_hide(data->wifi.connect);
3277+ gtk_widget_show(data->wifi.disconnect);
3278+
3279+ data->connecting = 1;
3280+
3281+ if (data->wifi.passphrase) { 3772+ if (data->wifi.passphrase) {
3282+ passphrase = gtk_entry_get_text(GTK_ENTRY(data->wifi.passphrase)); 3773+ char *passphrase;
3774+ passphrase = (gchar *)gtk_entry_get_text(GTK_ENTRY(data->wifi.passphrase));
3283+ ret = connman_client_set_passphrase(data->client, data->device, 3775+ ret = connman_client_set_passphrase(data->client, data->device,
3284+ passphrase); 3776+ passphrase);
3285+ }
3286+ 3777+
3287+ connman_client_connect_async(data->client, data->device, connect_reply_cb, data); 3778+ if (ret == FALSE) {
3779+ return;
3780+ }
3781 }
3288+ 3782+
3289+ active = gtk_combo_box_get_active(GTK_COMBO_BOX(data->policy.config)); 3783+ active = gtk_combo_box_get_active(GTK_COMBO_BOX(data->policy.config));
3290+ data->ipv4_config.method = active ? "manual" : "dhcp"; 3784+ data->ipv4_config.method = active ? "manual" : "dhcp";
3291+ data->ipv4_config.address = active ? gtk_entry_get_text(GTK_ENTRY(data->ipv4.entry[0])) : NULL; 3785+ data->ipv4_config.address = active ? gtk_entry_get_text(GTK_ENTRY(data->ipv4.entry[0])) : NULL;
3292+ data->ipv4_config.netmask = active ? gtk_entry_get_text(GTK_ENTRY(data->ipv4.entry[1])) : NULL; 3786+ data->ipv4_config.netmask = active ? gtk_entry_get_text(GTK_ENTRY(data->ipv4.entry[1])) : NULL;
3293+ data->ipv4_config.gateway = active ? gtk_entry_get_text(GTK_ENTRY(data->ipv4.entry[2])) : NULL; 3787+ data->ipv4_config.gateway = active ? gtk_entry_get_text(GTK_ENTRY(data->ipv4.entry[2])) : NULL;
3788+ ret = connman_client_set_ipv4(data->client, data->device, &data->ipv4_config);
3789+ if (ret == FALSE) {
3790+ return;
3791+ }
3294+ 3792+
3295+ connman_client_set_ipv4(data->client, data->device, &data->ipv4_config); 3793+ connman_client_connect_async(data->client, data->device, connect_reply_cb, data);
3794 }
3795
3796-void add_wifi_policy(GtkWidget *mainbox, struct config_data *data)
3797+static void disconnect_callback(GtkWidget *editable, gpointer user_data)
3798+{
3799+ struct config_data *data = user_data;
3296+ 3800+
3801+ connman_client_disconnect(data->client, data->device);
3297+} 3802+}
3298+ 3803+
3299+static void disconnect_callback(GtkWidget *editable, gpointer user_data) 3804+static void switch_callback(GtkWidget *editable, gpointer user_data)
3300+{ 3805+{
3301+ struct config_data *data = user_data; 3806+ struct config_data *data = user_data;
3302+ gboolean ret; 3807+ const gchar *label = gtk_button_get_label(GTK_BUTTON(data->wifi_button));
3303+ 3808+
3304+ data->connecting = 0; 3809+ if (g_str_equal(label, "Disable"))
3810+ connman_client_disable_technology(data->client, data->device, "wifi");
3811+ else
3812+ connman_client_enable_technology(data->client, data->device, "wifi");
3813+}
3305+ 3814+
3306+ ret = connman_client_disconnect(data->client, data->device); 3815+static void scan_reply_cb(DBusGProxy *proxy, GError *error,
3307+ if (ret == TRUE) { 3816+ gpointer user_data)
3308+ gtk_widget_show(data->wifi.connect); 3817+{
3309+ gtk_widget_hide(data->wifi.disconnect); 3818+ GtkWidget *button = user_data;
3310 } 3819+ gtk_widget_set_sensitive(button, 1);
3311 } 3820+
3312 3821+ if (error)
3313-void add_wifi_policy(GtkWidget *mainbox, struct config_data *data) 3822+ g_error_free(error);
3314+static void wifi_ipconfig(GtkWidget *table, struct config_data *data, GtkTreeIter *iter) 3823+}
3824+
3825+static void scan_callback(GtkWidget *button, gpointer user_data)
3826+{
3827+ struct config_data *data = user_data;
3828+ gtk_widget_set_sensitive(button, 0);
3829+ connman_client_request_scan(data->client, "", scan_reply_cb, button);
3830+}
3831+
3832+void add_wifi_switch_button(GtkWidget *mainbox, GtkTreeIter *iter,
3833+ struct config_data *data)
3315 { 3834 {
3316 GtkWidget *vbox; 3835 GtkWidget *vbox;
3317- GtkWidget *table; 3836 GtkWidget *table;
3318+ GtkWidget *dialog;
3319+ GtkWidget *entry;
3320 GtkWidget *label; 3837 GtkWidget *label;
3321 GtkWidget *combo; 3838- GtkWidget *combo;
3322+ GtkWidget *buttonbox; 3839+ GtkWidget *buttonbox;
3323+ GtkWidget *button; 3840+ GtkWidget *button;
3324+ DBusGProxy *proxy; 3841+ gboolean wifi_enabled;
3325 3842
3326- vbox = gtk_vbox_new(FALSE, 0); 3843- vbox = gtk_vbox_new(FALSE, 0);
3327- gtk_container_set_border_width(GTK_CONTAINER(vbox), 24); 3844+ gtk_tree_model_get(data->model, iter,
3328- gtk_box_pack_start(GTK_BOX(mainbox), vbox, FALSE, FALSE, 0); 3845+ CONNMAN_COLUMN_WIFI_ENABLED, &wifi_enabled,
3846+ -1);
3847+
3848+ vbox = gtk_vbox_new(TRUE, 0);
3849 gtk_container_set_border_width(GTK_CONTAINER(vbox), 24);
3850 gtk_box_pack_start(GTK_BOX(mainbox), vbox, FALSE, FALSE, 0);
3851
3852- table = gtk_table_new(2, 4, FALSE);
3853- gtk_table_set_row_spacings(GTK_TABLE(table), 8);
3854- gtk_table_set_col_spacings(GTK_TABLE(table), 8);
3855+ table = gtk_table_new(1, 1, TRUE);
3856+ gtk_table_set_row_spacings(GTK_TABLE(table), 10);
3857+ gtk_table_set_col_spacings(GTK_TABLE(table), 10);
3858 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
3859
3860-#if 0
3861- label = gtk_label_new(_("Network Name:"));
3862- gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_RIGHT);
3863- gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
3864+ label = gtk_label_new(_("Configure Wifi Networks."));
3865 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1);
3866
3867- combo = gtk_combo_box_new_text();
3868- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "Guest");
3869- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "");
3870- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "Off");
3871- gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(combo),
3872- separator_function, NULL, NULL);
3873- gtk_table_attach_defaults(GTK_TABLE(table), combo, 1, 4, 0, 1);
3874- data->policy.config = combo;
3875-#endif
3876+ buttonbox = gtk_hbutton_box_new();
3877+ gtk_button_box_set_layout(GTK_BUTTON_BOX(buttonbox), GTK_BUTTONBOX_CENTER);
3878+ gtk_box_pack_start(GTK_BOX(mainbox), buttonbox, FALSE, FALSE, 0);
3879+
3880+ button = gtk_button_new();
3881+ data->wifi_button = button;
3882+
3883+ if (wifi_enabled)
3884+ gtk_button_set_label(GTK_BUTTON(button), _("Disable"));
3885+ else
3886+ gtk_button_set_label(GTK_BUTTON(button), _("Enable"));
3887+
3888+ gtk_container_add(GTK_CONTAINER(buttonbox), button);
3889+ g_signal_connect(G_OBJECT(button), "clicked",
3890+ G_CALLBACK(switch_callback), data);
3891+
3892+ button = gtk_button_new_with_label(_("Scan"));
3893+ data->scan_button = button;
3894+
3895+ if (!wifi_enabled)
3896+ gtk_widget_set_sensitive(button, 0);
3897+
3898+ gtk_container_add(GTK_CONTAINER(buttonbox), button);
3899+ g_signal_connect(G_OBJECT(button), "clicked",
3900+ G_CALLBACK(scan_callback), data);
3901+}
3902+
3903+
3904+static void wifi_ipconfig(GtkWidget *table, struct config_data *data, GtkTreeIter *iter)
3905+{
3906+ GtkWidget *entry;
3907+ GtkWidget *label;
3908+ GtkWidget *combo;
3909+ DBusGProxy *proxy;
3910+
3329+ struct ipv4_config ipv4_config = { 3911+ struct ipv4_config ipv4_config = {
3330+ .method = NULL, 3912+ .method = NULL,
3331+ .address = NULL, 3913+ .address = NULL,
3332+ .netmask = NULL, 3914+ .netmask = NULL,
3333+ .gateway = NULL, 3915+ .gateway = NULL,
3334+ }; 3916+ };
3335 3917+
3336- table = gtk_table_new(2, 4, FALSE);
3337- gtk_table_set_row_spacings(GTK_TABLE(table), 8);
3338- gtk_table_set_col_spacings(GTK_TABLE(table), 8);
3339- gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
3340+ gtk_tree_model_get(data->model, iter, 3918+ gtk_tree_model_get(data->model, iter,
3341+ CONNMAN_COLUMN_PROXY, &proxy, 3919+ CONNMAN_COLUMN_PROXY, &proxy,
3342+ CONNMAN_COLUMN_METHOD, &ipv4_config.method, 3920+ CONNMAN_COLUMN_METHOD, &ipv4_config.method,
@@ -3345,19 +3923,16 @@ index 320dce4..3d3cee8 100644
3345+ CONNMAN_COLUMN_GATEWAY, &ipv4_config.gateway, 3923+ CONNMAN_COLUMN_GATEWAY, &ipv4_config.gateway,
3346+ -1); 3924+ -1);
3347 3925
3348-#if 0 3926 label = gtk_label_new(_("Configuration:"));
3349- label = gtk_label_new(_("Network Name:"));
3350- gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_RIGHT); 3927- gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_RIGHT);
3351- gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); 3928- gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
3352- gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); 3929- gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1);
3353+ label = gtk_label_new(_("Configuration:"));
3354+ gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, 3, 4); 3930+ gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, 3, 4);
3355+// gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
3356+// gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
3357+ data->ipv4.label[0] = label; 3931+ data->ipv4.label[0] = label;
3358 3932
3359 combo = gtk_combo_box_new_text(); 3933 combo = gtk_combo_box_new_text();
3360- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "Guest"); 3934- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "Automatically");
3935- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "Manually");
3361- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), ""); 3936- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "");
3362- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "Off"); 3937- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "Off");
3363+ gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "DHCP"); 3938+ gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "DHCP");
@@ -3369,27 +3944,13 @@ index 320dce4..3d3cee8 100644
3369+ 3944+
3370+ gtk_table_attach_defaults(GTK_TABLE(table), combo, 2, 4, 3, 4); 3945+ gtk_table_attach_defaults(GTK_TABLE(table), combo, 2, 4, 3, 4);
3371 data->policy.config = combo; 3946 data->policy.config = combo;
3372-#endif
3373 3947
3374- label = gtk_label_new(_("Configuration:")); 3948- label = gtk_label_new(NULL);
3375- gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_RIGHT); 3949- gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
3376- gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
3377- gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1);
3378+ label = gtk_label_new(_("IP address:")); 3950+ label = gtk_label_new(_("IP address:"));
3379+ gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, 4, 5); 3951+ gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, 4, 5);
3380+// gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
3381+// gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
3382+ data->ipv4.label[0] = label; 3952+ data->ipv4.label[0] = label;
3383 3953+
3384- combo = gtk_combo_box_new_text();
3385- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "Automatically");
3386- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "Manually");
3387- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "");
3388- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "Off");
3389- gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(combo),
3390- separator_function, NULL, NULL);
3391- gtk_table_attach_defaults(GTK_TABLE(table), combo, 1, 4, 0, 1);
3392- data->policy.config = combo;
3393+ entry = gtk_entry_new(); 3954+ entry = gtk_entry_new();
3394+ gtk_entry_set_max_length (GTK_ENTRY (entry), 15); 3955+ gtk_entry_set_max_length (GTK_ENTRY (entry), 15);
3395+ if (ipv4_config.address) 3956+ if (ipv4_config.address)
@@ -3399,12 +3960,8 @@ index 320dce4..3d3cee8 100644
3399+ 3960+
3400+ label = gtk_label_new(_("Netmask:")); 3961+ label = gtk_label_new(_("Netmask:"));
3401+ gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, 5, 6); 3962+ gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, 5, 6);
3402+// gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
3403+// gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
3404+ data->ipv4.label[1] = label; 3963+ data->ipv4.label[1] = label;
3405 3964+
3406- label = gtk_label_new(NULL);
3407- gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
3408+ entry = gtk_entry_new(); 3965+ entry = gtk_entry_new();
3409+ gtk_entry_set_max_length (GTK_ENTRY (entry), 15); 3966+ gtk_entry_set_max_length (GTK_ENTRY (entry), 15);
3410+ if (ipv4_config.netmask) 3967+ if (ipv4_config.netmask)
@@ -3414,8 +3971,6 @@ index 320dce4..3d3cee8 100644
3414+ 3971+
3415+ label = gtk_label_new(_("Gateway:")); 3972+ label = gtk_label_new(_("Gateway:"));
3416+ gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, 6, 7); 3973+ gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, 6, 7);
3417+// gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
3418+// gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
3419+ data->ipv4.label[2] = label; 3974+ data->ipv4.label[2] = label;
3420+ 3975+
3421+ entry = gtk_entry_new(); 3976+ entry = gtk_entry_new();
@@ -3454,7 +4009,7 @@ index 320dce4..3d3cee8 100644
3454+ GtkWidget *entry; 4009+ GtkWidget *entry;
3455+ GtkWidget *button; 4010+ GtkWidget *button;
3456+ 4011+
3457+ const gchar *name, *security, *icon, *state; 4012+ const char *name, *security, *icon, *state;
3458+ guint strength; 4013+ guint strength;
3459+ 4014+
3460+ gtk_tree_model_get(data->model, iter, 4015+ gtk_tree_model_get(data->model, iter,
@@ -3465,6 +4020,9 @@ index 320dce4..3d3cee8 100644
3465+ CONNMAN_COLUMN_STRENGTH, &strength, 4020+ CONNMAN_COLUMN_STRENGTH, &strength,
3466+ -1); 4021+ -1);
3467+ 4022+
4023+ if (g_str_equal(state, "failure") == TRUE)
4024+ connman_client_remove(data->client, data->device);
4025+
3468+ vbox = gtk_vbox_new(TRUE, 0); 4026+ vbox = gtk_vbox_new(TRUE, 0);
3469+ gtk_container_set_border_width(GTK_CONTAINER(vbox), 24); 4027+ gtk_container_set_border_width(GTK_CONTAINER(vbox), 24);
3470+ gtk_box_pack_start(GTK_BOX(mainbox), vbox, FALSE, FALSE, 0); 4028+ gtk_box_pack_start(GTK_BOX(mainbox), vbox, FALSE, FALSE, 0);
@@ -3475,31 +4033,24 @@ index 320dce4..3d3cee8 100644
3475+ 4033+
3476+ label = gtk_label_new(_("Access Point:")); 4034+ label = gtk_label_new(_("Access Point:"));
3477+ gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, 0, 1); 4035+ gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, 0, 1);
3478+// gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
3479+// gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
3480+ 4036+
3481+ label = gtk_label_new(_(name)); 4037+ label = gtk_label_new(_(name));
3482+ gtk_table_attach_defaults(GTK_TABLE(table), label, 2, 4, 0, 1); 4038+ gtk_table_attach_defaults(GTK_TABLE(table), label, 2, 4, 0, 1);
3483+ gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); 4039 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
3484+ gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); 4040+ gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
3485+ data->wifi.name = label; 4041+ data->wifi.name = label;
3486+ 4042+
3487+ label = gtk_label_new(_("Security:")); 4043+ label = gtk_label_new(_("Security:"));
3488+ gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, 1, 2); 4044+ gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, 1, 2);
3489+// gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
3490+// gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
3491+ 4045+
3492+ label = gtk_label_new(_(security)); 4046+ label = gtk_label_new(_(security));
3493+ gtk_table_attach_defaults(GTK_TABLE(table), label, 2, 4, 1, 2); 4047+ gtk_table_attach_defaults(GTK_TABLE(table), label, 2, 4, 1, 2);
3494 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); 4048+ gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
3495+ gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); 4049+ gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
3496+ data->wifi.security = label; 4050+ data->wifi.security = label;
3497+ 4051+
3498+ label = gtk_label_new(_("Passphrase:")); 4052+ label = gtk_label_new(_("Passphrase:"));
3499+ gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, 2, 3); 4053+ gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, 2, 3);
3500+// gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
3501+// gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
3502+
3503+ 4054+
3504+ if (g_str_equal(security, "none") != TRUE && 4055+ if (g_str_equal(security, "none") != TRUE &&
3505+ g_str_equal(security, "unknown") != TRUE) { 4056+ g_str_equal(security, "unknown") != TRUE) {
@@ -3532,7 +4083,9 @@ index 320dce4..3d3cee8 100644
3532- data->policy.label = label; 4083- data->policy.label = label;
3533+ gtk_widget_hide(label); 4084+ gtk_widget_hide(label);
3534+ data->wifi.connect_info = label; 4085+ data->wifi.connect_info = label;
3535+ 4086
4087- g_signal_connect(G_OBJECT(combo), "changed",
4088- G_CALLBACK(changed_callback), data);
3536+ button = gtk_button_new_with_label(_("Connect")); 4089+ button = gtk_button_new_with_label(_("Connect"));
3537+ gtk_table_attach_defaults(GTK_TABLE(table), button, 3, 4, 8, 9); 4090+ gtk_table_attach_defaults(GTK_TABLE(table), button, 3, 4, 8, 9);
3538+ g_signal_connect(G_OBJECT(button), "clicked", 4091+ g_signal_connect(G_OBJECT(button), "clicked",
@@ -3557,17 +4110,14 @@ index 320dce4..3d3cee8 100644
3557+ } 4110+ }
3558+ 4111+
3559+ wifi_ipconfig(table, data, iter); 4112+ wifi_ipconfig(table, data, iter);
3560
3561- g_signal_connect(G_OBJECT(combo), "changed",
3562- G_CALLBACK(changed_callback), data);
3563 } 4113 }
3564 4114
3565-void update_wifi_policy(struct config_data *data, guint policy) 4115-void update_wifi_policy(struct config_data *data, guint policy)
3566+void update_wifi_ipv4(struct config_data *data, guint policy) 4116+void update_wifi_ipv4(struct config_data *data, guint policy)
3567 { 4117 {
3568 GtkWidget *combo = data->policy.config; 4118 GtkWidget *combo = data->policy.config;
4119- gchar *info = NULL;
3569+ GtkWidget *entry[3]; 4120+ GtkWidget *entry[3];
3570 gchar *info = NULL;
3571+ int i; 4121+ int i;
3572+ 4122+
3573+ for (i = 0; i < 3; i++) 4123+ for (i = 0; i < 3; i++)
@@ -3599,14 +4149,14 @@ index 320dce4..3d3cee8 100644
3599 break; 4149 break;
3600 default: 4150 default:
3601 gtk_combo_box_set_active(GTK_COMBO_BOX(combo), -1); 4151 gtk_combo_box_set_active(GTK_COMBO_BOX(combo), -1);
3602@@ -136,9 +367,7 @@ void update_wifi_policy(struct config_data *data, guint policy) 4152@@ -136,9 +414,5 @@ void update_wifi_policy(struct config_data *data, guint policy)
3603 } 4153 }
3604 4154
3605 g_signal_handlers_unblock_by_func(G_OBJECT(combo), 4155 g_signal_handlers_unblock_by_func(G_OBJECT(combo),
3606- G_CALLBACK(changed_callback), data); 4156- G_CALLBACK(changed_callback), data);
3607- 4157-
3608- gtk_label_set_markup(GTK_LABEL(data->policy.label), info); 4158- gtk_label_set_markup(GTK_LABEL(data->policy.label), info);
4159-
4160- g_free(info);
3609+ G_CALLBACK(changed_callback), data); 4161+ G_CALLBACK(changed_callback), data);
3610
3611 g_free(info);
3612 } 4162 }
diff --git a/meta/recipes-connectivity/connman/connman-gnome_0.5.bb b/meta/recipes-connectivity/connman/connman-gnome_0.5.bb
index 6958ee5..7660048 100644
--- a/meta/recipes-connectivity/connman/connman-gnome_0.5.bb
+++ b/meta/recipes-connectivity/connman/connman-gnome_0.5.bb
@@ -6,7 +6,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=eb723b61539feef013de476e68b5c50a \
6 file://properties/main.c;beginline=1;endline=20;md5=50c77c81871308b033ab7a1504626afb \ 6 file://properties/main.c;beginline=1;endline=20;md5=50c77c81871308b033ab7a1504626afb \
7 file://common/connman-dbus.c;beginline=1;endline=20;md5=de6b485c0e717a0236402d220187717a" 7 file://common/connman-dbus.c;beginline=1;endline=20;md5=de6b485c0e717a0236402d220187717a"
8DEPENDS = "gtk+ dbus" 8DEPENDS = "gtk+ dbus"
9PR = "r0" 9PR = "r1"
10 10
11RRECOMMENDS_${PN} = "python python-dbus connman connman-plugin-ethernet connman-plugin-loopback connman-plugin-udhcp connman-plugin-wifi connman-plugin-fake connman-plugin-bluetooth connman-plugin-dnsproxy" 11RRECOMMENDS_${PN} = "python python-dbus connman connman-plugin-ethernet connman-plugin-loopback connman-plugin-udhcp connman-plugin-wifi connman-plugin-fake connman-plugin-bluetooth connman-plugin-dnsproxy"
12 12