[Libreoffice-commits] core.git: vcl/source vcl/unx
Caolán McNamara
caolanm at redhat.com
Wed Oct 19 11:59:43 UTC 2016
vcl/source/app/IconThemeSelector.cxx | 4 ++++
vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx | 15 +++++++++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
New commits:
commit 75544eb042ab3fc79dd6104749a32af7e180c116
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 19 12:57:09 2016 +0100
Resolves: tdf#102778 by default use breeze_dark when dark themes are requested
Under gtk3 if gtk-application-prefer-dark-theme is enabled or the requested
icon-theme name ends in [-|_]dark
Change-Id: Ia70ea3adc51ac0ec2b26d08fc960c1c7285c338b
diff --git a/vcl/source/app/IconThemeSelector.cxx b/vcl/source/app/IconThemeSelector.cxx
index ce91d5b..91a082c 100644
--- a/vcl/source/app/IconThemeSelector.cxx
+++ b/vcl/source/app/IconThemeSelector.cxx
@@ -82,6 +82,10 @@ IconThemeSelector::SelectIconThemeForDesktopEnvironment(
if (icon_theme_is_in_installed_themes(mPreferredIconTheme, installedThemes)) {
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)) {
+ return "breeze_dark";
+ }
}
OUString themeForDesktop = GetIconThemeForDesktopEnvironment(desktopEnvironment);
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index 3d5ee0f..8d6c2d0 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -2719,8 +2719,19 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
// preferred icon style
gchar* pIconThemeName = nullptr;
- g_object_get( pSettings, "gtk-icon-theme-name", &pIconThemeName, nullptr );
- aStyleSet.SetPreferredIconTheme( OUString::createFromAscii( pIconThemeName ) );
+ gboolean bDarkIconTheme = false;
+ g_object_get(pSettings, "gtk-icon-theme-name", &pIconThemeName,
+ "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);
g_free( pIconThemeName );
aStyleSet.SetToolbarIconSize( ToolbarIconSize::Large );
More information about the Libreoffice-commits
mailing list