void LauncherApplication::setBamfApplication(BamfApplication *application) { if (application == NULL) { return; } m_application = application; if (!sticky()) { setDesktopFile(application->desktop_file()); } QObject::connect(application, SIGNAL(ActiveChanged(bool)), this, SIGNAL(activeChanged(bool))); QObject::connect(application, SIGNAL(RunningChanged(bool)), this, SLOT(updateCounterVisible())); /* FIXME: a bug somewhere makes connecting to the Closed() signal not work even though the emit Closed() in bamf-view.cpp is reached. */ /* Connect first the onBamfApplicationClosed slot, then the runningChanged signal, to avoid a race condition when an application is closed. See https://launchpad.net/bugs/634057 */ QObject::connect(application, SIGNAL(RunningChanged(bool)), this, SLOT(onBamfApplicationClosed(bool))); QObject::connect(application, SIGNAL(RunningChanged(bool)), this, SIGNAL(runningChanged(bool))); QObject::connect(application, SIGNAL(UrgentChanged(bool)), this, SIGNAL(urgentChanged(bool))); QObject::connect(application, SIGNAL(WindowAdded(BamfWindow*)), this, SLOT(updateHasVisibleWindow())); QObject::connect(application, SIGNAL(WindowRemoved(BamfWindow*)), this, SLOT(updateHasVisibleWindow())); QObject::connect(application, SIGNAL(WindowAdded(BamfWindow*)), this, SLOT(updateWindowCount())); QObject::connect(application, SIGNAL(WindowRemoved(BamfWindow*)), this, SLOT(updateWindowCount())); connect(application, SIGNAL(ChildAdded(BamfView*)), SLOT(slotChildAdded(BamfView*))); connect(application, SIGNAL(ChildRemoved(BamfView*)), SLOT(slotChildRemoved(BamfView*))); connect(application, SIGNAL(WindowAdded(BamfWindow*)), SLOT(onWindowAdded(BamfWindow*))); updateBamfApplicationDependentProperties(); updateCounterVisible(); }
void LauncherApplication::onBamfApplicationClosed(bool running) { if(running) return; m_application->disconnect(this); m_application = NULL; updateBamfApplicationDependentProperties(); closed(); }
void Application::setBamfApplication(BamfApplication *application) { if (application == NULL) { return; } m_application = application; if (!sticky()) { setDesktopFile(application->desktop_file()); } QObject::connect(application, SIGNAL(ActiveChanged(bool)), this, SIGNAL(activeChanged(bool))); QObject::connect(application, SIGNAL(RunningChanged(bool)), this, SLOT(updateCounterVisible())); /* FIXME: Signal-slot mappings below were based on the assumption that BamfWindow - Closed() was broken. This was fixed in bamf-qt (see https://bugs.launchpad.net/bamf-qt/+bug/968046), so this code may be revisited as we can now rely on Closed(). */ /* Connect first the onBamfApplicationClosed slot, then the runningChanged signal, to avoid a race condition when an application is closed. See https://launchpad.net/bugs/634057 */ QObject::connect(application, SIGNAL(RunningChanged(bool)), this, SLOT(onBamfApplicationClosed(bool))); QObject::connect(application, SIGNAL(RunningChanged(bool)), this, SIGNAL(runningChanged(bool))); QObject::connect(application, SIGNAL(UrgentChanged(bool)), this, SIGNAL(urgentChanged(bool))); QObject::connect(application, SIGNAL(WindowAdded(BamfWindow*)), this, SLOT(updateHasVisibleWindow())); QObject::connect(application, SIGNAL(WindowRemoved(BamfWindow*)), this, SLOT(updateHasVisibleWindow())); QObject::connect(application, SIGNAL(WindowAdded(BamfWindow*)), this, SLOT(updateWindowCount())); QObject::connect(application, SIGNAL(WindowRemoved(BamfWindow*)), this, SLOT(updateWindowCount())); connect(application, SIGNAL(ChildAdded(BamfView*)), SLOT(slotChildAdded(BamfView*))); connect(application, SIGNAL(ChildRemoved(BamfView*)), SLOT(slotChildRemoved(BamfView*))); connect(application, SIGNAL(WindowAdded(BamfWindow*)), SLOT(onWindowAdded(BamfWindow*))); updateBamfApplicationDependentProperties(); updateCounterVisible(); }