on xenial help sign in
added application property to session
ec70d0fNick Dedekind
qml/Shell.qml+2−2
@@ -236,8 +236,8 @@ Item {
236 Connections {
236 Connections {
237 target: SessionManager
237 target: SessionManager
238 onSessionStopping: {
238 onSessionStopping: {
239− if (!session.parent) {
239+ if (!session.parentSession && !session.application) {
240− // there's no one displaying it. delete it right away
240+ // nothing is using it. delete it right away
241 session.release();
241 session.release();
242 }
242 }
243 }
243 }
tests/mocks/Unity/Application/Session.cpp+1
@@ -79,6 +79,7 @@ void Session::setApplication(ApplicationInfo* application)
79 return;
79 return;
80
80
81 m_application = application;
81 m_application = application;
82+ Q_EMIT applicationChanged(application);
82}
83}
83
84
84void Session::setSurface(MirSurfaceItem* surface)
85void Session::setSurface(MirSurfaceItem* surface)
tests/mocks/Unity/Application/Session.h+2
@@ -29,6 +29,7 @@ class Session : public QObject
29 Q_OBJECT
29 Q_OBJECT
30 Q_PROPERTY(QString name READ name CONSTANT)
30 Q_PROPERTY(QString name READ name CONSTANT)
31 Q_PROPERTY(MirSurfaceItem* surface READ surface NOTIFY surfaceChanged)
31 Q_PROPERTY(MirSurfaceItem* surface READ surface NOTIFY surfaceChanged)
32+ Q_PROPERTY(ApplicationInfo* application READ application NOTIFY applicationChanged)
32 Q_PROPERTY(Session* parentSession READ parentSession NOTIFY parentSessionChanged DESIGNABLE false)
33 Q_PROPERTY(Session* parentSession READ parentSession NOTIFY parentSessionChanged DESIGNABLE false)
33 Q_PROPERTY(SessionModel* childSessions READ childSessions DESIGNABLE false CONSTANT)
34 Q_PROPERTY(SessionModel* childSessions READ childSessions DESIGNABLE false CONSTANT)
34 Q_PROPERTY(bool live READ live NOTIFY liveChanged)
35 Q_PROPERTY(bool live READ live NOTIFY liveChanged)
@@ -58,6 +59,7 @@ public:
58 void removeChildSession(Session* session);
59 void removeChildSession(Session* session);
59
60
60Q_SIGNALS:
61Q_SIGNALS:
62+ void applicationChanged(ApplicationInfo*);
61 void surfaceChanged(MirSurfaceItem*);
63 void surfaceChanged(MirSurfaceItem*);
62 void parentSessionChanged(Session*);
64 void parentSessionChanged(Session*);
63 void liveChanged(bool live);
65 void liveChanged(bool live);
tests/mocks/Unity/Application/plugin.cpp+1
@@ -60,6 +60,7 @@ static QObject* applicationTestInterface(QQmlEngine* engine, QJSEngine* scriptEn
60void FakeUnityApplicationQmlPlugin::registerTypes(const char *uri)
60void FakeUnityApplicationQmlPlugin::registerTypes(const char *uri)
61{
61{
62 qRegisterMetaType<Session*>("Session*");
62 qRegisterMetaType<Session*>("Session*");
63+ qRegisterMetaType<ApplicationInfo*>("ApplicationInfo*");
63 qRegisterMetaType<MirSurfaceItemModel*>("SessionModel*");
64 qRegisterMetaType<MirSurfaceItemModel*>("SessionModel*");
64 qRegisterMetaType<MirSurfaceItem*>("MirSurfaceItem*");
65 qRegisterMetaType<MirSurfaceItem*>("MirSurfaceItem*");
65 qRegisterMetaType<MirSurfaceItemModel*>("MirSurfaceItemModel*");
66 qRegisterMetaType<MirSurfaceItemModel*>("MirSurfaceItemModel*");