From 2f9d5077dcd82ad0ea09f342ebc1baf8dc68a68c Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 7 May 2016 17:17:41 +0200 Subject: GUI part of LocaleGuard optimization. --- gtk2_ardour/ardour_ui_ed.cc | 1 + gtk2_ardour/ui_config.cc | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index 607b8e7327..5278c247f2 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -677,6 +677,7 @@ ARDOUR_UI::save_ardour_state () a different lifetime model from add_instant_xml(). */ + LocaleGuard lg; // one guard to rule them all XMLNode* node = new XMLNode (keyboard->get_state()); Config->add_extra_xml (*node); Config->add_extra_xml (get_transport_controllable_state()); diff --git a/gtk2_ardour/ui_config.cc b/gtk2_ardour/ui_config.cc index 50d3fba120..d456a95794 100644 --- a/gtk2_ardour/ui_config.cc +++ b/gtk2_ardour/ui_config.cc @@ -33,6 +33,7 @@ #include // for fontmap resolution control for GnomeCanvas #include "pbd/gstdio_compat.h" +#include "pbd/unwind.h" #include #include @@ -248,7 +249,6 @@ UIConfiguration::load_defaults () if (ret == 0) { /* reload color theme */ load_color_theme (false); - ColorsChanged (); /* EMIT SIGNAL */ } return ret; @@ -260,6 +260,10 @@ UIConfiguration::load_color_theme (bool allow_own) std::string cfile; string basename; bool found = false; + /* ColorsChanged() will trigger a parameter_changed () which + * in turn calls save_state() + */ + PBD::Unwinder uw (block_save, block_save + 1); if (allow_own) { basename = "my-"; @@ -357,6 +361,7 @@ UIConfiguration::store_color_theme () int UIConfiguration::load_state () { + LocaleGuard lg; // a single guard for all 3 configs bool found = false; std::string rcfile; @@ -407,6 +412,9 @@ UIConfiguration::load_state () int UIConfiguration::save_state() { + if (block_save != 0) { + return -1; + } if (_dirty) { std::string rcfile = Glib::build_filename (user_config_directory(), ui_config_file_name); @@ -480,6 +488,7 @@ UIConfiguration::get_variables (std::string which_node) int UIConfiguration::set_state (const XMLNode& root, int /*version*/) { + LocaleGuard lg; /* this can load a generic UI configuration file or a colors file */ if (root.name() != "Ardour") { -- cgit v1.2.3