Merge lp:~azzar1/unity/lp-1169340 into lp:unity/7.0

Proposed by Marco Trevisan (Treviño) on 2013-04-26
Status: Merged
Approved by: Marco Trevisan (Treviño) on 2013-04-26
Approved revision: 3303
Merged at revision: 3314
Proposed branch: lp:~azzar1/unity/lp-1169340
Merge into: lp:unity/7.0
Diff against target: 224 lines (+62/-9)
11 files modified
launcher/AbstractLauncherIcon.h (+1/-0)
launcher/ApplicationLauncherIcon.cpp (+5/-0)
launcher/ApplicationLauncherIcon.h (+1/-0)
launcher/LauncherIcon.h (+5/-0)
launcher/MockLauncherIcon.h (+5/-0)
launcher/SwitcherController.cpp (+2/-2)
tests/mock-application.h (+3/-1)
tests/test_application_launcher_icon.cpp (+9/-0)
tests/test_switcher_controller.cpp (+15/-0)
tests/test_switcher_controller.h (+5/-3)
tests/test_switcher_controller_class.cpp (+11/-3)
To merge this branch: bzr merge lp:~azzar1/unity/lp-1169340
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve on 2013-04-26
Marco Trevisan (Treviño) Approve on 2013-04-26
Review via email: mp+161152@code.launchpad.net

Commit message

Disable detail view for webapp icons.

Description of the change

To post a comment you must log in.
review: Approve
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'launcher/AbstractLauncherIcon.h'
2--- launcher/AbstractLauncherIcon.h 2013-03-14 18:55:36 +0000
3+++ launcher/AbstractLauncherIcon.h 2013-04-26 14:21:59 +0000
4@@ -180,6 +180,7 @@
5 virtual float GetProgress() = 0;
6
7 virtual bool ShowInSwitcher(bool current) = 0;
8+ virtual bool AllowDetailViewInSwitcher() const = 0;
9
10 virtual unsigned long long SwitcherPriority() = 0;
11
12
13=== modified file 'launcher/ApplicationLauncherIcon.cpp'
14--- launcher/ApplicationLauncherIcon.cpp 2013-04-09 17:02:27 +0000
15+++ launcher/ApplicationLauncherIcon.cpp 2013-04-26 14:21:59 +0000
16@@ -1254,6 +1254,11 @@
17 return result;
18 }
19
20+bool ApplicationLauncherIcon::AllowDetailViewInSwitcher() const
21+{
22+ return app_->type() != "webapp";
23+}
24+
25 unsigned long long ApplicationLauncherIcon::SwitcherPriority()
26 {
27 unsigned long long result = 0;
28
29=== modified file 'launcher/ApplicationLauncherIcon.h'
30--- launcher/ApplicationLauncherIcon.h 2013-04-05 19:09:21 +0000
31+++ launcher/ApplicationLauncherIcon.h 2013-04-26 14:21:59 +0000
32@@ -60,6 +60,7 @@
33 virtual void UnStick();
34
35 virtual bool ShowInSwitcher(bool current);
36+ virtual bool AllowDetailViewInSwitcher() const override;
37 virtual unsigned long long SwitcherPriority();
38
39 virtual nux::Color BackgroundColor() const;
40
41=== modified file 'launcher/LauncherIcon.h'
42--- launcher/LauncherIcon.h 2013-03-18 12:57:00 +0000
43+++ launcher/LauncherIcon.h 2013-04-26 14:21:59 +0000
44@@ -119,6 +119,11 @@
45 return false;
46 };
47
48+ virtual bool AllowDetailViewInSwitcher() const override
49+ {
50+ return false;
51+ }
52+
53 virtual unsigned long long SwitcherPriority()
54 {
55 return 0;
56
57=== modified file 'launcher/MockLauncherIcon.h'
58--- launcher/MockLauncherIcon.h 2013-03-18 12:57:00 +0000
59+++ launcher/MockLauncherIcon.h 2013-04-26 14:21:59 +0000
60@@ -215,6 +215,11 @@
61 return true;
62 }
63
64+ bool AllowDetailViewInSwitcher() const override
65+ {
66+ return true;
67+ }
68+
69 void InsertEntryRemote(LauncherEntryRemote::Ptr const& remote) {}
70
71 void RemoveEntryRemote(LauncherEntryRemote::Ptr const& remote) {}
72
73=== modified file 'launcher/SwitcherController.cpp'
74--- launcher/SwitcherController.cpp 2013-03-19 18:47:01 +0000
75+++ launcher/SwitcherController.cpp 2013-04-26 14:21:59 +0000
76@@ -533,13 +533,13 @@
77
78 void Controller::Impl::SetDetail(bool value, unsigned int min_windows)
79 {
80- if (value && model_->DetailXids().size() >= min_windows)
81+ if (value && model_->Selection()->AllowDetailViewInSwitcher() && model_->DetailXids().size() >= min_windows)
82 {
83 model_->detail_selection = true;
84 obj_->detail_mode_ = DetailMode::TAB_NEXT_WINDOW;
85 }
86 else
87- {
88+ {
89 model_->detail_selection = false;
90 }
91 }
92
93=== modified file 'tests/mock-application.h'
94--- tests/mock-application.h 2013-03-06 16:38:17 +0000
95+++ tests/mock-application.h 2013-04-26 14:21:59 +0000
96@@ -84,6 +84,7 @@
97 , active_(false)
98 , running_(false)
99 , urgent_(false)
100+ , type_("mock")
101 {
102 seen.SetGetterFunction(sigc::mem_fun(this, &MockApplication::GetSeen));
103 seen.SetSetterFunction(sigc::mem_fun(this, &MockApplication::SetSeen));
104@@ -105,12 +106,13 @@
105 bool running_;
106 bool urgent_;
107 unity::WindowList windows_;
108+ std::string type_;
109
110
111 virtual std::string icon() const { return icon_; }
112 virtual std::string title() const { return title_; }
113 virtual std::string desktop_file() const { return desktop_file_; }
114- virtual std::string type() const { return "mock"; }
115+ virtual std::string type() const { return type_; }
116 virtual std::string repr() const { return "MockApplication"; }
117
118 virtual unity::WindowList GetWindows() const { return windows_; }
119
120=== modified file 'tests/test_application_launcher_icon.cpp'
121--- tests/test_application_launcher_icon.cpp 2013-04-08 18:19:46 +0000
122+++ tests/test_application_launcher_icon.cpp 2013-04-26 14:21:59 +0000
123@@ -525,4 +525,13 @@
124 EXPECT_TRUE(icon->IsFileManager());
125 }
126
127+TEST_F(TestApplicationLauncherIcon, AllowDetailViewInSwitcher)
128+{
129+ mock_app->type_ = "mock";
130+ EXPECT_TRUE(mock_icon->AllowDetailViewInSwitcher());
131+
132+ mock_app->type_ = "webapp";
133+ EXPECT_FALSE(mock_icon->AllowDetailViewInSwitcher());
134+}
135+
136 }
137
138=== modified file 'tests/test_switcher_controller.cpp'
139--- tests/test_switcher_controller.cpp 2013-03-19 01:13:43 +0000
140+++ tests/test_switcher_controller.cpp 2013-04-26 14:21:59 +0000
141@@ -63,6 +63,21 @@
142 EXPECT_LT(model->detail_selection.changed.size(), prev_size);
143 }
144
145+TEST_F(TestSwitcherController, InitiateDetailWebapps)
146+{
147+ controller_->Show(ShowMode::ALL, SortMode::LAUNCHER_ORDER, icons_);
148+
149+ controller_->Select(3);
150+ controller_->InitiateDetail();
151+
152+ auto const& view = controller_->GetView();
153+ auto const& model = view->GetModel();
154+ EXPECT_EQ(controller_->detail_mode(), DetailMode::TAB_NEXT_TILE);
155+ EXPECT_FALSE(view->animate());
156+ EXPECT_FALSE(model->detail_selection());
157+}
158+
159+
160 TEST_F(TestSwitcherController, ShowSwitcher)
161 {
162 EXPECT_FALSE(controller_->Visible());
163
164=== modified file 'tests/test_switcher_controller.h'
165--- tests/test_switcher_controller.h 2013-03-19 01:13:43 +0000
166+++ tests/test_switcher_controller.h 2013-04-26 14:21:59 +0000
167@@ -72,12 +72,14 @@
168 class FakeLauncherIcon : public unity::launcher::SimpleLauncherIcon
169 {
170 public:
171- FakeLauncherIcon(std::string const& app_name, unsigned priority);
172+ FakeLauncherIcon(std::string const& app_name, bool allow_detail_view, unsigned priority);
173
174- unity::WindowList Windows();
175- unsigned long long SwitcherPriority();
176+ unity::WindowList Windows()override;
177+ bool AllowDetailViewInSwitcher() const override;
178+ unsigned long long SwitcherPriority() override;
179
180 private:
181+ bool allow_detail_view_;
182 unsigned priority_;
183 unity::WindowList window_list;
184 };
185
186=== modified file 'tests/test_switcher_controller_class.cpp'
187--- tests/test_switcher_controller_class.cpp 2013-03-19 01:13:43 +0000
188+++ tests/test_switcher_controller_class.cpp 2013-04-26 14:21:59 +0000
189@@ -37,8 +37,9 @@
190 bool FakeApplicationWindow::Focus() const { return false; }
191 void FakeApplicationWindow::Quit() const {}
192
193-FakeLauncherIcon::FakeLauncherIcon(std::string const& app_name, unsigned priority)
194+FakeLauncherIcon::FakeLauncherIcon(std::string const& app_name, bool allow_detail_view, unsigned priority)
195 : launcher::SimpleLauncherIcon(IconType::APPLICATION)
196+ , allow_detail_view_(allow_detail_view)
197 , priority_(priority)
198 , window_list{ std::make_shared<FakeApplicationWindow>(priority_ | 0x0001),
199 std::make_shared<FakeApplicationWindow>(priority_ | 0x0002) }
200@@ -51,6 +52,11 @@
201 return window_list;
202 }
203
204+bool FakeLauncherIcon::AllowDetailViewInSwitcher() const
205+{
206+ return allow_detail_view_;
207+}
208+
209 unsigned long long FakeLauncherIcon::SwitcherPriority()
210 {
211 return 0xffffffff - priority_;
212@@ -74,8 +80,10 @@
213
214 icons_.push_back(launcher::AbstractLauncherIcon::Ptr(new launcher::DesktopLauncherIcon()));
215
216- FakeLauncherIcon* first_app = new FakeLauncherIcon("First", 0x0100);
217+ FakeLauncherIcon* first_app = new FakeLauncherIcon("First", true, 0x0100);
218 icons_.push_back(launcher::AbstractLauncherIcon::Ptr(first_app));
219- FakeLauncherIcon* second_app = new FakeLauncherIcon("Second", 0x0200);
220+ FakeLauncherIcon* second_app = new FakeLauncherIcon("Second", true, 0x0200);
221 icons_.push_back(launcher::AbstractLauncherIcon::Ptr(second_app));
222+ FakeLauncherIcon* third_app = new FakeLauncherIcon("Third", false, 0x0300);
223+ icons_.push_back(launcher::AbstractLauncherIcon::Ptr(third_app));
224 }

Subscribers

People subscribed via source and target branches

to all changes: