Make sure favorite setting is properly loaded
authorMarcel Holtmann <marcel@holtmann.org>
Thu, 14 May 2009 05:18:26 +0000 (22:18 -0700)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 14 May 2009 05:18:26 +0000 (22:18 -0700)
include/service.h
src/service.c
test/monitor-services
test/test-connman

index fb7d5e7..652add2 100644 (file)
@@ -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
index e23a651..7b7717f 100644 (file)
@@ -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;
index 2ee8473..1d2b44e 100755 (executable)
@@ -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"]:
index c180282..ae8cb30 100755 (executable)
@@ -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):