OSDN Git Service

Remove use of dbus_connection_get_object_user_data from network.
authorLuiz Augusto von Dentz <luiz.dentz@openbossa.org>
Fri, 6 Jun 2008 17:55:02 +0000 (17:55 +0000)
committerLuiz Augusto von Dentz <luiz.dentz@openbossa.org>
Fri, 6 Jun 2008 17:55:02 +0000 (17:55 +0000)
network/connection.c

index c57623b..55c9c52 100644 (file)
@@ -648,11 +648,14 @@ int connection_find_data(const char *path, const char *pattern)
 gboolean connection_has_pending(const char *path)
 {
        struct network_conn *nc;
+       GSList *l;
 
-       if (!dbus_connection_get_object_user_data(connection,
-                               path, (void *) &nc))
+       l = g_slist_find_custom(connections, path, find_connection);
+       if (!l)
                return FALSE;
 
+       nc = l->data;
+
        return (nc->state == CONNECTING);
 }
 
@@ -664,11 +667,14 @@ int connection_remove_stored(const char *path)
        char filename[PATH_MAX + 1];
        char src_addr[18], dst_addr[18];
        int err;
+       GSList *l;
 
-       if (!dbus_connection_get_object_user_data(connection,
-                               path, (void *) &nc))
+       l = g_slist_find_custom(connections, path, find_connection);
+       if (!l)
                return -ENOENT;
 
+       nc = l->data;
+
        ba2str(&nc->dst, dst_addr);
        role = bnep_name(nc->id);
        snprintf(key, 32, "%s#%s", dst_addr, role);
@@ -684,11 +690,14 @@ int connection_remove_stored(const char *path)
 gboolean connection_is_connected(const char *path)
 {
        struct network_conn *nc;
+       GSList *l;
 
-       if (!dbus_connection_get_object_user_data(connection,
-                               path, (void *) &nc))
+       l = g_slist_find_custom(connections, path, find_connection);
+       if (!l)
                return FALSE;
 
+       nc = l->data;
+
        return (nc->state == CONNECTED);
 }