From 23f2dc3bfb94930b938281c7f1e5663b761fa508 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 9 Oct 2018 20:20:59 +0100 Subject: [PATCH] Quell config-save warning when we're only trying to save history. --- src/lib/config.cc | 2 +- src/lib/config.h | 1 + src/tools/dcpomatic_player.cc | 20 +++++++++++--------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/lib/config.cc b/src/lib/config.cc index 1d83f0a25..eb13112d2 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -1083,7 +1083,7 @@ Config::add_to_history_internal (vector& h, boost::file h.pop_back (); } - changed (); + changed (HISTORY); } bool diff --git a/src/lib/config.h b/src/lib/config.h index a470bf391..94690a727 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -78,6 +78,7 @@ public: SOUND_OUTPUT, INTERFACE_COMPLEXITY, PLAYER_DCP_DIRECTORY, + HISTORY, #ifdef DCPOMATIC_VARIANT_SWAROOP PLAYER_BACKGROUND_IMAGE, #endif diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc index cc6e294ff..c20c3cbd8 100644 --- a/src/tools/dcpomatic_player.cc +++ b/src/tools/dcpomatic_player.cc @@ -137,7 +137,7 @@ public: SetIcon (wxIcon (std_to_wx ("id"))); #endif - _config_changed_connection = Config::instance()->Changed.connect (boost::bind (&DOMFrame::config_changed, this)); + _config_changed_connection = Config::instance()->Changed.connect (boost::bind (&DOMFrame::config_changed, this, _1)); update_from_config (); Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_open, this), ID_file_open); @@ -835,19 +835,21 @@ private: _update_news_requested = false; } - void config_changed () + void config_changed (Config::Property prop) { /* Instantly save any config changes when using the player GUI */ try { Config::instance()->write_config(); } catch (FileError& e) { - error_dialog ( - this, - wxString::Format( - _("Could not write to config file at %s. Your changes have not been saved."), - std_to_wx(e.file().string()) - ) - ); + if (prop != Config::HISTORY) { + error_dialog ( + this, + wxString::Format( + _("Could not write to config file at %s. Your changes have not been saved."), + std_to_wx(e.file().string()) + ) + ); + } } catch (exception& e) { error_dialog ( this, -- 2.30.2