summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/gtk.c20
-rw-r--r--ui/librccui.c9
2 files changed, 21 insertions, 8 deletions
diff --git a/ui/gtk.c b/ui/gtk.c
index 22854ab..2ae0622 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -32,8 +32,9 @@ rcc_ui_id rccUiMenuGet(rcc_ui_menu_context ctx) {
GtkWidget *menu;
if (!ctx) return (rcc_ui_id)-1;
+ printf("Widget: %p\n", ctx->widget);
- if (ctx->type == RCC_UI_MENU_OPTION)
+ if ((ctx->type == RCC_UI_MENU_OPTION)&&(rccUiMenuGetRangeType(ctx)==RCC_OPTION_RANGE_TYPE_BOOLEAN))
return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ctx->widget));
menu = gtk_option_menu_get_menu(ctx->widget);
@@ -45,7 +46,16 @@ int rccUiMenuSet(rcc_ui_menu_context ctx, rcc_ui_id id) {
switch (ctx->type) {
case RCC_UI_MENU_OPTION:
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ctx->widget),id);
+ switch (rccUiMenuGetRangeType(ctx)) {
+ case RCC_OPTION_RANGE_TYPE_BOOLEAN:
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ctx->widget),id);
+ break;
+ case RCC_OPTION_RANGE_TYPE_MENU:
+ gtk_option_menu_set_history(ctx->widget, id);
+ break;
+ default:
+ return -1;
+ }
break;
default:
gtk_option_menu_set_history(ctx->widget, id);
@@ -170,8 +180,7 @@ int rccUiMenuConfigureWidget(rcc_ui_menu_context ctx) {
item = gtk_check_button_new_with_label(rccUiGetOptionName(uictx, rccUiMenuGetOption(ctx)));
ctx->widget = item;
}
-
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(item), rccGetOption(rccctx, rccUiMenuGetOption(ctx)));
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ctx->widget), rccGetOption(rccctx, rccUiMenuGetOption(ctx)));
break;
case RCC_OPTION_RANGE_TYPE_MENU:
if (!ctx->widget) {
@@ -193,8 +202,7 @@ int rccUiMenuConfigureWidget(rcc_ui_menu_context ctx) {
gtk_option_menu_remove_menu(GTK_OPTION_MENU(menu));
gtk_option_menu_set_menu(GTK_OPTION_MENU(menu), list);
}
-
- gtk_option_menu_set_history(GTK_OPTION_MENU(menu), rccGetOption(rccctx, rccUiMenuGetOption(ctx)));
+ gtk_option_menu_set_history(GTK_OPTION_MENU(ctx->widget), rccGetOption(rccctx, rccUiMenuGetOption(ctx)));
break;
default:
return -1;
diff --git a/ui/librccui.c b/ui/librccui.c
index 9f4dc49..2c7c632 100644
--- a/ui/librccui.c
+++ b/ui/librccui.c
@@ -438,8 +438,11 @@ int rccUiRestore(rcc_ui_context ctx) {
language_id = rccGetSelectedLanguage(rccctx);
rccUiMenuSet(ctx->language, (rcc_ui_id)language_id);
- for (i=0;i<RCC_MAX_OPTIONS;i++)
+ for (i=0;i<RCC_MAX_OPTIONS;i++) {
+ if (rccUiMenuGetType(ctx->options[i]) == RCC_OPTION_TYPE_INVISIBLE) continue;
+
rccUiMenuSet(ctx->options[i], rccGetOption(rccctx, (rcc_option)i));
+ }
return 0;
}
@@ -455,8 +458,10 @@ int rccUiUpdate(rcc_ui_context ctx) {
rccSetLanguage(rccctx, (rcc_language_id)rccUiMenuGet(ctx->language));
- for (i=0;i<RCC_MAX_OPTIONS;i++)
+ for (i=0;i<RCC_MAX_OPTIONS;i++) {
+ if (rccUiMenuGetType(ctx->options[i]) == RCC_OPTION_TYPE_INVISIBLE) continue;
rccSetOption(rccctx, (rcc_option)i, (rcc_option_value)rccUiMenuGet(ctx->options[i]));
+ }
rccSetEngine(rccctx, (rcc_language_id)rccUiMenuGet(ctx->engine));