aboutsummaryrefslogtreecommitdiff
path: root/src/displaywindow.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2009-12-20 17:41:26 +0100
committerThomas White <taw@bitwiz.org.uk>2009-12-20 17:41:26 +0100
commit24ce4a9e2becccb6f7e9a15ae29ba57042ce4e2e (patch)
tree14984848d3fcc6c307b72fb9a53e2c9cebdca16c /src/displaywindow.c
parentb5c5877c21fe9df36192e3a95840e3f969d3c945 (diff)
Use radio menu items for images
Diffstat (limited to 'src/displaywindow.c')
-rw-r--r--src/displaywindow.c56
1 files changed, 31 insertions, 25 deletions
diff --git a/src/displaywindow.c b/src/displaywindow.c
index 9f0db0f5..8c1d0b01 100644
--- a/src/displaywindow.c
+++ b/src/displaywindow.c
@@ -652,6 +652,7 @@ static GtkWidget *displaywindow_addhdfgroup(struct hdfile *hdfile,
int *is_group;
int *is_image;
GtkWidget *ms;
+ GSList *rg = NULL;
int n, i;
names = hdfile_read_group(hdfile, &n, group, &is_group, &is_image);
@@ -664,38 +665,43 @@ static GtkWidget *displaywindow_addhdfgroup(struct hdfile *hdfile,
GtkWidget *item;
GtkWidget *sub;
- if ( names[i] != NULL ) {
+ if ( names[i] == NULL ) return NULL;
+
+ if ( is_group[i] ) {
item = gtk_menu_item_new_with_label(names[i]);
- gtk_menu_shell_append(GTK_MENU_SHELL(ms), item);
- gtk_widget_show(item);
-
- if ( is_group[i] ) {
- sub = displaywindow_addhdfgroup(hdfile,
- names[i], dw);
- gtk_menu_item_set_submenu(GTK_MENU_ITEM(item),
- sub);
- } else if ( is_image[i] ) {
-
- struct newhdf *nh;
-
- nh = malloc(sizeof(struct newhdf));
- if ( nh != NULL ) {
- strncpy(nh->name, names[i], 1023);
- nh->dw = dw;
- g_signal_connect(G_OBJECT(item),
- "activate",
- G_CALLBACK(displaywindow_newhdf),
- nh);
- }
- }
- free(names[i]);
+ sub = displaywindow_addhdfgroup(hdfile, names[i], dw);
+ 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]);
+ rg = gtk_radio_menu_item_get_group(
+ GTK_RADIO_MENU_ITEM(item));
+
+ nh = malloc(sizeof(struct newhdf));
+ if ( nh != NULL ) {
+ strncpy(nh->name, names[i], 1023);
+ nh->dw = dw;
+ g_signal_connect(G_OBJECT(item), "activate",
+ G_CALLBACK(displaywindow_newhdf), nh);
+ }
} else {
- return NULL;
+
+ item = gtk_menu_item_new_with_label(names[i]);
+
}
+ gtk_menu_shell_append(GTK_MENU_SHELL(ms), item);
+ gtk_widget_show(item);
+
+ free(names[i]);
+
+
}
free(is_group);