Merge lp:~azzar1/unity/fix-914018 into lp:unity

Proposed by Andrea Azzarone
Status: Merged
Approved by: Jay Taoko
Approved revision: no longer in the source branch.
Merged at revision: 1852
Proposed branch: lp:~azzar1/unity/fix-914018
Merge into: lp:unity
Diff against target: 61 lines (+10/-3)
2 files modified
plugins/unityshell/src/LauncherController.cpp (+9/-2)
plugins/unityshell/src/LauncherModel.cpp (+1/-1)
To merge this branch: bzr merge lp:~azzar1/unity/fix-914018
Reviewer Review Type Date Requested Status
Marco Biscaro (community) Approve
Unity Team Pending
Review via email: mp+88015@code.launchpad.net

Description of the change

Updates launcher icons shortcuts when removing icons from launcher.

To post a comment you must log in.
Revision history for this message
Marco Biscaro (marcobiscaro2112) wrote :

+ std::cout << "OnIconRemoved" << std::endl;

This should not be here, right? But the code looks good.

review: Needs Fixing
Revision history for this message
Marco Biscaro (marcobiscaro2112) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/LauncherController.cpp'
2--- plugins/unityshell/src/LauncherController.cpp 2012-01-07 17:09:23 +0000
3+++ plugins/unityshell/src/LauncherController.cpp 2012-01-10 15:31:27 +0000
4@@ -65,6 +65,7 @@
5 void SortAndUpdate();
6
7 void OnIconAdded(LauncherIcon* icon);
8+ void OnIconRemoved(LauncherIcon* icon);
9
10 void OnLauncherAddRequest(char* path, LauncherIcon* before);
11 void OnLauncherRemoveRequest(LauncherIcon* icon);
12@@ -211,7 +212,7 @@
13 if (before)
14 model_->ReorderBefore(result, before, false);
15 }
16-
17+
18 Save();
19 }
20
21@@ -263,6 +264,11 @@
22 this->RegisterIcon(icon);
23 }
24
25+void Controller::Impl::OnIconRemoved(LauncherIcon* icon)
26+{
27+ SortAndUpdate();
28+}
29+
30 void Controller::Impl::OnLauncherRemoveRequest(LauncherIcon* icon)
31 {
32 switch (icon->Type())
33@@ -450,7 +456,7 @@
34 BamfApplication* app;
35 BamfLauncherIcon* icon;
36
37- // Sufficiently large number such that we ensure proper sorting
38+ // Sufficiently large number such that we ensure proper sorting
39 // (avoids case where first item gets tacked onto end rather than start)
40 int priority = 100;
41
42@@ -489,6 +495,7 @@
43 SortAndUpdate();
44
45 model_->order_changed.connect(sigc::mem_fun(this, &Impl::SortAndUpdate));
46+ model_->icon_removed.connect(sigc::mem_fun(this, &Impl::OnIconRemoved));
47 model_->saved.connect(sigc::mem_fun(this, &Impl::Save));
48 bamf_timer_handler_id_ = 0;
49 }
50
51=== modified file 'plugins/unityshell/src/LauncherModel.cpp'
52--- plugins/unityshell/src/LauncherModel.cpp 2011-10-05 23:55:59 +0000
53+++ plugins/unityshell/src/LauncherModel.cpp 2012-01-10 15:31:27 +0000
54@@ -163,7 +163,7 @@
55 {
56 iterator it;
57 iterator end;
58-
59+
60 if (icon && icon->Type() == AbstractLauncherIcon::TYPE_DEVICE)
61 return true;
62