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

Proposed by Andrea Azzarone
Status: Merged
Approved by: Andrea Azzarone
Approved revision: no longer in the source branch.
Merged at revision: 1819
Proposed branch: lp:~azzar1/unity/fix-870143
Merge into: lp:unity
Diff against target: 59 lines (+11/-1)
4 files modified
plugins/unityshell/src/BamfLauncherIcon.cpp (+6/-1)
plugins/unityshell/src/BamfLauncherIcon.h (+1/-0)
plugins/unityshell/src/Launcher.cpp (+1/-0)
plugins/unityshell/src/LauncherController.cpp (+3/-0)
To merge this branch: bzr merge lp:~azzar1/unity/fix-870143
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
Sam Spilsbury (community) Needs Information
Review via email: mp+86469@code.launchpad.net

Description of the change

Quit a running application on drag and drop on trash icon.

To post a comment you must log in.
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

52 + BamfLauncherIcon* bamf_icon = dynamic_cast<BamfLauncherIcon*>(_drag_icon);

Ouch. Guess there's no way to work around that ?

review: Needs Information
Revision history for this message
Andrea Azzarone (azzar1) wrote :

> 52 + BamfLauncherIcon* bamf_icon =
> dynamic_cast<BamfLauncherIcon*>(_drag_icon);
>
> Ouch. Guess there's no way to work around that ?

Mmm, we can abstract it. I mean we can do something like that:

class LauncherIcon
{
...
virtual void OnDropOnTrash(); // Maybe we can choose a better name :)
}

then
class BamfLauncherIcon : public LauncherIcon
{
...
void OnDropOnTrash() { bla bla bla }
}

and
class DeviceLauncherIcon : public LauncherIcon
{
...
void OnDropOnTrash() { la la la la la la}
}

What do you think?

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Good for me.

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-12-14 01:47:53 +0000
3+++ plugins/unityshell/src/BamfLauncherIcon.cpp 2012-01-07 17:19:24 +0000
4@@ -850,10 +850,15 @@
5
6 void BamfLauncherIcon::OnQuit(DbusmenuMenuitem* item, int time, BamfLauncherIcon* self)
7 {
8+ self->Quit();
9+}
10+
11+void BamfLauncherIcon::Quit()
12+{
13 GList* children, *l;
14 BamfView* view;
15
16- children = bamf_view_get_children(BAMF_VIEW(self->m_App));
17+ children = bamf_view_get_children(BAMF_VIEW(m_App));
18
19 for (l = children; l; l = l->next)
20 {
21
22=== modified file 'plugins/unityshell/src/BamfLauncherIcon.h'
23--- plugins/unityshell/src/BamfLauncherIcon.h 2011-10-25 17:00:12 +0000
24+++ plugins/unityshell/src/BamfLauncherIcon.h 2012-01-07 17:19:24 +0000
25@@ -46,6 +46,7 @@
26
27 const char* DesktopFile();
28 bool IsSticky();
29+ void Quit();
30 void Stick();
31 void UnStick();
32
33
34=== modified file 'plugins/unityshell/src/Launcher.cpp'
35--- plugins/unityshell/src/Launcher.cpp 2011-12-19 20:20:22 +0000
36+++ plugins/unityshell/src/Launcher.cpp 2012-01-07 17:19:24 +0000
37@@ -2323,6 +2323,7 @@
38 hovered_icon->SetQuirk(LauncherIcon::QUIRK_PULSE_ONCE, true);
39
40 launcher_removerequest.emit(_drag_icon);
41+
42 _drag_window->ShowWindow(false);
43 EnsureAnimation();
44 }
45
46=== modified file 'plugins/unityshell/src/LauncherController.cpp'
47--- plugins/unityshell/src/LauncherController.cpp 2011-12-20 08:35:42 +0000
48+++ plugins/unityshell/src/LauncherController.cpp 2012-01-07 17:19:24 +0000
49@@ -272,7 +272,10 @@
50 BamfLauncherIcon* bamf_icon = dynamic_cast<BamfLauncherIcon*>(icon);
51
52 if (bamf_icon)
53+ {
54 bamf_icon->UnStick();
55+ bamf_icon->Quit();
56+ }
57
58 break;
59 }