aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-02-26 08:01:12 +0100
committerMarcel Holtmann <marcel@holtmann.org>2008-02-26 08:01:12 +0100
commit85b47145890bfba64a536f901a772b8023d2550e (patch)
treef29bd83609a9bc99c2473250f08287c85d086e46
parent27f27c1c8e5e5d3f346fef858fe81281f029f5d5 (diff)
downloadconnman-gnome-85b47145890bfba64a536f901a772b8023d2550e.tar.gz
Add support for user confirmation policy
-rw-r--r--common/client.c4
-rw-r--r--common/client.h1
-rw-r--r--common/test-client.c24
3 files changed, 29 insertions, 0 deletions
diff --git a/common/client.c b/common/client.c
index fc5d122..fe67856 100644
--- a/common/client.c
+++ b/common/client.c
@@ -140,6 +140,8 @@ static guint string_to_policy(const char *policy)
return CLIENT_POLICY_IGNORE;
else if (g_ascii_strcasecmp(policy, "auto") == 0)
return CLIENT_POLICY_AUTO;
+ else if (g_ascii_strcasecmp(policy, "ask") == 0)
+ return CLIENT_POLICY_ASK;
else
return CLIENT_POLICY_UNKNOWN;
}
@@ -153,6 +155,8 @@ static const char *policy_to_string(guint policy)
return "ignore";
case CLIENT_POLICY_AUTO:
return "auto";
+ case CLIENT_POLICY_ASK:
+ return "ask";
default:
return "unknown";
}
diff --git a/common/client.h b/common/client.h
index f1d8d40..f454cc8 100644
--- a/common/client.h
+++ b/common/client.h
@@ -62,6 +62,7 @@ enum {
CLIENT_POLICY_OFF,
CLIENT_POLICY_IGNORE,
CLIENT_POLICY_AUTO,
+ CLIENT_POLICY_ASK,
};
enum {
diff --git a/common/test-client.c b/common/test-client.c
index b996ab0..8942600 100644
--- a/common/test-client.c
+++ b/common/test-client.c
@@ -150,6 +150,9 @@ static void policy_to_text(GtkTreeViewColumn *column, GtkCellRenderer *cell,
case CLIENT_POLICY_AUTO:
str = "Automatic";
break;
+ case CLIENT_POLICY_ASK:
+ str = "Ask User";
+ break;
default:
str = "Unknown";
break;
@@ -374,6 +377,22 @@ static void policy_auto(GtkWidget *button, gpointer user_data)
client_set_policy(index, CLIENT_POLICY_AUTO);
}
+static void policy_ask(GtkWidget *button, gpointer user_data)
+{
+ GtkTreeSelection *selection = user_data;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gchar *index;
+
+ if (gtk_tree_selection_get_selected(selection,
+ &model, &iter) == FALSE)
+ return;
+
+ index = gtk_tree_model_get_string_from_iter(model, &iter);
+
+ client_set_policy(index, CLIENT_POLICY_ASK);
+}
+
static void dhcp_callback(GtkWidget *button, gpointer user_data)
{
GtkTreeSelection *selection = user_data;
@@ -513,6 +532,11 @@ static GtkWidget *create_window(void)
g_signal_connect(G_OBJECT(button), "clicked",
G_CALLBACK(policy_auto), selection);
+ button = gtk_button_new_with_label("Policy Ask");
+ gtk_container_add(GTK_CONTAINER(buttonbox), button);
+ g_signal_connect(G_OBJECT(button), "clicked",
+ G_CALLBACK(policy_ask), selection);
+
buttonbox = gtk_vbutton_box_new();
gtk_button_box_set_layout(GTK_BUTTON_BOX(buttonbox),
GTK_BUTTONBOX_START);