Use crl::on_main in MainWindow::sniSignalEmitted

This commit is contained in:
Ilya Fedin 2020-10-27 13:29:50 +04:00 committed by John Preston
parent d73d3cd43d
commit af6b07b780
2 changed files with 9 additions and 4 deletions

View File

@ -509,7 +509,7 @@ void MainWindow::initHook() {
_sniDBusProxy,
"g-signal",
G_CALLBACK(sniSignalEmitted),
this);
nullptr);
auto sniWatcher = new QDBusServiceWatcher(
kSNIWatcherService.utf16(),
@ -655,9 +655,13 @@ void MainWindow::sniSignalEmitted(
gchar *sender_name,
gchar *signal_name,
GVariant *parameters,
MainWindow *window) {
gpointer user_data) {
if(signal_name == qstr("StatusNotifierHostRegistered")) {
window->handleSNIHostRegistered();
crl::on_main([] {
if (const auto window = App::wnd()) {
window->handleSNIHostRegistered();
}
});
}
}

View File

@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <QtDBus/QDBusObjectPath>
#include <dbusmenuexporter.h>
typedef void* gpointer;
typedef char gchar;
typedef struct _GVariant GVariant;
typedef struct _GDBusProxy GDBusProxy;
@ -145,7 +146,7 @@ private:
gchar *sender_name,
gchar *signal_name,
GVariant *parameters,
MainWindow *window);
gpointer user_data);
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
};