diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-11-14 13:49:01 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-11-14 13:50:37 +0000 |
commit | 6e32e575829160b3c51ebbb67231baec7135afd3 (patch) | |
tree | 748090363b848a47d7931684c4eb07593678c841 | |
parent | 32d0378284a42f0eba1df92555767a43be079117 (diff) |
Resolves: tdf#103915 when global dark theme is set fall back to breeze_dark
otherwise don't assume a desired iconset ending in *dark means breeze_dark
is a good fallback
Change-Id: Ia294a86e17a2c390b503d5200dfc7195759afa00
-rw-r--r-- | include/vcl/IconThemeSelector.hxx | 3 | ||||
-rw-r--r-- | include/vcl/settings.hxx | 2 | ||||
-rw-r--r-- | vcl/source/app/IconThemeSelector.cxx | 11 | ||||
-rw-r--r-- | vcl/source/app/settings.cxx | 4 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx | 9 |
5 files changed, 14 insertions, 15 deletions
diff --git a/include/vcl/IconThemeSelector.hxx b/include/vcl/IconThemeSelector.hxx index 70b000bbdc2e..0fcd66d1f263 100644 --- a/include/vcl/IconThemeSelector.hxx +++ b/include/vcl/IconThemeSelector.hxx @@ -63,7 +63,7 @@ public: SetUseHighContrastTheme(bool); void - SetPreferredIconTheme(const OUString&); + SetPreferredIconTheme(const OUString&, bool bDarkIconTheme); bool operator==(const vcl::IconThemeSelector&) const; @@ -85,6 +85,7 @@ private: OUString mPreferredIconTheme; bool mUseHighContrastTheme; + bool mPreferDarkIconTheme; friend class ::IconThemeSelectorTest; }; diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx index 74197f14c025..fd2881001e42 100644 --- a/include/vcl/settings.hxx +++ b/include/vcl/settings.hxx @@ -548,7 +548,7 @@ public: /** Set a preferred icon theme. * This theme will be preferred in GetAutomaticallyChosenIconTheme() */ - void SetPreferredIconTheme(const OUString&); + void SetPreferredIconTheme(const OUString&, bool bDarkIconTheme = false); const DialogStyle& GetDialogStyle() const; void SetDialogStyle( const DialogStyle& rStyle ); diff --git a/vcl/source/app/IconThemeSelector.cxx b/vcl/source/app/IconThemeSelector.cxx index 556d31a260a0..95ee517b6f21 100644 --- a/vcl/source/app/IconThemeSelector.cxx +++ b/vcl/source/app/IconThemeSelector.cxx @@ -43,7 +43,8 @@ bool icon_theme_is_in_installed_themes(const OUString& theme, } // end anonymous namespace IconThemeSelector::IconThemeSelector() -: mUseHighContrastTheme(false) + : mUseHighContrastTheme(false) + , mPreferDarkIconTheme(false) { } @@ -83,7 +84,7 @@ IconThemeSelector::SelectIconThemeForDesktopEnvironment( return mPreferredIconTheme; } //if a dark variant is preferred, and we didn't have an exact match, then try our one and only dark theme - if (mPreferredIconTheme.endsWith("_dark") && icon_theme_is_in_installed_themes("breeze_dark", installedThemes)) { + if (mPreferDarkIconTheme && icon_theme_is_in_installed_themes("breeze_dark", installedThemes)) { return OUString("breeze_dark"); } } @@ -121,9 +122,10 @@ IconThemeSelector::SetUseHighContrastTheme(bool v) } void -IconThemeSelector::SetPreferredIconTheme(const OUString& theme) +IconThemeSelector::SetPreferredIconTheme(const OUString& theme, bool bDarkIconTheme) { mPreferredIconTheme = theme; + mPreferDarkIconTheme = bDarkIconTheme; } bool @@ -135,6 +137,9 @@ IconThemeSelector::operator==(const vcl::IconThemeSelector& other) const if (mPreferredIconTheme != other.mPreferredIconTheme) { return false; } + if (mPreferDarkIconTheme != other.mPreferDarkIconTheme) { + return false; + } if (mUseHighContrastTheme != other.mUseHighContrastTheme) { return false; } diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 03aac219be8b..b8c5167b8a8a 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -3026,9 +3026,9 @@ StyleSettings::GetHighContrastMode() const } void -StyleSettings::SetPreferredIconTheme(const OUString& theme) +StyleSettings::SetPreferredIconTheme(const OUString& theme, bool bDarkIconTheme) { - mxData->mIconThemeSelector->SetPreferredIconTheme(theme); + mxData->mIconThemeSelector->SetPreferredIconTheme(theme, bDarkIconTheme); } void diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx index 286e4a28fc60..e9250eda8c09 100644 --- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx @@ -2726,14 +2726,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) "gtk-application-prefer-dark-theme", &bDarkIconTheme, nullptr ); OUString sIconThemeName(OUString::createFromAscii(pIconThemeName)); - if (sIconThemeName.endsWithIgnoreAsciiCase("-dark", &sIconThemeName) || - sIconThemeName.endsWithIgnoreAsciiCase("_dark", &sIconThemeName)) - { - bDarkIconTheme = true; - } - if (bDarkIconTheme) - sIconThemeName += "_dark"; - aStyleSet.SetPreferredIconTheme(sIconThemeName); + aStyleSet.SetPreferredIconTheme(sIconThemeName, bDarkIconTheme); g_free( pIconThemeName ); aStyleSet.SetToolbarIconSize( ToolbarIconSize::Large ); |