diff options
author | Sergio Ahumada <sergio.ahumada@digia.com> | 2013-04-10 15:41:47 +0200 |
---|---|---|
committer | Sergio Ahumada <sergio.ahumada@digia.com> | 2013-04-10 15:42:22 +0200 |
commit | 90297a64f203959f90041887ea31f4bd04bc059a (patch) | |
tree | 86f8ad6a5af26fd618cdb2e20601e6df89ac94d6 /src/widgets/styles/qgtkstyle_p.cpp | |
parent | 537a4bc4011d32de193dc31caf09a44c1810ab33 (diff) | |
parent | f273d6fbc02055ff3999adc0df76360ca0670435 (diff) |
Merge branch 'stable' into dev
Change-Id: Icff019d74ae04c628a80f66aa478e4db40fae464
Diffstat (limited to 'src/widgets/styles/qgtkstyle_p.cpp')
-rw-r--r-- | src/widgets/styles/qgtkstyle_p.cpp | 50 |
1 files changed, 6 insertions, 44 deletions
diff --git a/src/widgets/styles/qgtkstyle_p.cpp b/src/widgets/styles/qgtkstyle_p.cpp index f29f250de0..a53a961a89 100644 --- a/src/widgets/styles/qgtkstyle_p.cpp +++ b/src/widgets/styles/qgtkstyle_p.cpp @@ -529,18 +529,6 @@ void QGtkStylePrivate::initGtkWidgets() const return; } - static QString themeName; - if (!gtkWidgetMap()->contains("GtkWindow") && themeName.isEmpty()) { - themeName = getThemeName(); - - if (themeName == QLS("Qt") || themeName == QLS("Qt4")) { - // Due to namespace conflicts with Qt3 and obvious recursion with Qt4, - // we cannot support the GTK_Qt Gtk engine - qWarning("QGtkStyle cannot be used together with the GTK_Qt engine."); - return; - } - } - if (QGtkStylePrivate::gtk_init) { #ifndef Q_OS_MAC // Gtk will set the Qt error handler so we have to reset it afterwards @@ -688,38 +676,12 @@ bool QGtkStylePrivate::getGConfBool(const QString &key, bool fallback) QString QGtkStylePrivate::getThemeName() { QString themeName; - // We try to parse the gtkrc file first - // primarily to avoid resolving Gtk functions if - // the KDE 3 "Qt" style is currently in use - QString rcPaths = QString::fromLocal8Bit(qgetenv("GTK2_RC_FILES")); - if (!rcPaths.isEmpty()) { - QStringList paths = rcPaths.split(QLS(":")); - foreach (const QString &rcPath, paths) { - if (!rcPath.isEmpty()) { - QFile rcFile(rcPath); - if (rcFile.open(QIODevice::ReadOnly | QIODevice::Text)) { - QTextStream in(&rcFile); - while(!in.atEnd()) { - QString line = in.readLine(); - if (line.contains(QLS("gtk-theme-name"))) { - line = line.right(line.length() - line.indexOf(QLatin1Char('=')) - 1); - line.remove(QLatin1Char('\"')); - line = line.trimmed(); - themeName = line; - break; - } - } - } - } - if (!themeName.isEmpty()) - break; - } - } - - // Fall back to gconf - if (themeName.isEmpty() && resolveGConf()) - themeName = getGConfString(QLS("/desktop/gnome/interface/gtk_theme")); - + // Read the theme name from GtkSettings + GtkSettings *settings = QGtkStylePrivate::gtk_settings_get_default(); + gchararray value; + g_object_get(settings, "gtk-theme-name", &value, NULL); + themeName = QString::fromUtf8(value); + g_free(value); return themeName; } |