diff options
| author | Marco Trevisan (TreviƱo) <mail@3v1n0.net> | 2017-07-21 08:51:59 +0000 | 
|---|---|---|
| committer | Bileto Bot <ci-train-bot@canonical.com> | 2017-07-21 08:51:59 +0000 | 
| commit | c42da4c62dbeb9210911fd1d318ff11a5a544685 (patch) | |
| tree | 637a7d0c7b5e3a93732e409a0ca12099d0cd7549 | |
| parent | c7f4437d4f98c58d6f7a6c1e5ada9752464edb34 (diff) | |
| parent | d83c9eac9f9a0f1b8bc2d70789873436ab8b8f2f (diff) | |
UnitySettings: use glib::Signal blocking for ignoring setting changes
Approved by: Andrea Azzarone (bzr r4249)
| -rw-r--r-- | unity-shared/UnitySettings.cpp | 16 | 
1 files changed, 5 insertions, 11 deletions
| diff --git a/unity-shared/UnitySettings.cpp b/unity-shared/UnitySettings.cpp index 32a944df4..5d89a5b90 100644 --- a/unity-shared/UnitySettings.cpp +++ b/unity-shared/UnitySettings.cpp @@ -108,7 +108,6 @@ public:  , cached_form_factor_(FormFactor::DESKTOP)  , cursor_scale_(1.0)  , cached_double_click_activate_(true) - , changing_gnome_settings_(false)  , remote_content_enabled_(true)  {  parent_->form_factor.SetGetterFunction(sigc::mem_fun(this, &Impl::GetFormFactor)); @@ -170,11 +169,8 @@ public:  });  signals_.Add<void, GSettings*, const gchar*>(gnome_ui_settings_, "changed::" + GNOME_TEXT_SCALE_FACTOR, [this] (GSettings*, const gchar* t) { - if (!changing_gnome_settings_) - { - double new_scale_factor = g_settings_get_double(gnome_ui_settings_, GNOME_TEXT_SCALE_FACTOR.c_str()); - g_settings_set_double(ui_settings_, TEXT_SCALE_FACTOR.c_str(), new_scale_factor); - } + double new_scale_factor = g_settings_get_double(gnome_ui_settings_, GNOME_TEXT_SCALE_FACTOR.c_str()); + g_settings_set_double(ui_settings_, TEXT_SCALE_FACTOR.c_str(), new_scale_factor);  });  signals_.Add<void, GSettings*, const gchar*>(lim_settings_, "changed", [this] (GSettings*, const gchar*) { @@ -418,7 +414,7 @@ public:  if (value > 0)  ui_scale = static_cast<double>(value)/DPI_SCALING_STEP;  } - else  + else  {  value = FindOptimalScale(uscreen, monitor);  ui_scale = static_cast<double>(value)/DPI_SCALING_STEP; @@ -455,8 +451,7 @@ public:  void UpdateAppsScaling(double scale)  { - changing_gnome_settings_ = true; - changing_gnome_settings_timeout_.reset(); + signals_.Block(gnome_ui_settings_);  unsigned integer_scaling = std::max<unsigned>(1, std::lround(scale));  double point_scaling = scale / static_cast<double>(integer_scaling);  double text_scale_factor = parent_->font_scaling() * point_scaling; @@ -467,7 +462,7 @@ public:  g_settings_set_double(gnome_ui_settings_, GNOME_TEXT_SCALE_FACTOR.c_str(), text_scale_factor);  changing_gnome_settings_timeout_.reset(new glib::TimeoutSeconds(GNOME_SETTINGS_CHANGED_WAIT_SECONDS, [this] { - changing_gnome_settings_ = false; + signals_.Unblock(gnome_ui_settings_);  return false;  }, glib::Source::Priority::LOW));  } @@ -506,7 +501,6 @@ public:  FormFactor cached_form_factor_;  double cursor_scale_;  bool cached_double_click_activate_; - bool changing_gnome_settings_;  bool remote_content_enabled_;  }; | 
