Hi. I've modified your example a bit to give you a kick start with this problem.
== test.c == #include <gtk/gtk.h> #include <stdio.h> void on_combobox1_changed (GtkComboBox *widget, GtkWidget *window) { GtkTreeIter iter; GtkTreeModel *model; gchar *color; GdkColor gcolor; gtk_combo_box_get_active_iter( widget, &iter ); model = gtk_combo_box_get_model( widget ); gtk_tree_model_get( model, &iter, 0, &color, -1 ); gdk_color_parse( color, &gcolor ); g_free( color ); gtk_widget_modify_bg( window, GTK_STATE_NORMAL, &gcolor ); } int main (int argc, char *argv[]) { GtkBuilder *builder; GtkWidget *window; gtk_init (&argc, &argv); builder = gtk_builder_new (); gtk_builder_add_from_file (builder, "test.xml", NULL); window = GTK_WIDGET (gtk_builder_get_object (builder, "window1")); gtk_builder_connect_signals (builder, window); g_object_unref (G_OBJECT (builder)); gtk_widget_show (window); gtk_main (); return 0; } == end test.c == == test.xml == <?xml version="1.0"?> <!--Generated with glade3 3.4.5 on Thu Nov 27 00:27:12 2008 --> <interface> <object class="GtkListStore" id="model1"> <columns> <column type="gchararray"/> </columns> <data> <row> <col id="0">red</col> </row> <row> <col id="0">blue</col> </row> <row> <col id="0">green</col> </row> </data> </object> <object class="GtkWindow" id="window1"> <signal handler="gtk_main_quit" name="destroy"/> <child> <object class="GtkVBox" id="vbox1"> <property name="visible">True</property> <child> <object class="GtkComboBox" id="combobox1"> <property name="visible">True</property> <signal handler="on_combobox1_changed" name="changed"/> <property name="model">model1</property> <child> <object class="GtkCellRendererText" id="renderer1"/> <attributes> <attribute name="text">0</attribute> </attributes> </child> </object> </child> <child> <object class="GtkLabel" id="label1"> <property name="visible">True</property> <property name="label" translatable="yes">label</property> </object> <packing> <property name="position">1</property> </packing> </child> <child> <object class="GtkLabel" id="label2"> <property name="visible">True</property> <property name="label" translatable="yes">label</property> </object> <packing> <property name="position">2</property> </packing> </child> </object> </child> </object> </interface> == end test.xml == 2008/11/26 Roy G. Biv <[EMAIL PROTECTED]>: > On Wed, Nov 26, 2008 at 8:03 AM, Nicola Fontana <[EMAIL PROTECTED]> wrote: >> On Tue, 25 Nov 2008 21:26:54 -0800 >> "Roy G. Biv" <[EMAIL PROTECTED]> wrote: >> >>> Hello everybody! >>> >>> I am just learning how to use GTK+ and have run into a problem. After >>> having followed Micah Carrick's Glade3 tutorial, I have learned that >>> using GtkBuilder seems to be the best way to do things. Therefore the >>> method that he used in his tutorial is the how I'm doing it too. On >>> to my problem... >>> >>> I have created a window that contains a single combobox widget named >>> combobox1. In this combobox I have listed a few different colors. >>> And in glade I set the a handler named "on_combobox1_changed" for the >>> "changed" entry under GtkComboBox. >>> >>> My C program contains this function: >>> >>> void on_combobox1_changed (GtkComboBox *widget, gpointer user_data); >> >> My guess is you have something weird in your event loop: you >> should post the code. >> >> Ciao >> -- >> Nicola > > Thank you all for your help. > > I tried adding stderr to my printf function but it still seems to be > buffered. Here is the code that I am working with: > > #include <gtk/gtk.h> > #include <stdio.h> > > void on_combobox1_changed (GtkComboBox *widget, gpointer user_data) { > printf("on_combobox1_changed event"); > // int hello = GPOINTER_TO_INT(user_data); > // printf("%d", hello); > // GtkWidget window = GTK_WIDGET( widget ); > GdkColor color; > // gdk_color_parse(gtk_combo_box_get_active_text(widget), &color); > gdk_color_parse("blue", &color); > gtk_widget_modify_bg (GTK_WIDGET (widget), GTK_STATE_NORMAL, &color); > } > > void > on_window_destroy (GtkObject *object, gpointer user_data) > { > printf("on_window_destroy event"); > gtk_main_quit (); > } > > int > main (int argc, char *argv[]) > { > // GtkWidget *combobox1; > GtkBuilder *builder; > GtkWidget *window; > GdkColor red; > > gtk_init (&argc, &argv); > > builder = gtk_builder_new (); > gtk_builder_add_from_file (builder, "testcolor1.xml", NULL); > window = GTK_WIDGET (gtk_builder_get_object (builder, "window")); > gdk_color_parse ("red", &red); > gtk_widget_modify_bg (window, GTK_STATE_NORMAL, &red); > gtk_builder_connect_signals (builder, NULL); > // GtkComboBox *combobox1 = GTK_COMBO_BOX (builder); > // g_signal_connect(G_OBJECT(combobox1), "clicked", G_CALLBACK > (on_combobox1_changed), NULL); > > g_object_unref (G_OBJECT (builder)); > gtk_widget_show (window); > // gtk_widget_modify_bg (window, GTK_STATE_NORMAL, red); > > gtk_main (); > > return 0; > } > > -Roy > _______________________________________________ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list > -- Tadej Borovšak 00386 (0)40 613 131 [EMAIL PROTECTED] [EMAIL PROTECTED] _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list