diff options
-rw-r--r-- | src/gui/kernel/qapplication_x11.cpp | 7 | ||||
-rw-r--r-- | src/gui/styles/gtksymbols.cpp | 19 | ||||
-rw-r--r-- | src/gui/styles/gtksymbols_p.h | 3 | ||||
-rw-r--r-- | src/gui/styles/qgtkstyle.cpp | 5 |
4 files changed, 34 insertions, 0 deletions
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 0056b9e..a7a6504 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -79,6 +79,7 @@ #include <private/qcolor_p.h> #include <private/qcursor_p.h> #include <private/qiconloader_p.h> +#include <private/gtksymbols_p.h> #include "qstyle.h" #include "qmetaobject.h" #include "qtimer.h" @@ -2287,6 +2288,12 @@ void qt_init(QApplicationPrivate *priv, int, if (X11->desktopEnvironment == DE_KDE) X11->desktopVersion = QString::fromLocal8Bit(qgetenv("KDE_SESSION_VERSION")).toInt(); +#if !defined(QT_NO_STYLE_GTK) + if (X11->desktopEnvironment == DE_GNOME) { + static bool menusHaveIcons = QGtk::getGConfBool(QLatin1String("/desktop/gnome/interface/menus_have_icons"), true); + QApplication::setAttribute(Qt::AA_DontShowIconsInMenus, !menusHaveIcons); + } +#endif qt_set_input_encoding(); qt_set_x11_resources(appFont, appFGCol, appBGCol, appBTNCol); diff --git a/src/gui/styles/gtksymbols.cpp b/src/gui/styles/gtksymbols.cpp index 0d34c77..b61675b 100644 --- a/src/gui/styles/gtksymbols.cpp +++ b/src/gui/styles/gtksymbols.cpp @@ -194,6 +194,7 @@ Ptr_gdk_x11_drawable_get_xdisplay QGtk::gdk_x11_drawable_get_xdisplay = 0; Ptr_gconf_client_get_default QGtk::gconf_client_get_default = 0; Ptr_gconf_client_get_string QGtk::gconf_client_get_string = 0; +Ptr_gconf_client_get_bool QGtk::gconf_client_get_bool = 0; static QString classPath(GtkWidget *widget) { @@ -336,6 +337,7 @@ static bool resolveGConf() if (!QGtk::gconf_client_get_default) { QGtk::gconf_client_get_default = (Ptr_gconf_client_get_default)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_default"); QGtk::gconf_client_get_string = (Ptr_gconf_client_get_string)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_string"); + QGtk::gconf_client_get_bool = (Ptr_gconf_client_get_bool)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_bool"); } return (QGtk::gconf_client_get_default !=0); } @@ -361,6 +363,23 @@ QString QGtk::getGConfString(const QString &value, const QString &fallback) return retVal; } +bool QGtk::getGConfBool(const QString &key, bool fallback) +{ + bool retVal = fallback; + if (resolveGConf()) { + g_type_init(); + GConfClient* client = QGtk::gconf_client_get_default(); + GError *err = 0; + bool result = QGtk::gconf_client_get_bool(client, qPrintable(key), &err); + g_object_unref(client); + if (!err) + retVal = result; + else + g_error_free (err); + } + return retVal; +} + static QString getThemeName() { QString themeName; diff --git a/src/gui/styles/gtksymbols_p.h b/src/gui/styles/gtksymbols_p.h index 596a312..fb9d129 100644 --- a/src/gui/styles/gtksymbols_p.h +++ b/src/gui/styles/gtksymbols_p.h @@ -77,6 +77,7 @@ class GConfClient; typedef GConfClient* (*Ptr_gconf_client_get_default)(); typedef char* (*Ptr_gconf_client_get_string)(GConfClient*, const char*, GError **); +typedef bool (*Ptr_gconf_client_get_bool)(GConfClient*, const char*, GError **); typedef void (*Ptr_gtk_init)(int *, char ***); typedef GtkWidget* (*Ptr_gtk_window_new) (GtkWindowType); @@ -217,6 +218,7 @@ public: static QStringList openFilenames(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options); static QString getGConfString(const QString &key, const QString &fallback = QString()); + static bool getGConfBool(const QString &key, bool fallback = 0); static Ptr_gtk_container_forall gtk_container_forall; static Ptr_gtk_init gtk_init; @@ -330,6 +332,7 @@ public: static Ptr_gconf_client_get_default gconf_client_get_default; static Ptr_gconf_client_get_string gconf_client_get_string; + static Ptr_gconf_client_get_bool gconf_client_get_bool; }; // Helper to ensure that we have polished all our gtk widgets diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index 87fa322..0ccf219 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -656,6 +656,11 @@ int QGtkStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidg return !scrollbars_within_bevel; } + case SH_DialogButtonBox_ButtonsHaveIcons: { + static bool buttonsHaveIcons = QGtk::getGConfBool(QLS("/desktop/gnome/interface/buttons_have_icons")); + return buttonsHaveIcons; + } + default: return QCleanlooksStyle::styleHint(hint, option, widget, returnData); } |