setup: Add window action to open music pack dir.
This replaces the widget that controls the music pack path with a window action button that just opens the configured music pack path. The path is now automatically created and populated with an explanatory README file that should explain the purpose to users. Another major step in implementing #1051.
This commit is contained in:
parent
ceb3e49189
commit
9e14ceab62
1 changed files with 22 additions and 7 deletions
|
|
@ -113,9 +113,25 @@ static txt_dropdown_list_t *OPLTypeSelector(void)
|
|||
return result;
|
||||
}
|
||||
|
||||
static void OpenMusicPackDir(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused))
|
||||
{
|
||||
char *cmd;
|
||||
|
||||
#if defined(__MACOSX__)
|
||||
cmd = M_StringJoin("open \"", music_pack_path, "\"", NULL);
|
||||
#elif defined(_WIN32)
|
||||
cmd = M_StringJoin("start \"", music_pack_path, "\"", NULL);
|
||||
#else
|
||||
cmd = M_StringJoin("xdg-open \"", music_pack_path, "\"", NULL);
|
||||
#endif
|
||||
system(cmd);
|
||||
free(cmd);
|
||||
}
|
||||
|
||||
void ConfigSound(TXT_UNCAST_ARG(widget), void *user_data)
|
||||
{
|
||||
txt_window_t *window;
|
||||
txt_window_action_t *music_action;
|
||||
|
||||
// Build the window
|
||||
|
||||
|
|
@ -126,6 +142,12 @@ void ConfigSound(TXT_UNCAST_ARG(widget), void *user_data)
|
|||
TXT_SetWindowPosition(window, TXT_HORIZ_CENTER, TXT_VERT_TOP,
|
||||
TXT_SCREEN_W / 2, 3);
|
||||
|
||||
music_action = TXT_NewWindowAction('m', "Music Packs");
|
||||
TXT_SetWindowAction(window, TXT_HORIZ_CENTER,
|
||||
TXT_NewConditional(&snd_musicdevice, SNDDEVICE_GENMIDI,
|
||||
music_action));
|
||||
TXT_SignalConnect(music_action, "pressed", OpenMusicPackDir, NULL);
|
||||
|
||||
TXT_AddWidgets(window,
|
||||
TXT_NewSeparator("Sound effects"),
|
||||
TXT_NewRadioButton("Disabled", &snd_sfxdevice, SNDDEVICE_NONE),
|
||||
|
|
@ -181,13 +203,6 @@ void ConfigSound(TXT_UNCAST_ARG(widget), void *user_data)
|
|||
TXT_NewFileSelector(&timidity_cfg_path, 34,
|
||||
"Select Timidity config file",
|
||||
cfg_extension),
|
||||
TXT_NewStrut(4, 0),
|
||||
TXT_NewLabel("Digital music pack directory: "),
|
||||
TXT_NewStrut(4, 0),
|
||||
TXT_NewFileSelector(&music_pack_path, 34,
|
||||
"Select directory containing music pack "
|
||||
"config files",
|
||||
TXT_DIRECTORY),
|
||||
NULL)),
|
||||
NULL);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue