/** gnomepropertybox.c **/ #include static void propertyboxCallback(GtkWidget *widget, gint page,gpointer data); static GtkWidget *makeRadioButtonBox(); void radioCallback(GtkWidget *widget, GnomePropertyBox *propertybox); int main(int argc,char *argv[]) { GtkWidget *propertybox; GtkWidget *pageWidget; GtkWidget *label; gnome_init("gnomepropertybox","1.0",argc,argv); propertybox = gnome_property_box_new(); gtk_window_set_title(GTK_WINDOW(propertybox), "GnomePropertyBox"); pageWidget = makeRadioButtonBox("Apples", "Oranges","Peaches",propertybox); label = gtk_label_new("Radio Buttons"); gnome_property_box_append_page( GNOME_PROPERTY_BOX(propertybox), pageWidget,label); pageWidget = makeRadioButtonBox("Light Blue", "Dark Blue","Black",propertybox); label = gtk_label_new("More Radio Buttons"); gnome_property_box_append_page( GNOME_PROPERTY_BOX(propertybox), pageWidget,label); gtk_signal_connect(GTK_OBJECT(propertybox),"apply", propertyboxCallback,NULL); gtk_widget_show_all(propertybox); gtk_main(); exit(0); } static void propertyboxCallback(GtkWidget *widget, gint page,gpointer data) { switch(page) { case 0: g_print("Page 0 has changed\n"); break; case 1: g_print("Page 1 has changed\n"); break; default: g_print("Apply all pages\n"); break; } } static GtkWidget *makeRadioButtonBox( gchar *label1,gchar *label2,gchar *label3, GtkWidget *propertybox) { GtkWidget *box; GSList *group; GtkWidget *radiobutton; box = gtk_vbox_new(FALSE,0); radiobutton = gtk_radio_button_new_with_label(NULL, label1); gtk_box_pack_start(GTK_BOX(box),radiobutton, FALSE,TRUE,0); gtk_signal_connect(GTK_OBJECT(radiobutton),"toggled", radioCallback,propertybox); group = gtk_radio_button_group( GTK_RADIO_BUTTON(radiobutton)); radiobutton = gtk_radio_button_new_with_label(group, label2); gtk_signal_connect(GTK_OBJECT(radiobutton),"toggled", radioCallback,propertybox); gtk_box_pack_start(GTK_BOX(box),radiobutton, FALSE,TRUE,0); group = gtk_radio_button_group( GTK_RADIO_BUTTON(radiobutton)); radiobutton = gtk_radio_button_new_with_label(group, label3); gtk_signal_connect(GTK_OBJECT(radiobutton),"toggled", radioCallback,propertybox); gtk_box_pack_start(GTK_BOX(box),radiobutton, FALSE,TRUE,0); return(box); } void radioCallback(GtkWidget *widget, GnomePropertyBox *propertybox) { gnome_property_box_changed(propertybox); }