~ci-train-bot/appmenu-qt5/appmenu-qt5-ubuntu-xenial-2467

« back to all changes in this revision

Viewing changes to src/appmenuplatformmenubar.cpp

  • Committer: Bileto Bot
  • Date: 2017-02-16 22:57:38 UTC
  • mfrom: (41.1.3 appmenu-xenial)
  • Revision ID: ci-train-bot@canonical.com-20170216225738-y8r74elaha9ltz55
* IconCache: get the proper theme path based on the fact we're using a
  themed icon or not (LP: #1600136)
* IconCache: use $XDG_RUNTIME_DIR as preferred place where to save
  icons
* AppMenuPlatformMenuBar: Don't initialize X11 related functions in
  other environments (LP: #1606246)

Show diffs side-by-side

added added

removed removed

Lines of Context:
229
229
/* Helper function, as copy-pasted from Qt 5.2.1 gtk2 platformthemeplugin */
230
230
static QString gtkSetting(const gchar *propertyName)
231
231
{
 
232
    if (qgetenv("DISPLAY").isEmpty()) {
 
233
        return QString();
 
234
    }
 
235
 
232
236
    GtkSettings *settings = gtk_settings_get_default();
233
237
    gchararray value;
234
238
    g_object_get(settings, propertyName, &value, NULL);
261
265
GnomeAppMenuPlatformTheme::GnomeAppMenuPlatformTheme()
262
266
    : QGnomeTheme()
263
267
{
264
 
    int (*oldErrorHandler)(Display *, XErrorEvent *) = XSetErrorHandler(NULL);
265
 
    gtk_init(0, 0);
266
 
    XSetErrorHandler(oldErrorHandler);
 
268
    if (!qgetenv("DISPLAY").isEmpty()) {
 
269
        int (*oldErrorHandler)(Display *, XErrorEvent *) = XSetErrorHandler(NULL);
 
270
        gtk_init(0, 0);
 
271
        XSetErrorHandler(oldErrorHandler);
 
272
    }
267
273
}
268
274
 
269
275
QVariant GnomeAppMenuPlatformTheme::themeHint(QPlatformTheme::ThemeHint hint) const
270
276
{
 
277
    if (qgetenv("DISPLAY").isEmpty()) {
 
278
        return QVariant(QVariant::String);
 
279
    }
 
280
 
271
281
    switch (hint) {
272
282
        case QPlatformTheme::SystemIconThemeName:
273
283
            return QVariant(gtkSetting("gtk-icon-theme-name"));