From 3b400975bf5b76c27979b44dd40f9e1d81898b8c Mon Sep 17 00:00:00 2001 From: NightlyFox Date: Fri, 28 Sep 2018 18:10:39 -0500 Subject: [PATCH] made some final changes, cleaned up code --- common/language.c | 9 +++++++++ common/language.h | 1 + common/theme.c | 18 +++++++----------- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/common/language.c b/common/language.c index ae4e0f8..93c07fb 100644 --- a/common/language.c +++ b/common/language.c @@ -327,6 +327,15 @@ const char* const g_strings[StrId_Max][16] = STR_KO("테마 메뉴"), STR_TW("主题菜单"), }, + + [StrId_ThemeNotApplied] = + { + STR_EN("Theme cannot be applied because an error occurred"), + STR_ES("El temático no se puede aplicar porque se ha producido un error"), + STR_JP("エラーが発生したため、テーマを適用できませんでした"), + STR_KO("오류가 발생 했기 때문에 테마를 적용할 수 없습니다."), + STR_TW("由于发生错误, 无法应用主题"), + }, /*[StrId_Reboot] = { diff --git a/common/language.h b/common/language.h index 68ff13d..73d354e 100644 --- a/common/language.h +++ b/common/language.h @@ -44,6 +44,7 @@ typedef enum StrId_NetLoaderTransferring, StrId_ThemeMenu, + StrId_ThemeNotApplied, StrId_Max, } StrId; diff --git a/common/theme.c b/common/theme.c index f34282a..5772153 100644 --- a/common/theme.c +++ b/common/theme.c @@ -31,8 +31,6 @@ void themeStartup(ThemePreset preset) { .enableWaveBlending = 0, .buttonAText = "\uE0E0", .buttonBText = "\uE0E1", - //.buttonAImage = button_a_light_bin, - //.buttonBImage = button_b_light_bin, .hbmenuLogoImage = hbmenu_logo_light_bin }; @@ -49,8 +47,6 @@ void themeStartup(ThemePreset preset) { .enableWaveBlending = 0, .buttonAText = "\uE0A0", .buttonBText = "\uE0A1", - //.buttonAImage = button_a_dark_bin, - //.buttonBImage = button_b_dark_bin, .hbmenuLogoImage = hbmenu_logo_dark_bin }; @@ -60,7 +56,7 @@ void themeStartup(ThemePreset preset) { theme_t *themeDefault; config_t cfg = {0}; config_init(&cfg); - config_setting_t *theme; + config_setting_t *theme = NULL; color_t text, frontWave, middleWave, backWave, background, highlight, separator, borderColor, borderTextColor; int waveBlending; const char *AText, *BText; @@ -121,9 +117,7 @@ void themeStartup(ThemePreset preset) { .borderColor = borderColor, .borderTextColor = borderTextColor, .enableWaveBlending = waveBlending, - //.buttonAImage = button_a_dark_bin, - //.buttonBImage = button_b_dark_bin, - .hbmenuLogoImage = hbmenu_logo_dark_bin + .hbmenuLogoImage = themeDefault->hbmenuLogoImage }; strncpy(themeCurrent.buttonAText, AText, sizeof(themeCurrent.buttonAText)-1); strncpy(themeCurrent.buttonBText, BText, sizeof(themeCurrent.buttonBText)-1); @@ -139,7 +133,7 @@ void themeStartup(ThemePreset preset) { void GetThemePathFromConfig(char* themePath, size_t size) { const char* tmpThemePath = ""; config_t cfg = {0}; - config_setting_t *settings; + config_setting_t *settings = NULL; char tmp_path[PATH_MAX] = {0}; #ifdef __SWITCH__ @@ -165,7 +159,9 @@ void SetThemePathToConfig(const char* themePath) { config_init(&cfg); char settingPath[PATH_MAX] = {0}; - config_setting_t *root,*group, *settings; + config_setting_t *root = NULL, + *group = NULL, + *settings = NULL; #ifdef __SWITCH__ settingPath[0] = '/'; @@ -191,7 +187,7 @@ void SetThemePathToConfig(const char* themePath) { } if(!config_write_file(&cfg, settingPath)) { - menuCreateMsgBox(780, 300, "Something went wrong, and the theme could not be applied!"); + menuCreateMsgBox(780, 300, textGetString(StrId_ThemeNotApplied)); } config_destroy(&cfg);