on xenial help sign in
Launch upstart and with it, indicator services and ofono
210aff0Michael Terry
GreeterShell.qml+1−1
@@ -230,7 +230,7 @@ BasicShell {
230*/
230*/
231
231
232 Connections {
232 Connections {
233− target: LightDM.URLDispatcher
233+ target: LightDM.Upstart
234 onDispatchURL: shell.activateApplication(url)
234 onDispatchURL: shell.activateApplication(url)
235 }
235 }
236
236
debian/control+2−1
@@ -92,7 +92,8 @@ Description: Unity 8 shell
92
92
93Package: unity8-greeter
93Package: unity8-greeter
94Architecture: any
94Architecture: any
95+Depends: dbus-x11,
95−Depends: lightdm,
96+ lightdm,
96 ubuntu-touch-session,
97 ubuntu-touch-session,
97 unity8 (>= ${source:Version}),
98 unity8 (>= ${source:Version}),
98 ${misc:Depends},
99 ${misc:Depends},
debian/unity8-greeter.install+1
@@ -2,3 +2,4 @@ usr/bin/unity8-greeter
2usr/share/lightdm
2usr/share/lightdm
3usr/share/unity8/GreeterShell.qml
3usr/share/unity8/GreeterShell.qml
4usr/share/unity8/Greeter
4usr/share/unity8/Greeter
5+usr/share/upstart/sessions/unity8-greeter-init.conf
plugins/LightDM/CMakeLists.txt+5−1
@@ -18,7 +18,7 @@ set(QMLPLUGIN_SRC
18 DBusGreeterList.cpp
18 DBusGreeterList.cpp
19 Greeter.cpp
19 Greeter.cpp
20 plugin.cpp
20 plugin.cpp
21− URLDispatcher.cpp
21+ Upstart.cpp
22 UsersModel.cpp
22 UsersModel.cpp
23 )
23 )
24
24
@@ -36,3 +36,7 @@ qt5_use_modules(LightDM-qml DBus Qml)
36# export the qmldir qmltypes and plugin files
36# export the qmldir qmltypes and plugin files
37export_qmlfiles(LightDM LightDM)
37export_qmlfiles(LightDM LightDM)
38export_qmlplugin(LightDM 0.1 LightDM TARGETS LightDM-qml)
38export_qmlplugin(LightDM 0.1 LightDM TARGETS LightDM-qml)
39+
40+install(FILES unity8-greeter-init.conf
41+ DESTINATION ${CMAKE_INSTALL_DATADIR}/upstart/sessions
42+ )
plugins/LightDM/URLDispatcher.cppdeleted−56
@@ -1,56 +0,0 @@
1−/*
2− * Copyright (C) 2013 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−#include "URLDispatcher.h"
18−
19−#include <QDBusConnection>
20−
21−class DBusURLDispatcher : public QObject
22−{
23− Q_OBJECT
24− Q_CLASSINFO("D-Bus Interface", "com.canonical.URLDispatcher")
25−
26−public:
27− explicit DBusURLDispatcher(URLDispatcher *parent);
28−
29− Q_SCRIPTABLE void DispatchURL(const QString &url);
30−
31−private:
32− URLDispatcher *m_parent;
33−};
34−
35−DBusURLDispatcher::DBusURLDispatcher(URLDispatcher *parent)
36− : QObject(parent),
37− m_parent(parent)
38−{
39−}
40−
41−void DBusURLDispatcher::DispatchURL(const QString &url)
42−{
43− Q_EMIT m_parent->dispatchURL(url);
44−}
45−
46−URLDispatcher::URLDispatcher(QObject *parent)
47− : QObject(parent)
48−{
49− // Own url dispatcher on DBus, we want to intercept these calls
50− QDBusConnection connection = QDBusConnection::sessionBus();
51− DBusURLDispatcher *dispatcher = new DBusURLDispatcher(this);
52− connection.registerObject("/com/canonical/URLDispatcher", dispatcher, QDBusConnection::ExportScriptableContents);
53− connection.registerService("com.canonical.URLDispatcher");
54−}
55−
56−#include "URLDispatcher.moc"
plugins/LightDM/Upstart.cppnew file+76
@@ -0,0 +1,76 @@
1+/*
2+ * Copyright (C) 2013 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+#include "Upstart.h"
18+
19+#include <QDBusConnection>
20+#include <QProcess>
21+#include <unistd.h>
22+
23+class URLDispatcher : public QObject
24+{
25+ Q_OBJECT
26+ Q_CLASSINFO("D-Bus Interface", "com.canonical.URLDispatcher")
27+
28+public:
29+ explicit URLDispatcher(Upstart *parent);
30+
31+ Q_SCRIPTABLE void DispatchURL(const QString &url);
32+
33+private:
34+ Upstart *m_parent;
35+};
36+
37+URLDispatcher::URLDispatcher(Upstart *parent)
38+ : QObject(parent),
39+ m_parent(parent)
40+{
41+}
42+
43+void URLDispatcher::DispatchURL(const QString &url)
44+{
45+ Q_EMIT m_parent->dispatchURL(url);
46+}
47+
48+// Normal unity8 sessions are entirely driven by Upstart. But greeters
49+// are special. They need access to the file descriptors that lightdm
50+// creates for them and don't want to start all the services that a normal
51+// session would. So it's inconvenient to live within an upstart session.
52+// But... we still want to use Upstart for some services. So rather than being
53+// spawned *by* Upstart like unity8 is, we spawn *it* instead.
54+Upstart::Upstart(QObject *parent)
55+ : QObject(parent)
56+{
57+ // This class also manages our url-dispatcher interception, as it's sort of
58+ // a service provided by Upstart normally. We intercept url-dispatcher
59+ // because rather than spawning the handler for the URL in our own session,
60+ // we want to do notify the user session to do it for us (and start an
61+ // unlock in the process).
62+ QDBusConnection connection = QDBusConnection::sessionBus();
63+ URLDispatcher *dispatcher = new URLDispatcher(this);
64+ connection.registerObject("/com/canonical/URLDispatcher", dispatcher, QDBusConnection::ExportScriptableContents);
65+ connection.registerService("com.canonical.URLDispatcher");
66+
67+ // Start upstart (unless it's already running, like if the user is testing
68+ // locally on their desktop)
69+ if (QString(qgetenv("UPSTART_SESSION")).isEmpty())
70+ {
71+ QProcess *upstart = new QProcess(this);
72+ upstart->start("/sbin/init --user --startup-event=unity8-greeter-started");
73+ }
74+}
75+
76+#include "Upstart.moc"
plugins/LightDM/URLDispatcher.h → plugins/LightDM/Upstart.hrenamed+4−4
@@ -14,18 +14,18 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
15 */
16
16
17−#ifndef UNITY_URLDISPATCHER_H
17+#ifndef UNITY_UPSTART_H
18−#define UNITY_URLDISPATCHER_H
18+#define UNITY_UPSTART_H
19
19
20#include <QObject>
20#include <QObject>
21#include <QString>
21#include <QString>
22
22
23−class URLDispatcher : public QObject
23+class Upstart : public QObject
24{
24{
25 Q_OBJECT
25 Q_OBJECT
26
26
27public:
27public:
28− explicit URLDispatcher(QObject *parent=0);
28+ explicit Upstart(QObject *parent=0);
29
29
30Q_SIGNALS:
30Q_SIGNALS:
31 void dispatchURL(const QString &url);
31 void dispatchURL(const QString &url);
plugins/LightDM/plugin.cpp+4−4
@@ -20,7 +20,7 @@
20#include "plugin.h"
20#include "plugin.h"
21#include "DBusGreeterList.h"
21#include "DBusGreeterList.h"
22#include "Greeter.h"
22#include "Greeter.h"
23−#include "URLDispatcher.h"
23+#include "Upstart.h"
24#include "UsersModel.h"
24#include "UsersModel.h"
25#include <libusermetricsoutput/ColorTheme.h>
25#include <libusermetricsoutput/ColorTheme.h>
26#include <libusermetricsoutput/UserMetrics.h>
26#include <libusermetricsoutput/UserMetrics.h>
@@ -47,11 +47,11 @@ static QObject *greeter_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
47 return greeter;
47 return greeter;
48}
48}
49
49
50−static QObject *dispatcher_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
50+static QObject *upstart_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
51{
51{
52 Q_UNUSED(engine)
52 Q_UNUSED(engine)
53 Q_UNUSED(scriptEngine)
53 Q_UNUSED(scriptEngine)
54− return new URLDispatcher();
54+ return new Upstart();
55}
55}
56
56
57static QObject *users_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
57static QObject *users_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
@@ -75,7 +75,7 @@ void LightDMPlugin::registerTypes(const char *uri)
75
75
76 Q_ASSERT(uri == QLatin1String("LightDM"));
76 Q_ASSERT(uri == QLatin1String("LightDM"));
77 qmlRegisterSingletonType<Greeter>(uri, 0, 1, "Greeter", greeter_provider);
77 qmlRegisterSingletonType<Greeter>(uri, 0, 1, "Greeter", greeter_provider);
78− qmlRegisterSingletonType<URLDispatcher>(uri, 0, 1, "URLDispatcher", dispatcher_provider);
78+ qmlRegisterSingletonType<Upstart>(uri, 0, 1, "Upstart", upstart_provider);
79 qmlRegisterSingletonType<UsersModel>(uri, 0, 1, "Users", users_provider);
79 qmlRegisterSingletonType<UsersModel>(uri, 0, 1, "Users", users_provider);
80 qmlRegisterUncreatableType<QLightDM::UsersModel>(uri, 0, 1, "UserRoles", "Type is not instantiable");
80 qmlRegisterUncreatableType<QLightDM::UsersModel>(uri, 0, 1, "UserRoles", "Type is not instantiable");
81 qmlRegisterSingletonType<UserMetricsOutput::UserMetrics>(uri, 0, 1, "Infographic", infographic_provider);
81 qmlRegisterSingletonType<UserMetricsOutput::UserMetrics>(uri, 0, 1, "Infographic", infographic_provider);
plugins/LightDM/unity8-greeter-init.confnew file+11
@@ -0,0 +1,11 @@
1+description "Unity 8 Greeter initialization"
2+author "Michael Terry <mterry@ubuntu.com>"
3+
4+start on unity8-greeter-started
5+emits indicator-services-start
6+task
7+
8+script
9+ initctl emit indicator-services-start
10+ initctl start ofono-setup
11+end script
unity8-greeter.desktop.in+1−2
@@ -1,6 +1,5 @@
1[Desktop Entry]
1[Desktop Entry]
2Type=Application
2Type=Application
3Name=Unity 8 Greeter
3Name=Unity 8 Greeter
4−Exec=ubuntu-touch-session @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/unity8-greeter
4+Exec=ubuntu-touch-session dbus-launch @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/unity8-greeter
5−Icon=unity8
6X-LightDM-Session-Type=mir
5X-LightDM-Session-Type=mir