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