From 078b3419bd33031923c791f9286686d2babb1b61 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 28 Feb 2013 17:34:07 +0100 Subject: QGtk2Theme: use GtkSettings to fetch the icon theme name Change-Id: Ib486d65276512a94299650adfbf3d87108ae5845 Reviewed-by: Dmitry Shachnev Reviewed-by: Jens Bache-Wiig --- src/plugins/platformthemes/gtk2/qgtk2theme.cpp | 23 +++++++++++++++++++++++ src/plugins/platformthemes/gtk2/qgtk2theme.h | 2 ++ 2 files changed, 25 insertions(+) (limited to 'src/plugins/platformthemes') diff --git a/src/plugins/platformthemes/gtk2/qgtk2theme.cpp b/src/plugins/platformthemes/gtk2/qgtk2theme.cpp index 7bb538b888..b26ab94b83 100644 --- a/src/plugins/platformthemes/gtk2/qgtk2theme.cpp +++ b/src/plugins/platformthemes/gtk2/qgtk2theme.cpp @@ -41,6 +41,7 @@ #include "qgtk2theme.h" #include "qgtk2dialoghelpers.h" +#include #undef signals #include @@ -49,11 +50,33 @@ QT_BEGIN_NAMESPACE const char *QGtk2Theme::name = "gtk2"; +static QString gtkSetting(const gchar *propertyName) +{ + GtkSettings *settings = gtk_settings_get_default(); + gchararray value; + g_object_get(settings, propertyName, &value, NULL); + QString str = QString::fromUtf8(value); + g_free(value); + return str; +} + QGtk2Theme::QGtk2Theme() { gtk_init(0, 0); } +QVariant QGtk2Theme::themeHint(QPlatformTheme::ThemeHint hint) const +{ + switch (hint) { + case QPlatformTheme::SystemIconThemeName: + return QVariant(gtkSetting("gtk-icon-theme-name")); + case QPlatformTheme::SystemIconFallbackThemeName: + return QVariant(gtkSetting("gtk-fallback-icon-theme")); + default: + return QGnomeTheme::themeHint(hint); + } +} + bool QGtk2Theme::usePlatformNativeDialog(DialogType type) const { Q_UNUSED(type); diff --git a/src/plugins/platformthemes/gtk2/qgtk2theme.h b/src/plugins/platformthemes/gtk2/qgtk2theme.h index 6d8768dd8e..a351b5b738 100644 --- a/src/plugins/platformthemes/gtk2/qgtk2theme.h +++ b/src/plugins/platformthemes/gtk2/qgtk2theme.h @@ -51,6 +51,8 @@ class QGtk2Theme : public QGnomeTheme public: QGtk2Theme(); + virtual QVariant themeHint(ThemeHint hint) const; + virtual bool usePlatformNativeDialog(DialogType type) const; virtual QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const; -- cgit v1.2.3