Hide User Interface options if no companion interface is not

available
This commit is contained in:
twinaphex 2016-08-10 07:18:55 +02:00
parent c07d316b45
commit 032f7f83ae
3 changed files with 59 additions and 45 deletions

View File

@ -59,6 +59,7 @@
#include "../input/input_config.h" #include "../input/input_config.h"
#include "../input/input_autodetect.h" #include "../input/input_autodetect.h"
#include "../config.def.h" #include "../config.def.h"
#include "../ui/ui_companion_driver.h"
#include "../performance_counters.h" #include "../performance_counters.h"
#include "../lakka.h" #include "../lakka.h"
#include "../retroarch.h" #include "../retroarch.h"
@ -7263,53 +7264,56 @@ static bool setting_append_list(
menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_VIDEO_DISABLE_COMPOSITION); menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_VIDEO_DISABLE_COMPOSITION);
#endif #endif
CONFIG_BOOL( if (!string_is_equal(ui_companion_driver_get_ident(), "null"))
list, list_info, {
&settings->ui.companion_enable, CONFIG_BOOL(
msg_hash_to_str(MENU_ENUM_LABEL_UI_COMPANION_ENABLE), list, list_info,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_UI_COMPANION_ENABLE), &settings->ui.companion_enable,
ui_companion_enable, msg_hash_to_str(MENU_ENUM_LABEL_UI_COMPANION_ENABLE),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_UI_COMPANION_ENABLE),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON), ui_companion_enable,
&group_info, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF),
&subgroup_info, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON),
parent_group, &group_info,
general_write_handler, &subgroup_info,
general_read_handler, parent_group,
SD_FLAG_ADVANCED); general_write_handler,
menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_UI_COMPANION_ENABLE); general_read_handler,
SD_FLAG_ADVANCED);
menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_UI_COMPANION_ENABLE);
CONFIG_BOOL( CONFIG_BOOL(
list, list_info, list, list_info,
&settings->ui.companion_start_on_boot, &settings->ui.companion_start_on_boot,
msg_hash_to_str(MENU_ENUM_LABEL_UI_COMPANION_START_ON_BOOT), msg_hash_to_str(MENU_ENUM_LABEL_UI_COMPANION_START_ON_BOOT),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_UI_COMPANION_START_ON_BOOT), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_UI_COMPANION_START_ON_BOOT),
ui_companion_start_on_boot, ui_companion_start_on_boot,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON),
&group_info, &group_info,
&subgroup_info, &subgroup_info,
parent_group, parent_group,
general_write_handler, general_write_handler,
general_read_handler, general_read_handler,
SD_FLAG_ADVANCED); SD_FLAG_ADVANCED);
menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_UI_COMPANION_START_ON_BOOT); menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_UI_COMPANION_START_ON_BOOT);
CONFIG_BOOL( CONFIG_BOOL(
list, list_info, list, list_info,
&settings->ui.menubar_enable, &settings->ui.menubar_enable,
msg_hash_to_str(MENU_ENUM_LABEL_UI_MENUBAR_ENABLE), msg_hash_to_str(MENU_ENUM_LABEL_UI_MENUBAR_ENABLE),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_UI_MENUBAR_ENABLE), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_UI_MENUBAR_ENABLE),
true, true,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON),
&group_info, &group_info,
&subgroup_info, &subgroup_info,
parent_group, parent_group,
general_write_handler, general_write_handler,
general_read_handler, general_read_handler,
SD_FLAG_NONE); SD_FLAG_NONE);
menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_UI_MENUBAR_ENABLE); menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_UI_MENUBAR_ENABLE);
}
END_SUB_GROUP(list, list_info, parent_group); END_SUB_GROUP(list, list_info, parent_group);

View File

@ -209,3 +209,11 @@ void *ui_companion_driver_get_main_window(void)
return NULL; return NULL;
return ui->get_main_window(ui_companion_data); return ui->get_main_window(ui_companion_data);
} }
const char *ui_companion_driver_get_ident(void)
{
const ui_companion_driver_t *ui = ui_companion_get_ptr();
if (!ui || !ui->ident)
return "null";
return ui->ident;
}

View File

@ -218,6 +218,8 @@ const ui_application_t *ui_companion_driver_get_application_ptr(void);
void *ui_companion_driver_get_main_window(void); void *ui_companion_driver_get_main_window(void);
const char *ui_companion_driver_get_ident(void);
RETRO_END_DECLS RETRO_END_DECLS
#endif #endif