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

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
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
Marco Trevisan (Treviño) Approve
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.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) :
review: Approve
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 :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'launcher/AbstractLauncherIcon.h'
--- launcher/AbstractLauncherIcon.h 2013-03-14 18:55:36 +0000
+++ launcher/AbstractLauncherIcon.h 2013-04-26 14:21:59 +0000
@@ -180,6 +180,7 @@
180 virtual float GetProgress() = 0;180 virtual float GetProgress() = 0;
181181
182 virtual bool ShowInSwitcher(bool current) = 0;182 virtual bool ShowInSwitcher(bool current) = 0;
183 virtual bool AllowDetailViewInSwitcher() const = 0;
183184
184 virtual unsigned long long SwitcherPriority() = 0;185 virtual unsigned long long SwitcherPriority() = 0;
185186
186187
=== modified file 'launcher/ApplicationLauncherIcon.cpp'
--- launcher/ApplicationLauncherIcon.cpp 2013-04-09 17:02:27 +0000
+++ launcher/ApplicationLauncherIcon.cpp 2013-04-26 14:21:59 +0000
@@ -1254,6 +1254,11 @@
1254 return result;1254 return result;
1255}1255}
12561256
1257bool ApplicationLauncherIcon::AllowDetailViewInSwitcher() const
1258{
1259 return app_->type() != "webapp";
1260}
1261
1257unsigned long long ApplicationLauncherIcon::SwitcherPriority()1262unsigned long long ApplicationLauncherIcon::SwitcherPriority()
1258{1263{
1259 unsigned long long result = 0;1264 unsigned long long result = 0;
12601265
=== modified file 'launcher/ApplicationLauncherIcon.h'
--- launcher/ApplicationLauncherIcon.h 2013-04-05 19:09:21 +0000
+++ launcher/ApplicationLauncherIcon.h 2013-04-26 14:21:59 +0000
@@ -60,6 +60,7 @@
60 virtual void UnStick();60 virtual void UnStick();
6161
62 virtual bool ShowInSwitcher(bool current);62 virtual bool ShowInSwitcher(bool current);
63 virtual bool AllowDetailViewInSwitcher() const override;
63 virtual unsigned long long SwitcherPriority();64 virtual unsigned long long SwitcherPriority();
6465
65 virtual nux::Color BackgroundColor() const;66 virtual nux::Color BackgroundColor() const;
6667
=== modified file 'launcher/LauncherIcon.h'
--- launcher/LauncherIcon.h 2013-03-18 12:57:00 +0000
+++ launcher/LauncherIcon.h 2013-04-26 14:21:59 +0000
@@ -119,6 +119,11 @@
119 return false;119 return false;
120 };120 };
121121
122 virtual bool AllowDetailViewInSwitcher() const override
123 {
124 return false;
125 }
126
122 virtual unsigned long long SwitcherPriority()127 virtual unsigned long long SwitcherPriority()
123 {128 {
124 return 0;129 return 0;
125130
=== modified file 'launcher/MockLauncherIcon.h'
--- launcher/MockLauncherIcon.h 2013-03-18 12:57:00 +0000
+++ launcher/MockLauncherIcon.h 2013-04-26 14:21:59 +0000
@@ -215,6 +215,11 @@
215 return true;215 return true;
216 }216 }
217217
218 bool AllowDetailViewInSwitcher() const override
219 {
220 return true;
221 }
222
218 void InsertEntryRemote(LauncherEntryRemote::Ptr const& remote) {}223 void InsertEntryRemote(LauncherEntryRemote::Ptr const& remote) {}
219224
220 void RemoveEntryRemote(LauncherEntryRemote::Ptr const& remote) {}225 void RemoveEntryRemote(LauncherEntryRemote::Ptr const& remote) {}
221226
=== modified file 'launcher/SwitcherController.cpp'
--- launcher/SwitcherController.cpp 2013-03-19 18:47:01 +0000
+++ launcher/SwitcherController.cpp 2013-04-26 14:21:59 +0000
@@ -533,13 +533,13 @@
533533
534void Controller::Impl::SetDetail(bool value, unsigned int min_windows)534void Controller::Impl::SetDetail(bool value, unsigned int min_windows)
535{535{
536 if (value && model_->DetailXids().size() >= min_windows)536 if (value && model_->Selection()->AllowDetailViewInSwitcher() && model_->DetailXids().size() >= min_windows)
537 {537 {
538 model_->detail_selection = true;538 model_->detail_selection = true;
539 obj_->detail_mode_ = DetailMode::TAB_NEXT_WINDOW;539 obj_->detail_mode_ = DetailMode::TAB_NEXT_WINDOW;
540 }540 }
541 else541 else
542 {542 {
543 model_->detail_selection = false;543 model_->detail_selection = false;
544 }544 }
545}545}
546546
=== modified file 'tests/mock-application.h'
--- tests/mock-application.h 2013-03-06 16:38:17 +0000
+++ tests/mock-application.h 2013-04-26 14:21:59 +0000
@@ -84,6 +84,7 @@
84 , active_(false)84 , active_(false)
85 , running_(false)85 , running_(false)
86 , urgent_(false)86 , urgent_(false)
87 , type_("mock")
87 {88 {
88 seen.SetGetterFunction(sigc::mem_fun(this, &MockApplication::GetSeen));89 seen.SetGetterFunction(sigc::mem_fun(this, &MockApplication::GetSeen));
89 seen.SetSetterFunction(sigc::mem_fun(this, &MockApplication::SetSeen));90 seen.SetSetterFunction(sigc::mem_fun(this, &MockApplication::SetSeen));
@@ -105,12 +106,13 @@
105 bool running_;106 bool running_;
106 bool urgent_;107 bool urgent_;
107 unity::WindowList windows_;108 unity::WindowList windows_;
109 std::string type_;
108110
109111
110 virtual std::string icon() const { return icon_; }112 virtual std::string icon() const { return icon_; }
111 virtual std::string title() const { return title_; }113 virtual std::string title() const { return title_; }
112 virtual std::string desktop_file() const { return desktop_file_; }114 virtual std::string desktop_file() const { return desktop_file_; }
113 virtual std::string type() const { return "mock"; }115 virtual std::string type() const { return type_; }
114 virtual std::string repr() const { return "MockApplication"; }116 virtual std::string repr() const { return "MockApplication"; }
115117
116 virtual unity::WindowList GetWindows() const { return windows_; }118 virtual unity::WindowList GetWindows() const { return windows_; }
117119
=== modified file 'tests/test_application_launcher_icon.cpp'
--- tests/test_application_launcher_icon.cpp 2013-04-08 18:19:46 +0000
+++ tests/test_application_launcher_icon.cpp 2013-04-26 14:21:59 +0000
@@ -525,4 +525,13 @@
525 EXPECT_TRUE(icon->IsFileManager());525 EXPECT_TRUE(icon->IsFileManager());
526}526}
527527
528TEST_F(TestApplicationLauncherIcon, AllowDetailViewInSwitcher)
529{
530 mock_app->type_ = "mock";
531 EXPECT_TRUE(mock_icon->AllowDetailViewInSwitcher());
532
533 mock_app->type_ = "webapp";
534 EXPECT_FALSE(mock_icon->AllowDetailViewInSwitcher());
535}
536
528}537}
529538
=== modified file 'tests/test_switcher_controller.cpp'
--- tests/test_switcher_controller.cpp 2013-03-19 01:13:43 +0000
+++ tests/test_switcher_controller.cpp 2013-04-26 14:21:59 +0000
@@ -63,6 +63,21 @@
63 EXPECT_LT(model->detail_selection.changed.size(), prev_size);63 EXPECT_LT(model->detail_selection.changed.size(), prev_size);
64}64}
6565
66TEST_F(TestSwitcherController, InitiateDetailWebapps)
67{
68 controller_->Show(ShowMode::ALL, SortMode::LAUNCHER_ORDER, icons_);
69
70 controller_->Select(3);
71 controller_->InitiateDetail();
72
73 auto const& view = controller_->GetView();
74 auto const& model = view->GetModel();
75 EXPECT_EQ(controller_->detail_mode(), DetailMode::TAB_NEXT_TILE);
76 EXPECT_FALSE(view->animate());
77 EXPECT_FALSE(model->detail_selection());
78}
79
80
66TEST_F(TestSwitcherController, ShowSwitcher)81TEST_F(TestSwitcherController, ShowSwitcher)
67{82{
68 EXPECT_FALSE(controller_->Visible());83 EXPECT_FALSE(controller_->Visible());
6984
=== modified file 'tests/test_switcher_controller.h'
--- tests/test_switcher_controller.h 2013-03-19 01:13:43 +0000
+++ tests/test_switcher_controller.h 2013-04-26 14:21:59 +0000
@@ -72,12 +72,14 @@
72class FakeLauncherIcon : public unity::launcher::SimpleLauncherIcon72class FakeLauncherIcon : public unity::launcher::SimpleLauncherIcon
73{73{
74public:74public:
75 FakeLauncherIcon(std::string const& app_name, unsigned priority);75 FakeLauncherIcon(std::string const& app_name, bool allow_detail_view, unsigned priority);
7676
77 unity::WindowList Windows();77 unity::WindowList Windows()override;
78 unsigned long long SwitcherPriority();78 bool AllowDetailViewInSwitcher() const override;
79 unsigned long long SwitcherPriority() override;
7980
80private:81private:
82 bool allow_detail_view_;
81 unsigned priority_;83 unsigned priority_;
82 unity::WindowList window_list;84 unity::WindowList window_list;
83};85};
8486
=== modified file 'tests/test_switcher_controller_class.cpp'
--- tests/test_switcher_controller_class.cpp 2013-03-19 01:13:43 +0000
+++ tests/test_switcher_controller_class.cpp 2013-04-26 14:21:59 +0000
@@ -37,8 +37,9 @@
37bool FakeApplicationWindow::Focus() const { return false; }37bool FakeApplicationWindow::Focus() const { return false; }
38void FakeApplicationWindow::Quit() const {}38void FakeApplicationWindow::Quit() const {}
3939
40FakeLauncherIcon::FakeLauncherIcon(std::string const& app_name, unsigned priority)40FakeLauncherIcon::FakeLauncherIcon(std::string const& app_name, bool allow_detail_view, unsigned priority)
41 : launcher::SimpleLauncherIcon(IconType::APPLICATION)41 : launcher::SimpleLauncherIcon(IconType::APPLICATION)
42 , allow_detail_view_(allow_detail_view)
42 , priority_(priority)43 , priority_(priority)
43 , window_list{ std::make_shared<FakeApplicationWindow>(priority_ | 0x0001),44 , window_list{ std::make_shared<FakeApplicationWindow>(priority_ | 0x0001),
44 std::make_shared<FakeApplicationWindow>(priority_ | 0x0002) }45 std::make_shared<FakeApplicationWindow>(priority_ | 0x0002) }
@@ -51,6 +52,11 @@
51 return window_list;52 return window_list;
52}53}
5354
55bool FakeLauncherIcon::AllowDetailViewInSwitcher() const
56{
57 return allow_detail_view_;
58}
59
54unsigned long long FakeLauncherIcon::SwitcherPriority()60unsigned long long FakeLauncherIcon::SwitcherPriority()
55{61{
56 return 0xffffffff - priority_;62 return 0xffffffff - priority_;
@@ -74,8 +80,10 @@
7480
75 icons_.push_back(launcher::AbstractLauncherIcon::Ptr(new launcher::DesktopLauncherIcon()));81 icons_.push_back(launcher::AbstractLauncherIcon::Ptr(new launcher::DesktopLauncherIcon()));
7682
77 FakeLauncherIcon* first_app = new FakeLauncherIcon("First", 0x0100);83 FakeLauncherIcon* first_app = new FakeLauncherIcon("First", true, 0x0100);
78 icons_.push_back(launcher::AbstractLauncherIcon::Ptr(first_app));84 icons_.push_back(launcher::AbstractLauncherIcon::Ptr(first_app));
79 FakeLauncherIcon* second_app = new FakeLauncherIcon("Second", 0x0200);85 FakeLauncherIcon* second_app = new FakeLauncherIcon("Second", true, 0x0200);
80 icons_.push_back(launcher::AbstractLauncherIcon::Ptr(second_app));86 icons_.push_back(launcher::AbstractLauncherIcon::Ptr(second_app));
87 FakeLauncherIcon* third_app = new FakeLauncherIcon("Third", false, 0x0300);
88 icons_.push_back(launcher::AbstractLauncherIcon::Ptr(third_app));
81}89}

Subscribers

People subscribed via source and target branches

to all changes: