diff options
author | Thomas White <taw@physics.org> | 2010-04-23 18:50:00 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2010-04-23 18:50:00 +0200 |
commit | 6ef14ec73ab891100e309309d47264dee7d77784 (patch) | |
tree | c1102377ebc5e57f6926ad671774ee8a989c9284 /src | |
parent | 4387e0e827c288657fd8383d86f5da0b2950d619 (diff) |
hdfsee: Fix HDF image radio groups
Previously, the radio groups for the images found in the HDF group structure were
assigned incorrectly, meaning that more than one radio item could be shown active
at a time.
Diffstat (limited to 'src')
-rw-r--r-- | src/displaywindow.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/src/displaywindow.c b/src/displaywindow.c index 0580b0f6..82acb58d 100644 --- a/src/displaywindow.c +++ b/src/displaywindow.c @@ -778,7 +778,7 @@ static gint displaywindow_newhdf(GtkMenuItem *item, struct newhdf *nh) static GtkWidget *displaywindow_addhdfgroup(struct hdfile *hdfile, const char *group, - DisplayWindow *dw, GSList *rg) + DisplayWindow *dw, GSList **rgp) { char **names; int *is_group; @@ -805,18 +805,26 @@ static GtkWidget *displaywindow_addhdfgroup(struct hdfile *hdfile, item = gtk_menu_item_new_with_label(names[i]); sub = displaywindow_addhdfgroup(hdfile, names[i], - dw, rg); + dw, rgp); gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), sub); } else if ( is_image[i] ) { struct newhdf *nh; - item = gtk_radio_menu_item_new_with_label(rg, names[i]); - if ( rg == NULL ) { - rg = gtk_radio_menu_item_get_group( + item = gtk_radio_menu_item_new_with_label(*rgp, + names[i]); + + if ( *rgp == NULL ) { + gtk_check_menu_item_set_active( + GTK_CHECK_MENU_ITEM(item), TRUE); + } else { + gtk_check_menu_item_set_active( + GTK_CHECK_MENU_ITEM(item), FALSE); + } + + *rgp = gtk_radio_menu_item_get_group( GTK_RADIO_MENU_ITEM(item)); - } nh = malloc(sizeof(struct newhdf)); if ( nh != NULL ) { @@ -864,12 +872,21 @@ static GtkWidget *displaywindow_addhdfgroup(struct hdfile *hdfile, } +static GtkWidget *displaywindow_createhdfmenus(struct hdfile *hdfile, + DisplayWindow *dw) +{ + GSList *rg = NULL; + + return displaywindow_addhdfgroup(hdfile, "/", dw, &rg); +} + + static void displaywindow_update_menus(DisplayWindow *dw) { GtkWidget *ms; GtkWidget *w; - ms = displaywindow_addhdfgroup(dw->hdfile, "/", dw, NULL); + ms = displaywindow_createhdfmenus(dw->hdfile, dw); if ( ms == NULL ) { |