diff console/libgnt/test/combo.c @ 13943:25be562aaca8

[gaim-migrate @ 16480] New widget GntLine to use as a separator. A partial dialog for add-account callback. Updating the dialog as a result of selection-change in the prpl dropdown is way ickier than I had expected it to be. It 'works' now, but quite a bit quirky. I will try to smooth things up later, perhaps next week. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Mon, 10 Jul 2006 23:55:24 +0000
parents 5d5c84239eea
children a06f7495af6f
line wrap: on
line diff
--- a/console/libgnt/test/combo.c	Mon Jul 10 18:08:11 2006 +0000
+++ b/console/libgnt/test/combo.c	Mon Jul 10 23:55:24 2006 +0000
@@ -4,11 +4,23 @@
 #include <gntcombobox.h>
 #include <gntlabel.h>
 
+static void
+button_activated(GntWidget *b, GntComboBox *combo)
+{
+	GntWidget *w = b->parent;
+
+	gnt_box_add_widget(GNT_BOX(w),
+			gnt_label_new(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo))));
+	fprintf(stderr, "%s\n", gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)));
+	gnt_box_readjust(GNT_BOX(w->parent));
+}
+
 int main()
 {
 	GntWidget *box, *combo, *button;
 	GntWidget *hbox;
 
+	freopen(".error", "w", stderr);
 	gnt_init();
 	
 	box = gnt_box_new(FALSE, TRUE);
@@ -43,6 +55,7 @@
 
 	button = gnt_button_new("OK");
 	gnt_box_add_widget(GNT_BOX(hbox), button);
+	g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(button_activated), combo);
 
 	gnt_box_add_widget(GNT_BOX(box), hbox);