Merge lp:~unity-team/unity/unity.launcher-icon-smart-pointers into lp:unity

Proposed by Jason Smith
Status: Merged
Approved by: Jason Smith
Approved revision: no longer in the source branch.
Merged at revision: 1963
Proposed branch: lp:~unity-team/unity/unity.launcher-icon-smart-pointers
Merge into: lp:unity
Diff against target: 2242 lines (+393/-320)
32 files modified
plugins/unityshell/src/AbstractLauncherIcon.cpp (+27/-0)
plugins/unityshell/src/AbstractLauncherIcon.h (+17/-6)
plugins/unityshell/src/BamfLauncherIcon.cpp (+4/-2)
plugins/unityshell/src/BamfLauncherIcon.h (+1/-0)
plugins/unityshell/src/DesktopLauncherIcon.cpp (+1/-0)
plugins/unityshell/src/DeviceLauncherSection.cpp (+2/-2)
plugins/unityshell/src/DeviceLauncherSection.h (+1/-1)
plugins/unityshell/src/IconTextureSource.cpp (+1/-0)
plugins/unityshell/src/IconTextureSource.h (+1/-0)
plugins/unityshell/src/Launcher.cpp (+53/-54)
plugins/unityshell/src/Launcher.h (+34/-34)
plugins/unityshell/src/LauncherController.cpp (+75/-83)
plugins/unityshell/src/LauncherController.h (+1/-1)
plugins/unityshell/src/LauncherIcon.cpp (+21/-8)
plugins/unityshell/src/LauncherIcon.h (+16/-1)
plugins/unityshell/src/LauncherModel.cpp (+18/-26)
plugins/unityshell/src/LauncherModel.h (+22/-22)
plugins/unityshell/src/MockLauncherIcon.h (+16/-1)
plugins/unityshell/src/SimpleLauncherIcon.cpp (+3/-1)
plugins/unityshell/src/SimpleLauncherIcon.h (+1/-0)
plugins/unityshell/src/SoftwareCenterLauncherIcon.cpp (+1/-0)
plugins/unityshell/src/SwitcherController.cpp (+9/-9)
plugins/unityshell/src/SwitcherController.h (+3/-3)
plugins/unityshell/src/SwitcherModel.cpp (+8/-10)
plugins/unityshell/src/SwitcherModel.h (+7/-7)
plugins/unityshell/src/SwitcherView.cpp (+4/-4)
plugins/unityshell/src/SwitcherView.h (+2/-2)
plugins/unityshell/src/unity-launcher-accessible.cpp (+16/-16)
plugins/unityshell/src/unity-switcher-accessible.cpp (+7/-7)
plugins/unityshell/src/unityshell.cpp (+2/-2)
tests/CMakeLists.txt (+1/-0)
tests/test_launcher_model.cpp (+18/-18)
To merge this branch: bzr merge lp:~unity-team/unity/unity.launcher-icon-smart-pointers
Reviewer Review Type Date Requested Status
Gord Allott (community) Approve
Review via email: mp+92663@code.launchpad.net

Description of the change

Makes unity use nux::ObjectPtr for AbstractLauncherIcon's rather than doing manual memory management.

To post a comment you must log in.
Revision history for this message
Gord Allott (gordallott) wrote :

mostly just changes to ::Ptr versions, skipped that for the most part as its impossible to review without context, +1 on the rest

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'plugins/unityshell/src/AbstractLauncherIcon.cpp'
2--- plugins/unityshell/src/AbstractLauncherIcon.cpp 1970-01-01 00:00:00 +0000
3+++ plugins/unityshell/src/AbstractLauncherIcon.cpp 2012-02-12 19:58:19 +0000
4@@ -0,0 +1,27 @@
5+// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
6+/*
7+ * Copyright (C) 2012 Canonical Ltd
8+ *
9+ * This program is free software: you can redistribute it and/or modify
10+ * it under the terms of the GNU General Public License version 3 as
11+ * published by the Free Software Foundation.
12+ *
13+ * This program is distributed in the hope that it will be useful,
14+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+ * GNU General Public License for more details.
17+ *
18+ * You should have received a copy of the GNU General Public License
19+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20+ *
21+ * Authored by: Jason Smith <jason.smith@canonical.com>
22+ */
23+
24+#include "AbstractLauncherIcon.h"
25+
26+namespace unity {
27+namespace launcher {
28+ // needed for ungodly stupid reasons
29+ NUX_IMPLEMENT_OBJECT_TYPE(AbstractLauncherIcon);
30+}
31+}
32\ No newline at end of file
33
34=== modified file 'plugins/unityshell/src/AbstractLauncherIcon.h'
35--- plugins/unityshell/src/AbstractLauncherIcon.h 2012-02-04 05:28:23 +0000
36+++ plugins/unityshell/src/AbstractLauncherIcon.h 2012-02-12 19:58:19 +0000
37@@ -75,8 +75,9 @@
38
39 class AbstractLauncherIcon : public ui::IconTextureSource, public debug::Introspectable
40 {
41+ NUX_DECLARE_OBJECT_TYPE(AbstractLauncherIcon, ui::IconTextureSource);
42 public:
43-
44+ typedef nux::ObjectPtr<AbstractLauncherIcon> Ptr;
45 typedef std::vector<nux::Vector4> TransformVector;
46
47 typedef enum
48@@ -168,7 +169,7 @@
49
50 virtual void ResetQuirkTime(Quirk quirk) = 0;
51
52- virtual IconType Type() = 0;
53+ virtual IconType GetIconType() = 0;
54
55 virtual const gchar* RemoteUri() = 0;
56
57@@ -186,16 +187,26 @@
58
59 virtual void RemoveEntryRemote(LauncherEntryRemote* remote) = 0;
60
61+ virtual std::string DesktopFile() = 0;
62+
63+ virtual bool IsSticky() const = 0;
64+
65+ virtual bool IsVisible() const = 0;
66+
67+ virtual void AboutToRemove() = 0;
68+
69+ virtual void Stick(bool save = true) = 0;
70+
71+ virtual void UnStick() = 0;
72+
73 sigc::signal<void, int, int> mouse_down;
74 sigc::signal<void, int, int> mouse_up;
75 sigc::signal<void, int, int> mouse_click;
76 sigc::signal<void, int> mouse_enter;
77 sigc::signal<void, int> mouse_leave;
78
79- sigc::signal<void, AbstractLauncherIcon*> show;
80- sigc::signal<void, AbstractLauncherIcon*> hide;
81- sigc::signal<void, AbstractLauncherIcon*> needs_redraw;
82- sigc::signal<void, AbstractLauncherIcon*> remove;
83+ sigc::signal<void, AbstractLauncherIcon::Ptr> needs_redraw;
84+ sigc::signal<void, AbstractLauncherIcon::Ptr> remove;
85
86 sigc::connection needs_redraw_connection;
87 sigc::connection on_icon_added_connection;
88
89=== modified file 'plugins/unityshell/src/BamfLauncherIcon.cpp'
90--- plugins/unityshell/src/BamfLauncherIcon.cpp 2012-02-11 07:34:27 +0000
91+++ plugins/unityshell/src/BamfLauncherIcon.cpp 2012-02-12 19:58:19 +0000
92@@ -39,6 +39,8 @@
93 namespace launcher
94 {
95
96+NUX_IMPLEMENT_OBJECT_TYPE(BamfLauncherIcon);
97+
98 BamfLauncherIcon::BamfLauncherIcon(BamfApplication* app)
99 : SimpleLauncherIcon()
100 , _bamf_app(app, glib::AddRef())
101@@ -120,7 +122,7 @@
102 WindowManager::Default()->compiz_screen_viewport_switch_ended.connect(sigc::mem_fun(this, &BamfLauncherIcon::EnsureWindowState));
103 WindowManager::Default()->terminate_expo.connect(sigc::mem_fun(this, &BamfLauncherIcon::EnsureWindowState));
104
105- EnsureWindowState();
106+ //EnsureWindowState();
107 UpdateMenus();
108 UpdateDesktopFile();
109
110@@ -653,7 +655,7 @@
111 for (int i = 0; i < max_num_monitors; i++)
112 SetWindowVisibleOnMonitor(monitors[i], i);
113
114- needs_redraw.emit(this);
115+ EmitNeedsRedraw();
116
117 g_list_free(children);
118 }
119
120=== modified file 'plugins/unityshell/src/BamfLauncherIcon.h'
121--- plugins/unityshell/src/BamfLauncherIcon.h 2012-02-08 00:32:46 +0000
122+++ plugins/unityshell/src/BamfLauncherIcon.h 2012-02-12 19:58:19 +0000
123@@ -38,6 +38,7 @@
124
125 class BamfLauncherIcon : public SimpleLauncherIcon
126 {
127+ NUX_DECLARE_OBJECT_TYPE(BamfLauncherIcon, SimpleLauncherIcon);
128 public:
129 BamfLauncherIcon(BamfApplication* app);
130 virtual ~BamfLauncherIcon();
131
132=== modified file 'plugins/unityshell/src/DesktopLauncherIcon.cpp'
133--- plugins/unityshell/src/DesktopLauncherIcon.cpp 2012-02-08 00:32:46 +0000
134+++ plugins/unityshell/src/DesktopLauncherIcon.cpp 2012-02-12 19:58:19 +0000
135@@ -36,6 +36,7 @@
136 SetQuirk(QUIRK_VISIBLE, true);
137 SetQuirk(QUIRK_RUNNING, false);
138 SetIconType(TYPE_BEGIN);
139+ SetShowInSwitcher(false);
140 }
141
142 DesktopLauncherIcon::~DesktopLauncherIcon()
143
144=== modified file 'plugins/unityshell/src/DeviceLauncherSection.cpp'
145--- plugins/unityshell/src/DeviceLauncherSection.cpp 2012-02-04 05:28:23 +0000
146+++ plugins/unityshell/src/DeviceLauncherSection.cpp 2012-02-12 19:58:19 +0000
147@@ -81,7 +81,7 @@
148 DeviceLauncherIcon* icon = new DeviceLauncherIcon(volume);
149
150 self->map_[volume] = icon;
151- self->IconAdded.emit(icon);
152+ self->IconAdded.emit(AbstractLauncherIcon::Ptr(icon));
153 }
154
155 g_list_free(volumes);
156@@ -102,7 +102,7 @@
157 DeviceLauncherIcon* icon = new DeviceLauncherIcon(volume);
158
159 self->map_[volume] = icon;
160- self->IconAdded.emit(icon);
161+ self->IconAdded.emit(AbstractLauncherIcon::Ptr(icon));
162 }
163
164 void DeviceLauncherSection::OnVolumeRemoved(GVolumeMonitor* monitor,
165
166=== modified file 'plugins/unityshell/src/DeviceLauncherSection.h'
167--- plugins/unityshell/src/DeviceLauncherSection.h 2012-02-04 05:28:23 +0000
168+++ plugins/unityshell/src/DeviceLauncherSection.h 2012-02-12 19:58:19 +0000
169@@ -42,7 +42,7 @@
170 DeviceLauncherSection();
171 ~DeviceLauncherSection();
172
173- sigc::signal<void, LauncherIcon*> IconAdded;
174+ sigc::signal<void, AbstractLauncherIcon::Ptr> IconAdded;
175
176 private:
177 static bool PopulateEntries(DeviceLauncherSection* self);
178
179=== modified file 'plugins/unityshell/src/IconTextureSource.cpp'
180--- plugins/unityshell/src/IconTextureSource.cpp 2012-02-01 05:22:29 +0000
181+++ plugins/unityshell/src/IconTextureSource.cpp 2012-02-12 19:58:19 +0000
182@@ -24,6 +24,7 @@
183 {
184 namespace ui
185 {
186+NUX_IMPLEMENT_OBJECT_TYPE(IconTextureSource);
187
188 IconTextureSource::IconTextureSource()
189 {
190
191=== modified file 'plugins/unityshell/src/IconTextureSource.h'
192--- plugins/unityshell/src/IconTextureSource.h 2012-02-01 03:39:14 +0000
193+++ plugins/unityshell/src/IconTextureSource.h 2012-02-12 19:58:19 +0000
194@@ -32,6 +32,7 @@
195
196 class IconTextureSource : public nux::InitiallyUnownedObject
197 {
198+ NUX_DECLARE_OBJECT_TYPE(IconTextureSource, nux::InitiallyUnownedObject);
199 public:
200 typedef nux::ObjectPtr<IconTextureSource> Ptr;
201
202
203=== modified file 'plugins/unityshell/src/Launcher.cpp'
204--- plugins/unityshell/src/Launcher.cpp 2012-02-11 08:11:04 +0000
205+++ plugins/unityshell/src/Launcher.cpp 2012-02-12 19:58:19 +0000
206@@ -498,7 +498,7 @@
207 NeedRedraw();
208 }
209
210-bool Launcher::IconNeedsAnimation(AbstractLauncherIcon* icon, struct timespec const& current) const
211+bool Launcher::IconNeedsAnimation(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
212 {
213 struct timespec time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_VISIBLE);
214 if (unity::TimeUtil::TimeDelta(&current, &time) < ANIM_DURATION_SHORT)
215@@ -618,7 +618,7 @@
216 }
217
218
219-float Launcher::IconVisibleProgress(AbstractLauncherIcon* icon, struct timespec const& current) const
220+float Launcher::IconVisibleProgress(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
221 {
222 if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE))
223 {
224@@ -636,16 +636,15 @@
225
226 void Launcher::SetDndDelta(float x, float y, nux::Geometry const& geo, timespec const& current)
227 {
228- AbstractLauncherIcon* anchor = nullptr;
229- LauncherModel::iterator it;
230+ AbstractLauncherIcon::Ptr anchor;
231 anchor = MouseIconIntersection(x, _enter_y);
232
233 if (anchor)
234 {
235 float position = y;
236- for (it = _model->begin(); it != _model->end(); it++)
237+ for (AbstractLauncherIcon::Ptr model_icon : *_model)
238 {
239- if (*it == anchor)
240+ if (model_icon == anchor)
241 {
242 position += _icon_size / 2;
243 _launcher_drag_delta = _enter_y - position;
244@@ -655,12 +654,12 @@
245
246 break;
247 }
248- position += (_icon_size + _space_between_icons) * IconVisibleProgress(*it, current);
249+ position += (_icon_size + _space_between_icons) * IconVisibleProgress(model_icon, current);
250 }
251 }
252 }
253
254-float Launcher::IconPresentProgress(AbstractLauncherIcon* icon, struct timespec const& current) const
255+float Launcher::IconPresentProgress(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
256 {
257 struct timespec icon_present_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_PRESENTED);
258 int ms = unity::TimeUtil::TimeDelta(&current, &icon_present_time);
259@@ -672,7 +671,7 @@
260 return 1.0f - result;
261 }
262
263-float Launcher::IconUrgentProgress(AbstractLauncherIcon* icon, struct timespec const& current) const
264+float Launcher::IconUrgentProgress(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
265 {
266 struct timespec urgent_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_URGENT);
267 int urgent_ms = unity::TimeUtil::TimeDelta(&current, &urgent_time);
268@@ -689,7 +688,7 @@
269 return 1.0f - result;
270 }
271
272-float Launcher::IconDropDimValue(AbstractLauncherIcon* icon, struct timespec const& current) const
273+float Launcher::IconDropDimValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
274 {
275 struct timespec dim_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_DROP_DIM);
276 int dim_ms = unity::TimeUtil::TimeDelta(&current, &dim_time);
277@@ -701,7 +700,7 @@
278 return result;
279 }
280
281-float Launcher::IconDesatValue(AbstractLauncherIcon* icon, struct timespec const& current) const
282+float Launcher::IconDesatValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
283 {
284 struct timespec dim_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_DESAT);
285 int ms = unity::TimeUtil::TimeDelta(&current, &dim_time);
286@@ -713,21 +712,21 @@
287 return result;
288 }
289
290-float Launcher::IconShimmerProgress(AbstractLauncherIcon* icon, struct timespec const& current) const
291+float Launcher::IconShimmerProgress(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
292 {
293 struct timespec shimmer_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_SHIMMER);
294 int shimmer_ms = unity::TimeUtil::TimeDelta(&current, &shimmer_time);
295 return CLAMP((float) shimmer_ms / (float) ANIM_DURATION_LONG, 0.0f, 1.0f);
296 }
297
298-float Launcher::IconCenterTransitionProgress(AbstractLauncherIcon* icon, struct timespec const& current) const
299+float Launcher::IconCenterTransitionProgress(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
300 {
301 struct timespec save_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_CENTER_SAVED);
302 int save_ms = unity::TimeUtil::TimeDelta(&current, &save_time);
303 return CLAMP((float) save_ms / (float) ANIM_DURATION, 0.0f, 1.0f);
304 }
305
306-float Launcher::IconUrgentPulseValue(AbstractLauncherIcon* icon, struct timespec const& current) const
307+float Launcher::IconUrgentPulseValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
308 {
309 if (!icon->GetQuirk(AbstractLauncherIcon::QUIRK_URGENT))
310 return 1.0f; // we are full on in a normal condition
311@@ -736,7 +735,7 @@
312 return 0.5f + (float)(std::cos(M_PI * (float)(URGENT_BLINKS * 2) * urgent_progress)) * 0.5f;
313 }
314
315-float Launcher::IconPulseOnceValue(AbstractLauncherIcon *icon, struct timespec const &current) const
316+float Launcher::IconPulseOnceValue(AbstractLauncherIcon::Ptr icon, struct timespec const &current) const
317 {
318 struct timespec pulse_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_PULSE_ONCE);
319 int pulse_ms = unity::TimeUtil::TimeDelta(&current, &pulse_time);
320@@ -748,7 +747,7 @@
321 return 0.5f + (float) (std::cos(M_PI * 2.0 * pulse_progress)) * 0.5f;
322 }
323
324-float Launcher::IconUrgentWiggleValue(AbstractLauncherIcon* icon, struct timespec const& current) const
325+float Launcher::IconUrgentWiggleValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
326 {
327 if (!icon->GetQuirk(AbstractLauncherIcon::QUIRK_URGENT))
328 return 0.0f; // we are full on in a normal condition
329@@ -757,7 +756,7 @@
330 return 0.3f * (float)(std::sin(M_PI * (float)(WIGGLE_CYCLES * 2) * urgent_progress)) * 0.5f;
331 }
332
333-float Launcher::IconStartingBlinkValue(AbstractLauncherIcon* icon, struct timespec const& current) const
334+float Launcher::IconStartingBlinkValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
335 {
336 struct timespec starting_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_STARTING);
337 int starting_ms = unity::TimeUtil::TimeDelta(&current, &starting_time);
338@@ -766,7 +765,7 @@
339 return 0.5f + (float)(std::cos(M_PI * val * starting_progress)) * 0.5f;
340 }
341
342-float Launcher::IconStartingPulseValue(AbstractLauncherIcon* icon, struct timespec const& current) const
343+float Launcher::IconStartingPulseValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
344 {
345 struct timespec starting_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_STARTING);
346 int starting_ms = unity::TimeUtil::TimeDelta(&current, &starting_time);
347@@ -781,7 +780,7 @@
348 return 0.5f + (float)(std::cos(M_PI * (float)(MAX_STARTING_BLINKS * 2) * starting_progress)) * 0.5f;
349 }
350
351-float Launcher::IconBackgroundIntensity(AbstractLauncherIcon* icon, struct timespec const& current) const
352+float Launcher::IconBackgroundIntensity(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
353 {
354 float result = 0.0f;
355
356@@ -848,7 +847,7 @@
357 return result;
358 }
359
360-float Launcher::IconProgressBias(AbstractLauncherIcon* icon, struct timespec const& current) const
361+float Launcher::IconProgressBias(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
362 {
363 struct timespec icon_progress_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_PROGRESS);
364 int ms = unity::TimeUtil::TimeDelta(&current, &icon_progress_time);
365@@ -860,7 +859,7 @@
366 return result;
367 }
368
369-bool Launcher::IconDrawEdgeOnly(AbstractLauncherIcon* icon) const
370+bool Launcher::IconDrawEdgeOnly(AbstractLauncherIcon::Ptr icon) const
371 {
372 if (options()->backlight_mode() == BACKLIGHT_EDGE_TOGGLE)
373 return true;
374@@ -871,10 +870,10 @@
375 return false;
376 }
377
378-void Launcher::SetupRenderArg(AbstractLauncherIcon* icon, struct timespec const& current, RenderArg& arg)
379+void Launcher::SetupRenderArg(AbstractLauncherIcon::Ptr icon, struct timespec const& current, RenderArg& arg)
380 {
381 float desat_value = IconDesatValue(icon, current);
382- arg.icon = icon;
383+ arg.icon = icon.GetPointer();
384 arg.alpha = 0.5f + 0.5f * desat_value;
385 arg.saturation = desat_value;
386 arg.colorify = nux::color::White;
387@@ -892,13 +891,13 @@
388 arg.progress_bias = IconProgressBias(icon, current);
389 arg.progress = CLAMP(icon->GetProgress(), 0.0f, 1.0f);
390 arg.draw_shortcut = _shortcuts_shown && !_hide_machine->GetQuirk(LauncherHideMachine::PLACES_VISIBLE);
391- arg.system_item = icon->Type() == AbstractLauncherIcon::TYPE_HOME;
392- arg.colorify_background = icon->Type() == AbstractLauncherIcon::TYPE_HOME ||
393- icon->Type() == AbstractLauncherIcon::TYPE_TRASH ||
394- icon->Type() == AbstractLauncherIcon::TYPE_EXPO;
395+ arg.system_item = icon->GetIconType() == AbstractLauncherIcon::TYPE_HOME;
396+ arg.colorify_background = icon->GetIconType() == AbstractLauncherIcon::TYPE_HOME ||
397+ icon->GetIconType() == AbstractLauncherIcon::TYPE_TRASH ||
398+ icon->GetIconType() == AbstractLauncherIcon::TYPE_EXPO;
399
400 if (_dash_is_open)
401- arg.active_arrow = icon->Type() == AbstractLauncherIcon::TYPE_HOME;
402+ arg.active_arrow = icon->GetIconType() == AbstractLauncherIcon::TYPE_HOME;
403 else
404 arg.active_arrow = icon->GetQuirk(AbstractLauncherIcon::QUIRK_ACTIVE);
405
406@@ -947,7 +946,7 @@
407 }
408 }
409
410-void Launcher::FillRenderArg(AbstractLauncherIcon* icon,
411+void Launcher::FillRenderArg(AbstractLauncherIcon::Ptr icon,
412 RenderArg& arg,
413 nux::Point3& center,
414 nux::Geometry const& parent_abs_geo,
415@@ -1190,7 +1189,7 @@
416 for (it = _model->main_begin(); it != _model->main_end(); it++)
417 {
418 RenderArg arg;
419- AbstractLauncherIcon* icon = *it;
420+ AbstractLauncherIcon::Ptr icon = *it;
421
422 FillRenderArg(icon, arg, center, parent_abs_geo, folding_threshold, folded_size, folded_spacing,
423 autohide_offset, folded_z_distance, animation_neg_rads, current);
424@@ -1218,7 +1217,7 @@
425 for (it = _model->shelf_begin(); it != _model->shelf_end(); it++)
426 {
427 RenderArg arg;
428- AbstractLauncherIcon* icon = *it;
429+ AbstractLauncherIcon::Ptr icon = *it;
430
431 FillRenderArg(icon, arg, center, parent_abs_geo, folding_threshold, folded_size, folded_spacing,
432 autohide_offset, folded_z_distance, animation_neg_rads, current);
433@@ -1268,7 +1267,7 @@
434 {
435 for (auto icon : *_model)
436 {
437- if (icon->Type () != AbstractLauncherIcon::TYPE_HOME)
438+ if (icon->GetIconType () != AbstractLauncherIcon::TYPE_HOME)
439 icon->SetQuirk(AbstractLauncherIcon::QUIRK_DESAT, true);
440 icon->HideTooltip();
441 }
442@@ -1700,14 +1699,14 @@
443
444 }
445
446-void Launcher::OnIconAdded(AbstractLauncherIcon* icon)
447+void Launcher::OnIconAdded(AbstractLauncherIcon::Ptr icon)
448 {
449 EnsureAnimation();
450
451 icon->needs_redraw.connect(sigc::mem_fun(this, &Launcher::OnIconNeedsRedraw));
452 }
453
454-void Launcher::OnIconRemoved(AbstractLauncherIcon* icon)
455+void Launcher::OnIconRemoved(AbstractLauncherIcon::Ptr icon)
456 {
457 if (icon->needs_redraw_connection.connected())
458 icon->needs_redraw_connection.disconnect();
459@@ -1742,7 +1741,7 @@
460 return _model;
461 }
462
463-void Launcher::EnsureIconOnScreen(AbstractLauncherIcon* selection)
464+void Launcher::EnsureIconOnScreen(AbstractLauncherIcon::Ptr selection)
465 {
466 nux::Geometry geo = GetGeometry();
467
468@@ -1764,7 +1763,7 @@
469 _launcher_drag_delta = std::max<int>(min_drag_delta, std::min<int>(max_drag_delta, _launcher_drag_delta));
470 }
471
472-void Launcher::OnSelectionChanged(AbstractLauncherIcon* selection)
473+void Launcher::OnSelectionChanged(AbstractLauncherIcon::Ptr selection)
474 {
475 if (IsInKeyNavMode())
476 {
477@@ -1773,7 +1772,7 @@
478 }
479 }
480
481-void Launcher::OnIconNeedsRedraw(AbstractLauncherIcon* icon)
482+void Launcher::OnIconNeedsRedraw(AbstractLauncherIcon::Ptr icon)
483 {
484 EnsureAnimation();
485 }
486@@ -2007,7 +2006,7 @@
487
488 void Launcher::StartIconDragRequest(int x, int y)
489 {
490- AbstractLauncherIcon* drag_icon = MouseIconIntersection((int)(GetGeometry().x / 2.0f), y);
491+ AbstractLauncherIcon::Ptr drag_icon = MouseIconIntersection((int)(GetGeometry().x / 2.0f), y);
492
493 // FIXME: nux doesn't give nux::GetEventButton (button_flags) there, relying
494 // on an internal Launcher property then
495@@ -2036,7 +2035,7 @@
496 }
497 }
498
499-void Launcher::StartIconDrag(AbstractLauncherIcon* icon)
500+void Launcher::StartIconDrag(AbstractLauncherIcon::Ptr icon)
501 {
502 if (!icon)
503 return;
504@@ -2065,9 +2064,9 @@
505 {
506 if (_drag_window)
507 {
508- AbstractLauncherIcon* hovered_icon = MouseIconIntersection(_mouse_position.x, _mouse_position.y);
509+ AbstractLauncherIcon::Ptr hovered_icon = MouseIconIntersection(_mouse_position.x, _mouse_position.y);
510
511- if (hovered_icon && hovered_icon->Type() == AbstractLauncherIcon::TYPE_TRASH)
512+ if (hovered_icon && hovered_icon->GetIconType() == AbstractLauncherIcon::TYPE_TRASH)
513 {
514 hovered_icon->SetQuirk(AbstractLauncherIcon::QUIRK_PULSE_ONCE, true);
515
516@@ -2107,7 +2106,7 @@
517 nux::Geometry geo = _drag_window->GetGeometry();
518 _drag_window->SetBaseXY(x - geo.width / 2 + _parent->GetGeometry().x, y - geo.height / 2 + _parent->GetGeometry().y);
519
520- AbstractLauncherIcon* hovered_icon = MouseIconIntersection((int)(GetGeometry().x / 2.0f), y);
521+ AbstractLauncherIcon::Ptr hovered_icon = MouseIconIntersection((int)(GetGeometry().x / 2.0f), y);
522
523 struct timespec current;
524 clock_gettime(CLOCK_MONOTONIC, &current);
525@@ -2355,7 +2354,7 @@
526 GetActionState() == ACTION_DRAG_LAUNCHER)
527 return;
528
529- AbstractLauncherIcon* launcher_icon = nullptr;
530+ AbstractLauncherIcon::Ptr launcher_icon;
531
532 if (!_hidden && !IsInKeyNavMode() && _hovered)
533 {
534@@ -2380,7 +2379,7 @@
535
536 void Launcher::MouseDownLogic(int x, int y, unsigned long button_flags, unsigned long key_flags)
537 {
538- AbstractLauncherIcon* launcher_icon = nullptr;
539+ AbstractLauncherIcon::Ptr launcher_icon;
540 launcher_icon = MouseIconIntersection(_mouse_position.x, _mouse_position.y);
541
542 _hide_machine->SetQuirk(LauncherHideMachine::LAST_ACTION_ACTIVATE, false);
543@@ -2399,7 +2398,7 @@
544
545 void Launcher::MouseUpLogic(int x, int y, unsigned long button_flags, unsigned long key_flags)
546 {
547- AbstractLauncherIcon* launcher_icon = nullptr;
548+ AbstractLauncherIcon::Ptr launcher_icon;
549
550 launcher_icon = MouseIconIntersection(_mouse_position.x, _mouse_position.y);
551
552@@ -2430,7 +2429,7 @@
553 _icon_mouse_down = nullptr;
554 }
555
556-AbstractLauncherIcon* Launcher::MouseIconIntersection(int x, int y)
557+AbstractLauncherIcon::Ptr Launcher::MouseIconIntersection(int x, int y)
558 {
559 LauncherModel::iterator it;
560 // We are looking for the icon at screen coordinates x, y;
561@@ -2454,11 +2453,11 @@
562 return (*it);
563 }
564
565- return 0;
566+ return AbstractLauncherIcon::Ptr();
567 }
568
569 void
570-Launcher::RenderIconToTexture(nux::GraphicsEngine& GfxContext, AbstractLauncherIcon* icon, nux::ObjectPtr<nux::IOpenGLBaseTexture> texture)
571+Launcher::RenderIconToTexture(nux::GraphicsEngine& GfxContext, AbstractLauncherIcon::Ptr icon, nux::ObjectPtr<nux::IOpenGLBaseTexture> texture)
572 {
573 RenderArg arg;
574 struct timespec current;
575@@ -2671,15 +2670,15 @@
576 }
577
578 EventLogic();
579- AbstractLauncherIcon* hovered_icon = MouseIconIntersection(_mouse_position.x, _mouse_position.y);
580+ AbstractLauncherIcon::Ptr hovered_icon = MouseIconIntersection(_mouse_position.x, _mouse_position.y);
581
582 bool hovered_icon_is_appropriate = false;
583 if (hovered_icon)
584 {
585- if (hovered_icon->Type() == AbstractLauncherIcon::TYPE_TRASH)
586+ if (hovered_icon->GetIconType() == AbstractLauncherIcon::TYPE_TRASH)
587 _steal_drag = false;
588
589- if (hovered_icon->Type() == AbstractLauncherIcon::TYPE_APPLICATION || hovered_icon->Type() == AbstractLauncherIcon::TYPE_EXPO)
590+ if (hovered_icon->GetIconType() == AbstractLauncherIcon::TYPE_APPLICATION || hovered_icon->GetIconType() == AbstractLauncherIcon::TYPE_EXPO)
591 hovered_icon_is_appropriate = true;
592 }
593
594@@ -2788,11 +2787,11 @@
595 * Returns the current selected icon if it is in keynavmode
596 * It will return NULL if it is not on keynavmode
597 */
598-AbstractLauncherIcon*
599+AbstractLauncherIcon::Ptr
600 Launcher::GetSelectedMenuIcon() const
601 {
602 if (!IsInKeyNavMode())
603- return NULL;
604+ return AbstractLauncherIcon::Ptr();
605 return _model->Selection();
606 }
607
608@@ -2822,7 +2821,7 @@
609 g_variant_get(parameters, "(ssiiiss)", &title, &icon, &icon_x, &icon_y, &icon_size, &desktop_file, &aptdaemon_task, NULL);
610
611 Launcher* self = (Launcher*)user_data;
612- self->launcher_addrequest_special.emit(desktop_file, nullptr, aptdaemon_task, icon);
613+ self->launcher_addrequest_special.emit(desktop_file, AbstractLauncherIcon::Ptr(), aptdaemon_task, icon);
614
615 g_dbus_method_invocation_return_value(invocation, nullptr);
616 g_free(icon);
617
618=== modified file 'plugins/unityshell/src/Launcher.h'
619--- plugins/unityshell/src/Launcher.h 2012-02-09 22:47:21 +0000
620+++ plugins/unityshell/src/Launcher.h 2012-02-12 19:58:19 +0000
621@@ -65,7 +65,7 @@
622 virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
623 virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw);
624
625- AbstractLauncherIcon* GetSelectedMenuIcon() const;
626+ AbstractLauncherIcon::Ptr GetSelectedMenuIcon() const;
627
628 void SetIconSize(int tile_size, int icon_size);
629
630@@ -85,7 +85,7 @@
631 void StartKeyShowLauncher();
632 void EndKeyShowLauncher();
633
634- void EnsureIconOnScreen(AbstractLauncherIcon* icon);
635+ void EnsureIconOnScreen(AbstractLauncherIcon::Ptr icon);
636
637 void SetBacklightMode(BacklightMode mode);
638 BacklightMode GetBacklightMode() const;
639@@ -112,9 +112,9 @@
640
641 void Resize();
642
643- sigc::signal<void, char*, AbstractLauncherIcon*> launcher_addrequest;
644- sigc::signal<void, std::string const&, AbstractLauncherIcon*, std::string const&, std::string const&> launcher_addrequest_special;
645- sigc::signal<void, AbstractLauncherIcon*> launcher_removerequest;
646+ sigc::signal<void, char*, AbstractLauncherIcon::Ptr> launcher_addrequest;
647+ sigc::signal<void, std::string const&, AbstractLauncherIcon::Ptr, std::string const&, std::string const&> launcher_addrequest_special;
648+ sigc::signal<void, AbstractLauncherIcon::Ptr> launcher_removerequest;
649 sigc::signal<void> selection_change;
650 sigc::signal<void> hidden_changed;
651
652@@ -181,7 +181,7 @@
653
654 void OnPluginStateChanged();
655
656- void OnSelectionChanged(AbstractLauncherIcon* selection);
657+ void OnSelectionChanged(AbstractLauncherIcon::Ptr selection);
658
659 static gboolean AnimationTimeout(gpointer data);
660 static gboolean StrutHack(gpointer data);
661@@ -195,8 +195,8 @@
662
663 void OnDragWindowAnimCompleted();
664
665- bool IconNeedsAnimation(AbstractLauncherIcon* icon, struct timespec const& current) const;
666- bool IconDrawEdgeOnly(AbstractLauncherIcon* icon) const;
667+ bool IconNeedsAnimation(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const;
668+ bool IconDrawEdgeOnly(AbstractLauncherIcon::Ptr icon) const;
669 bool AnimationInProgress() const;
670
671 void SetActionState(LauncherActionState actionstate);
672@@ -221,20 +221,20 @@
673 float DragThresholdProgress(struct timespec const& current) const;
674 float DragHideProgress(struct timespec const& current) const;
675 float DragOutProgress(struct timespec const& current) const;
676- float IconDesatValue(AbstractLauncherIcon* icon, struct timespec const& current) const;
677- float IconPresentProgress(AbstractLauncherIcon* icon, struct timespec const& current) const;
678- float IconUrgentProgress(AbstractLauncherIcon* icon, struct timespec const& current) const;
679- float IconShimmerProgress(AbstractLauncherIcon* icon, struct timespec const& current) const;
680- float IconUrgentPulseValue(AbstractLauncherIcon* icon, struct timespec const& current) const;
681- float IconPulseOnceValue(AbstractLauncherIcon *icon, struct timespec const &current) const;
682- float IconUrgentWiggleValue(AbstractLauncherIcon* icon, struct timespec const& current) const;
683- float IconStartingBlinkValue(AbstractLauncherIcon* icon, struct timespec const& current) const;
684- float IconStartingPulseValue(AbstractLauncherIcon* icon, struct timespec const& current) const;
685- float IconBackgroundIntensity(AbstractLauncherIcon* icon, struct timespec const& current) const;
686- float IconProgressBias(AbstractLauncherIcon* icon, struct timespec const& current) const;
687- float IconDropDimValue(AbstractLauncherIcon* icon, struct timespec const& current) const;
688- float IconCenterTransitionProgress(AbstractLauncherIcon* icon, struct timespec const& current) const;
689- float IconVisibleProgress(AbstractLauncherIcon* icon, struct timespec const& current) const;
690+ float IconDesatValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const;
691+ float IconPresentProgress(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const;
692+ float IconUrgentProgress(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const;
693+ float IconShimmerProgress(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const;
694+ float IconUrgentPulseValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const;
695+ float IconPulseOnceValue(AbstractLauncherIcon::Ptr icon, struct timespec const &current) const;
696+ float IconUrgentWiggleValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const;
697+ float IconStartingBlinkValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const;
698+ float IconStartingPulseValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const;
699+ float IconBackgroundIntensity(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const;
700+ float IconProgressBias(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const;
701+ float IconDropDimValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const;
702+ float IconCenterTransitionProgress(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const;
703+ float IconVisibleProgress(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const;
704
705 void SetHover(bool hovered);
706 void SetHidden(bool hidden);
707@@ -242,8 +242,8 @@
708 void SetDndDelta(float x, float y, nux::Geometry const& geo, timespec const& current);
709 float DragLimiter(float x);
710
711- void SetupRenderArg(AbstractLauncherIcon* icon, struct timespec const& current, ui::RenderArg& arg);
712- void FillRenderArg(AbstractLauncherIcon* icon,
713+ void SetupRenderArg(AbstractLauncherIcon::Ptr icon, struct timespec const& current, ui::RenderArg& arg);
714+ void FillRenderArg(AbstractLauncherIcon::Ptr icon,
715 ui::RenderArg& arg,
716 nux::Point3& center,
717 nux::Geometry const& parent_abs_geo,
718@@ -258,11 +258,11 @@
719 void RenderArgs(std::list<ui::RenderArg> &launcher_args,
720 nux::Geometry& box_geo, float* launcher_alpha, nux::Geometry const& parent_abs_geo);
721
722- void OnIconAdded(AbstractLauncherIcon* icon);
723- void OnIconRemoved(AbstractLauncherIcon* icon);
724+ void OnIconAdded(AbstractLauncherIcon::Ptr icon);
725+ void OnIconRemoved(AbstractLauncherIcon::Ptr icon);
726 void OnOrderChanged();
727
728- void OnIconNeedsRedraw(AbstractLauncherIcon* icon);
729+ void OnIconNeedsRedraw(AbstractLauncherIcon::Ptr icon);
730
731 void OnOverlayHidden(GVariant* data);
732 void OnOverlayShown(GVariant* data);
733@@ -276,15 +276,15 @@
734
735 void OnActionDone(GVariant* data);
736
737- void RenderIconToTexture(nux::GraphicsEngine& GfxContext, AbstractLauncherIcon* icon, nux::ObjectPtr<nux::IOpenGLBaseTexture> texture);
738+ void RenderIconToTexture(nux::GraphicsEngine& GfxContext, AbstractLauncherIcon::Ptr icon, nux::ObjectPtr<nux::IOpenGLBaseTexture> texture);
739
740- AbstractLauncherIcon* MouseIconIntersection(int x, int y);
741+ AbstractLauncherIcon::Ptr MouseIconIntersection(int x, int y);
742 void EventLogic();
743 void MouseDownLogic(int x, int y, unsigned long button_flags, unsigned long key_flags);
744 void MouseUpLogic(int x, int y, unsigned long button_flags, unsigned long key_flags);
745
746 void StartIconDragRequest(int x, int y);
747- void StartIconDrag(AbstractLauncherIcon* icon);
748+ void StartIconDrag(AbstractLauncherIcon::Ptr icon);
749 void EndIconDrag();
750 void UpdateDragWindowPosition(int x, int y);
751
752@@ -305,9 +305,9 @@
753 nux::HLayout* m_Layout;
754
755 // used by keyboard/a11y-navigation
756- AbstractLauncherIcon* _icon_under_mouse;
757- AbstractLauncherIcon* _icon_mouse_down;
758- AbstractLauncherIcon* _drag_icon;
759+ AbstractLauncherIcon::Ptr _icon_under_mouse;
760+ AbstractLauncherIcon::Ptr _icon_mouse_down;
761+ AbstractLauncherIcon::Ptr _drag_icon;
762
763 QuicklistView* _active_quicklist;
764
765@@ -368,7 +368,7 @@
766 bool _data_checked;
767 bool _steal_drag;
768 bool _drag_edge_touching;
769- AbstractLauncherIcon* _dnd_hovered_icon;
770+ AbstractLauncherIcon::Ptr _dnd_hovered_icon;
771 unity::DNDCollectionWindow* _collection_window;
772 sigc::connection _on_data_collected_connection;
773
774
775=== modified file 'plugins/unityshell/src/LauncherController.cpp'
776--- plugins/unityshell/src/LauncherController.cpp 2012-02-08 08:58:05 +0000
777+++ plugins/unityshell/src/LauncherController.cpp 2012-02-12 19:58:19 +0000
778@@ -80,12 +80,12 @@
779 void Save();
780 void SortAndUpdate();
781
782- void OnIconAdded(AbstractLauncherIcon* icon);
783- void OnIconRemoved(AbstractLauncherIcon* icon);
784+ void OnIconAdded(AbstractLauncherIcon::Ptr icon);
785+ void OnIconRemoved(AbstractLauncherIcon::Ptr icon);
786
787- void OnLauncherAddRequest(char* path, AbstractLauncherIcon* before);
788- void OnLauncherAddRequestSpecial(std::string const& path, AbstractLauncherIcon* before, std::string const& aptdaemon_trans_id, std::string const& icon_path);
789- void OnLauncherRemoveRequest(AbstractLauncherIcon* icon);
790+ void OnLauncherAddRequest(char* path, AbstractLauncherIcon::Ptr before);
791+ void OnLauncherAddRequestSpecial(std::string const& path, AbstractLauncherIcon::Ptr before, std::string const& aptdaemon_trans_id, std::string const& icon_path);
792+ void OnLauncherRemoveRequest(AbstractLauncherIcon::Ptr icon);
793
794 void OnLauncherEntryRemoteAdded(LauncherEntryRemote* entry);
795 void OnLauncherEntryRemoteRemoved(LauncherEntryRemote* entry);
796@@ -111,11 +111,11 @@
797
798 void InsertTrash();
799
800- void RegisterIcon(AbstractLauncherIcon* icon);
801-
802- AbstractLauncherIcon* CreateFavorite(const char* file_path);
803-
804- SoftwareCenterLauncherIcon* CreateSCLauncherIcon(std::string const& file_path, std::string const& aptdaemon_trans_id, std::string const& icon_path);
805+ void RegisterIcon(AbstractLauncherIcon::Ptr icon);
806+
807+ AbstractLauncherIcon::Ptr CreateFavorite(const char* file_path);
808+
809+ AbstractLauncherIcon::Ptr CreateSCLauncherIcon(std::string const& file_path, std::string const& aptdaemon_trans_id, std::string const& icon_path);
810
811 void SetupBamf();
812
813@@ -145,9 +145,9 @@
814 int sort_priority_;
815 DeviceLauncherSection* device_section_;
816 LauncherEntryRemoteModel remote_model_;
817- SimpleLauncherIcon* expo_icon_;
818- DesktopLauncherIcon* desktop_launcher_icon_;
819- nux::ObjectPtr<AbstractLauncherIcon> desktop_icon_;
820+ AbstractLauncherIcon::Ptr expo_icon_;
821+ AbstractLauncherIcon::Ptr desktop_launcher_icon_;
822+ AbstractLauncherIcon::Ptr desktop_icon_;
823 int num_workspaces_;
824 bool show_desktop_icon_;
825 Display* display_;
826@@ -234,8 +234,8 @@
827 FavoriteStore::GetDefault().favorite_removed.connect(sigc::mem_fun(this, &Impl::OnFavoriteStoreFavoriteRemoved));
828 FavoriteStore::GetDefault().reordered.connect(sigc::mem_fun(this, &Impl::OnFavoriteStoreReordered));
829
830- RegisterIcon(new BFBLauncherIcon());
831- desktop_icon_ = new DesktopLauncherIcon();
832+ RegisterIcon(AbstractLauncherIcon::Ptr(new BFBLauncherIcon()));
833+ desktop_icon_ = AbstractLauncherIcon::Ptr(new DesktopLauncherIcon());
834
835 uscreen->changed.connect(sigc::mem_fun(this, &Controller::Impl::OnScreenChanged));
836
837@@ -333,7 +333,7 @@
838 return launcher;
839 }
840
841-void Controller::Impl::OnLauncherAddRequest(char* path, AbstractLauncherIcon* before)
842+void Controller::Impl::OnLauncherAddRequest(char* path, AbstractLauncherIcon::Ptr before)
843 {
844 for (auto it : model_->GetSublist<BamfLauncherIcon> ())
845 {
846@@ -346,7 +346,7 @@
847 }
848 }
849
850- AbstractLauncherIcon* result = CreateFavorite(path);
851+ AbstractLauncherIcon::Ptr result = CreateFavorite(path);
852 if (result)
853 {
854 RegisterIcon(result);
855@@ -362,7 +362,7 @@
856 unity::FavoriteList desktop_paths;
857
858 // Updates gsettings favorites.
859- std::list<BamfLauncherIcon*> launchers = model_->GetSublist<BamfLauncherIcon> ();
860+ auto launchers = model_->GetSublist<BamfLauncherIcon> ();
861 for (auto icon : launchers)
862 {
863 if (!icon->IsSticky())
864@@ -379,20 +379,18 @@
865
866 void
867 Controller::Impl::OnLauncherAddRequestSpecial(std::string const& path,
868- AbstractLauncherIcon* before,
869+ AbstractLauncherIcon::Ptr before,
870 std::string const& aptdaemon_trans_id,
871 std::string const& icon_path)
872 {
873- std::list<BamfLauncherIcon*> launchers;
874-
875- launchers = model_->GetSublist<BamfLauncherIcon>();
876+ auto launchers = model_->GetSublist<BamfLauncherIcon>();
877 for (auto icon : launchers)
878 {
879 if (icon->DesktopFile() == path)
880 return;
881 }
882
883- SoftwareCenterLauncherIcon* result = CreateSCLauncherIcon(path, aptdaemon_trans_id, icon_path);
884+ AbstractLauncherIcon::Ptr result = CreateSCLauncherIcon(path, aptdaemon_trans_id, icon_path);
885 if (result)
886 {
887 RegisterIcon(result);
888@@ -407,7 +405,7 @@
889 {
890 gint shortcut = 1;
891
892- std::list<BamfLauncherIcon*> launchers = model_->GetSublist<BamfLauncherIcon> ();
893+ auto launchers = model_->GetSublist<BamfLauncherIcon> ();
894 for (auto icon : launchers)
895 {
896 if (shortcut <= 10 && icon->IsVisible())
897@@ -425,23 +423,23 @@
898 }
899 }
900
901-void Controller::Impl::OnIconAdded(AbstractLauncherIcon* icon)
902+void Controller::Impl::OnIconAdded(AbstractLauncherIcon::Ptr icon)
903 {
904 this->RegisterIcon(icon);
905 }
906
907-void Controller::Impl::OnIconRemoved(AbstractLauncherIcon* icon)
908+void Controller::Impl::OnIconRemoved(AbstractLauncherIcon::Ptr icon)
909 {
910 SortAndUpdate();
911 }
912
913-void Controller::Impl::OnLauncherRemoveRequest(AbstractLauncherIcon* icon)
914+void Controller::Impl::OnLauncherRemoveRequest(AbstractLauncherIcon::Ptr icon)
915 {
916- switch (icon->Type())
917+ switch (icon->GetIconType())
918 {
919 case AbstractLauncherIcon::TYPE_APPLICATION:
920 {
921- BamfLauncherIcon* bamf_icon = dynamic_cast<BamfLauncherIcon*>(icon);
922+ BamfLauncherIcon* bamf_icon = dynamic_cast<BamfLauncherIcon*>(icon.GetPointer());
923
924 if (bamf_icon)
925 {
926@@ -453,7 +451,7 @@
927 }
928 case AbstractLauncherIcon::TYPE_DEVICE:
929 {
930- DeviceLauncherIcon* device_icon = dynamic_cast<DeviceLauncherIcon*>(icon);
931+ DeviceLauncherIcon* device_icon = dynamic_cast<DeviceLauncherIcon*>(icon.GetPointer());
932
933 if (device_icon && device_icon->CanEject())
934 device_icon->Eject();
935@@ -490,7 +488,9 @@
936 void Controller::Impl::OnFavoriteStoreFavoriteAdded(std::string const& entry, std::string const& pos, bool before)
937 {
938 auto bamf_list = model_->GetSublist<BamfLauncherIcon>();
939- AbstractLauncherIcon* other = (bamf_list.size() > 0) ? *(bamf_list.begin()) : nullptr;
940+ AbstractLauncherIcon::Ptr other;
941+ if (bamf_list.size() > 0)
942+ other = *(bamf_list.begin());
943
944 if (!pos.empty())
945 {
946@@ -514,7 +514,7 @@
947 }
948 }
949
950- AbstractLauncherIcon* result = CreateFavorite(entry.c_str());
951+ AbstractLauncherIcon::Ptr result = CreateFavorite(entry.c_str());
952 if (result)
953 {
954 RegisterIcon(result);
955@@ -546,7 +546,7 @@
956 for (auto it : favs)
957 {
958 auto icon = std::find_if(bamf_list.begin(), bamf_list.end(),
959- [&it](BamfLauncherIcon* x) { return (x->DesktopFile() == it); });
960+ [&it](AbstractLauncherIcon::Ptr x) { return (x->DesktopFile() == it); });
961
962 if (icon != bamf_list.end())
963 {
964@@ -570,8 +570,7 @@
965
966 void Controller::Impl::InsertTrash()
967 {
968- TrashLauncherIcon* icon;
969- icon = new TrashLauncherIcon();
970+ AbstractLauncherIcon::Ptr icon(new TrashLauncherIcon());
971 RegisterIcon(icon);
972 }
973
974@@ -591,17 +590,19 @@
975
976 void Controller::Impl::InsertExpoAction()
977 {
978- expo_icon_ = new SimpleLauncherIcon();
979-
980- expo_icon_->tooltip_text = _("Workspace Switcher");
981- expo_icon_->icon_name = "workspace-switcher";
982- expo_icon_->SetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE, true);
983- expo_icon_->SetQuirk(AbstractLauncherIcon::QUIRK_RUNNING, false);
984- expo_icon_->SetIconType(AbstractLauncherIcon::TYPE_EXPO);
985- expo_icon_->SetShortcut('s');
986-
987- on_expoicon_activate_connection_ = expo_icon_->activate.connect(sigc::mem_fun(this, &Impl::OnExpoActivated));
988-
989+ expo_icon_ = AbstractLauncherIcon::Ptr(new SimpleLauncherIcon());
990+
991+ SimpleLauncherIcon* icon = static_cast<SimpleLauncherIcon*>(expo_icon_.GetPointer());
992+ icon->tooltip_text = _("Workspace Switcher");
993+ icon->icon_name = "workspace-switcher";
994+ icon->SetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE, true);
995+ icon->SetQuirk(AbstractLauncherIcon::QUIRK_RUNNING, false);
996+ icon->SetIconType(AbstractLauncherIcon::TYPE_EXPO);
997+ icon->SetShortcut('s');
998+
999+ on_expoicon_activate_connection_ = icon->activate.connect(sigc::mem_fun(this, &Impl::OnExpoActivated));
1000+
1001+
1002 RegisterIcon(expo_icon_);
1003 }
1004
1005@@ -614,10 +615,7 @@
1006
1007 void Controller::Impl::InsertDesktopIcon()
1008 {
1009- desktop_launcher_icon_ = new DesktopLauncherIcon();
1010- desktop_launcher_icon_->SetIconType(AbstractLauncherIcon::TYPE_DESKTOP);
1011- desktop_launcher_icon_->SetShowInSwitcher(false);
1012-
1013+ desktop_launcher_icon_ = AbstractLauncherIcon::Ptr(new DesktopLauncherIcon());
1014 RegisterIcon(desktop_launcher_icon_);
1015 }
1016
1017@@ -626,20 +624,16 @@
1018 model_->RemoveIcon(desktop_launcher_icon_);
1019 }
1020
1021-void Controller::Impl::RegisterIcon(AbstractLauncherIcon* icon)
1022+void Controller::Impl::RegisterIcon(AbstractLauncherIcon::Ptr icon)
1023 {
1024 model_->AddIcon(icon);
1025
1026- BamfLauncherIcon* bamf_icon = dynamic_cast<BamfLauncherIcon*>(icon);
1027- if (bamf_icon)
1028- {
1029- LauncherEntryRemote* entry = NULL;
1030- std::string const& path = bamf_icon->DesktopFile();
1031- if (!path.empty())
1032- entry = remote_model_.LookupByDesktopFile(path.c_str());
1033- if (entry)
1034- icon->InsertEntryRemote(entry);
1035- }
1036+ LauncherEntryRemote* entry = NULL;
1037+ std::string const& path = icon->DesktopFile();
1038+ if (!path.empty())
1039+ entry = remote_model_.LookupByDesktopFile(path.c_str());
1040+ if (entry)
1041+ icon->InsertEntryRemote(entry);
1042 }
1043
1044 /* static private */
1045@@ -659,71 +653,69 @@
1046 return;
1047 }
1048
1049- BamfLauncherIcon* icon = new BamfLauncherIcon(app);
1050- icon->SetIconType(AbstractLauncherIcon::TYPE_APPLICATION);
1051+ AbstractLauncherIcon::Ptr icon (new BamfLauncherIcon(app));
1052 icon->SetSortPriority(self->sort_priority_++);
1053
1054 self->RegisterIcon(icon);
1055 }
1056
1057-AbstractLauncherIcon* Controller::Impl::CreateFavorite(const char* file_path)
1058+AbstractLauncherIcon::Ptr Controller::Impl::CreateFavorite(const char* file_path)
1059 {
1060 BamfApplication* app;
1061- BamfLauncherIcon* icon;
1062+ AbstractLauncherIcon::Ptr result;
1063
1064 app = bamf_matcher_get_application_for_desktop_file(matcher_, file_path, true);
1065 if (!app)
1066- return NULL;
1067+ return result;
1068
1069 if (g_object_get_qdata(G_OBJECT(app), g_quark_from_static_string("unity-seen")))
1070 {
1071 bamf_view_set_sticky(BAMF_VIEW(app), true);
1072- return 0;
1073+ return result;
1074 }
1075
1076 g_object_set_qdata(G_OBJECT(app), g_quark_from_static_string("unity-seen"), GINT_TO_POINTER(1));
1077
1078 bamf_view_set_sticky(BAMF_VIEW(app), true);
1079- icon = new BamfLauncherIcon(app);
1080- icon->SetIconType(AbstractLauncherIcon::TYPE_APPLICATION);
1081+ AbstractLauncherIcon::Ptr icon (new BamfLauncherIcon(app));
1082 icon->SetSortPriority(sort_priority_++);
1083+ result = icon;
1084
1085- return icon;
1086+ return result;
1087 }
1088
1089-SoftwareCenterLauncherIcon*
1090+AbstractLauncherIcon::Ptr
1091 Controller::Impl::CreateSCLauncherIcon(std::string const& file_path,
1092 std::string const& aptdaemon_trans_id,
1093 std::string const& icon_path)
1094 {
1095 BamfApplication* app;
1096- SoftwareCenterLauncherIcon* icon;
1097+ AbstractLauncherIcon::Ptr result;
1098
1099 app = bamf_matcher_get_application_for_desktop_file(matcher_, file_path.c_str(), true);
1100 if (!BAMF_IS_APPLICATION(app))
1101- return NULL;
1102+ return result;
1103
1104 if (g_object_get_qdata(G_OBJECT(app), g_quark_from_static_string("unity-seen")))
1105 {
1106 bamf_view_set_sticky(BAMF_VIEW(app), true);
1107- return 0;
1108+ return result;
1109 }
1110
1111 g_object_set_qdata(G_OBJECT(app), g_quark_from_static_string("unity-seen"), GINT_TO_POINTER(1));
1112
1113 bamf_view_set_sticky(BAMF_VIEW(app), true);
1114- icon = new SoftwareCenterLauncherIcon(app, aptdaemon_trans_id, icon_path);
1115- icon->SetIconType(LauncherIcon::TYPE_APPLICATION);
1116+ AbstractLauncherIcon::Ptr icon(new SoftwareCenterLauncherIcon(app, aptdaemon_trans_id, icon_path));
1117 icon->SetSortPriority(sort_priority_++);
1118
1119- return icon;
1120+ result = icon;
1121+ return result;
1122 }
1123
1124 void Controller::Impl::SetupBamf()
1125 {
1126 GList* apps, *l;
1127 BamfApplication* app;
1128- BamfLauncherIcon* icon;
1129
1130 // Sufficiently large number such that we ensure proper sorting
1131 // (avoids case where first item gets tacked onto end rather than start)
1132@@ -736,7 +728,7 @@
1133 for (FavoriteList::const_iterator i = favs.begin(), end = favs.end();
1134 i != end; ++i)
1135 {
1136- AbstractLauncherIcon* fav = CreateFavorite(i->c_str());
1137+ AbstractLauncherIcon::Ptr fav = CreateFavorite(i->c_str());
1138
1139 if (fav)
1140 {
1141@@ -757,7 +749,7 @@
1142 continue;
1143 g_object_set_qdata(G_OBJECT(app), g_quark_from_static_string("unity-seen"), GINT_TO_POINTER(1));
1144
1145- icon = new BamfLauncherIcon(app);
1146+ AbstractLauncherIcon::Ptr icon(new BamfLauncherIcon(app));
1147 icon->SetSortPriority(sort_priority_++);
1148 RegisterIcon(icon);
1149 }
1150@@ -827,11 +819,11 @@
1151 return shortcuts;
1152 }
1153
1154-std::vector<AbstractLauncherIcon*> Controller::GetAltTabIcons(bool current) const
1155+std::vector<AbstractLauncherIcon::Ptr> Controller::GetAltTabIcons(bool current) const
1156 {
1157- std::vector<AbstractLauncherIcon*> results;
1158+ std::vector<AbstractLauncherIcon::Ptr> results;
1159
1160- results.push_back(pimpl->desktop_icon_.GetPointer());
1161+ results.push_back(pimpl->desktop_icon_);
1162
1163 for (auto icon : *(pimpl->model_))
1164 if (icon->ShowInSwitcher(current))
1165
1166=== modified file 'plugins/unityshell/src/LauncherController.h'
1167--- plugins/unityshell/src/LauncherController.h 2012-02-04 05:28:23 +0000
1168+++ plugins/unityshell/src/LauncherController.h 2012-02-12 19:58:19 +0000
1169@@ -53,7 +53,7 @@
1170
1171 void UpdateNumWorkspaces(int workspaces);
1172 std::vector<char> GetAllShortcuts() const;
1173- std::vector<AbstractLauncherIcon*> GetAltTabIcons(bool current) const;
1174+ std::vector<AbstractLauncherIcon::Ptr> GetAltTabIcons(bool current) const;
1175
1176 void PushToFront();
1177
1178
1179=== modified file 'plugins/unityshell/src/LauncherIcon.cpp'
1180--- plugins/unityshell/src/LauncherIcon.cpp 2012-02-11 07:34:27 +0000
1181+++ plugins/unityshell/src/LauncherIcon.cpp 2012-02-12 19:58:19 +0000
1182@@ -706,7 +706,7 @@
1183 return;
1184
1185 _has_visible_window[monitor] = val;
1186- needs_redraw.emit(this);
1187+ EmitNeedsRedraw();
1188 }
1189
1190 gboolean
1191@@ -760,7 +760,7 @@
1192 _quicklist->Hide();
1193
1194 SetQuirk(QUIRK_VISIBLE, false);
1195- remove.emit(this);
1196+ EmitRemove();
1197 }
1198
1199 void
1200@@ -782,7 +782,7 @@
1201 }
1202
1203 LauncherIcon::IconType
1204-LauncherIcon::Type()
1205+LauncherIcon::GetIconType()
1206 {
1207 return _icon_type;
1208 }
1209@@ -804,7 +804,7 @@
1210 TimeUtil::SetTimeStruct(&(_quirk_times[quirk]), &(_quirk_times[quirk]), Launcher::ANIM_DURATION_SHORT);
1211 else
1212 clock_gettime(CLOCK_MONOTONIC, &(_quirk_times[quirk]));
1213- needs_redraw.emit(this);
1214+ EmitNeedsRedraw();
1215
1216 // Present on urgent as a general policy
1217 if (quirk == QUIRK_VISIBLE && value)
1218@@ -828,7 +828,7 @@
1219 LauncherIcon* self = arg->self;
1220
1221 clock_gettime(CLOCK_MONOTONIC, &(self->_quirk_times[arg->quirk]));
1222- self->needs_redraw.emit(self);
1223+ self->EmitNeedsRedraw();
1224
1225 self->_time_delay_handle = 0;
1226
1227@@ -849,7 +849,7 @@
1228 LauncherIcon::UpdateQuirkTime(LauncherIcon::Quirk quirk)
1229 {
1230 clock_gettime(CLOCK_MONOTONIC, &(_quirk_times[quirk]));
1231- needs_redraw.emit(this);
1232+ EmitNeedsRedraw();
1233 }
1234
1235 void
1236@@ -872,7 +872,7 @@
1237 return;
1238
1239 _progress = progress;
1240- needs_redraw.emit(this);
1241+ EmitNeedsRedraw();
1242 }
1243
1244 float
1245@@ -902,7 +902,7 @@
1246 LauncherIcon::SetEmblem(LauncherIcon::BaseTexturePtr const& emblem)
1247 {
1248 _emblem = emblem;
1249- needs_redraw.emit(this);
1250+ EmitNeedsRedraw();
1251 }
1252
1253 void
1254@@ -1135,5 +1135,18 @@
1255 SetProgress((float) remote->Progress());
1256 }
1257
1258+void LauncherIcon::EmitNeedsRedraw()
1259+{
1260+ if (OwnsTheReference())
1261+ needs_redraw.emit(AbstractLauncherIcon::Ptr(this));
1262+}
1263+
1264+void LauncherIcon::EmitRemove()
1265+{
1266+ if (OwnsTheReference())
1267+ remove.emit(AbstractLauncherIcon::Ptr(this));
1268+}
1269+
1270+
1271 } // namespace launcher
1272 } // namespace unity
1273
1274=== modified file 'plugins/unityshell/src/LauncherIcon.h'
1275--- plugins/unityshell/src/LauncherIcon.h 2012-02-09 04:14:31 +0000
1276+++ plugins/unityshell/src/LauncherIcon.h 2012-02-12 19:58:19 +0000
1277@@ -141,7 +141,7 @@
1278
1279 struct timespec GetQuirkTime(Quirk quirk);
1280
1281- IconType Type();
1282+ IconType GetIconType();
1283
1284 virtual nux::Color BackgroundColor();
1285
1286@@ -184,6 +184,18 @@
1287
1288 void SetIconType(IconType type);
1289
1290+ virtual std::string DesktopFile() { return std::string(""); }
1291+
1292+ virtual bool IsSticky() const { return false; }
1293+
1294+ virtual bool IsVisible() const { return false; }
1295+
1296+ virtual void AboutToRemove() {}
1297+
1298+ virtual void Stick(bool save = true) {}
1299+
1300+ virtual void UnStick() {}
1301+
1302 protected:
1303 std::vector<nux::Point3> GetCenters();
1304
1305@@ -263,6 +275,9 @@
1306
1307 void OnRemoteProgressVisibleChanged(LauncherEntryRemote* remote);
1308
1309+ void EmitNeedsRedraw();
1310+
1311+ void EmitRemove();
1312
1313 // This looks like a case for boost::logical::tribool
1314 static int _current_theme_is_mono;
1315
1316=== modified file 'plugins/unityshell/src/LauncherModel.cpp'
1317--- plugins/unityshell/src/LauncherModel.cpp 2012-02-08 00:32:46 +0000
1318+++ plugins/unityshell/src/LauncherModel.cpp 2012-02-12 19:58:19 +0000
1319@@ -30,7 +30,7 @@
1320
1321 typedef struct
1322 {
1323- AbstractLauncherIcon* icon;
1324+ AbstractLauncherIcon::Ptr icon;
1325 LauncherModel* self;
1326 } RemoveArg;
1327
1328@@ -41,11 +41,6 @@
1329
1330 LauncherModel::~LauncherModel()
1331 {
1332- for (auto icon : _inner_shelf)
1333- icon->UnReference();
1334-
1335- for (auto icon : _inner_main)
1336- icon->UnReference();
1337 }
1338
1339 std::string LauncherModel::GetName() const
1340@@ -64,21 +59,21 @@
1341 introspection_results_.clear();
1342
1343 for (auto icon : _inner)
1344- introspection_results_.push_back(icon);
1345+ introspection_results_.push_back(icon.GetPointer());
1346
1347 return introspection_results_;
1348 }
1349
1350-bool LauncherModel::IconShouldShelf(AbstractLauncherIcon* icon) const
1351+bool LauncherModel::IconShouldShelf(AbstractLauncherIcon::Ptr icon) const
1352 {
1353- return icon->Type() == AbstractLauncherIcon::TYPE_TRASH;
1354+ return icon->GetIconType() == AbstractLauncherIcon::TYPE_TRASH;
1355 }
1356
1357-bool LauncherModel::CompareIcons(AbstractLauncherIcon* first, AbstractLauncherIcon* second)
1358+bool LauncherModel::CompareIcons(AbstractLauncherIcon::Ptr first, AbstractLauncherIcon::Ptr second)
1359 {
1360- if (first->Type() < second->Type())
1361+ if (first->GetIconType() < second->GetIconType())
1362 return true;
1363- else if (first->Type() > second->Type())
1364+ else if (first->GetIconType() > second->GetIconType())
1365 return false;
1366
1367 return first->SortPriority() < second->SortPriority();
1368@@ -112,10 +107,8 @@
1369 }
1370
1371 void
1372-LauncherModel::AddIcon(AbstractLauncherIcon* icon)
1373+LauncherModel::AddIcon(AbstractLauncherIcon::Ptr icon)
1374 {
1375- icon->SinkReference();
1376-
1377 if (IconShouldShelf(icon))
1378 _inner_shelf.push_back(icon);
1379 else
1380@@ -131,7 +124,7 @@
1381 }
1382
1383 void
1384-LauncherModel::RemoveIcon(AbstractLauncherIcon* icon)
1385+LauncherModel::RemoveIcon(AbstractLauncherIcon::Ptr icon)
1386 {
1387 size_t size;
1388
1389@@ -144,7 +137,6 @@
1390 if (size != _inner.size())
1391 {
1392 icon_removed.emit(icon);
1393- icon->UnReference();
1394 }
1395 }
1396
1397@@ -160,7 +152,7 @@
1398 }
1399
1400 void
1401-LauncherModel::OnIconRemove(AbstractLauncherIcon* icon)
1402+LauncherModel::OnIconRemove(AbstractLauncherIcon::Ptr icon)
1403 {
1404 RemoveArg* arg = (RemoveArg*) g_malloc0(sizeof(RemoveArg));
1405 arg->icon = icon;
1406@@ -186,12 +178,12 @@
1407 }
1408
1409 bool
1410-LauncherModel::IconHasSister(AbstractLauncherIcon* icon) const
1411+LauncherModel::IconHasSister(AbstractLauncherIcon::Ptr icon) const
1412 {
1413 const_iterator it;
1414 const_iterator end;
1415
1416- if (icon && icon->Type() == AbstractLauncherIcon::TYPE_DEVICE)
1417+ if (icon && icon->GetIconType() == AbstractLauncherIcon::TYPE_DEVICE)
1418 return true;
1419
1420 if (IconShouldShelf(icon))
1421@@ -207,9 +199,9 @@
1422
1423 for (; it != end; ++it)
1424 {
1425- AbstractLauncherIcon* iter_icon = *it;
1426+ AbstractLauncherIcon::Ptr iter_icon = *it;
1427 if ((iter_icon != icon)
1428- && iter_icon->Type() == icon->Type())
1429+ && iter_icon->GetIconType() == icon->GetIconType())
1430 return true;
1431 }
1432
1433@@ -217,7 +209,7 @@
1434 }
1435
1436 void
1437-LauncherModel::ReorderAfter(AbstractLauncherIcon* icon, AbstractLauncherIcon* other)
1438+LauncherModel::ReorderAfter(AbstractLauncherIcon::Ptr icon, AbstractLauncherIcon::Ptr other)
1439 {
1440 if (icon == other)
1441 return;
1442@@ -247,7 +239,7 @@
1443 }
1444
1445 void
1446-LauncherModel::ReorderBefore(AbstractLauncherIcon* icon, AbstractLauncherIcon* other, bool save)
1447+LauncherModel::ReorderBefore(AbstractLauncherIcon::Ptr icon, AbstractLauncherIcon::Ptr other, bool save)
1448 {
1449 if (icon == other)
1450 return;
1451@@ -288,7 +280,7 @@
1452 }
1453
1454 void
1455-LauncherModel::ReorderSmart(AbstractLauncherIcon* icon, AbstractLauncherIcon* other, bool save)
1456+LauncherModel::ReorderSmart(AbstractLauncherIcon::Ptr icon, AbstractLauncherIcon::Ptr other, bool save)
1457 {
1458 if (icon == other)
1459 return;
1460@@ -347,7 +339,7 @@
1461 return _inner.size();
1462 }
1463
1464-AbstractLauncherIcon* LauncherModel::Selection () const
1465+AbstractLauncherIcon::Ptr LauncherModel::Selection () const
1466 {
1467 return _inner[selection_];
1468 }
1469
1470=== modified file 'plugins/unityshell/src/LauncherModel.h'
1471--- plugins/unityshell/src/LauncherModel.h 2012-02-08 00:32:46 +0000
1472+++ plugins/unityshell/src/LauncherModel.h 2012-02-12 19:58:19 +0000
1473@@ -35,7 +35,7 @@
1474 {
1475 public:
1476 typedef std::shared_ptr<LauncherModel> Ptr;
1477- typedef std::vector<AbstractLauncherIcon*> Base;
1478+ typedef std::vector<AbstractLauncherIcon::Ptr> Base;
1479 typedef Base::iterator iterator;
1480 typedef Base::const_iterator const_iterator;
1481 typedef Base::reverse_iterator reverse_iterator;
1482@@ -44,22 +44,22 @@
1483 LauncherModel();
1484 ~LauncherModel();
1485
1486- void AddIcon(AbstractLauncherIcon* icon);
1487- void RemoveIcon(AbstractLauncherIcon* icon);
1488+ void AddIcon(AbstractLauncherIcon::Ptr icon);
1489+ void RemoveIcon(AbstractLauncherIcon::Ptr icon);
1490 void Save();
1491 void Sort();
1492 int Size() const;
1493
1494- void OnIconRemove(AbstractLauncherIcon* icon);
1495-
1496- bool IconHasSister(AbstractLauncherIcon* icon) const;
1497-
1498- void ReorderAfter(AbstractLauncherIcon* icon, AbstractLauncherIcon* other);
1499- void ReorderBefore(AbstractLauncherIcon* icon, AbstractLauncherIcon* other, bool save);
1500-
1501- void ReorderSmart(AbstractLauncherIcon* icon, AbstractLauncherIcon* other, bool save);
1502-
1503- AbstractLauncherIcon* Selection() const;
1504+ void OnIconRemove(AbstractLauncherIcon::Ptr icon);
1505+
1506+ bool IconHasSister(AbstractLauncherIcon::Ptr icon) const;
1507+
1508+ void ReorderAfter(AbstractLauncherIcon::Ptr icon, AbstractLauncherIcon::Ptr other);
1509+ void ReorderBefore(AbstractLauncherIcon::Ptr icon, AbstractLauncherIcon::Ptr other, bool save);
1510+
1511+ void ReorderSmart(AbstractLauncherIcon::Ptr icon, AbstractLauncherIcon::Ptr other, bool save);
1512+
1513+ AbstractLauncherIcon::Ptr Selection() const;
1514 int SelectionIndex() const;
1515 void SetSelection(int selection);
1516 void SelectNext();
1517@@ -81,11 +81,11 @@
1518 reverse_iterator shelf_rbegin();
1519 reverse_iterator shelf_rend();
1520
1521- sigc::signal<void, AbstractLauncherIcon*> icon_added;
1522- sigc::signal<void, AbstractLauncherIcon*> icon_removed;
1523+ sigc::signal<void, AbstractLauncherIcon::Ptr> icon_added;
1524+ sigc::signal<void, AbstractLauncherIcon::Ptr> icon_removed;
1525 sigc::signal<void> order_changed;
1526 sigc::signal<void> saved;
1527- sigc::signal<void, AbstractLauncherIcon*> selection_changed;
1528+ sigc::signal<void, AbstractLauncherIcon::Ptr> selection_changed;
1529
1530 IntrospectableList const& GetIntrospectableChildren();
1531 protected:
1532@@ -102,26 +102,26 @@
1533
1534 bool Populate();
1535
1536- bool IconShouldShelf(AbstractLauncherIcon* icon) const;
1537+ bool IconShouldShelf(AbstractLauncherIcon::Ptr icon) const;
1538
1539 static gboolean RemoveCallback(gpointer data);
1540
1541- static bool CompareIcons(AbstractLauncherIcon* first, AbstractLauncherIcon* second);
1542+ static bool CompareIcons(AbstractLauncherIcon::Ptr first, AbstractLauncherIcon::Ptr second);
1543
1544 /* Template Methods */
1545 public:
1546 template<class T>
1547- std::list<T*> GetSublist()
1548+ std::list<AbstractLauncherIcon::Ptr> GetSublist()
1549 {
1550- std::list<T*> result;
1551+ std::list<AbstractLauncherIcon::Ptr> result;
1552
1553 iterator it;
1554 for (it = begin(); it != end(); it++)
1555 {
1556- T* var = dynamic_cast<T*>(*it);
1557+ T* var = dynamic_cast<T*>((*it).GetPointer());
1558
1559 if (var)
1560- result.push_back(var);
1561+ result.push_back(*it);
1562 }
1563
1564 return result;
1565
1566=== modified file 'plugins/unityshell/src/MockLauncherIcon.h'
1567--- plugins/unityshell/src/MockLauncherIcon.h 2012-02-04 05:28:23 +0000
1568+++ plugins/unityshell/src/MockLauncherIcon.h 2012-02-12 19:58:19 +0000
1569@@ -42,6 +42,7 @@
1570
1571 class MockLauncherIcon : public AbstractLauncherIcon
1572 {
1573+ NUX_DECLARE_OBJECT_TYPE(MockLauncherIcon, AbstractLauncherIcon);
1574 public:
1575 MockLauncherIcon()
1576 : icon_(0)
1577@@ -185,7 +186,7 @@
1578 return tv;
1579 }
1580
1581- IconType Type()
1582+ IconType GetIconType()
1583 {
1584 return type_;
1585 }
1586@@ -239,6 +240,18 @@
1587
1588 void SendDndLeave() {}
1589
1590+ std::string DesktopFile() { return std::string(""); }
1591+
1592+ bool IsSticky() const { return false; }
1593+
1594+ bool IsVisible() const { return false; }
1595+
1596+ void AboutToRemove() {}
1597+
1598+ void Stick(bool save = true) {}
1599+
1600+ void UnStick() {}
1601+
1602 private:
1603 nux::BaseTexture* TextureFromGtkTheme(const char* icon_name, int size)
1604 {
1605@@ -292,6 +305,8 @@
1606 IconType type_;
1607 };
1608
1609+NUX_IMPLEMENT_OBJECT_TYPE(MockLauncherIcon);
1610+
1611 }
1612 }
1613
1614
1615=== modified file 'plugins/unityshell/src/SimpleLauncherIcon.cpp'
1616--- plugins/unityshell/src/SimpleLauncherIcon.cpp 2012-02-08 00:32:46 +0000
1617+++ plugins/unityshell/src/SimpleLauncherIcon.cpp 2012-02-12 19:58:19 +0000
1618@@ -40,6 +40,8 @@
1619 nux::logging::Logger logger("unity.dash.CategoryViewGrid");
1620 }
1621
1622+NUX_IMPLEMENT_OBJECT_TYPE(SimpleLauncherIcon);
1623+
1624 SimpleLauncherIcon::SimpleLauncherIcon()
1625 : LauncherIcon()
1626 , icon_name("", sigc::mem_fun(this, &SimpleLauncherIcon::SetIconName))
1627@@ -130,7 +132,7 @@
1628 element.second->UnReference();
1629
1630 texture_map.clear ();
1631- needs_redraw.emit(this);
1632+ EmitNeedsRedraw();
1633 }
1634
1635 void SimpleLauncherIcon::OnIconThemeChanged(GtkIconTheme* icon_theme, gpointer data)
1636
1637=== modified file 'plugins/unityshell/src/SimpleLauncherIcon.h'
1638--- plugins/unityshell/src/SimpleLauncherIcon.h 2012-02-08 00:32:46 +0000
1639+++ plugins/unityshell/src/SimpleLauncherIcon.h 2012-02-12 19:58:19 +0000
1640@@ -31,6 +31,7 @@
1641
1642 class SimpleLauncherIcon : public LauncherIcon
1643 {
1644+ NUX_DECLARE_OBJECT_TYPE(SimpleLauncherIcon, LauncherIcon);
1645 public:
1646 SimpleLauncherIcon();
1647 virtual ~SimpleLauncherIcon();
1648
1649=== modified file 'plugins/unityshell/src/SoftwareCenterLauncherIcon.cpp'
1650--- plugins/unityshell/src/SoftwareCenterLauncherIcon.cpp 2012-02-03 01:24:53 +0000
1651+++ plugins/unityshell/src/SoftwareCenterLauncherIcon.cpp 2012-02-12 19:58:19 +0000
1652@@ -43,6 +43,7 @@
1653 SetProgress(0.0f);
1654 });
1655
1656+ SetIconType(TYPE_APPLICATION);
1657 icon_name = icon_path.c_str();
1658 tooltip_text = _("Waiting to install");
1659 }
1660
1661=== modified file 'plugins/unityshell/src/SwitcherController.cpp'
1662--- plugins/unityshell/src/SwitcherController.cpp 2012-02-04 05:28:23 +0000
1663+++ plugins/unityshell/src/SwitcherController.cpp 2012-02-12 19:58:19 +0000
1664@@ -74,7 +74,7 @@
1665 }
1666
1667 void Controller::Show(ShowMode show, SortMode sort, bool reverse,
1668- std::vector<AbstractLauncherIcon*> results)
1669+ std::vector<AbstractLauncherIcon::Ptr> results)
1670 {
1671 if (sort == SortMode::FOCUS_ORDER)
1672 {
1673@@ -147,7 +147,7 @@
1674 return FALSE;
1675 }
1676
1677-void Controller::OnModelSelectionChanged(AbstractLauncherIcon *icon)
1678+void Controller::OnModelSelectionChanged(AbstractLauncherIcon::Ptr icon)
1679 {
1680 if (detail_on_timeout)
1681 {
1682@@ -205,7 +205,7 @@
1683
1684 if (accept_state)
1685 {
1686- AbstractLauncherIcon* selection = model_->Selection();
1687+ AbstractLauncherIcon::Ptr selection = model_->Selection();
1688 if (selection)
1689 {
1690 if (model_->detail_selection)
1691@@ -374,12 +374,12 @@
1692 return view_->ExternalTargets();
1693 }
1694
1695-bool Controller::CompareSwitcherItemsPriority(AbstractLauncherIcon* first,
1696- AbstractLauncherIcon* second)
1697+bool Controller::CompareSwitcherItemsPriority(AbstractLauncherIcon::Ptr first,
1698+ AbstractLauncherIcon::Ptr second)
1699 {
1700- if (first->Type() == second->Type())
1701+ if (first->GetIconType() == second->GetIconType())
1702 return first->SwitcherPriority() > second->SwitcherPriority();
1703- return first->Type() < second->Type();
1704+ return first->GetIconType() < second->GetIconType();
1705 }
1706
1707 void Controller::SelectFirstItem()
1708@@ -387,8 +387,8 @@
1709 if (!model_)
1710 return;
1711
1712- AbstractLauncherIcon* first = model_->at(1);
1713- AbstractLauncherIcon* second = model_->at(2);
1714+ AbstractLauncherIcon::Ptr first = model_->at(1);
1715+ AbstractLauncherIcon::Ptr second = model_->at(2);
1716
1717 if (!first)
1718 {
1719
1720=== modified file 'plugins/unityshell/src/SwitcherController.h'
1721--- plugins/unityshell/src/SwitcherController.h 2012-02-04 05:28:23 +0000
1722+++ plugins/unityshell/src/SwitcherController.h 2012-02-12 19:58:19 +0000
1723@@ -70,7 +70,7 @@
1724 nux::Property<bool> detail_on_timeout;
1725 nux::Property<int> detail_timeout_length;
1726
1727- void Show(ShowMode show, SortMode sort, bool reverse, std::vector<launcher::AbstractLauncherIcon*> results);
1728+ void Show(ShowMode show, SortMode sort, bool reverse, std::vector<launcher::AbstractLauncherIcon::Ptr> results);
1729 void Hide(bool accept_state=true);
1730
1731 bool Visible();
1732@@ -108,7 +108,7 @@
1733
1734 void ConstructView();
1735
1736- void OnModelSelectionChanged(launcher::AbstractLauncherIcon *icon);
1737+ void OnModelSelectionChanged(launcher::AbstractLauncherIcon::Ptr icon);
1738
1739 static void OnBackgroundUpdate(GVariant* data, Controller* self);
1740
1741@@ -131,7 +131,7 @@
1742 static gboolean OnShowTimer(gpointer data);
1743 static gboolean OnDetailTimer(gpointer data);
1744
1745- static bool CompareSwitcherItemsPriority(launcher::AbstractLauncherIcon* first, launcher::AbstractLauncherIcon* second);
1746+ static bool CompareSwitcherItemsPriority(launcher::AbstractLauncherIcon::Ptr first, launcher::AbstractLauncherIcon::Ptr second);
1747 };
1748
1749 }
1750
1751=== modified file 'plugins/unityshell/src/SwitcherModel.cpp'
1752--- plugins/unityshell/src/SwitcherModel.cpp 2012-02-07 07:42:12 +0000
1753+++ plugins/unityshell/src/SwitcherModel.cpp 2012-02-12 19:58:19 +0000
1754@@ -30,7 +30,7 @@
1755 namespace switcher
1756 {
1757
1758-SwitcherModel::SwitcherModel(std::vector<AbstractLauncherIcon*> icons)
1759+SwitcherModel::SwitcherModel(std::vector<AbstractLauncherIcon::Ptr> icons)
1760 : _inner(icons)
1761 , _index(0)
1762 , _last_index(0)
1763@@ -41,8 +41,7 @@
1764
1765 for (auto icon : _inner)
1766 {
1767- AddChild(icon);
1768- icon->Reference();
1769+ AddChild(icon.GetPointer());
1770 }
1771 }
1772
1773@@ -50,8 +49,7 @@
1774 {
1775 for (auto icon : _inner)
1776 {
1777- RemoveChild(icon);
1778- icon->UnReference();
1779+ RemoveChild(icon.GetPointer());
1780 }
1781 }
1782
1783@@ -94,11 +92,11 @@
1784 return _inner.rend();
1785 }
1786
1787-AbstractLauncherIcon*
1788+AbstractLauncherIcon::Ptr
1789 SwitcherModel::at(unsigned int index)
1790 {
1791 if ((int) index >= Size ())
1792- return 0;
1793+ return AbstractLauncherIcon::Ptr();
1794 return _inner[index];
1795 }
1796
1797@@ -108,7 +106,7 @@
1798 return _inner.size();
1799 }
1800
1801-AbstractLauncherIcon*
1802+AbstractLauncherIcon::Ptr
1803 SwitcherModel::Selection()
1804 {
1805 return _inner.at(_index);
1806@@ -120,7 +118,7 @@
1807 return _index;
1808 }
1809
1810-AbstractLauncherIcon*
1811+AbstractLauncherIcon::Ptr
1812 SwitcherModel::LastSelection()
1813 {
1814 return _inner.at(_last_index);
1815@@ -229,7 +227,7 @@
1816 }
1817
1818 void
1819-SwitcherModel::Select(AbstractLauncherIcon* selection)
1820+SwitcherModel::Select(AbstractLauncherIcon::Ptr selection)
1821 {
1822 int i = 0;
1823 for (iterator it = begin(), e = end(); it != e; ++it)
1824
1825=== modified file 'plugins/unityshell/src/SwitcherModel.h'
1826--- plugins/unityshell/src/SwitcherModel.h 2011-12-08 01:23:11 +0000
1827+++ plugins/unityshell/src/SwitcherModel.h 2012-02-12 19:58:19 +0000
1828@@ -41,7 +41,7 @@
1829 public:
1830 typedef boost::shared_ptr<SwitcherModel> Ptr;
1831
1832- typedef std::vector<launcher::AbstractLauncherIcon*> Base;
1833+ typedef std::vector<launcher::AbstractLauncherIcon::Ptr> Base;
1834 typedef Base::iterator iterator;
1835 typedef Base::reverse_iterator reverse_iterator;
1836
1837@@ -52,7 +52,7 @@
1838 // Icons are owned externally and assumed valid for life of switcher.
1839 // When AbstractLauncherIcon is complete, it will be passed as a shared pointer and this
1840 // will no longer be a worry.
1841- SwitcherModel(std::vector<launcher::AbstractLauncherIcon*> icons);
1842+ SwitcherModel(std::vector<launcher::AbstractLauncherIcon::Ptr> icons);
1843 virtual ~SwitcherModel();
1844
1845 iterator begin();
1846@@ -61,14 +61,14 @@
1847 reverse_iterator rbegin();
1848 reverse_iterator rend();
1849
1850- launcher::AbstractLauncherIcon* at(unsigned int index);
1851+ launcher::AbstractLauncherIcon::Ptr at(unsigned int index);
1852
1853 int Size();
1854
1855- launcher::AbstractLauncherIcon* Selection();
1856+ launcher::AbstractLauncherIcon::Ptr Selection();
1857 int SelectionIndex();
1858
1859- launcher::AbstractLauncherIcon* LastSelection();
1860+ launcher::AbstractLauncherIcon::Ptr LastSelection();
1861 int LastSelectionIndex();
1862
1863 std::vector<Window> DetailXids ();
1864@@ -80,10 +80,10 @@
1865 void NextDetail();
1866 void PrevDetail();
1867
1868- void Select(launcher::AbstractLauncherIcon* selection);
1869+ void Select(launcher::AbstractLauncherIcon::Ptr selection);
1870 void Select(int index);
1871
1872- sigc::signal<void, launcher::AbstractLauncherIcon*> selection_changed;
1873+ sigc::signal<void, launcher::AbstractLauncherIcon::Ptr> selection_changed;
1874
1875 protected:
1876 // Introspectable methods
1877
1878=== modified file 'plugins/unityshell/src/SwitcherView.cpp'
1879--- plugins/unityshell/src/SwitcherView.cpp 2012-02-04 05:28:23 +0000
1880+++ plugins/unityshell/src/SwitcherView.cpp 2012-02-12 19:58:19 +0000
1881@@ -172,7 +172,7 @@
1882 QueueDraw ();
1883 }
1884
1885-void SwitcherView::OnSelectionChanged(AbstractLauncherIcon* selection)
1886+void SwitcherView::OnSelectionChanged(AbstractLauncherIcon::Ptr selection)
1887 {
1888 if (selection)
1889 text_view_->SetText(selection->tooltip_text().c_str());
1890@@ -185,10 +185,10 @@
1891 return model_;
1892 }
1893
1894-RenderArg SwitcherView::CreateBaseArgForIcon(AbstractLauncherIcon* icon)
1895+RenderArg SwitcherView::CreateBaseArgForIcon(AbstractLauncherIcon::Ptr icon)
1896 {
1897 RenderArg arg;
1898- arg.icon = icon;
1899+ arg.icon = icon.GetPointer();
1900 arg.alpha = 0.95f;
1901
1902 // tells the renderer to render arrows by number
1903@@ -569,7 +569,7 @@
1904 std::list<RenderArg>::iterator it;
1905 for (it = last_args_.begin(); it != last_args_.end(); ++it)
1906 {
1907- if (it->icon == model_->Selection())
1908+ if (model_->Selection() == it->icon)
1909 {
1910 int view_width = text_view_->GetBaseWidth();
1911 int start_x = it->render_center.x - view_width / 2;
1912
1913=== modified file 'plugins/unityshell/src/SwitcherView.h'
1914--- plugins/unityshell/src/SwitcherView.h 2012-02-04 05:28:23 +0000
1915+++ plugins/unityshell/src/SwitcherView.h 2012-02-12 19:58:19 +0000
1916@@ -88,9 +88,9 @@
1917
1918 std::list<ui::RenderArg> RenderArgsFlat(nux::Geometry& background_geo, int selection, timespec const& current);
1919
1920- ui::RenderArg CreateBaseArgForIcon(launcher::AbstractLauncherIcon* icon);
1921+ ui::RenderArg CreateBaseArgForIcon(launcher::AbstractLauncherIcon::Ptr icon);
1922 private:
1923- void OnSelectionChanged(launcher::AbstractLauncherIcon* selection);
1924+ void OnSelectionChanged(launcher::AbstractLauncherIcon::Ptr selection);
1925 void OnDetailSelectionChanged (bool detail);
1926 void OnDetailSelectionIndexChanged (unsigned int index);
1927
1928
1929=== modified file 'plugins/unityshell/src/unity-launcher-accessible.cpp'
1930--- plugins/unityshell/src/unity-launcher-accessible.cpp 2012-02-04 05:28:23 +0000
1931+++ plugins/unityshell/src/unity-launcher-accessible.cpp 2012-02-12 19:58:19 +0000
1932@@ -64,8 +64,8 @@
1933
1934 /* private */
1935 static void on_selection_change_cb(UnityLauncherAccessible* launcher_accessible);
1936-static void on_icon_added_cb(AbstractLauncherIcon* icon, UnityLauncherAccessible* self);
1937-static void on_icon_removed_cb(AbstractLauncherIcon* icon, UnityLauncherAccessible* self);
1938+static void on_icon_added_cb(AbstractLauncherIcon::Ptr icon, UnityLauncherAccessible* self);
1939+static void on_icon_removed_cb(AbstractLauncherIcon::Ptr icon, UnityLauncherAccessible* self);
1940 static void on_order_change_cb(UnityLauncherAccessible* self);
1941 static void update_children_index(UnityLauncherAccessible* self);
1942
1943@@ -227,7 +227,7 @@
1944 it = launcher_model->begin();
1945 std::advance(it, i);
1946
1947- child = dynamic_cast<nux::Object*>(*it);
1948+ child = dynamic_cast<nux::Object*>((*it).GetPointer());
1949 child_accessible = unity_a11y_get_accessible(child);
1950
1951 parent = atk_object_get_parent(child_accessible);
1952@@ -287,7 +287,7 @@
1953 gint i)
1954 {
1955 Launcher* launcher = NULL;
1956- AbstractLauncherIcon* selected_icon = NULL;
1957+ AbstractLauncherIcon::Ptr selected_icon;
1958 nux::Object* nux_object = NULL;
1959 AtkObject* accessible_selected = NULL;
1960
1961@@ -302,9 +302,9 @@
1962 launcher = dynamic_cast<Launcher*>(nux_object);
1963 selected_icon = launcher->GetSelectedMenuIcon();
1964
1965- if (selected_icon != 0)
1966+ if (selected_icon)
1967 {
1968- accessible_selected = unity_a11y_get_accessible(selected_icon);
1969+ accessible_selected = unity_a11y_get_accessible(selected_icon.GetPointer());
1970 g_object_ref(accessible_selected);
1971 }
1972
1973@@ -315,7 +315,7 @@
1974 unity_launcher_accessible_get_selection_count(AtkSelection* selection)
1975 {
1976 Launcher* launcher = NULL;
1977- AbstractLauncherIcon* selected_icon = NULL;
1978+ AbstractLauncherIcon::Ptr selected_icon;
1979 nux::Object* nux_object = NULL;
1980
1981 g_return_val_if_fail(UNITY_IS_LAUNCHER_ACCESSIBLE(selection), 0);
1982@@ -327,7 +327,7 @@
1983 launcher = dynamic_cast<Launcher*>(nux_object);
1984 selected_icon = launcher->GetSelectedMenuIcon();
1985
1986- if (selected_icon == 0)
1987+ if (!selected_icon)
1988 return 0;
1989 else
1990 return 1;
1991@@ -338,8 +338,8 @@
1992 gint i)
1993 {
1994 Launcher* launcher = NULL;
1995- AbstractLauncherIcon* icon = NULL;
1996- AbstractLauncherIcon* selected_icon = NULL;
1997+ AbstractLauncherIcon::Ptr icon;
1998+ AbstractLauncherIcon::Ptr selected_icon;
1999 LauncherModel* launcher_model = NULL;
2000 LauncherModel::iterator it;
2001 nux::Object* nux_object = NULL;
2002@@ -354,7 +354,7 @@
2003 launcher_model = launcher->GetModel();
2004 it = launcher_model->begin();
2005 std::advance(it, i);
2006- icon = dynamic_cast<AbstractLauncherIcon*>(*it);
2007+ icon = *it;
2008
2009 selected_icon = launcher->GetSelectedMenuIcon();
2010
2011@@ -372,7 +372,7 @@
2012
2013
2014 static void
2015-on_icon_added_cb(AbstractLauncherIcon* icon,
2016+on_icon_added_cb(AbstractLauncherIcon::Ptr icon,
2017 UnityLauncherAccessible* self)
2018 {
2019 AtkObject* icon_accessible = NULL;
2020@@ -385,7 +385,7 @@
2021 if (nux_object == NULL) /* state is defunct */
2022 return;
2023
2024- icon_accessible = unity_a11y_get_accessible(icon);
2025+ icon_accessible = unity_a11y_get_accessible(icon.GetPointer());
2026
2027 update_children_index(self);
2028
2029@@ -396,7 +396,7 @@
2030 }
2031
2032 static void
2033-on_icon_removed_cb(AbstractLauncherIcon* icon,
2034+on_icon_removed_cb(AbstractLauncherIcon::Ptr icon,
2035 UnityLauncherAccessible* self)
2036 {
2037 AtkObject* icon_accessible = NULL;
2038@@ -409,7 +409,7 @@
2039 if (nux_object == NULL) /* state is defunct */
2040 return;
2041
2042- icon_accessible = unity_a11y_get_accessible(icon);
2043+ icon_accessible = unity_a11y_get_accessible(icon.GetPointer());
2044
2045 index = atk_object_get_index_in_parent(icon_accessible);
2046
2047@@ -442,7 +442,7 @@
2048
2049 for (it = launcher_model->begin(); it != launcher_model->end(); it++)
2050 {
2051- child = dynamic_cast<nux::Object*>(*it);
2052+ child = dynamic_cast<nux::Object*>((*it).GetPointer());
2053 child_accessible = unity_a11y_get_accessible(child);
2054
2055 unity_launcher_icon_accessible_set_index(UNITY_LAUNCHER_ICON_ACCESSIBLE(child_accessible),
2056
2057=== modified file 'plugins/unityshell/src/unity-switcher-accessible.cpp'
2058--- plugins/unityshell/src/unity-switcher-accessible.cpp 2012-02-04 05:28:23 +0000
2059+++ plugins/unityshell/src/unity-switcher-accessible.cpp 2012-02-12 19:58:19 +0000
2060@@ -64,7 +64,7 @@
2061 static gboolean unity_switcher_accessible_check_pending_notification(NuxAreaAccessible* self);
2062
2063 /* private */
2064-static void on_selection_changed_cb(AbstractLauncherIcon* icon,
2065+static void on_selection_changed_cb(AbstractLauncherIcon::Ptr icon,
2066 UnitySwitcherAccessible* switcher_accessible);
2067 static void create_children(UnitySwitcherAccessible* self);
2068
2069@@ -311,7 +311,7 @@
2070 {
2071 SwitcherView* switcher = NULL;
2072 SwitcherModel::Ptr switcher_model;
2073- AbstractLauncherIcon* selected_icon = NULL;
2074+ AbstractLauncherIcon::Ptr selected_icon;
2075 nux::Object* nux_object = NULL;
2076
2077 g_return_val_if_fail(UNITY_IS_SWITCHER_ACCESSIBLE(selection), 0);
2078@@ -325,7 +325,7 @@
2079
2080 selected_icon = switcher_model->Selection();
2081
2082- if (selected_icon == 0)
2083+ if (!selected_icon)
2084 return 0;
2085 else
2086 return 1;
2087@@ -377,7 +377,7 @@
2088
2089 /* private */
2090 static void
2091-on_selection_changed_cb(AbstractLauncherIcon* icon,
2092+on_selection_changed_cb(AbstractLauncherIcon::Ptr icon,
2093 UnitySwitcherAccessible* switcher_accessible)
2094 {
2095 g_signal_emit_by_name(ATK_OBJECT(switcher_accessible), "selection-changed");
2096@@ -391,7 +391,7 @@
2097 SwitcherView* switcher = NULL;
2098 SwitcherModel::Ptr switcher_model;
2099 SwitcherModel::iterator it;
2100- AbstractLauncherIcon* child = NULL;
2101+ AbstractLauncherIcon::Ptr child;
2102 AtkObject* child_accessible = NULL;
2103
2104 nux_object = nux_object_accessible_get_object(NUX_OBJECT_ACCESSIBLE(self));
2105@@ -406,8 +406,8 @@
2106
2107 for (it = switcher_model->begin(); it != switcher_model->end(); it++)
2108 {
2109- child = dynamic_cast<AbstractLauncherIcon*>(*it);
2110- child_accessible = unity_launcher_icon_accessible_new(child);
2111+ child = *it;
2112+ child_accessible = unity_launcher_icon_accessible_new(child.GetPointer());
2113 atk_object_set_parent(child_accessible, ATK_OBJECT(self));
2114 self->priv->children = g_slist_append(self->priv->children,
2115 child_accessible);
2116
2117=== modified file 'plugins/unityshell/src/unityshell.cpp'
2118--- plugins/unityshell/src/unityshell.cpp 2012-02-12 05:21:59 +0000
2119+++ plugins/unityshell/src/unityshell.cpp 2012-02-12 19:58:19 +0000
2120@@ -1595,9 +1595,9 @@
2121
2122 int show_monitor = (show_mode == switcher::ShowMode::CURRENT_VIEWPORT) ? device : -1;
2123
2124- std::vector<unity::launcher::AbstractLauncherIcon*> results = launcher_controller_->GetAltTabIcons(show_monitor);
2125+ auto results = launcher_controller_->GetAltTabIcons(show_monitor);
2126
2127- if (!(results.size() == 1 && results[0]->Type() == AbstractLauncherIcon::IconType::TYPE_BEGIN))
2128+ if (!(results.size() == 1 && results[0]->GetIconType() == AbstractLauncherIcon::IconType::TYPE_BEGIN))
2129 switcher_controller_->Show(show_mode, switcher::SortMode::FOCUS_ORDER, false, results);
2130
2131 return true;
2132
2133=== modified file 'tests/CMakeLists.txt'
2134--- tests/CMakeLists.txt 2012-02-07 13:38:59 +0000
2135+++ tests/CMakeLists.txt 2012-02-12 19:58:19 +0000
2136@@ -123,6 +123,7 @@
2137 test_grabhandle.cpp
2138 test_unityshell_private.cpp
2139 ${UNITY_SRC}/AbstractLauncherIcon.h
2140+ ${UNITY_SRC}/AbstractLauncherIcon.cpp
2141 ${UNITY_SRC}/AbstractShortcutHint.h
2142 ${UNITY_SRC}/Animator.cpp
2143 ${UNITY_SRC}/Animator.h
2144
2145=== modified file 'tests/test_launcher_model.cpp'
2146--- tests/test_launcher_model.cpp 2012-01-29 21:50:37 +0000
2147+++ tests/test_launcher_model.cpp 2012-02-12 19:58:19 +0000
2148@@ -41,12 +41,12 @@
2149 icon_removed = false;
2150 }
2151
2152- void OnIconAdded (AbstractLauncherIcon* icon)
2153+ void OnIconAdded (AbstractLauncherIcon::Ptr icon)
2154 {
2155 icon_added = true;
2156 }
2157
2158- void OnIconRemoved (AbstractLauncherIcon* icon)
2159+ void OnIconRemoved (AbstractLauncherIcon::Ptr icon)
2160 {
2161 icon_removed = true;
2162 }
2163@@ -64,7 +64,7 @@
2164
2165 TEST(TestLauncherModel, TestAdd)
2166 {
2167- AbstractLauncherIcon* first = new MockLauncherIcon();
2168+ AbstractLauncherIcon::Ptr first(new MockLauncherIcon());
2169 LauncherModel::Ptr model(new LauncherModel());
2170
2171 EXPECT_EQ(model->Size(), 0);
2172@@ -74,7 +74,7 @@
2173
2174 TEST(TestLauncherModel, TestRemove)
2175 {
2176- AbstractLauncherIcon* first = new MockLauncherIcon();
2177+ AbstractLauncherIcon::Ptr first(new MockLauncherIcon());
2178 LauncherModel::Ptr model(new LauncherModel());
2179
2180 EXPECT_EQ(model->Size(), 0);
2181@@ -86,7 +86,7 @@
2182
2183 TEST(TestLauncherModel, TestAddSignal)
2184 {
2185- AbstractLauncherIcon* first = new MockLauncherIcon();
2186+ AbstractLauncherIcon::Ptr first(new MockLauncherIcon());
2187 LauncherModel::Ptr model(new LauncherModel());
2188
2189 EventListener *listener = new EventListener();
2190@@ -100,7 +100,7 @@
2191
2192 TEST(TestLauncherModel, TestRemoveSignal)
2193 {
2194- AbstractLauncherIcon* first = new MockLauncherIcon();
2195+ AbstractLauncherIcon::Ptr first(new MockLauncherIcon());
2196 LauncherModel::Ptr model(new LauncherModel());
2197
2198 EventListener *listener = new EventListener();
2199@@ -116,10 +116,10 @@
2200
2201 TEST(TestLauncherModel, TestSort)
2202 {
2203- AbstractLauncherIcon* first = new MockLauncherIcon();
2204- AbstractLauncherIcon* second = new MockLauncherIcon();
2205- AbstractLauncherIcon* third = new MockLauncherIcon();
2206- AbstractLauncherIcon* fourth = new MockLauncherIcon();
2207+ AbstractLauncherIcon::Ptr first(new MockLauncherIcon());
2208+ AbstractLauncherIcon::Ptr second(new MockLauncherIcon());
2209+ AbstractLauncherIcon::Ptr third(new MockLauncherIcon());
2210+ AbstractLauncherIcon::Ptr fourth(new MockLauncherIcon());
2211
2212 LauncherModel::Ptr model(new LauncherModel());
2213
2214@@ -149,10 +149,10 @@
2215
2216 TEST(TestLauncherModel, TestReorderBefore)
2217 {
2218- AbstractLauncherIcon* first = new MockLauncherIcon();
2219- AbstractLauncherIcon* second = new MockLauncherIcon();
2220- AbstractLauncherIcon* third = new MockLauncherIcon();
2221- AbstractLauncherIcon* fourth = new MockLauncherIcon();
2222+ AbstractLauncherIcon::Ptr first(new MockLauncherIcon());
2223+ AbstractLauncherIcon::Ptr second(new MockLauncherIcon());
2224+ AbstractLauncherIcon::Ptr third(new MockLauncherIcon());
2225+ AbstractLauncherIcon::Ptr fourth(new MockLauncherIcon());
2226
2227 LauncherModel::Ptr model(new LauncherModel());
2228
2229@@ -182,10 +182,10 @@
2230
2231 TEST(TestLauncherModel, TestReorderSmart)
2232 {
2233- AbstractLauncherIcon* first = new MockLauncherIcon();
2234- AbstractLauncherIcon* second = new MockLauncherIcon();
2235- AbstractLauncherIcon* third = new MockLauncherIcon();
2236- AbstractLauncherIcon* fourth = new MockLauncherIcon();
2237+ AbstractLauncherIcon::Ptr first(new MockLauncherIcon());
2238+ AbstractLauncherIcon::Ptr second(new MockLauncherIcon());
2239+ AbstractLauncherIcon::Ptr third(new MockLauncherIcon());
2240+ AbstractLauncherIcon::Ptr fourth(new MockLauncherIcon());
2241
2242 LauncherModel::Ptr model(new LauncherModel());
2243