summaryrefslogtreecommitdiffstats
path: root/src/plugins/platformthemes/gtk2
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2013-02-28 17:34:07 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-02 23:24:04 +0100
commit078b3419bd33031923c791f9286686d2babb1b61 (patch)
treeadb017e8411bf553ef5a7ea9e77b4ea59a7cae36 /src/plugins/platformthemes/gtk2
parentc4249e1e920f8bb0fc6a45bce11f0ae825da3597 (diff)
QGtk2Theme: use GtkSettings to fetch the icon theme name
Change-Id: Ib486d65276512a94299650adfbf3d87108ae5845 Reviewed-by: Dmitry Shachnev <mitya57@gmail.com> Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'src/plugins/platformthemes/gtk2')
-rw-r--r--src/plugins/platformthemes/gtk2/qgtk2theme.cpp23
-rw-r--r--src/plugins/platformthemes/gtk2/qgtk2theme.h2
2 files changed, 25 insertions, 0 deletions
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 <QVariant>
#undef signals
#include <gtk/gtk.h>
@@ -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;