comparison 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
comparison
equal deleted inserted replaced
13942:b14fdab68eac 13943:25be562aaca8
2 #include <gntbox.h> 2 #include <gntbox.h>
3 #include <gntbutton.h> 3 #include <gntbutton.h>
4 #include <gntcombobox.h> 4 #include <gntcombobox.h>
5 #include <gntlabel.h> 5 #include <gntlabel.h>
6 6
7 static void
8 button_activated(GntWidget *b, GntComboBox *combo)
9 {
10 GntWidget *w = b->parent;
11
12 gnt_box_add_widget(GNT_BOX(w),
13 gnt_label_new(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo))));
14 fprintf(stderr, "%s\n", gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)));
15 gnt_box_readjust(GNT_BOX(w->parent));
16 }
17
7 int main() 18 int main()
8 { 19 {
9 GntWidget *box, *combo, *button; 20 GntWidget *box, *combo, *button;
10 GntWidget *hbox; 21 GntWidget *hbox;
11 22
23 freopen(".error", "w", stderr);
12 gnt_init(); 24 gnt_init();
13 25
14 box = gnt_box_new(FALSE, TRUE); 26 box = gnt_box_new(FALSE, TRUE);
15 gnt_widget_set_name(box, "box"); 27 gnt_widget_set_name(box, "box");
16 gnt_box_set_alignment(GNT_BOX(box), GNT_ALIGN_MID); 28 gnt_box_set_alignment(GNT_BOX(box), GNT_ALIGN_MID);
41 gnt_box_set_alignment(GNT_BOX(hbox), GNT_ALIGN_MID); 53 gnt_box_set_alignment(GNT_BOX(hbox), GNT_ALIGN_MID);
42 gnt_widget_set_name(hbox, "lower"); 54 gnt_widget_set_name(hbox, "lower");
43 55
44 button = gnt_button_new("OK"); 56 button = gnt_button_new("OK");
45 gnt_box_add_widget(GNT_BOX(hbox), button); 57 gnt_box_add_widget(GNT_BOX(hbox), button);
58 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(button_activated), combo);
46 59
47 gnt_box_add_widget(GNT_BOX(box), hbox); 60 gnt_box_add_widget(GNT_BOX(box), hbox);
48 61
49 gnt_widget_show(box); 62 gnt_widget_show(box);
50 63