void RegisterGlobalPreferences( PreferenceSystem& preferences ){
preferences.registerPreference( "gamefile", make_property_string( g_GamesDialog.m_sGameFile ) );
preferences.registerPreference( "gamePrompt", make_property_string( g_GamesDialog.m_bGamePrompt ) );
+ preferences.registerPreference( "skipGamePromptOnce", make_property_string( g_GamesDialog.m_bSkipGamePromptOnce ) );
preferences.registerPreference( "log console", make_property_string<LogConsole>() );
}
if ( ( *iGame )->mGameFile != m_sGameFile ) {
m_sGameFile = ( *iGame )->mGameFile;
- PreferencesDialog_restartRequired( "Selected Game" );
+
+ // do not trigger radiant restart when switching game on startup using Global Preferences dialog
+ if ( !onStartup ) {
+ PreferencesDialog_restartRequired( "Selected Game" );
+ }
}
+
+ // onStartup can only be true once, when Global Preferences are displayed at startup
+ onStartup = false;
}
void CGameDialog::GameFileExport( const Callback<void(int)> & importCallback ) const {
}
void CGameDialog::Init(){
+ bool gamePrompt = false;
+
InitGlobalPrefPath();
LoadPrefs();
ScanForGames();
+
if ( mGames.empty() ) {
Error( "Didn't find any valid game file descriptions, aborting\n" );
}
CGameDescription* currentGameDescription = 0;
- if ( !m_bGamePrompt ) {
+ // m_bSkipGamePromptOnce is used to not prompt for game on restart, only on fresh startup
+ if ( m_bGamePrompt && !m_bSkipGamePromptOnce ) {
+ gamePrompt = true;
+ }
+
+ m_bSkipGamePromptOnce = false;
+ g_GamesDialog.SavePrefs();
+
+ if ( !gamePrompt ) {
// search by .game name
std::list<CGameDescription *>::iterator iGame;
for ( iGame = mGames.begin(); iGame != mGames.end(); ++iGame )
}
}
}
- if ( m_bGamePrompt || !currentGameDescription ) {
+
+ if ( gamePrompt || !currentGameDescription ) {
+ onStartup = true;
Create();
DoGameDialog();
// use m_nComboSelect to identify the game to run as and set the globals
currentGameDescription = GameDescriptionForComboItem();
ASSERT_NOTNULL( currentGameDescription );
}
+ else {
+ onStartup = false;
+ }
+
g_pGameDescription = currentGameDescription;
g_pGameDescription->Dump();
PreferencesDialog_addInterfacePreferences( makeCallbackF(Interface_constructPreferences) );
Mouse_registerPreferencesPage();
+ ui::Window main_window = MainFrame_getWindow();
+
ui::Window dialog = ui::Window(create_floating_window( RADIANT_NAME " Preferences", m_parent ));
+ gtk_window_set_transient_for( dialog, m_parent );
+ gtk_window_set_position( dialog, GTK_WIN_POS_CENTER_ON_PARENT );
+
{
auto mainvbox = ui::VBox( FALSE, 5 );
dialog.add(mainvbox);
return;
}
+ // save global preferences
g_GamesDialog.SavePrefs();
globalOutputStream() << "saving local preferences to " << g_Preferences.m_inipath->str << "\n";
if ( ConfirmModified( "Edit Preferences" ) && g_Preferences.DoModal() == eIDOK ) {
if ( !g_restart_required.empty() ) {
StringOutputStream message( 256 );
- message << "Preference changes require a restart:\n";
+ message << "Preference changes require a restart:\n\n";
for ( std::vector<const char*>::iterator i = g_restart_required.begin(); i != g_restart_required.end(); ++i )
{
g_restart_required.clear();
if ( ret == ui::alert_response::YES ) {
+ g_GamesDialog.m_bSkipGamePromptOnce = true;
Radiant_Restart();
}
}