aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-12-18 10:37:10 +0100
committerMarcel Holtmann <marcel@holtmann.org>2008-12-18 10:37:10 +0100
commitc6fa8a50b6eafe8c06ff8e2541094219c3447be7 (patch)
tree27875d93b25cc66bab9991d436a68bf0d25fa394
parent332bca5effa43ddcf1bc9458e9eaa5903b48ba2f (diff)
downloadconnman-gnome-c6fa8a50b6eafe8c06ff8e2541094219c3447be7.tar.gz
If specified propose a scan for all devices
-rw-r--r--common/connman-client.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/common/connman-client.c b/common/connman-client.c
index df4e4b9..9d0972e 100644
--- a/common/connman-client.c
+++ b/common/connman-client.c
@@ -333,6 +333,32 @@ void connman_client_set_powered(ConnmanClient *client, const gchar *device,
g_object_unref(proxy);
}
+static gboolean device_scan(GtkTreeModel *model, GtkTreePath *path,
+ GtkTreeIter *iter, gpointer user_data)
+{
+ DBusGProxy *proxy;
+ gboolean enabled;
+
+ gtk_tree_model_get(model, iter, CONNMAN_COLUMN_PROXY, &proxy,
+ CONNMAN_COLUMN_ENABLED, &enabled, -1);
+
+ if (proxy == NULL)
+ return FALSE;
+
+ if (g_str_equal(dbus_g_proxy_get_interface(proxy),
+ CONNMAN_DEVICE_INTERFACE) == FALSE)
+ return FALSE;
+
+ if (enabled == FALSE)
+ return FALSE;
+
+ connman_propose_scan(proxy, NULL);
+
+ g_object_unref(proxy);
+
+ return FALSE;
+}
+
void connman_client_propose_scan(ConnmanClient *client, const gchar *device)
{
ConnmanClientPrivate *priv = CONNMAN_CLIENT_GET_PRIVATE(client);
@@ -340,8 +366,11 @@ void connman_client_propose_scan(ConnmanClient *client, const gchar *device)
DBG("client %p", client);
- if (device == NULL)
+ if (device == NULL) {
+ gtk_tree_model_foreach(GTK_TREE_MODEL(priv->store),
+ device_scan, NULL);
return;
+ }
proxy = connman_dbus_get_proxy(priv->store, device);
if (proxy == NULL)
@@ -355,7 +384,6 @@ void connman_client_propose_scan(ConnmanClient *client, const gchar *device)
static gboolean network_disconnect(GtkTreeModel *model, GtkTreePath *path,
GtkTreeIter *iter, gpointer user_data)
{
- ConnmanClient *client = user_data;
DBusGProxy *proxy;
gboolean enabled;
@@ -370,7 +398,7 @@ static gboolean network_disconnect(GtkTreeModel *model, GtkTreePath *path,
return FALSE;
if (enabled == TRUE)
- connman_client_disconnect(client, dbus_g_proxy_get_path(proxy));
+ connman_disconnect(proxy, NULL);
g_object_unref(proxy);
@@ -388,7 +416,7 @@ void connman_client_connect(ConnmanClient *client, const gchar *network)
return;
gtk_tree_model_foreach(GTK_TREE_MODEL(priv->store),
- network_disconnect, client);
+ network_disconnect, NULL);
proxy = connman_dbus_get_proxy(priv->store, network);
if (proxy == NULL)