Merge lp:~mterry/ubuntu-system-settings/reset-lang-after-page into lp:ubuntu-system-settings

Proposed by Michael Terry
Status: Merged
Approved by: Sebastien Bacher
Approved revision: 915
Merged at revision: 942
Proposed branch: lp:~mterry/ubuntu-system-settings/reset-lang-after-page
Merge into: lp:ubuntu-system-settings
Diff against target: 189 lines (+68/-26)
7 files modified
wizard/CMakeLists.txt (+2/-0)
wizard/main.cpp (+33/-4)
wizard/qml/Pages/10-welcome.qml (+1/-0)
wizard/qml/main.qml (+2/-0)
wizard/ubuntu-system-settings-wizard-cleanup.conf (+0/-17)
wizard/ubuntu-system-settings-wizard-set-lang.conf (+30/-0)
wizard/ubuntu-system-settings-wizard.conf (+0/-5)
To merge this branch: bzr merge lp:~mterry/ubuntu-system-settings/reset-lang-after-page
Reviewer Review Type Date Requested Status
Sebastien Bacher (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+231200@code.launchpad.net

Commit message

After selecting the language, update the session environment immediately and restart indicators so that their notifications (like wifi prompt) are translated.

Description of the change

After selecting the language, update the session environment immediately and restart indicators so that their notifications (like wifi prompt) are translated.

I've split out the language parts of the cleanup job into its own upstart job that the wizard calls when prompted to by the language page.

== Checklist ==
 * Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)
 - Yes

 * Did you build your software in a clean sbuild/pbuilder chroot or ppa?
 - Yes

 * Did you build your software in a clean sbuild/pbuilder armhf chroot or ppa?
 - Yes

 * Has your component "TestPlan” been executed successfully on emulator, N4?
 - Yes

 * Has a 5 minute exploratory testing run been executed on N4?
 - Yes

 * If you changed the packaging (debian), did you subscribe a core-dev to this MP?
 - NA

 * If you changed the UI, did you subscribe the design-reviewers to this MP?
 - NA

 * If you changed UI labels, did you update the pot file?
 - NA

 * What components might get impacted by your changes?
 - Just wizard

 * Have you requested review by the teams of these owning components?
 - I'm sorta responsible for it

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:915
http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-ci/1242/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/3715
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/2865
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-amd64-ci/435
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/431
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-armhf-ci/431/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-system-settings-utopic-i386-ci/434
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/3595
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4962
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/4962/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/11682
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/2326
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/3149
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/3149/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-system-settings-ci/1242/rebuild

review: Approve (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :

that looks fine to me, thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'wizard/CMakeLists.txt'
2--- wizard/CMakeLists.txt 2014-06-17 15:03:02 +0000
3+++ wizard/CMakeLists.txt 2014-08-18 14:22:14 +0000
4@@ -1,4 +1,5 @@
5 include_directories(
6+ ${CMAKE_CURRENT_BINARY_DIR}
7 ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
8 )
9
10@@ -41,6 +42,7 @@
11 install(TARGETS system-settings-wizard RUNTIME DESTINATION bin)
12 install(FILES ubuntu-system-settings-wizard.conf
13 ubuntu-system-settings-wizard-cleanup.conf
14+ ubuntu-system-settings-wizard-set-lang.conf
15 DESTINATION share/upstart/sessions)
16
17 set(POLKIT_LIB_DIR "${CMAKE_INSTALL_LOCALSTATEDIR}/lib/polkit-1")
18
19=== modified file 'wizard/main.cpp'
20--- wizard/main.cpp 2014-07-03 14:04:32 +0000
21+++ wizard/main.cpp 2014-08-18 14:22:14 +0000
22@@ -22,18 +22,42 @@
23 #include <QDebug>
24 #include <QGuiApplication>
25 #include <QLibrary>
26+#include <QObject>
27 #include <QProcess>
28 #include <QQmlContext>
29 #include <QQmlEngine>
30+#include <QQuickItem>
31 #include <QQuickView>
32 #include <QTimer>
33
34 #include "PageList.h"
35
36-void quitViaUpstart()
37+class SignalHandler : public QObject
38 {
39- QProcess::startDetached("initctl start ubuntu-system-settings-wizard-cleanup");
40-}
41+ Q_OBJECT
42+
43+public:
44+ static SignalHandler *instance()
45+ {
46+ static SignalHandler instance_;
47+ return &instance_;
48+ }
49+
50+public Q_SLOTS:
51+ void handleLanguageUpdate()
52+ {
53+ QProcess::startDetached("sh -c \"initctl start ubuntu-system-settings-wizard-set-lang; initctl emit --no-wait indicator-services-start; initctl start --no-wait maliit-server\"");
54+ }
55+
56+ void handleQuit()
57+ {
58+ QProcess::startDetached("initctl start ubuntu-system-settings-wizard-cleanup");
59+ }
60+
61+private:
62+ SignalHandler() {}
63+ Q_DISABLE_COPY(SignalHandler)
64+};
65
66 int main(int argc, const char *argv[])
67 {
68@@ -69,7 +93,10 @@
69 view->setSource(QUrl(rootDir + "/qml/main.qml"));
70 view->setColor("transparent");
71
72- QObject::connect(view->engine(), &QQmlEngine::quit, quitViaUpstart);
73+ QObject::connect(view->rootObject(), SIGNAL(updateLanguage()),
74+ SignalHandler::instance(), SLOT(handleLanguageUpdate()));
75+ QObject::connect(view->engine(), &QQmlEngine::quit,
76+ SignalHandler::instance(), &SignalHandler::handleQuit);
77
78 if (isMirServer) {
79 view->showFullScreen();
80@@ -83,3 +110,5 @@
81 delete application;
82 return result;
83 }
84+
85+#include "main.moc"
86
87=== modified file 'wizard/qml/Pages/10-welcome.qml'
88--- wizard/qml/Pages/10-welcome.qml 2014-08-07 19:02:11 +0000
89+++ wizard/qml/Pages/10-welcome.qml 2014-08-18 14:22:14 +0000
90@@ -89,6 +89,7 @@
91 text: i18n.tr("Start")
92 onClicked: {
93 plugin.currentLanguage = languageList.selectedIndex
94+ root.updateLanguage()
95 if (manager.modems.length == 0 || simManager0.present || simManager1.present)
96 pageStack.next()
97 else
98
99=== modified file 'wizard/qml/main.qml'
100--- wizard/qml/main.qml 2014-08-06 19:36:06 +0000
101+++ wizard/qml/main.qml 2014-08-18 14:22:14 +0000
102@@ -33,6 +33,8 @@
103 property int passwordMethod: UbuntuSecurityPrivacyPanel.Swipe
104 property string password: ""
105
106+ signal updateLanguage()
107+
108 Component.onCompleted: {
109 Theme.name = "Ubuntu.Components.Themes.SuruGradient"
110 i18n.domain = "ubuntu-system-settings"
111
112=== modified file 'wizard/ubuntu-system-settings-wizard-cleanup.conf'
113--- wizard/ubuntu-system-settings-wizard-cleanup.conf 2014-08-06 19:18:13 +0000
114+++ wizard/ubuntu-system-settings-wizard-cleanup.conf 2014-08-18 14:22:14 +0000
115@@ -24,23 +24,6 @@
116 echo "Resetting MIR_SOCKET to $WIZARD_ORIG_MIR_SOCKET"
117 setenv MIR_SOCKET $WIZARD_ORIG_MIR_SOCKET
118 fi
119-
120- UID=$(id -u)
121-
122- # But do change upstart's ideas about locales
123- LANGUAGE=$(gdbus call --system --dest org.freedesktop.Accounts --object-path /org/freedesktop/Accounts/User$UID --method org.freedesktop.DBus.Properties.Get org.freedesktop.Accounts.User Language | cut -d\' -f2)
124- setenv LANGUAGE $LANGUAGE
125- echo "Set language for $USER_PATH as $LANGUAGE"
126- LOCALE=$(gdbus call --system --dest org.freedesktop.Accounts --object-path /org/freedesktop/Accounts/User$UID --method org.freedesktop.DBus.Properties.Get org.freedesktop.Accounts.User FormatsLocale | cut -d\' -f2)
127- setenv LC_ALL $LOCALE
128- setenv LANG $LOCALE
129- echo "Set locale as $LOCALE"
130-
131- # Stop any indicators so they will be restarted with new environment
132- initctl emit indicator-services-end
133-
134- # Stop maliit-server, since it needs to be restarted by unity8
135- stop maliit-server || true
136 end script
137
138 post-stop script
139
140=== added file 'wizard/ubuntu-system-settings-wizard-set-lang.conf'
141--- wizard/ubuntu-system-settings-wizard-set-lang.conf 1970-01-01 00:00:00 +0000
142+++ wizard/ubuntu-system-settings-wizard-set-lang.conf 2014-08-18 14:22:14 +0000
143@@ -0,0 +1,30 @@
144+description "Welcome to Ubuntu Cleanup"
145+author "Michael Terry <michael.terry@canonical.com>"
146+
147+# This job updates the system idea of what language is configured. It adjusts
148+# the upstart env and the DBus activation env. It also stops indicators and
149+# the OSK so that they can be restarted with the new env.
150+
151+task
152+
153+script
154+ setenv() {
155+ initctl set-env --global $1=$2
156+ gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.UpdateActivationEnvironment "@a{ss} {'$1': '$2'}"
157+ }
158+
159+ UID=$(id -u)
160+
161+ # Change upstart's ideas about locales
162+ LANGUAGE=$(gdbus call --system --dest org.freedesktop.Accounts --object-path /org/freedesktop/Accounts/User$UID --method org.freedesktop.DBus.Properties.Get org.freedesktop.Accounts.User Language | cut -d\' -f2)
163+ setenv LANGUAGE $LANGUAGE
164+ echo "Set language for $USER_PATH as $LANGUAGE"
165+ LOCALE=$(gdbus call --system --dest org.freedesktop.Accounts --object-path /org/freedesktop/Accounts/User$UID --method org.freedesktop.DBus.Properties.Get org.freedesktop.Accounts.User FormatsLocale | cut -d\' -f2)
166+ setenv LC_ALL $LOCALE
167+ setenv LANG $LOCALE
168+ echo "Set locale as $LOCALE"
169+
170+ # Stop any indicators and OSK so they will be restarted with new environment
171+ initctl emit indicator-services-end
172+ stop maliit-server || true
173+end script
174
175=== modified file 'wizard/ubuntu-system-settings-wizard.conf'
176--- wizard/ubuntu-system-settings-wizard.conf 2014-08-13 16:46:37 +0000
177+++ wizard/ubuntu-system-settings-wizard.conf 2014-08-18 14:22:14 +0000
178@@ -39,11 +39,6 @@
179
180 exec system-settings-wizard
181
182-post-start script
183- initctl emit --no-wait indicator-services-start # for Wi-Fi page
184- start --no-wait maliit-server # for Wi-Fi page
185-end script
186-
187 post-stop script
188 rm -f "$XDG_RUNTIME_DIR/wizard_socket"
189 end script

Subscribers

People subscribed via source and target branches