diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2009-01-12 06:33:56 +0100 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2009-01-12 06:33:56 +0100 |
commit | 6ccedbcbd6026351a0bec9a492f971baa2d5192e (patch) | |
tree | 5be939f320e75d0f614ed5d5db1450a77274965a | |
parent | 145daf50985e483bf334e4e00c8109bb697d017a (diff) | |
download | connman-gnome-6ccedbcbd6026351a0bec9a492f971baa2d5192e.tar.gz |
Handle device state, address and Ethernet policy
-rw-r--r-- | properties/ethernet.c | 19 | ||||
-rw-r--r-- | properties/main.c | 37 |
2 files changed, 47 insertions, 9 deletions
diff --git a/properties/ethernet.c b/properties/ethernet.c index 2cc202c..90a3149 100644 --- a/properties/ethernet.c +++ b/properties/ethernet.c @@ -89,7 +89,24 @@ void update_ethernet_policy(struct config_data *data, guint policy) g_signal_handlers_block_by_func(G_OBJECT(combo), G_CALLBACK(changed_callback), data); - /* change policy */ + switch (policy) { + case CONNMAN_POLICY_OFF: + gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 3); + break; + case CONNMAN_POLICY_IGNORE: + gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 1); + info = g_strdup_printf(_("Ignore the interface and don't " + "make any attempts for configuration.")); + break; + case CONNMAN_POLICY_AUTO: + gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0); + info = g_strdup_printf(_("Detect carrier and then " + "automatically configure the interface.")); + break; + default: + gtk_combo_box_set_active(GTK_COMBO_BOX(combo), -1); + break; + } g_signal_handlers_unblock_by_func(G_OBJECT(combo), G_CALLBACK(changed_callback), data); diff --git a/properties/main.c b/properties/main.c index 3747505..c71b76e 100644 --- a/properties/main.c +++ b/properties/main.c @@ -33,7 +33,7 @@ static ConnmanClient *client; static GtkWidget *interface_notebook; static void update_status(struct config_data *data, - guint type, guint state, guint policy, + guint type, gboolean inrange, guint policy, const gchar *network, const gchar *address) { const char *str; @@ -41,17 +41,33 @@ static void update_status(struct config_data *data, switch (type) { case CONNMAN_TYPE_ETHERNET: - str = N_("Cable Unplugged"); - info = g_strdup_printf(_("The cable for %s is " + if (inrange == TRUE) { + str = N_("Connected"); + info = g_strdup_printf(_("%s is currently active " + "and has the IP address %s."), + N_("Ethernet"), address); + } else { + str = N_("Cable Unplugged"); + info = g_strdup_printf(_("The cable for %s is " "not plugged in."), N_("Ethernet")); + } break; case CONNMAN_TYPE_WIFI: - str = N_("Not Connected"); + if (inrange == TRUE) { + str = N_("Connected"); + info = g_strdup_printf(_("%s is currently active " + "and has the IP address %s."), + N_("Wireless"), address); + } else + str = N_("Not Connected"); break; default: - str = N_("Not Connected"); + if (inrange == TRUE) + str = N_("Connected"); + else + str = N_("Not Connected"); break; } @@ -107,7 +123,8 @@ static struct config_data *create_config(GtkTreeModel *model, GtkWidget *hbox; GtkWidget *button; struct config_data *data; - guint type, state = 0, policy = 0; + guint type, policy; + gboolean inrange; gchar *markup, *vendor = NULL, *product = NULL; gchar *network = NULL, *address = NULL; @@ -116,7 +133,11 @@ static struct config_data *create_config(GtkTreeModel *model, return NULL; gtk_tree_model_get(model, iter, - CONNMAN_COLUMN_TYPE, &type, -1); + CONNMAN_COLUMN_TYPE, &type, + CONNMAN_COLUMN_INRANGE, &inrange, + CONNMAN_COLUMN_NETWORK, &network, + CONNMAN_COLUMN_ADDRESS, &address, + CONNMAN_COLUMN_POLICY, &policy, -1); mainbox = gtk_vbox_new(FALSE, 6); data->widget = mainbox; @@ -170,7 +191,7 @@ static struct config_data *create_config(GtkTreeModel *model, data->window = user_data; create_advanced_dialog(data, type); - update_status(data, type, state, policy, network, address); + update_status(data, type, inrange, policy, network, address); g_free(network); g_free(address); |