Merge lp:~larsu/unity8/per-profile-indicator-positions into lp:unity8

Proposed by Lars Karlitski
Status: Merged
Approved by: MichaƂ Sawicz
Approved revision: 415
Merged at revision: 548
Proposed branch: lp:~larsu/unity8/per-profile-indicator-positions
Merge into: lp:unity8
Diff against target: 135 lines (+18/-28)
6 files modified
Panel/Indicators/client/IndicatorsTree.qml (+2/-3)
plugins/Unity/Indicators/indicator.cpp (+8/-16)
plugins/Unity/Indicators/indicator.h (+1/-1)
plugins/Unity/Indicators/indicatorsmanager.cpp (+3/-1)
plugins/Unity/Indicators/qml/IndicatorBase.qml (+3/-4)
tests/plugins/Unity/Indicators/indicatorsmanagertest.cpp (+1/-3)
To merge this branch: bzr merge lp:~larsu/unity8/per-profile-indicator-positions
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Nick Dedekind (community) Approve
Review via email: mp+190472@code.launchpad.net

Commit message

Allow setting different indicator positions for different profiles

Description of the change

Allow setting different indicator positions for different profiles

The order of the indicators is different on the phone [1] and on the desktop [2].

[1] https://wiki.ubuntu.com/StatusBar
[2] https://wiki.ubuntu.com/MenuBar#System_status_menus_.28system_indicators.29

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

menuObjectPaths is used by IndicatorBase in the Indicators plugin to get the path. It's implicitly set by iterating over all the properties in the map.

I have a feeling we may need to support multiple profiles in the shell ("greeter" vs "phone") at some point. Maybe the profile should be a property on the IndicatorsModel.
But I guess this is OK for now, as long as the IndicatorBase issue is fixed.

Revision history for this message
Nick Dedekind (nick-dedekind) :
review: Needs Fixing
Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

> menuObjectPaths is used by IndicatorBase in the Indicators plugin to get the
> path. It's implicitly set by iterating over all the properties in the map.
>
> I have a feeling we may need to support multiple profiles in the shell
> ("greeter" vs "phone") at some point. Maybe the profile should be a property
> on the IndicatorsModel.
> But I guess this is OK for now, as long as the IndicatorBase issue is fixed.

my bad. i'm blind

Revision history for this message
Nick Dedekind (nick-dedekind) wrote :
review: Needs Fixing
Revision history for this message
Lars Karlitski (larsu) wrote :

Thanks for having a look. I fixed that place and also the test.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:415
http://jenkins.qa.ubuntu.com/job/unity8-ci/1379/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-saucy/4965
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-touch/2873
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-saucy/2245
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-amd64-ci/402
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1379
        deb: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1379/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-i386-ci/1378
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-saucy/1139
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/840
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/840/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2875
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2875/artifact/work/output/*zip*/output.zip
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/2388
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/2428

Click here to trigger a rebuild:
http://10.97.0.26:8080/job/unity8-ci/1379/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

LGTM

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
http://jenkins.qa.ubuntu.com/job/unity8-autolanding/701/
Executed test runs:
    FAILURE: http://s-jenkins:8080/job/generic-cleanup-mbs/3237/console
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/776
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/764
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/270
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-autolanding/87
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/87
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/87/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-autolanding/87
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/709
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/776
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/776/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/764
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/764/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/3391
    SUCCESS: http://s-jenkins:8080/job/touch-flash-device/1481

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
http://jenkins.qa.ubuntu.com/job/unity8-autolanding/715/
Executed test runs:
    SUCCESS: http://s-jenkins:8080/job/generic-cleanup-mbs/3259
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/834
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/822
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/294
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-autolanding/101
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/101
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/101/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-autolanding/101
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/751
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/834
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/834/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/822
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/822/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/3430
    SUCCESS: http://s-jenkins:8080/job/touch-flash-device/1519

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
http://jenkins.qa.ubuntu.com/job/unity8-autolanding/724/
Executed test runs:
    None: http://s-jenkins.ubuntu-ci:8080/job/generic-cleanup-mbs/3301/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/880
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/868
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/309
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-autolanding/110
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/110
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/110/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-autolanding/110
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/791
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/880
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/880/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/868
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/868/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/3469
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/1558

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
http://jenkins.qa.ubuntu.com/job/unity8-autolanding/732/
Executed test runs:
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/generic-cleanup-mbs/3324
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/896
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/879/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/318
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-autolanding/118
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/118
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/118/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-autolanding/118
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/807
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/896
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/896/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/879
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/879/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/3481/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/1570

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
http://jenkins.qa.ubuntu.com/job/unity8-autolanding/744/
Executed test runs:
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/generic-cleanup-mbs/3352
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/935
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/919/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/339
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-autolanding/130
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/130
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/130/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-autolanding/130
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/839
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/935
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/935/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/919
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/919/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/3515/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/1607

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
http://jenkins.qa.ubuntu.com/job/unity8-autolanding/756/
Executed test runs:
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/generic-cleanup-mbs/3370
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/984
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/968/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/369
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-autolanding/142
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/142
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/142/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-autolanding/142
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/882
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/984
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/984/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/968
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/968/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/3560/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/1663

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Panel/Indicators/client/IndicatorsTree.qml'
2--- Panel/Indicators/client/IndicatorsTree.qml 2013-10-02 09:38:06 +0000
3+++ Panel/Indicators/client/IndicatorsTree.qml 2013-10-11 20:22:29 +0000
4@@ -29,10 +29,9 @@
5
6 property string busName: unityModel.busName
7 property string actionsObjectPath
8- property var menuObjectPaths: undefined
9- readonly property string device: "phone"
10+ property string menuObjectPath
11
12- property string deviceMenuObjectPath: menuObjectPaths.hasOwnProperty(device) ? menuObjectPaths[device] : ""
13+ property string deviceMenuObjectPath: menuObjectPath
14
15 function start() {
16 }
17
18=== modified file 'plugins/Unity/Indicators/indicator.cpp'
19--- plugins/Unity/Indicators/indicator.cpp 2013-09-02 07:39:53 +0000
20+++ plugins/Unity/Indicators/indicator.cpp 2013-10-11 20:22:29 +0000
21@@ -31,32 +31,24 @@
22 {
23 }
24
25-void Indicator::init(const QString& busName, const QSettings& settings)
26+void Indicator::init(const QString &profile, const QString& busName, const QSettings& settings)
27 {
28 setId(settings.value("Indicator Service/Name").toString());
29- setPosition(settings.value("Indicator Service/Position", QVariant::fromValue(0)).toInt());
30+
31+ QVariant pos = settings.value(profile + "/Position");
32+ if (!pos.isValid())
33+ pos = settings.value("Indicator Service/Position", QVariant::fromValue(0));
34+ setPosition(pos.toInt());
35
36 QString actionObjectPath = settings.value("Indicator Service/ObjectPath").toString();
37-
38- QVariantMap mapMenuObjectPaths;
39- Q_FOREACH(const QString& childGroup, settings.childGroups())
40- {
41- if (childGroup == "Indicator Service")
42- continue;
43-
44- QString menuPath = childGroup+"/ObjectPath";
45- if (settings.contains(menuPath))
46- {
47- mapMenuObjectPaths[childGroup] = settings.value(menuPath).toString();
48- }
49- }
50+ QString menuObjectPath = settings.value(profile + "/ObjectPath").toString();
51
52 QVariantMap properties;
53 properties.clear();
54 properties.insert("busType", 1);
55 properties.insert("busName", busName);
56 properties.insert("actionsObjectPath", actionObjectPath);
57- properties.insert("menuObjectPaths", mapMenuObjectPaths);
58+ properties.insert("menuObjectPath", menuObjectPath);
59 setIndicatorProperties(properties);
60 }
61
62
63=== modified file 'plugins/Unity/Indicators/indicator.h'
64--- plugins/Unity/Indicators/indicator.h 2013-09-02 07:39:53 +0000
65+++ plugins/Unity/Indicators/indicator.h 2013-10-11 20:22:29 +0000
66@@ -35,7 +35,7 @@
67 Indicator(QObject *parent = 0);
68 virtual ~Indicator();
69
70- void init(const QString& busName, const QSettings& settings);
71+ void init(const QString &profile, const QString& busName, const QSettings& settings);
72
73 QString identifier() const;
74 int position() const;
75
76=== modified file 'plugins/Unity/Indicators/indicatorsmanager.cpp'
77--- plugins/Unity/Indicators/indicatorsmanager.cpp 2013-10-10 18:00:54 +0000
78+++ plugins/Unity/Indicators/indicatorsmanager.cpp 2013-10-11 20:22:29 +0000
79@@ -26,6 +26,8 @@
80
81 #include "paths.h"
82
83+const QString profile = "phone";
84+
85
86 class IndicatorsManager::IndicatorData
87 {
88@@ -298,7 +300,7 @@
89 Indicator::Ptr new_indicator(new Indicator(this));
90 data->m_indicator = new_indicator;
91 QSettings settings(data->m_fileInfo.absoluteFilePath(), QSettings::IniFormat, this);
92- new_indicator->init(data->m_fileInfo.fileName(), settings);
93+ new_indicator->init(profile, data->m_fileInfo.fileName(), settings);
94 return new_indicator;
95 }
96
97
98=== modified file 'plugins/Unity/Indicators/qml/IndicatorBase.qml'
99--- plugins/Unity/Indicators/qml/IndicatorBase.qml 2013-09-30 16:37:55 +0000
100+++ plugins/Unity/Indicators/qml/IndicatorBase.qml 2013-10-11 20:22:29 +0000
101@@ -24,16 +24,15 @@
102 Item {
103 id: indicatorItem
104
105- enabled: menuObjectPaths.hasOwnProperty(device)
106+ enabled: menuObjectPath != ""
107
108 //const
109 property string busName
110 property string actionsObjectPath
111- property var menuObjectPaths: undefined
112- readonly property string device: "phone"
113+ property string menuObjectPath
114 property string rootMenuType: "com.canonical.indicator.root"
115
116- property string deviceMenuObjectPath: menuObjectPaths.hasOwnProperty(device) ? menuObjectPaths[device] : ""
117+ property string deviceMenuObjectPath: menuObjectPath
118
119 property alias menuModel: cachedModel.model
120
121
122=== modified file 'tests/plugins/Unity/Indicators/indicatorsmanagertest.cpp'
123--- tests/plugins/Unity/Indicators/indicatorsmanagertest.cpp 2013-08-14 09:07:45 +0000
124+++ tests/plugins/Unity/Indicators/indicatorsmanagertest.cpp 2013-10-11 20:22:29 +0000
125@@ -80,9 +80,7 @@
126 QCOMPARE(props["busName"].toString(), QString("com.canonical.indicator.fake1"));
127 QCOMPARE(props["actionsObjectPath"].toString(), QString("/com/canonical/indicator/fake1"));
128
129- QVariantMap objectPaths = props["menuObjectPaths"].toMap();
130- QCOMPARE(objectPaths["phone"].toString(), QString("/com/canonical/indicator/fake1/phone"));
131- QCOMPARE(objectPaths["desktop"].toString(), QString("/com/canonical/indicator/fake1/desktop"));
132+ QCOMPARE(props["menuObjectPath"].toString(), QString("/com/canonical/indicator/fake1/phone"));
133 }
134
135 /*

Subscribers

People subscribed via source and target branches