Merge lp:~didrocks/unity/launcher-addons into lp:unity

Proposed by Didier Roche on 2011-03-24
Status: Merged
Merged at revision: 1017
Proposed branch: lp:~didrocks/unity/launcher-addons
Merge into: lp:unity
Diff against target: 207 lines (+64/-11)
7 files modified
src/BamfLauncherIcon.cpp (+17/-0)
src/BamfLauncherIcon.h (+1/-0)
src/Launcher.cpp (+30/-10)
src/Launcher.h (+1/-0)
src/LauncherController.cpp (+13/-0)
src/LauncherController.h (+1/-0)
src/LauncherIcon.cpp (+1/-1)
To merge this branch: bzr merge lp:~didrocks/unity/launcher-addons
Reviewer Review Type Date Requested Status
Jason Smith (community) 2011-03-24 Approve on 2011-03-24
Review via email: mp+54635@code.launchpad.net

Description of the change

This small branch should:
Fix tooltip not drawn when getting special characters (LP: #740907)
Drag an application icon on the trash should unstick it (LP: #676466)
expands the icons on super and keynav (LP: #741319) with a basic launcher drag
move with keys (no animation yet, will be integrated properly later)

To post a comment you must log in.
Jason Smith (jassmith) wrote :

+1 code looks good

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/BamfLauncherIcon.cpp'
2--- src/BamfLauncherIcon.cpp 2011-03-23 18:26:24 +0000
3+++ src/BamfLauncherIcon.cpp 2011-03-24 01:21:33 +0000
4@@ -651,6 +651,23 @@
5 }
6
7 void
8+BamfLauncherIcon::UnStick (void)
9+{
10+ BamfView *view = BAMF_VIEW (this->m_App);
11+
12+ if (!bamf_view_is_sticky (view))
13+ return;
14+
15+ const gchar *desktop_file = bamf_application_get_desktop_file (this->m_App);
16+ bamf_view_set_sticky (view, false);
17+ if (bamf_view_is_closed (view))
18+ this->Remove ();
19+
20+ if (desktop_file && strlen (desktop_file) > 0)
21+ FavoriteStore::GetDefault ()->RemoveFavorite (desktop_file);
22+}
23+
24+void
25 BamfLauncherIcon::OnTogglePin (DbusmenuMenuitem *item, int time, BamfLauncherIcon *self)
26 {
27 BamfView *view = BAMF_VIEW (self->m_App);
28
29=== modified file 'src/BamfLauncherIcon.h'
30--- src/BamfLauncherIcon.h 2011-03-23 18:20:22 +0000
31+++ src/BamfLauncherIcon.h 2011-03-24 01:21:33 +0000
32@@ -41,6 +41,7 @@
33
34 const char* DesktopFile ();
35 bool IsSticky ();
36+ void UnStick ();
37
38 void ActivateLauncherIcon ();
39
40
41=== modified file 'src/Launcher.cpp'
42--- src/Launcher.cpp 2011-03-23 19:44:00 +0000
43+++ src/Launcher.cpp 2011-03-24 01:21:33 +0000
44@@ -539,6 +539,7 @@
45
46 GrabKeyboard ();
47 GrabPointer ();
48+ EnsureHoverState ();
49
50 // FIXME: long term solution is to rewrite the keynav handle
51 if (_focus_keynav_handle > 0)
52@@ -598,6 +599,7 @@
53 _current_icon_index = -1;
54 _last_icon_index = _current_icon_index;
55 QueueDraw ();
56+ EnsureHoverState ();
57 ubus_server_send_message (ubus_server_get_default (),
58 UBUS_LAUNCHER_END_KEY_NAV,
59 NULL);
60@@ -1387,6 +1389,7 @@
61 _hide_machine->SetQuirk (LauncherHideMachine::TRIGGER_BUTTON_DOWN, true);
62 _hide_machine->SetQuirk (LauncherHideMachine::LAST_ACTION_ACTIVATE, false);
63 QueueDraw ();
64+ EnsureHoverState ();
65 SetTimeStruct (&_times[TIME_TAP_SUPER], NULL, SUPER_TAP_DURATION);
66 if (_redraw_handle > 0)
67 g_source_remove (_redraw_handle);
68@@ -1398,6 +1401,7 @@
69
70 _hide_machine->SetQuirk (LauncherHideMachine::TRIGGER_BUTTON_DOWN, false);
71 QueueDraw ();
72+ EnsureHoverState ();
73
74 // it's a tap on super
75 if (TapOnSuper ())
76@@ -1764,6 +1768,7 @@
77 Launcher::EnsureHoverState ()
78 {
79 if (_hide_machine->GetQuirk (LauncherHideMachine::MOUSE_OVER_LAUNCHER) || _hide_machine->GetQuirk (LauncherHideMachine::MOUSE_OVER_BFB) ||
80+ _hide_machine->GetQuirk (LauncherHideMachine::TRIGGER_BUTTON_DOWN) || _hide_machine->GetQuirk (LauncherHideMachine::KEY_NAV_ACTIVE) ||
81 QuicklistManager::Default ()->Current() || GetActionState () != ACTION_NONE)
82 {
83 SetHover ();
84@@ -2543,9 +2548,20 @@
85 {
86 if (_drag_window)
87 {
88- _drag_window->SetAnimationTarget ((int) (_drag_icon->GetCenter ().x), (int) (_drag_icon->GetCenter ().y));
89- _drag_window->StartAnimation ();
90- _drag_window->anim_completed.connect (sigc::mem_fun (this, &Launcher::OnDragWindowAnimCompleted));
91+ LauncherIcon* hovered_icon = MouseIconIntersection (_mouse_position.x, _mouse_position.y);
92+
93+ if(hovered_icon && hovered_icon->Type () == LauncherIcon::TYPE_TRASH)
94+ {
95+ launcher_removerequest.emit (_drag_icon);
96+ _drag_window->ShowWindow (false);
97+ EnsureAnimation ();
98+ }
99+ else
100+ {
101+ _drag_window->SetAnimationTarget ((int) (_drag_icon->GetCenter ().x), (int) (_drag_icon->GetCenter ().y));
102+ _drag_window->StartAnimation ();
103+ _drag_window->anim_completed.connect (sigc::mem_fun (this, &Launcher::OnDragWindowAnimCompleted));
104+ }
105 }
106
107 if (MouseBeyondDragThreshold ())
108@@ -2785,11 +2801,13 @@
109 it = _model->at (temp_current_icon_index );
110 }while (it != (LauncherModel::iterator)NULL && !(*it)->GetQuirk (LauncherIcon::QUIRK_VISIBLE));
111
112- if (it != (LauncherModel::iterator)NULL)
113- _current_icon_index = temp_current_icon_index;
114+ if (it != (LauncherModel::iterator)NULL) {
115+ _current_icon_index = temp_current_icon_index;
116+ _launcher_drag_delta += (_icon_size + _space_between_icons);
117+ }
118+ EnsureAnimation ();
119+ selection_change.emit ();
120 }
121- EnsureAnimation ();
122- selection_change.emit ();
123 break;
124
125 // down (move selection down and unfold launcher if needed)
126@@ -2804,9 +2822,11 @@
127 it = _model->at (temp_current_icon_index );
128 }while (it != (LauncherModel::iterator)NULL && !(*it)->GetQuirk (LauncherIcon::QUIRK_VISIBLE));
129
130- if (it != (LauncherModel::iterator)NULL)
131- _current_icon_index = temp_current_icon_index;
132-
133+ if (it != (LauncherModel::iterator)NULL) {
134+ _current_icon_index = temp_current_icon_index;
135+ _launcher_drag_delta -= (_icon_size + _space_between_icons);
136+ }
137+
138 EnsureAnimation ();
139 selection_change.emit ();
140 }
141
142=== modified file 'src/Launcher.h'
143--- src/Launcher.h 2011-03-22 16:57:04 +0000
144+++ src/Launcher.h 2011-03-24 01:21:33 +0000
145@@ -163,6 +163,7 @@
146 void EnableCheckWindowOverLauncher (gboolean enabled);
147
148 sigc::signal<void, char *, LauncherIcon *> launcher_addrequest;
149+ sigc::signal<void, LauncherIcon *> launcher_removerequest;
150 sigc::signal<void> selection_change;
151 protected:
152 // Introspectable methods
153
154=== modified file 'src/LauncherController.cpp'
155--- src/LauncherController.cpp 2011-03-16 16:29:02 +0000
156+++ src/LauncherController.cpp 2011-03-24 01:21:33 +0000
157@@ -39,6 +39,7 @@
158
159 _launcher->SetModel (_model);
160 _launcher->launcher_addrequest.connect (sigc::mem_fun (this, &LauncherController::OnLauncherAddRequest));
161+ _launcher->launcher_removerequest.connect (sigc::mem_fun (this, &LauncherController::OnLauncherRemoveRequest));
162 _favorite_store = FavoriteStore::GetDefault ();
163
164 _place_section = new PlaceLauncherSection (_launcher);
165@@ -137,6 +138,18 @@
166 }
167
168 void
169+LauncherController::OnLauncherRemoveRequest (LauncherIcon *icon)
170+{
171+ BamfLauncherIcon *bamf_icon = dynamic_cast<BamfLauncherIcon *> (icon);
172+
173+ // we only handle bamf Icon removal request for now.
174+ if (!bamf_icon)
175+ return;
176+
177+ bamf_icon->UnStick ();
178+}
179+
180+void
181 LauncherController::OnLauncerEntryRemoteAdded (LauncherEntryRemote *entry)
182 {
183 LauncherModel::iterator it;
184
185=== modified file 'src/LauncherController.h'
186--- src/LauncherController.h 2011-03-15 16:26:27 +0000
187+++ src/LauncherController.h 2011-03-24 01:21:33 +0000
188@@ -70,6 +70,7 @@
189 void OnIconAdded (LauncherIcon *icon);
190
191 void OnLauncherAddRequest (char *path, LauncherIcon *before);
192+ void OnLauncherRemoveRequest (LauncherIcon *icon);
193
194 void OnLauncerEntryRemoteAdded (LauncherEntryRemote *entry);
195 void OnLauncerEntryRemoteRemoved (LauncherEntryRemote *entry);
196
197=== modified file 'src/LauncherIcon.cpp'
198--- src/LauncherIcon.cpp 2011-03-23 19:21:46 +0000
199+++ src/LauncherIcon.cpp 2011-03-24 01:21:33 +0000
200@@ -332,7 +332,7 @@
201
202 void LauncherIcon::SetTooltipText(const TCHAR* text)
203 {
204- m_TooltipText = text;
205+ m_TooltipText = g_markup_escape_text (text, -1);
206 _tooltip->SetText (m_TooltipText);
207 }
208