Index: layersel/layersel.c =================================================================== --- layersel/layersel.c (revision 8481) +++ layersel/layersel.c (revision 8482) @@ -1,9 +1,13 @@ #include "layersel.h" #include "lib_gtk_common/compat.h" -static GtkWidget *add_grp(const char *gname) +typedef struct layersel_grp_s { + GtkWidget *grp_row, *grp_closed, *grp_open, *layer[4]; +} layersel_grp_t; + +static GtkWidget *add_grp(layersel_grp_t *ls, const char *gname) { - GtkWidget *grp_row, *grp_closed, *grp_open, *gn_vert, *layer[4], *grp_layers; + GtkWidget *gn_vert, *grp_layers; int n; char tmp[32]; @@ -19,30 +23,30 @@ |+-----------------------+ | +--------------------------+ */ - grp_row = gtkc_vbox_new(0, 0); - grp_closed = gtkc_hbox_new(0, 0); - grp_open = gtkc_hbox_new(0, 0); - gtk_box_pack_start(GTK_BOX(grp_row), grp_closed, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(grp_row), grp_open, TRUE, TRUE, 0); + ls->grp_row = gtkc_vbox_new(0, 0); + ls->grp_closed = gtkc_hbox_new(0, 0); + ls->grp_open = gtkc_hbox_new(0, 0); + gtk_box_pack_start(GTK_BOX(ls->grp_row), ls->grp_closed, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(ls->grp_row), ls->grp_open, TRUE, TRUE, 0); gn_vert = gtkc_vbox_new(0, 0); grp_layers = gtkc_vbox_new(0, 0); - gtk_box_pack_start(GTK_BOX(grp_open), gn_vert, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(grp_open), grp_layers, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(ls->grp_open), gn_vert, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(ls->grp_open), grp_layers, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(gn_vert), gtk_label_new(gname), TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(grp_open), gtk_label_new(gname), TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(ls->grp_open), gtk_label_new(gname), TRUE, TRUE, 0); for(n = 0; n < 4; n++) { - layer[n] = gtkc_hbox_new(0, 0); - gtk_box_pack_start(GTK_BOX(grp_layers), layer[n], TRUE, TRUE, 0); + ls->layer[n] = gtkc_hbox_new(0, 0); + gtk_box_pack_start(GTK_BOX(grp_layers), ls->layer[n], TRUE, TRUE, 0); sprintf(tmp, "layer %d\n", n); - gtk_box_pack_start(GTK_BOX(layer[n]), gtk_label_new("[vis]"), TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(layer[n]), gtk_label_new(tmp), TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(ls->layer[n]), gtk_label_new("[vis]"), TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(ls->layer[n]), gtk_label_new(tmp), TRUE, TRUE, 0); } - return grp_row; + return ls->grp_row; }