From b66db4038b9188c14aafd212d7a4b649e1ca04b1 Mon Sep 17 00:00:00 2001 From: Michal Skorupinski Date: Tue, 21 Mar 2017 17:22:31 +0100 Subject: [PATCH] [UI] Displaying the needed buttons in the 'System' layout. Change-Id: Ib2c000617b20644640e521ed8acf92f8efb61f6e Signed-off-by: Michal Skorupinski --- include/define.h | 1 + src/layout/layout_system.c | 101 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 100 insertions(+), 2 deletions(-) diff --git a/include/define.h b/include/define.h index 554ca82..821591c 100644 --- a/include/define.h +++ b/include/define.h @@ -29,6 +29,7 @@ /* View ID - System */ #define VIEW_CLOCK "VIEW_CLOCK" #define VIEW_LANGUAGE "VIEW_LANGUAGE" +#define VIEW_VOICE_CONTROL "VOICE_CONTROL" #define VIEW_RESET "VIEW_RESET" #define VIEW_NEW_NETWORK "VIEW_NEW_NETWORK" diff --git a/src/layout/layout_system.c b/src/layout/layout_system.c index a13e721..c7466a6 100755 --- a/src/layout/layout_system.c +++ b/src/layout/layout_system.c @@ -46,12 +46,15 @@ struct _priv { enum { MENU_CLOCK = 0, MENU_LANGUAGE, + MENU_VOICE_CONTROL, MENU_RESET }; static char *_get_clock_mode(void *data, int id); static char *_get_language(void *data, int id); +//static char *_get_location(void *data, int id); +static char *_get_voice_control_status(void *data, int id); static void _selected(void *data, int id); static void _focused(void *data, int id); @@ -84,8 +87,47 @@ static struct menumgr_info menu_info[] = { .progress_value = NULL, .progress_evas = NULL, .update_cb = settings_language_set_state_update_callbacks + } + /*, + { + .id = MENU_SUBTITLE, + .title = STR_SUBTITLE, + .style = STYLE_STATUS_BTN, + .disabled = EINA_FALSE, + .status = _get_subtitle, + .selected = _selected, + .focused = _focused, + .selected_menu = _selected_menu, + .progress_value = NULL, + .progress_evas = NULL, + .update_cb = settings_language_set_subtitle_state_update_callbacks + }*/, + /*{ + .id = MENU_LOCATION, + .title = STR_LOCATION, + .style = STYLE_STATUS_BTN, + .disabled = EINA_FALSE, + .status = _get_location, + .selected = _selected, + .focused = _focused, + .selected_menu = _selected_menu, + .progress_value = NULL, + .progress_evas = NULL, + .update_cb = set_callback_for_system_location_change + },*/ + { + .id = MENU_VOICE_CONTROL, + .title = "Voice control", + .style = STYLE_STATUS_BTN, + .disabled = EINA_FALSE, + .status = _get_voice_control_status, + .selected = NULL, + .focused = _focused, + .selected_menu = _selected_menu, + .progress_value = NULL, + .progress_evas = NULL, + .update_cb = NULL, }, - /*, { .id = MENU_RESET, .title = STR_RESET, @@ -97,7 +139,7 @@ static struct menumgr_info menu_info[] = { .progress_value = NULL, .progress_evas = NULL, .update_cb = NULL - },*/ + }, }; static char *_get_clock_mode(void *data, int id) @@ -110,6 +152,61 @@ static char *_get_language(void *data, int id) return settings_language_get_language_display_str(); } +static char *_get_voice_control_status(void *data, int id) +{ + return strdup("OFF"); +} + +/* +static char *_get_location(void *data, int id) +{ + char *country = NULL; + char *lang = NULL; + char name[64] = {'\0'}; + i18n_uchar res[64] = {0,}; + int r = SYSTEM_SETTINGS_ERROR_NONE; + + r = system_settings_get_value_string( + SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &lang); + if (r != SYSTEM_SETTINGS_ERROR_NONE) { + _ERR("failed to get language"); + return strdup(STR_UNKNOWN); + } + + r = system_settings_get_value_string( + SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY, &country); + if (r != SYSTEM_SETTINGS_ERROR_NONE) { + _ERR("failed to get country"); + free(lang); + return strdup(STR_UNKNOWN); + } + + r = i18n_ulocale_get_display_country(country, lang, res, sizeof(res)); + if (r < 0) { + _ERR("failed to get display country: %s", get_last_result()); + free(lang); + free(country); + return strdup(STR_UNKNOWN); + } + + i18n_ustring_copy_au(name, res); + + free(lang); + free(country); + + return strdup(name); +} +*/ + +void set_callback_for_system_location_change(void *data) +{ + if (data) { + //@TODO: set needed callbacks + } else { + //@TODO: unset previously set callbacks + } +} + static void _selected(void *data, int id) { switch (id) { -- 2.7.4