aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-01-10 10:52:55 +0100
committerMarcel Holtmann <marcel@holtmann.org>2008-01-10 10:52:55 +0100
commitb955493d1c65a6cb482e3dd9800f3261c78ce18c (patch)
treec82d2b48f8aa1369574bbe2d8bc0384e482556ba
parent3ef989329fbf583d24230799e59be021645e7836 (diff)
downloadconnman-gnome-b955493d1c65a6cb482e3dd9800f3261c78ce18c.tar.gz
Add skeleton for advanced options dialog
-rw-r--r--po/POTFILES.in1
-rw-r--r--properties/Makefile.am2
-rw-r--r--properties/advanced.c112
-rw-r--r--properties/advanced.h34
-rw-r--r--properties/main.c30
5 files changed, 161 insertions, 18 deletions
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 71506af..efd5740 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,4 +1,5 @@
applet/main.c
applet/connman-applet.desktop.in
properties/main.c
+properties/advanced.c
properties/connman-properties.desktop.in
diff --git a/properties/Makefile.am b/properties/Makefile.am
index bbd9435..691118f 100644
--- a/properties/Makefile.am
+++ b/properties/Makefile.am
@@ -1,7 +1,7 @@
bin_PROGRAMS = connman-properties
-connman_properties_SOURCES = main.c
+connman_properties_SOURCES = main.c advanced.h advanced.c
connman_properties_LDADD = $(top_builddir)/common/libcommon.a \
@GTK_LIBS@ @DBUS_LIBS@
diff --git a/properties/advanced.c b/properties/advanced.c
new file mode 100644
index 0000000..e099f5e
--- /dev/null
+++ b/properties/advanced.c
@@ -0,0 +1,112 @@
+/*
+ *
+ * Connection Manager
+ *
+ * Copyright (C) 2008 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+
+#include "client.h"
+#include "advanced.h"
+
+static void delete_callback(GtkWidget *window, GdkEvent *event,
+ gpointer user_data)
+{
+ gtk_widget_hide(window);
+}
+
+static void close_callback(GtkWidget *button, gpointer user_data)
+{
+ GtkWidget *window = user_data;
+
+ gtk_widget_hide(window);
+}
+
+void create_advanced_dialog(struct config_data *data, guint type)
+{
+ GtkWidget *dialog;
+ GtkWidget *vbox;
+ GtkWidget *notebook;
+ GtkWidget *buttonbox;
+ GtkWidget *button;
+ GtkWidget *widget;
+
+ dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
+ gtk_window_set_transient_for(GTK_WINDOW(dialog),
+ GTK_WINDOW(data->window));
+ gtk_window_set_title(GTK_WINDOW(dialog), _("Advanced Settings"));
+ gtk_window_set_position(GTK_WINDOW(dialog),
+ GTK_WIN_POS_CENTER_ON_PARENT);
+ gtk_window_set_default_size(GTK_WINDOW(dialog), 460, 320);
+ g_signal_connect(G_OBJECT(dialog), "delete-event",
+ G_CALLBACK(delete_callback), NULL);
+
+ vbox = gtk_vbox_new(FALSE, 12);
+ gtk_container_set_border_width(GTK_CONTAINER(vbox), 12);
+ gtk_container_add(GTK_CONTAINER(dialog), vbox);
+
+ notebook = gtk_notebook_new();
+ gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);
+
+ buttonbox = gtk_hbutton_box_new();
+ gtk_button_box_set_layout(GTK_BUTTON_BOX(buttonbox), GTK_BUTTONBOX_END);
+ gtk_box_set_spacing(GTK_BOX(buttonbox), 6);
+ gtk_box_pack_start(GTK_BOX(vbox), buttonbox, FALSE, FALSE, 0);
+
+ button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
+ gtk_container_add(GTK_CONTAINER(buttonbox), button);
+ g_signal_connect(G_OBJECT(button), "clicked",
+ G_CALLBACK(close_callback), dialog);
+
+ button = gtk_button_new_from_stock(GTK_STOCK_OK);
+ gtk_container_add(GTK_CONTAINER(buttonbox), button);
+ g_signal_connect(G_OBJECT(button), "clicked",
+ G_CALLBACK(close_callback), dialog);
+
+ if (type == CLIENT_TYPE_80211) {
+ widget = gtk_label_new(NULL);
+ gtk_notebook_append_page(GTK_NOTEBOOK(notebook), widget, NULL);
+ gtk_notebook_set_tab_label_text(GTK_NOTEBOOK(notebook),
+ widget, _("Wireless"));
+ }
+
+ widget = gtk_label_new(NULL);
+ gtk_notebook_append_page(GTK_NOTEBOOK(notebook), widget, NULL);
+ gtk_notebook_set_tab_label_text(GTK_NOTEBOOK(notebook),
+ widget, _("TCP/IP"));
+
+ widget = gtk_label_new(NULL);
+ gtk_notebook_append_page(GTK_NOTEBOOK(notebook), widget, NULL);
+ gtk_notebook_set_tab_label_text(GTK_NOTEBOOK(notebook),
+ widget, _("DNS"));
+
+ if (type == CLIENT_TYPE_80203) {
+ widget = gtk_label_new(NULL);
+ gtk_notebook_append_page(GTK_NOTEBOOK(notebook), widget, NULL);
+ gtk_notebook_set_tab_label_text(GTK_NOTEBOOK(notebook),
+ widget, _("Ethernet"));
+ }
+
+ data->dialog = dialog;
+}
diff --git a/properties/advanced.h b/properties/advanced.h
new file mode 100644
index 0000000..95a73bb
--- /dev/null
+++ b/properties/advanced.h
@@ -0,0 +1,34 @@
+/*
+ *
+ * Connection Manager
+ *
+ * Copyright (C) 2008 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+struct config_data {
+ GtkWidget *widget;
+ GtkWidget *title;
+ GtkWidget *label;
+
+ GtkWidget *window;
+ GtkTreeModel *model;
+ gchar *index;
+
+ GtkWidget *dialog;
+};
+
+void create_advanced_dialog(struct config_data *data, guint type);
diff --git a/properties/main.c b/properties/main.c
index 68de530..d1be1ec 100644
--- a/properties/main.c
+++ b/properties/main.c
@@ -31,19 +31,10 @@
#include <gtk/gtk.h>
#include "client.h"
+#include "advanced.h"
static GtkWidget *interface_notebook;
-struct config_data {
- GtkWidget *widget;
- GtkWidget *title;
- GtkWidget *label;
-
- GtkWidget *window;
- GtkTreeModel *model;
- gchar *index;
-};
-
static void update_status(struct config_data *data, guint type, guint state,
const gchar *network, const gchar *address)
{
@@ -118,6 +109,9 @@ static void update_config(struct config_data *data)
static void advanced_callback(GtkWidget *button, gpointer user_data)
{
+ struct config_data *data = user_data;
+
+ gtk_widget_show_all(data->dialog);
}
static struct config_data *create_config(GtkTreeModel *model,
@@ -159,11 +153,6 @@ static struct config_data *create_config(GtkTreeModel *model,
gtk_box_pack_start(GTK_BOX(mainbox), label, FALSE, FALSE, 0);
data->label = label;
- update_status(data, type, state, network, address);
-
- g_free(network);
- g_free(address);
-
hbox = gtk_hbox_new(FALSE, 12);
gtk_box_pack_end(GTK_BOX(mainbox), hbox, FALSE, FALSE, 0);
@@ -185,6 +174,13 @@ static struct config_data *create_config(GtkTreeModel *model,
G_CALLBACK(advanced_callback), data);
data->window = user_data;
+ create_advanced_dialog(data, type);
+
+ update_status(data, type, state, network, address);
+
+ g_free(network);
+ g_free(address);
+
data->model = model;
data->index = gtk_tree_model_get_string_from_iter(model, iter);
client_set_userdata(data->index, data);
@@ -423,7 +419,7 @@ static GtkWidget *create_interfaces(GtkWidget *window)
static void delete_callback(GtkWidget *window, GdkEvent *event,
gpointer user_data)
{
- gtk_widget_destroy(GTK_WIDGET(window));
+ gtk_widget_destroy(window);
gtk_main_quit();
}
@@ -432,7 +428,7 @@ static void close_callback(GtkWidget *button, gpointer user_data)
{
GtkWidget *window = user_data;
- gtk_widget_destroy(GTK_WIDGET(window));
+ gtk_widget_destroy(window);
gtk_main_quit();
}