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

Proposed by Andrea Azzarone
Status: Merged
Approved by: Mirco Müller
Approved revision: no longer in the source branch.
Merged at revision: 1601
Proposed branch: lp:~azzar1/unity/fix-851619
Merge into: lp:unity
Diff against target: 66 lines (+23/-6)
3 files modified
plugins/unityshell/src/BamfLauncherIcon.cpp (+14/-0)
plugins/unityshell/src/BamfLauncherIcon.h (+1/-0)
plugins/unityshell/src/LauncherController.cpp (+8/-6)
To merge this branch: bzr merge lp:~azzar1/unity/fix-851619
Reviewer Review Type Date Requested Status
Mirco Müller (community) Approve
Review via email: mp+76600@code.launchpad.net

Description of the change

Gives feedback when dropping an icon that's already in the launcher, following design directives.

More info @ bug #851619

To post a comment you must log in.
Revision history for this message
Mirco Müller (macslow) wrote :

Works as described... approved.

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/BamfLauncherIcon.cpp'
2--- plugins/unityshell/src/BamfLauncherIcon.cpp 2011-09-19 16:36:21 +0000
3+++ plugins/unityshell/src/BamfLauncherIcon.cpp 2011-09-22 15:26:36 +0000
4@@ -777,6 +777,20 @@
5 g_list_free(children);
6 }
7
8+void BamfLauncherIcon::Stick()
9+{
10+ BamfView* view = BAMF_VIEW(m_App);
11+
12+ if (bamf_view_is_sticky(view))
13+ return;
14+
15+ const gchar* desktop_file = DesktopFile();
16+ bamf_view_set_sticky(view, true);
17+
18+ if (desktop_file && strlen(desktop_file) > 0)
19+ FavoriteStore::GetDefault().AddFavorite(desktop_file, -1);
20+}
21+
22 void BamfLauncherIcon::UnStick(void)
23 {
24 BamfView* view = BAMF_VIEW(this->m_App);
25
26=== modified file 'plugins/unityshell/src/BamfLauncherIcon.h'
27--- plugins/unityshell/src/BamfLauncherIcon.h 2011-09-08 11:04:17 +0000
28+++ plugins/unityshell/src/BamfLauncherIcon.h 2011-09-22 15:26:36 +0000
29@@ -41,6 +41,7 @@
30
31 const char* DesktopFile();
32 bool IsSticky();
33+ void Stick();
34 void UnStick();
35
36 void ActivateLauncherIcon(ActionArg arg);
37
38=== modified file 'plugins/unityshell/src/LauncherController.cpp'
39--- plugins/unityshell/src/LauncherController.cpp 2011-09-12 12:11:28 +0000
40+++ plugins/unityshell/src/LauncherController.cpp 2011-09-22 15:26:36 +0000
41@@ -73,17 +73,19 @@
42 delete _model;
43 }
44
45+
46 void
47 LauncherController::OnLauncherAddRequest(char* path, LauncherIcon* before)
48 {
49- std::list<BamfLauncherIcon*> launchers;
50- std::list<BamfLauncherIcon*>::iterator it;
51-
52- launchers = _model->GetSublist<BamfLauncherIcon> ();
53- for (it = launchers.begin(); it != launchers.end(); it++)
54+ for (auto it : _model->GetSublist<BamfLauncherIcon> ())
55 {
56- if (!g_strcmp0(path, (*it)->DesktopFile()))
57+ if (!g_strcmp0(path, it->DesktopFile()))
58+ {
59+ it->Stick();
60+ _model->ReorderBefore(it, before, false);
61+ Save();
62 return;
63+ }
64 }
65
66 LauncherIcon* result = CreateFavorite(path);