// gcc `pkg-config --cflags --libs gtk+-2.0` test.c #include static void change_color(GtkWidget *button, GtkWidget *bar) { GdkColor red; red.red = 65535; red.green = 0; red.blue = 0; gtk_widget_modify_bg(button, GTK_STATE_PRELIGHT, &red); gtk_widget_modify_bg(bar, GTK_STATE_PRELIGHT, &red); } int main (int argc, char **argv) { GtkWidget *window; GtkWidget *vbox; GtkWidget *button; GtkWidget *bar; gtk_init(&argc, &argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); vbox = gtk_vbox_new(FALSE, 0); button = gtk_button_new_with_label("Color red"); bar = gtk_progress_bar_new(); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(bar), 0.5); g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL); g_signal_connect(button, "clicked", G_CALLBACK(change_color), bar); gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), bar, FALSE, FALSE, 0); gtk_container_add(GTK_CONTAINER(window), vbox); gtk_widget_show_all(window); gtk_main(); }