From: Marcel Holtmann Date: Mon, 5 Jan 2009 01:10:27 +0000 (+0100) Subject: Only return networks that are registered X-Git-Tag: accepted/2.0alpha-wayland/20121110.002834~4158 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aec3be85b3858fd70f6ed6167e730f96f443c70f;p=profile%2Fivi%2Fconnman.git Only return networks that are registered --- diff --git a/src/connman.h b/src/connman.h index e803ddc..4e59e53 100644 --- a/src/connman.h +++ b/src/connman.h @@ -163,6 +163,8 @@ void __connman_network_cleanup(void); void __connman_network_set_device(struct connman_network *network, struct connman_device *device); +connman_bool_t __connman_network_has_driver(struct connman_network *network); + #include int __connman_rtnl_init(void); diff --git a/src/element.c b/src/element.c index 95157dc..28d362e 100644 --- a/src/element.c +++ b/src/element.c @@ -580,6 +580,10 @@ static gboolean append_path(GNode *node, gpointer user_data) __connman_device_has_driver(element->device) == FALSE) return FALSE; + if (filter->type == CONNMAN_ELEMENT_TYPE_NETWORK && + __connman_network_has_driver(element->network) == FALSE) + return FALSE; + dbus_message_iter_append_basic(filter->iter, DBUS_TYPE_OBJECT_PATH, &element->path); diff --git a/src/network.c b/src/network.c index 898bed5..dc6b60b 100644 --- a/src/network.c +++ b/src/network.c @@ -42,6 +42,8 @@ struct connman_network { struct connman_network_driver *driver; void *driver_data; + connman_bool_t registered; + struct connman_device *device; struct { @@ -201,6 +203,8 @@ static int register_interface(struct connman_element *element) return -EIO; } + network->registered = TRUE; + emit_networks_signal(); return 0; @@ -208,14 +212,26 @@ static int register_interface(struct connman_element *element) static void unregister_interface(struct connman_element *element) { + struct connman_network * network = element->network; + DBG("element %p name %s", element, element->name); + network->registered = FALSE; + emit_networks_signal(); g_dbus_unregister_interface(connection, element->path, CONNMAN_NETWORK_INTERFACE); } +connman_bool_t __connman_network_has_driver(struct connman_network *network) +{ + if (network == NULL || network->driver == NULL) + return FALSE; + + return network->registered; +} + static GSList *driver_list = NULL; static gint compare_priority(gconstpointer a, gconstpointer b)