|
发表于 2003-12-4 20:58:31
|
显示全部楼层
void func1 (GtkWidget *widget, gpointer user_data) {
NULL;
}
void func2 (GtkWidget *widget, gpointer user_data) {
NULL;
}
GtkWidget* create_radio (GtkWidget *widget, const gchar* user_data) {
return (gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (widget),
user_data));
}
void unnamed() {
GtkWidget *box;
GtkWidget *radio1;
GtkWidget *radio2;
box = gtk_hbox_new (TRUE, 2);
radio1 = gtk_radio_button_new (NULL);
radio2 = create_radio (radio1,"I'm radio2");
gtk_box_pack_start (GTK_BOX (box), radio1, TRUE, TRUE, 2);
gtk_box_pack_start (GTK_BOX (box), radio2, TRUE, TRUE, 2);
g_singal_connect (G_OBJECT (radio1), "released", G_CALLBACK (func1), NULL);
g_singal_connect (G_OBJECT (radio2), "released", G_CALLBACK (func2), NULL);
}
你把创建函数中的信号连接部分移到外部不就得了. |
|