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
=== modified file 'wizard/CMakeLists.txt'
--- wizard/CMakeLists.txt 2014-06-17 15:03:02 +0000
+++ wizard/CMakeLists.txt 2014-08-18 14:22:14 +0000
@@ -1,4 +1,5 @@
1include_directories(1include_directories(
2 ${CMAKE_CURRENT_BINARY_DIR}
2 ${Qt5Gui_PRIVATE_INCLUDE_DIRS}3 ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
3)4)
45
@@ -41,6 +42,7 @@
41install(TARGETS system-settings-wizard RUNTIME DESTINATION bin)42install(TARGETS system-settings-wizard RUNTIME DESTINATION bin)
42install(FILES ubuntu-system-settings-wizard.conf43install(FILES ubuntu-system-settings-wizard.conf
43 ubuntu-system-settings-wizard-cleanup.conf44 ubuntu-system-settings-wizard-cleanup.conf
45 ubuntu-system-settings-wizard-set-lang.conf
44 DESTINATION share/upstart/sessions)46 DESTINATION share/upstart/sessions)
4547
46set(POLKIT_LIB_DIR "${CMAKE_INSTALL_LOCALSTATEDIR}/lib/polkit-1")48set(POLKIT_LIB_DIR "${CMAKE_INSTALL_LOCALSTATEDIR}/lib/polkit-1")
4749
=== modified file 'wizard/main.cpp'
--- wizard/main.cpp 2014-07-03 14:04:32 +0000
+++ wizard/main.cpp 2014-08-18 14:22:14 +0000
@@ -22,18 +22,42 @@
22#include <QDebug>22#include <QDebug>
23#include <QGuiApplication>23#include <QGuiApplication>
24#include <QLibrary>24#include <QLibrary>
25#include <QObject>
25#include <QProcess>26#include <QProcess>
26#include <QQmlContext>27#include <QQmlContext>
27#include <QQmlEngine>28#include <QQmlEngine>
29#include <QQuickItem>
28#include <QQuickView>30#include <QQuickView>
29#include <QTimer>31#include <QTimer>
3032
31#include "PageList.h"33#include "PageList.h"
3234
33void quitViaUpstart()35class SignalHandler : public QObject
34{36{
35 QProcess::startDetached("initctl start ubuntu-system-settings-wizard-cleanup");37 Q_OBJECT
36}38
39public:
40 static SignalHandler *instance()
41 {
42 static SignalHandler instance_;
43 return &instance_;
44 }
45
46public Q_SLOTS:
47 void handleLanguageUpdate()
48 {
49 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\"");
50 }
51
52 void handleQuit()
53 {
54 QProcess::startDetached("initctl start ubuntu-system-settings-wizard-cleanup");
55 }
56
57private:
58 SignalHandler() {}
59 Q_DISABLE_COPY(SignalHandler)
60};
3761
38int main(int argc, const char *argv[])62int main(int argc, const char *argv[])
39{63{
@@ -69,7 +93,10 @@
69 view->setSource(QUrl(rootDir + "/qml/main.qml"));93 view->setSource(QUrl(rootDir + "/qml/main.qml"));
70 view->setColor("transparent");94 view->setColor("transparent");
7195
72 QObject::connect(view->engine(), &QQmlEngine::quit, quitViaUpstart);96 QObject::connect(view->rootObject(), SIGNAL(updateLanguage()),
97 SignalHandler::instance(), SLOT(handleLanguageUpdate()));
98 QObject::connect(view->engine(), &QQmlEngine::quit,
99 SignalHandler::instance(), &SignalHandler::handleQuit);
73100
74 if (isMirServer) {101 if (isMirServer) {
75 view->showFullScreen();102 view->showFullScreen();
@@ -83,3 +110,5 @@
83 delete application;110 delete application;
84 return result;111 return result;
85}112}
113
114#include "main.moc"
86115
=== modified file 'wizard/qml/Pages/10-welcome.qml'
--- wizard/qml/Pages/10-welcome.qml 2014-08-07 19:02:11 +0000
+++ wizard/qml/Pages/10-welcome.qml 2014-08-18 14:22:14 +0000
@@ -89,6 +89,7 @@
89 text: i18n.tr("Start")89 text: i18n.tr("Start")
90 onClicked: {90 onClicked: {
91 plugin.currentLanguage = languageList.selectedIndex91 plugin.currentLanguage = languageList.selectedIndex
92 root.updateLanguage()
92 if (manager.modems.length == 0 || simManager0.present || simManager1.present)93 if (manager.modems.length == 0 || simManager0.present || simManager1.present)
93 pageStack.next()94 pageStack.next()
94 else95 else
9596
=== modified file 'wizard/qml/main.qml'
--- wizard/qml/main.qml 2014-08-06 19:36:06 +0000
+++ wizard/qml/main.qml 2014-08-18 14:22:14 +0000
@@ -33,6 +33,8 @@
33 property int passwordMethod: UbuntuSecurityPrivacyPanel.Swipe33 property int passwordMethod: UbuntuSecurityPrivacyPanel.Swipe
34 property string password: ""34 property string password: ""
3535
36 signal updateLanguage()
37
36 Component.onCompleted: {38 Component.onCompleted: {
37 Theme.name = "Ubuntu.Components.Themes.SuruGradient"39 Theme.name = "Ubuntu.Components.Themes.SuruGradient"
38 i18n.domain = "ubuntu-system-settings"40 i18n.domain = "ubuntu-system-settings"
3941
=== modified file 'wizard/ubuntu-system-settings-wizard-cleanup.conf'
--- wizard/ubuntu-system-settings-wizard-cleanup.conf 2014-08-06 19:18:13 +0000
+++ wizard/ubuntu-system-settings-wizard-cleanup.conf 2014-08-18 14:22:14 +0000
@@ -24,23 +24,6 @@
24 echo "Resetting MIR_SOCKET to $WIZARD_ORIG_MIR_SOCKET"24 echo "Resetting MIR_SOCKET to $WIZARD_ORIG_MIR_SOCKET"
25 setenv MIR_SOCKET $WIZARD_ORIG_MIR_SOCKET25 setenv MIR_SOCKET $WIZARD_ORIG_MIR_SOCKET
26 fi26 fi
27
28 UID=$(id -u)
29
30 # But do change upstart's ideas about locales
31 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)
32 setenv LANGUAGE $LANGUAGE
33 echo "Set language for $USER_PATH as $LANGUAGE"
34 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)
35 setenv LC_ALL $LOCALE
36 setenv LANG $LOCALE
37 echo "Set locale as $LOCALE"
38
39 # Stop any indicators so they will be restarted with new environment
40 initctl emit indicator-services-end
41
42 # Stop maliit-server, since it needs to be restarted by unity8
43 stop maliit-server || true
44end script27end script
4528
46post-stop script29post-stop script
4730
=== added file 'wizard/ubuntu-system-settings-wizard-set-lang.conf'
--- wizard/ubuntu-system-settings-wizard-set-lang.conf 1970-01-01 00:00:00 +0000
+++ wizard/ubuntu-system-settings-wizard-set-lang.conf 2014-08-18 14:22:14 +0000
@@ -0,0 +1,30 @@
1description "Welcome to Ubuntu Cleanup"
2author "Michael Terry <michael.terry@canonical.com>"
3
4# This job updates the system idea of what language is configured. It adjusts
5# the upstart env and the DBus activation env. It also stops indicators and
6# the OSK so that they can be restarted with the new env.
7
8task
9
10script
11 setenv() {
12 initctl set-env --global $1=$2
13 gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.UpdateActivationEnvironment "@a{ss} {'$1': '$2'}"
14 }
15
16 UID=$(id -u)
17
18 # Change upstart's ideas about locales
19 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)
20 setenv LANGUAGE $LANGUAGE
21 echo "Set language for $USER_PATH as $LANGUAGE"
22 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)
23 setenv LC_ALL $LOCALE
24 setenv LANG $LOCALE
25 echo "Set locale as $LOCALE"
26
27 # Stop any indicators and OSK so they will be restarted with new environment
28 initctl emit indicator-services-end
29 stop maliit-server || true
30end script
031
=== modified file 'wizard/ubuntu-system-settings-wizard.conf'
--- wizard/ubuntu-system-settings-wizard.conf 2014-08-13 16:46:37 +0000
+++ wizard/ubuntu-system-settings-wizard.conf 2014-08-18 14:22:14 +0000
@@ -39,11 +39,6 @@
3939
40exec system-settings-wizard40exec system-settings-wizard
4141
42post-start script
43 initctl emit --no-wait indicator-services-start # for Wi-Fi page
44 start --no-wait maliit-server # for Wi-Fi page
45end script
46
47post-stop script42post-stop script
48 rm -f "$XDG_RUNTIME_DIR/wizard_socket"43 rm -f "$XDG_RUNTIME_DIR/wizard_socket"
49end script44end script

Subscribers

People subscribed via source and target branches