1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Prioritize Unity sistray backend over StatusNotifier

This commit is contained in:
tux3 2015-02-22 01:28:12 +01:00
parent d01737572a
commit 18a9955f43
No known key found for this signature in database
GPG Key ID: 7E086DD661263264

View File

@ -10,6 +10,30 @@ SystemTrayIcon::SystemTrayIcon()
{ {
QString desktop = getenv("XDG_CURRENT_DESKTOP"); QString desktop = getenv("XDG_CURRENT_DESKTOP");
if (false); 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 #ifdef ENABLE_SYSTRAY_STATUSNOTIFIER_BACKEND
else if (true) else if (true)
{ {
@ -35,30 +59,6 @@ SystemTrayIcon::SystemTrayIcon()
gtk_widget_show(item); gtk_widget_show(item);
} }
#endif #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" else if (desktop.toLower() == "kde"
&& getenv("KDE_SESSION_VERSION") == QString("5")) && getenv("KDE_SESSION_VERSION") == QString("5"))
{ {