From 926b10dff37ad869ead0b3add608b7be066875f1 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 13 May 2009 22:18:26 -0700 Subject: [PATCH] Make sure favorite setting is properly loaded --- include/service.h | 4 ---- src/service.c | 9 ++++++++- test/monitor-services | 2 +- test/test-connman | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/include/service.h b/include/service.h index fb7d5e7..652add2 100644 --- a/include/service.h +++ b/include/service.h @@ -73,10 +73,6 @@ extern void connman_service_unref(struct connman_service *service); extern int connman_service_set_favorite(struct connman_service *service, connman_bool_t favorite); -extern struct connman_service *connman_service_lookup(const char *identifier); -extern struct connman_service *connman_service_get(const char *identifier); -extern void connman_service_put(struct connman_service *service); - #ifdef __cplusplus } #endif diff --git a/src/service.c b/src/service.c index e23a651..7b7717f 100644 --- a/src/service.c +++ b/src/service.c @@ -610,7 +610,7 @@ int connman_service_set_favorite(struct connman_service *service, if (iter == NULL) return -ENOENT; - if (service->favorite) + if (service->favorite == favorite) return -EALREADY; service->favorite = favorite; @@ -777,6 +777,7 @@ static struct connman_service *__connman_service_get(const char *identifier) static int service_register(struct connman_service *service) { const char *path = __connman_profile_active_path(); + GSequenceIter *iter; DBG("service %p", service); @@ -792,6 +793,12 @@ static int service_register(struct connman_service *service) service_methods, service_signals, NULL, service, NULL); + __connman_storage_load_service(service); + + iter = g_hash_table_lookup(service_hash, service->identifier); + if (iter != NULL) + g_sequence_sort_changed(iter, service_compare, NULL); + __connman_profile_changed(); return 0; diff --git a/test/monitor-services b/test/monitor-services index 2ee8473..1d2b44e 100755 --- a/test/monitor-services +++ b/test/monitor-services @@ -8,7 +8,7 @@ import dbus.mainloop.glib def property_changed(name, value, path, interface): iface = interface[interface.rfind(".") + 1:] ipath = path[path.rfind("/") + 1:] - if iface not in ["Manager", "Service"]: + if iface not in ["Service"]: return if name in ["Profiles", "Services", "Devices", "Networks", "Connections"]: diff --git a/test/test-connman b/test/test-connman index c180282..ae8cb30 100755 --- a/test/test-connman +++ b/test/test-connman @@ -214,7 +214,7 @@ elif sys.argv[1] in ["connect", "conn"]: service = dbus.Interface(bus.get_object("org.moblin.connman", path), "org.moblin.connman.Service") - service.Connect() + service.Connect(timeout=60000) elif sys.argv[1] in ["disconnect", "disc"]: if (len(sys.argv) < 3): -- 1.7.9.5