diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2009-01-24 00:05:57 +0100 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2009-01-24 00:05:57 +0100 |
commit | e24f3aefeb76d7b0be65c899ff87d230cbf27fc8 (patch) | |
tree | c7519d38202bfc3ee9d4cb77944b23cfef27eaa0 | |
parent | 7ca18b54fe37d4186cc93b10b022107f1fb4b53b (diff) | |
download | connman-gnome-e24f3aefeb76d7b0be65c899ff87d230cbf27fc8.tar.gz |
Fix setting of Ethernet device policy
-rw-r--r-- | properties/advanced.h | 3 | ||||
-rw-r--r-- | properties/ethernet.c | 15 | ||||
-rw-r--r-- | properties/main.c | 8 |
3 files changed, 26 insertions, 0 deletions
diff --git a/properties/advanced.h b/properties/advanced.h index 7db5bb1..f85f10d 100644 --- a/properties/advanced.h +++ b/properties/advanced.h @@ -20,6 +20,8 @@ */ struct config_data { + ConnmanClient *client; + GtkWidget *widget; GtkWidget *title; GtkWidget *label; @@ -28,6 +30,7 @@ struct config_data { GtkWidget *window; GtkTreeModel *model; gchar *index; + gchar *device; GtkWidget *dialog; diff --git a/properties/ethernet.c b/properties/ethernet.c index 90a3149..d5c948d 100644 --- a/properties/ethernet.c +++ b/properties/ethernet.c @@ -36,6 +36,21 @@ static void changed_callback(GtkWidget *editable, gpointer user_data) gint active; active = gtk_combo_box_get_active(GTK_COMBO_BOX(data->policy.config)); + + switch (active) { + case 0: + connman_client_set_policy(data->client, data->device, "auto"); + update_ethernet_policy(data, CONNMAN_POLICY_AUTO); + break; + case 1: + connman_client_set_policy(data->client, data->device, "ignore"); + update_ethernet_policy(data, CONNMAN_POLICY_IGNORE); + break; + case 3: + connman_client_set_policy(data->client, data->device, "off"); + update_ethernet_policy(data, CONNMAN_POLICY_OFF); + break; + } } void add_ethernet_policy(GtkWidget *mainbox, struct config_data *data) diff --git a/properties/main.c b/properties/main.c index 4ba66b2..01439e6 100644 --- a/properties/main.c +++ b/properties/main.c @@ -24,6 +24,7 @@ #endif #include <glib/gi18n.h> +#include <dbus/dbus-glib.h> #include "connman-client.h" @@ -123,6 +124,7 @@ static struct config_data *create_config(GtkTreeModel *model, GtkWidget *hbox; GtkWidget *button; struct config_data *data; + DBusGProxy *proxy; guint type, policy; gboolean inrange; gchar *markup, *vendor = NULL, *product = NULL; @@ -132,13 +134,19 @@ static struct config_data *create_config(GtkTreeModel *model, if (data == NULL) return NULL; + data->client = client; + gtk_tree_model_get(model, iter, + CONNMAN_COLUMN_PROXY, &proxy, CONNMAN_COLUMN_TYPE, &type, CONNMAN_COLUMN_INRANGE, &inrange, CONNMAN_COLUMN_NETWORK, &network, CONNMAN_COLUMN_ADDRESS, &address, CONNMAN_COLUMN_POLICY, &policy, -1); + data->device = g_strdup(dbus_g_proxy_get_path(proxy)); + g_object_unref(proxy); + mainbox = gtk_vbox_new(FALSE, 6); data->widget = mainbox; |