changeset 13935:cd2da4b079cf

[gaim-migrate @ 16466] New widget GntComboBox. I have addde a test file as an example as well. Rename gntutils.* to gntmarshal.* I am going to have some util-functions in gntutils.* later. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 08 Jul 2006 23:58:20 +0000
parents ef0d515b9f97
children 669898e6aa11
files console/libgnt/Makefile.am console/libgnt/gntcombobox.c console/libgnt/gntcombobox.h console/libgnt/gntmarshal.c console/libgnt/gntmarshal.h console/libgnt/gnttree.c console/libgnt/gnttree.h console/libgnt/gntutils.c console/libgnt/gntutils.h console/libgnt/gntwidget.c console/libgnt/test/Makefile console/libgnt/test/combo.c
diffstat 12 files changed, 536 insertions(+), 211 deletions(-) [+]
line wrap: on
line diff
--- a/console/libgnt/Makefile.am	Sat Jul 08 19:06:59 2006 +0000
+++ b/console/libgnt/Makefile.am	Sat Jul 08 23:58:20 2006 +0000
@@ -8,11 +8,12 @@
 	gntbox.c \
 	gntbutton.c \
 	gntcolors.c \
+	gntcombobox.c \
 	gntentry.c \
 	gntlabel.c \
+	gntmarshal.c \
 	gnttextview.c \
 	gnttree.c \
-	gntutils.c \
 	gntmain.c
 
 libgnt_la_headers = \
@@ -20,12 +21,13 @@
 	gntbox.h \
 	gntbutton.h \
 	gntcolors.h \
+	gntcombobox.h \
 	gntentry.h \
 	gntkeys.h \
 	gntlabel.h \
+	gntmarshal.h \
 	gnttextview.h \
 	gnttree.h \
-	gntutils.h \
 	gnt.h
 
 libgnt_laincludedir=$(includedir)/gnt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/console/libgnt/gntcombobox.c	Sat Jul 08 23:58:20 2006 +0000
@@ -0,0 +1,220 @@
+#include "gntbox.h"
+#include "gntcombobox.h"
+#include "gnttree.h"
+#include "gntmarshal.h"
+
+#include <string.h>
+
+enum
+{
+	SIG_SELECTION_CHANGED,
+	SIGS,
+};
+
+static GntWidgetClass *parent_class = NULL;
+static guint signals[SIGS] = { 0 };
+static void (*widget_lost_focus)(GntWidget *widget);
+
+static void
+set_selection(GntComboBox *box, gpointer key)
+{
+	if (box->selected != key)
+	{
+		gpointer old = box->selected;
+		box->selected = key;
+		g_signal_emit(box, signals[SIG_SELECTION_CHANGED], 0, old, key);
+		gnt_widget_draw(GNT_WIDGET(box));
+	}
+}
+
+static void
+gnt_combo_box_draw(GntWidget *widget)
+{
+	GntComboBox *box = GNT_COMBO_BOX(widget);
+	const char *text = NULL;
+	GntColorType type;
+	
+	if (box->dropdown)
+	{
+		text = gnt_tree_get_selection_text(GNT_TREE(box->dropdown));
+		box->selected = gnt_tree_get_selection_data(GNT_TREE(box->dropdown));
+	}
+
+	if (text == NULL)
+		text = "";
+
+	if (gnt_widget_has_focus(widget))
+		type = GNT_COLOR_HIGHLIGHT;
+	else
+		type = GNT_COLOR_NORMAL;
+
+	wbkgdset(widget->window, '\0' | COLOR_PAIR(type));
+	mvwprintw(widget->window, 1, 1, text);
+
+	DEBUG;
+}
+
+static void
+gnt_combo_box_size_request(GntWidget *widget)
+{
+	widget->priv.height = 3;   /* For now, a combobox will have border */
+	widget->priv.width = 15;
+}
+
+static void
+gnt_combo_box_map(GntWidget *widget)
+{
+	if (widget->priv.width == 0 || widget->priv.height == 0)
+		gnt_widget_size_request(widget);
+	DEBUG;
+}
+
+static gboolean
+gnt_combo_box_key_pressed(GntWidget *widget, const char *text)
+{
+	GntComboBox *box = GNT_COMBO_BOX(widget);
+	if (GNT_WIDGET_IS_FLAG_SET(box->dropdown->parent, GNT_WIDGET_MAPPED))
+	{
+		if (text[1] == 0)
+		{
+			switch (text[0])
+			{
+				case '\r':
+				case '\t':
+					/* XXX: Get the selction */
+					set_selection(box, gnt_tree_get_selection_data(GNT_TREE(box->dropdown)));
+				case 27:
+					gnt_widget_hide(box->dropdown->parent);
+					return TRUE;
+					break;
+			}
+		}
+		if (gnt_widget_key_pressed(box->dropdown, text))
+			return TRUE;
+	}
+	else
+	{
+		if (text[0] == 27)
+		{
+			if (strcmp(text + 1, GNT_KEY_UP) == 0 ||
+					strcmp(text + 1, GNT_KEY_DOWN) == 0)
+			{
+				gnt_widget_set_size(box->dropdown, widget->priv.width, 9);
+				gnt_widget_set_position(box->dropdown->parent,
+						widget->priv.x, widget->priv.y + widget->priv.height - 1);
+				gnt_widget_draw(box->dropdown->parent);
+				return TRUE;
+			}
+		}
+	}
+
+	return FALSE;
+}
+
+static void
+gnt_combo_box_destroy(GntWidget *widget)
+{
+	gnt_widget_destroy(GNT_COMBO_BOX(widget)->dropdown->parent);
+}
+
+static void
+gnt_combo_box_lost_focus(GntWidget *widget)
+{
+	GntComboBox *combo = GNT_COMBO_BOX(widget);
+	if (GNT_WIDGET_IS_FLAG_SET(combo->dropdown->parent, GNT_WIDGET_MAPPED))
+		gnt_widget_hide(GNT_COMBO_BOX(widget)->dropdown->parent);
+	widget_lost_focus(widget);
+}
+
+static void
+gnt_combo_box_class_init(GntComboBoxClass *klass)
+{
+	parent_class = GNT_WIDGET_CLASS(klass);
+
+	parent_class->destroy = gnt_combo_box_destroy;
+	parent_class->draw = gnt_combo_box_draw;
+	parent_class->map = gnt_combo_box_map;
+	parent_class->size_request = gnt_combo_box_size_request;
+	parent_class->key_pressed = gnt_combo_box_key_pressed;
+
+	widget_lost_focus = parent_class->lost_focus;
+	parent_class->lost_focus = gnt_combo_box_lost_focus;
+
+	signals[SIG_SELECTION_CHANGED] = 
+		g_signal_new("selection-changed",
+					 G_TYPE_FROM_CLASS(klass),
+					 G_SIGNAL_RUN_LAST,
+					 0,
+					 NULL, NULL,
+					 gnt_closure_marshal_VOID__POINTER_POINTER,
+					 G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER);
+
+	DEBUG;
+}
+
+static void
+gnt_combo_box_init(GTypeInstance *instance, gpointer class)
+{
+	GntWidget *box;
+	GntComboBox *combo = GNT_COMBO_BOX(instance);
+
+	GNT_WIDGET_SET_FLAGS(GNT_WIDGET(instance),
+			GNT_WIDGET_GROW_X | GNT_WIDGET_CAN_TAKE_FOCUS | GNT_WIDGET_NO_SHADOW);
+	combo->dropdown = gnt_tree_new();
+
+	box = gnt_box_new(FALSE, FALSE);
+	GNT_WIDGET_SET_FLAGS(box, GNT_WIDGET_NO_SHADOW | GNT_WIDGET_NO_BORDER);
+	gnt_box_add_widget(GNT_BOX(box), combo->dropdown);
+	
+	DEBUG;
+}
+
+/******************************************************************************
+ * GntComboBox API
+ *****************************************************************************/
+GType
+gnt_combo_box_get_gtype(void)
+{
+	static GType type = 0;
+
+	if(type == 0)
+	{
+		static const GTypeInfo info = {
+			sizeof(GntComboBoxClass),
+			NULL,					/* base_init		*/
+			NULL,					/* base_finalize	*/
+			(GClassInitFunc)gnt_combo_box_class_init,
+			NULL,					/* class_finalize	*/
+			NULL,					/* class_data		*/
+			sizeof(GntComboBox),
+			0,						/* n_preallocs		*/
+			gnt_combo_box_init,			/* instance_init	*/
+		};
+
+		type = g_type_register_static(GNT_TYPE_WIDGET,
+									  "GntComboBox",
+									  &info, 0);
+	}
+
+	return type;
+}
+
+GntWidget *gnt_combo_box_new()
+{
+	GntWidget *widget = g_object_new(GNT_TYPE_COMBO_BOX, NULL);
+
+	return widget;
+}
+
+void gnt_combo_box_add_data(GntComboBox *box, gpointer key, const char *text)
+{
+	gnt_tree_add_row_after(GNT_TREE(box->dropdown), key, text, NULL, NULL);
+	if (box->selected == NULL)
+		set_selection(box, key);
+}
+
+gpointer gnt_combo_box_get_selected_data(GntComboBox *box)
+{
+	return box->selected;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/console/libgnt/gntcombobox.h	Sat Jul 08 23:58:20 2006 +0000
@@ -0,0 +1,55 @@
+#ifndef GNT_COMBO_BOX_H
+#define GNT_COMBO_BOX_H
+
+#include "gnt.h"
+#include "gntcolors.h"
+#include "gntkeys.h"
+#include "gntwidget.h"
+
+#define GNT_TYPE_COMBO_BOX				(gnt_combo_box_get_gtype())
+#define GNT_COMBO_BOX(obj)				(G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_COMBO_BOX, GntComboBox))
+#define GNT_COMBO_BOX_CLASS(klass)		(G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_COMBO_BOX, GntComboBoxClass))
+#define GNT_IS_COMBO_BOX(obj)			(G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_COMBO_BOX))
+#define GNT_IS_COMBO_BOX_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_COMBO_BOX))
+#define GNT_COMBO_BOX_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_COMBO_BOX, GntComboBoxClass))
+
+#define GNT_COMBO_BOX_FLAGS(obj)				(GNT_COMBO_BOX(obj)->priv.flags)
+#define GNT_COMBO_BOX_SET_FLAGS(obj, flags)		(GNT_COMBO_BOX_FLAGS(obj) |= flags)
+#define GNT_COMBO_BOX_UNSET_FLAGS(obj, flags)	(GNT_COMBO_BOX_FLAGS(obj) &= ~(flags))
+
+typedef struct _GnComboBox			GntComboBox;
+typedef struct _GnComboBoxPriv		GntComboBoxPriv;
+typedef struct _GnComboBoxClass		GntComboBoxClass;
+
+struct _GnComboBox
+{
+	GntWidget parent;
+
+	GntWidget *dropdown;   /* This is a GntTree */
+
+	void *selected;        /* Currently selected key */
+};
+
+struct _GnComboBoxClass
+{
+	GntWidgetClass parent;
+
+	void (*gnt_reserved1)(void);
+	void (*gnt_reserved2)(void);
+	void (*gnt_reserved3)(void);
+	void (*gnt_reserved4)(void);
+};
+
+G_BEGIN_DECLS
+
+GType gnt_combo_box_get_gtype(void);
+
+GntWidget *gnt_combo_box_new();
+
+void gnt_combo_box_add_data(GntComboBox *box, gpointer key, const char *text);
+
+gpointer gnt_combo_box_get_selected_data(GntComboBox *box);
+
+G_END_DECLS
+
+#endif /* GNT_COMBO_BOX_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/console/libgnt/gntmarshal.c	Sat Jul 08 23:58:20 2006 +0000
@@ -0,0 +1,168 @@
+#include "gntmarshal.h"
+
+void gnt_closure_marshal_BOOLEAN__STRING(GClosure *closure,
+										GValue *ret_value,
+										guint n_param_values,
+										const GValue *param_values,
+										gpointer invocation_hint,
+										gpointer marshal_data)
+{
+	typedef gboolean (*func) (gpointer data1, const char *arg1, gpointer data2);
+	register func callback;
+	register GCClosure *cc = (GCClosure*)closure;
+	register gpointer data1, data2;
+	gboolean ret;
+
+	g_return_if_fail(ret_value != NULL);
+	g_return_if_fail(n_param_values == 2);
+
+	if (G_CCLOSURE_SWAP_DATA(closure))
+	{
+		data1 = closure->data;
+		data2 = g_value_peek_pointer(param_values + 0);
+	}
+	else
+	{
+		data1 = g_value_peek_pointer(param_values + 0);
+		data2 = closure->data;
+	}
+
+	callback = (func) (marshal_data ? marshal_data : cc->callback);
+	ret = callback(data1, g_value_get_string(param_values + 1) , data2);
+	g_value_set_boolean(ret_value, ret);
+}
+
+void gnt_closure_marshal_VOID__INT_INT_INT_INT(GClosure *closure,
+										GValue *ret_value,
+										guint n_param_values,
+										const GValue *param_values,
+										gpointer invocation_hint,
+										gpointer marshal_data)
+{
+	typedef void (*func) (gpointer data1, int, int, int, int, gpointer data2);
+	register func callback;
+	register GCClosure *cc = (GCClosure*)closure;
+	register gpointer data1, data2;
+
+	g_return_if_fail(n_param_values == 5);
+
+	if (G_CCLOSURE_SWAP_DATA(closure))
+	{
+		data1 = closure->data;
+		data2 = g_value_peek_pointer(param_values + 0);
+	}
+	else
+	{
+		data1 = g_value_peek_pointer(param_values + 0);
+		data2 = closure->data;
+	}
+
+	callback = (func) (marshal_data ? marshal_data : cc->callback);
+	callback(data1,
+			g_value_get_int(param_values + 1) ,
+			g_value_get_int(param_values + 2) ,
+			g_value_get_int(param_values + 3) ,
+			g_value_get_int(param_values + 4) ,
+			data2);
+}
+
+void gnt_closure_marshal_VOID__INT_INT(GClosure *closure,
+										GValue *ret_value,
+										guint n_param_values,
+										const GValue *param_values,
+										gpointer invocation_hint,
+										gpointer marshal_data)
+{
+	typedef void (*func) (gpointer data1, int, int, gpointer data2);
+	register func callback;
+	register GCClosure *cc = (GCClosure*)closure;
+	register gpointer data1, data2;
+
+	g_return_if_fail(n_param_values == 3);
+
+	if (G_CCLOSURE_SWAP_DATA(closure))
+	{
+		data1 = closure->data;
+		data2 = g_value_peek_pointer(param_values + 0);
+	}
+	else
+	{
+		data1 = g_value_peek_pointer(param_values + 0);
+		data2 = closure->data;
+	}
+
+	callback = (func) (marshal_data ? marshal_data : cc->callback);
+	callback(data1,
+			g_value_get_int(param_values + 1) ,
+			g_value_get_int(param_values + 2) ,
+			data2);
+}
+
+void gnt_closure_marshal_VOID__POINTER_POINTER(GClosure *closure,
+										GValue *ret_value,
+										guint n_param_values,
+										const GValue *param_values,
+										gpointer invocation_hint,
+										gpointer marshal_data)
+{
+	typedef void (*func) (gpointer data1, gpointer, gpointer, gpointer data2);
+	register func callback;
+	register GCClosure *cc = (GCClosure*)closure;
+	register gpointer data1, data2;
+
+	g_return_if_fail(n_param_values == 3);
+
+	if (G_CCLOSURE_SWAP_DATA(closure))
+	{
+		data1 = closure->data;
+		data2 = g_value_peek_pointer(param_values + 0);
+	}
+	else
+	{
+		data1 = g_value_peek_pointer(param_values + 0);
+		data2 = closure->data;
+	}
+
+	callback = (func) (marshal_data ? marshal_data : cc->callback);
+	callback(data1,
+			g_value_get_pointer(param_values + 1) ,
+			g_value_get_pointer(param_values + 2) ,
+			data2);
+}
+
+void gnt_closure_marshal_BOOLEAN__INT_INT(GClosure *closure,
+										GValue *ret_value,
+										guint n_param_values,
+										const GValue *param_values,
+										gpointer invocation_hint,
+										gpointer marshal_data)
+{
+	typedef gboolean (*func) (gpointer data1, int, int, gpointer data2);
+	register func callback;
+	register GCClosure *cc = (GCClosure*)closure;
+	register gpointer data1, data2;
+	gboolean ret;
+
+	g_return_if_fail(ret_value != NULL);
+	g_return_if_fail(n_param_values == 3);
+
+	if (G_CCLOSURE_SWAP_DATA(closure))
+	{
+		data1 = closure->data;
+		data2 = g_value_peek_pointer(param_values + 0);
+	}
+	else
+	{
+		data1 = g_value_peek_pointer(param_values + 0);
+		data2 = closure->data;
+	}
+
+	callback = (func) (marshal_data ? marshal_data : cc->callback);
+	ret = callback(data1,
+			g_value_get_int(param_values + 1) ,
+			g_value_get_int(param_values + 2) ,
+			data2);
+	g_value_set_boolean(ret_value, ret);
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/console/libgnt/gntmarshal.h	Sat Jul 08 23:58:20 2006 +0000
@@ -0,0 +1,37 @@
+#include "gntwidget.h"
+
+void gnt_closure_marshal_BOOLEAN__STRING(GClosure *closure,
+										GValue *ret_value,
+										guint n_param_values,
+										const GValue *param_values,
+										gpointer invocation_hint,
+										gpointer marshal_data);
+
+void gnt_closure_marshal_VOID__INT_INT_INT_INT(GClosure *closure,
+										GValue *ret_value,
+										guint n_param_values,
+										const GValue *param_values,
+										gpointer invocation_hint,
+										gpointer marshal_data);
+
+void gnt_closure_marshal_VOID__INT_INT(GClosure *closure,
+										GValue *ret_value,
+										guint n_param_values,
+										const GValue *param_values,
+										gpointer invocation_hint,
+										gpointer marshal_data);
+
+void gnt_closure_marshal_VOID__POINTER_POINTER(GClosure *closure,
+										GValue *ret_value,
+										guint n_param_values,
+										const GValue *param_values,
+										gpointer invocation_hint,
+										gpointer marshal_data);
+
+void gnt_closure_marshal_BOOLEAN__INT_INT(GClosure *closure,
+										GValue *ret_value,
+										guint n_param_values,
+										const GValue *param_values,
+										gpointer invocation_hint,
+										gpointer marshal_data);
+
--- a/console/libgnt/gnttree.c	Sat Jul 08 19:06:59 2006 +0000
+++ b/console/libgnt/gnttree.c	Sat Jul 08 23:58:20 2006 +0000
@@ -1,5 +1,5 @@
 #include "gnttree.h"
-#include "gntutils.h"
+#include "gntmarshal.h"
 
 #include <string.h>
 
@@ -592,6 +592,13 @@
 	return NULL;
 }
 
+const char *gnt_tree_get_selection_text(GntTree *tree)
+{
+	if (tree->current)
+		return tree->current->text;
+	return NULL;
+}
+
 /* XXX: Should this also remove all the children of the row being removed? */
 void gnt_tree_remove(GntTree *tree, gpointer key)
 {
@@ -707,6 +714,6 @@
 		return;
 
 	row->flags = flags;
-	redraw_tree(tree);	/* XXX: Is shouldn't be necessary to redraw the whole darned tree */
+	redraw_tree(tree);	/* XXX: It shouldn't be necessary to redraw the whole darned tree */
 }
 
--- a/console/libgnt/gnttree.h	Sat Jul 08 19:06:59 2006 +0000
+++ b/console/libgnt/gnttree.h	Sat Jul 08 23:58:20 2006 +0000
@@ -67,6 +67,8 @@
 
 gpointer gnt_tree_get_selection_data(GntTree *tree);
 
+const char *gnt_tree_get_selection_text(GntTree *tree);
+
 void gnt_tree_remove(GntTree *tree, gpointer key);
 
 /* Returns the visible line number of the selected row */
--- a/console/libgnt/gntutils.c	Sat Jul 08 19:06:59 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,168 +0,0 @@
-#include "gntutils.h"
-
-void gnt_closure_marshal_BOOLEAN__STRING(GClosure *closure,
-										GValue *ret_value,
-										guint n_param_values,
-										const GValue *param_values,
-										gpointer invocation_hint,
-										gpointer marshal_data)
-{
-	typedef gboolean (*func) (gpointer data1, const char *arg1, gpointer data2);
-	register func callback;
-	register GCClosure *cc = (GCClosure*)closure;
-	register gpointer data1, data2;
-	gboolean ret;
-
-	g_return_if_fail(ret_value != NULL);
-	g_return_if_fail(n_param_values == 2);
-
-	if (G_CCLOSURE_SWAP_DATA(closure))
-	{
-		data1 = closure->data;
-		data2 = g_value_peek_pointer(param_values + 0);
-	}
-	else
-	{
-		data1 = g_value_peek_pointer(param_values + 0);
-		data2 = closure->data;
-	}
-
-	callback = (func) (marshal_data ? marshal_data : cc->callback);
-	ret = callback(data1, g_value_get_string(param_values + 1) , data2);
-	g_value_set_boolean(ret_value, ret);
-}
-
-void gnt_closure_marshal_VOID__INT_INT_INT_INT(GClosure *closure,
-										GValue *ret_value,
-										guint n_param_values,
-										const GValue *param_values,
-										gpointer invocation_hint,
-										gpointer marshal_data)
-{
-	typedef void (*func) (gpointer data1, int, int, int, int, gpointer data2);
-	register func callback;
-	register GCClosure *cc = (GCClosure*)closure;
-	register gpointer data1, data2;
-
-	g_return_if_fail(n_param_values == 5);
-
-	if (G_CCLOSURE_SWAP_DATA(closure))
-	{
-		data1 = closure->data;
-		data2 = g_value_peek_pointer(param_values + 0);
-	}
-	else
-	{
-		data1 = g_value_peek_pointer(param_values + 0);
-		data2 = closure->data;
-	}
-
-	callback = (func) (marshal_data ? marshal_data : cc->callback);
-	callback(data1,
-			g_value_get_int(param_values + 1) ,
-			g_value_get_int(param_values + 2) ,
-			g_value_get_int(param_values + 3) ,
-			g_value_get_int(param_values + 4) ,
-			data2);
-}
-
-void gnt_closure_marshal_VOID__INT_INT(GClosure *closure,
-										GValue *ret_value,
-										guint n_param_values,
-										const GValue *param_values,
-										gpointer invocation_hint,
-										gpointer marshal_data)
-{
-	typedef void (*func) (gpointer data1, int, int, gpointer data2);
-	register func callback;
-	register GCClosure *cc = (GCClosure*)closure;
-	register gpointer data1, data2;
-
-	g_return_if_fail(n_param_values == 3);
-
-	if (G_CCLOSURE_SWAP_DATA(closure))
-	{
-		data1 = closure->data;
-		data2 = g_value_peek_pointer(param_values + 0);
-	}
-	else
-	{
-		data1 = g_value_peek_pointer(param_values + 0);
-		data2 = closure->data;
-	}
-
-	callback = (func) (marshal_data ? marshal_data : cc->callback);
-	callback(data1,
-			g_value_get_int(param_values + 1) ,
-			g_value_get_int(param_values + 2) ,
-			data2);
-}
-
-void gnt_closure_marshal_VOID__POINTER_POINTER(GClosure *closure,
-										GValue *ret_value,
-										guint n_param_values,
-										const GValue *param_values,
-										gpointer invocation_hint,
-										gpointer marshal_data)
-{
-	typedef void (*func) (gpointer data1, gpointer, gpointer, gpointer data2);
-	register func callback;
-	register GCClosure *cc = (GCClosure*)closure;
-	register gpointer data1, data2;
-
-	g_return_if_fail(n_param_values == 3);
-
-	if (G_CCLOSURE_SWAP_DATA(closure))
-	{
-		data1 = closure->data;
-		data2 = g_value_peek_pointer(param_values + 0);
-	}
-	else
-	{
-		data1 = g_value_peek_pointer(param_values + 0);
-		data2 = closure->data;
-	}
-
-	callback = (func) (marshal_data ? marshal_data : cc->callback);
-	callback(data1,
-			g_value_get_pointer(param_values + 1) ,
-			g_value_get_pointer(param_values + 2) ,
-			data2);
-}
-
-void gnt_closure_marshal_BOOLEAN__INT_INT(GClosure *closure,
-										GValue *ret_value,
-										guint n_param_values,
-										const GValue *param_values,
-										gpointer invocation_hint,
-										gpointer marshal_data)
-{
-	typedef gboolean (*func) (gpointer data1, int, int, gpointer data2);
-	register func callback;
-	register GCClosure *cc = (GCClosure*)closure;
-	register gpointer data1, data2;
-	gboolean ret;
-
-	g_return_if_fail(ret_value != NULL);
-	g_return_if_fail(n_param_values == 3);
-
-	if (G_CCLOSURE_SWAP_DATA(closure))
-	{
-		data1 = closure->data;
-		data2 = g_value_peek_pointer(param_values + 0);
-	}
-	else
-	{
-		data1 = g_value_peek_pointer(param_values + 0);
-		data2 = closure->data;
-	}
-
-	callback = (func) (marshal_data ? marshal_data : cc->callback);
-	ret = callback(data1,
-			g_value_get_int(param_values + 1) ,
-			g_value_get_int(param_values + 2) ,
-			data2);
-	g_value_set_boolean(ret_value, ret);
-}
-
-
--- a/console/libgnt/gntutils.h	Sat Jul 08 19:06:59 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-#include "gntwidget.h"
-
-void gnt_closure_marshal_BOOLEAN__STRING(GClosure *closure,
-										GValue *ret_value,
-										guint n_param_values,
-										const GValue *param_values,
-										gpointer invocation_hint,
-										gpointer marshal_data);
-
-void gnt_closure_marshal_VOID__INT_INT_INT_INT(GClosure *closure,
-										GValue *ret_value,
-										guint n_param_values,
-										const GValue *param_values,
-										gpointer invocation_hint,
-										gpointer marshal_data);
-
-void gnt_closure_marshal_VOID__INT_INT(GClosure *closure,
-										GValue *ret_value,
-										guint n_param_values,
-										const GValue *param_values,
-										gpointer invocation_hint,
-										gpointer marshal_data);
-
-void gnt_closure_marshal_VOID__POINTER_POINTER(GClosure *closure,
-										GValue *ret_value,
-										guint n_param_values,
-										const GValue *param_values,
-										gpointer invocation_hint,
-										gpointer marshal_data);
-
-void gnt_closure_marshal_BOOLEAN__INT_INT(GClosure *closure,
-										GValue *ret_value,
-										guint n_param_values,
-										const GValue *param_values,
-										gpointer invocation_hint,
-										gpointer marshal_data);
-
--- a/console/libgnt/gntwidget.c	Sat Jul 08 19:06:59 2006 +0000
+++ b/console/libgnt/gntwidget.c	Sat Jul 08 23:58:20 2006 +0000
@@ -1,7 +1,7 @@
 /* Stuff brutally ripped from Gflib */
 
 #include "gntwidget.h"
-#include "gntutils.h"
+#include "gntmarshal.h"
 #include "gnt.h"
 
 #define MIN_SIZE 5
--- a/console/libgnt/test/Makefile	Sat Jul 08 19:06:59 2006 +0000
+++ b/console/libgnt/test/Makefile	Sat Jul 08 23:58:20 2006 +0000
@@ -2,7 +2,7 @@
 CFLAGS=`pkg-config --cflags gobject-2.0` -g -I../
 LDFLAGS=`pkg-config --libs gobject-2.0` -pg -lgnt -L../
 
-EXAMPLES=focus tv multiwin
+EXAMPLES=combo focus tv multiwin
 
 all:
 	make examples
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/console/libgnt/test/combo.c	Sat Jul 08 23:58:20 2006 +0000
@@ -0,0 +1,39 @@
+#include <gnt.h>
+#include <gntbox.h>
+#include <gntcombobox.h>
+#include <gntlabel.h>
+
+int main()
+{
+	GntWidget *box, *combo, *button;
+
+	gnt_init();
+	
+	box = gnt_box_new(FALSE, FALSE);
+
+	gnt_box_set_toplevel(GNT_BOX(box), TRUE);
+	gnt_box_set_title(GNT_BOX(box), "Checkbox");
+
+	combo = gnt_combo_box_new();
+	gnt_combo_box_add_data(GNT_COMBO_BOX(combo), "1", "1");
+	gnt_combo_box_add_data(GNT_COMBO_BOX(combo), "2", "2");
+	gnt_combo_box_add_data(GNT_COMBO_BOX(combo), "3", "3");
+	gnt_combo_box_add_data(GNT_COMBO_BOX(combo), "4", "4");
+	gnt_combo_box_add_data(GNT_COMBO_BOX(combo), "5", "5");
+	gnt_combo_box_add_data(GNT_COMBO_BOX(combo), "6", "6");
+
+	gnt_box_add_widget(GNT_BOX(box), gnt_label_new("Select"));
+	gnt_box_add_widget(GNT_BOX(box), combo);
+
+	button = gnt_button_new("OK");
+	gnt_box_add_widget(GNT_BOX(box), button);
+
+	gnt_widget_show(box);
+
+	gnt_main();
+
+	gnt_quit();
+
+	return 0;
+}
+