From 18a9955f43c3fe0521cedc6e5b5d3feb0485c026 Mon Sep 17 00:00:00 2001 From: tux3 Date: Sun, 22 Feb 2015 01:28:12 +0100 Subject: [PATCH] Prioritize Unity sistray backend over StatusNotifier --- src/widget/systemtrayicon.cpp | 48 +++++++++++++++++------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/widget/systemtrayicon.cpp b/src/widget/systemtrayicon.cpp index fbd61cd90..7108d3ea0 100644 --- a/src/widget/systemtrayicon.cpp +++ b/src/widget/systemtrayicon.cpp @@ -10,6 +10,30 @@ SystemTrayIcon::SystemTrayIcon() { QString desktop = getenv("XDG_CURRENT_DESKTOP"); if (false); + #ifdef ENABLE_SYSTRAY_UNITY_BACKEND + else if (desktop.toLower() == "unity") + { + QString settingsDir = Settings::getSettingsDirPath(); + QFile iconFile(settingsDir+"/icon.png"); + if (iconFile.open(QIODevice::Truncate | QIODevice::WriteOnly)) + { + QFile resIconFile(":/img/icon.png"); + if (resIconFile.open(QIODevice::ReadOnly)) + iconFile.write(resIconFile.readAll()); + resIconFile.close(); + iconFile.close(); + } + backendType = SystrayBackendType::Unity; + unityMenu = gtk_menu_new(); + unityIndicator = app_indicator_new_with_path( + "qTox", + "icon", + APP_INDICATOR_CATEGORY_APPLICATION_STATUS, + settingsDir.toStdString().c_str() + ); + app_indicator_set_menu(unityIndicator, GTK_MENU(unityMenu)); + } + #endif #ifdef ENABLE_SYSTRAY_STATUSNOTIFIER_BACKEND else if (true) { @@ -35,30 +59,6 @@ SystemTrayIcon::SystemTrayIcon() gtk_widget_show(item); } #endif - #ifdef ENABLE_SYSTRAY_UNITY_BACKEND - else if (desktop.toLower() == "unity") - { - QString settingsDir = Settings::getSettingsDirPath(); - QFile iconFile(settingsDir+"/icon.png"); - if (iconFile.open(QIODevice::Truncate | QIODevice::WriteOnly)) - { - QFile resIconFile(":/img/icon.png"); - if (resIconFile.open(QIODevice::ReadOnly)) - iconFile.write(resIconFile.readAll()); - resIconFile.close(); - iconFile.close(); - } - backendType = SystrayBackendType::Unity; - unityMenu = gtk_menu_new(); - unityIndicator = app_indicator_new_with_path( - "qTox", - "icon", - APP_INDICATOR_CATEGORY_APPLICATION_STATUS, - settingsDir.toStdString().c_str() - ); - app_indicator_set_menu(unityIndicator, GTK_MENU(unityMenu)); - } - #endif else if (desktop.toLower() == "kde" && getenv("KDE_SESSION_VERSION") == QString("5")) {