summaryrefslogtreecommitdiff
path: root/unity-shared
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2014-03-21 02:01:37 +0100
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2014-03-21 02:01:37 +0100
commit15d3ee864ccbdbe4fdee69ec2a498494b710a633 (patch)
treef73a6f67bb4a3426c147d332af3a094857d7f2d8 /unity-shared
parentce695371bc2f51c8db87f5ed25da4ae34a5827e5 (diff)
UnitySettings: don't depend on decoration::Style for text size anymore, get it from settings and monitor it
Before we were not monitoring changes to text size, and this was leading to not-updated EMConverter's (bzr r3725.7.16)
Diffstat (limited to 'unity-shared')
-rw-r--r--unity-shared/UnitySettings.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/unity-shared/UnitySettings.cpp b/unity-shared/UnitySettings.cpp
index fd96777c8..22a478f97 100644
--- a/unity-shared/UnitySettings.cpp
+++ b/unity-shared/UnitySettings.cpp
@@ -52,6 +52,7 @@ const std::string UBUNTU_UI_SETTINGS = "com.ubuntu.user-interface";
const std::string SCALE_FACTOR = "scale-factor";
const std::string GNOME_UI_SETTINGS = "org.gnome.desktop.interface";
+const std::string GNOME_FONT_NAME = "font-name";
const std::string GNOME_CURSOR_SIZE = "cursor-size";
const std::string GNOME_SCALE_FACTOR = "scaling-factor";
const std::string GNOME_TEXT_SCALE_FACTOR = "text-scaling-factor";
@@ -84,11 +85,14 @@ public:
CacheFormFactor();
CacheDoubleClickActivate();
+
+ // The order is important here, DPI is the last thing to be updated
UpdateLimSetting();
UpdateTextScaleFactor();
- UpdateEMConverter();
+ UpdateFontSize();
+ UpdateDPI();
- UScreen::GetDefault()->changed.connect(sigc::hide(sigc::hide(sigc::mem_fun(this, &Impl::UpdateEMConverter))));
+ UScreen::GetDefault()->changed.connect(sigc::hide(sigc::hide(sigc::mem_fun(this, &Impl::UpdateDPI))));
signals_.Add<void, GSettings*, const gchar*>(usettings_, "changed::" + FORM_FACTOR, [this] (GSettings*, const gchar*) {
CacheFormFactor();
@@ -121,6 +125,11 @@ public:
UpdateDPI();
});
+ signals_.Add<void, GSettings*, const gchar*>(gnome_ui_settings_, "changed::" + GNOME_FONT_NAME, [this] (GSettings*, const gchar* t) {
+ UpdateFontSize();
+ UpdateDPI();
+ });
+
signals_.Add<void, GSettings*, const gchar*>(gnome_ui_settings_, "changed::" + GNOME_TEXT_SCALE_FACTOR, [this] (GSettings*, const gchar* t) {
if (!changing_gnome_settings_)
{
@@ -191,7 +200,8 @@ public:
gint font_size;
PangoFontDescription* desc;
- desc = pango_font_description_from_string(decoration::Style::Get()->font().c_str());
+ glib::String font_name(g_settings_get_string(gnome_ui_settings_, GNOME_FONT_NAME.c_str()));
+ desc = pango_font_description_from_string(font_name);
font_size = pango_font_description_get_size(desc);
pango_font_description_free(desc);
@@ -253,12 +263,6 @@ public:
parent_->dpi_changed.emit();
}
- void UpdateEMConverter()
- {
- UpdateFontSize();
- UpdateDPI();
- }
-
void UpdateAppsScaling(double scale)
{
changing_gnome_settings_ = true;