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

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

Description of the change

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

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

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

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'plugins/unityshell/src/AbstractLauncherIcon.cpp'
--- plugins/unityshell/src/AbstractLauncherIcon.cpp 1970-01-01 00:00:00 +0000
+++ plugins/unityshell/src/AbstractLauncherIcon.cpp 2012-02-12 19:58:19 +0000
@@ -0,0 +1,27 @@
1// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
2/*
3 * Copyright (C) 2012 Canonical Ltd
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Authored by: Jason Smith <jason.smith@canonical.com>
18 */
19
20#include "AbstractLauncherIcon.h"
21
22namespace unity {
23namespace launcher {
24 // needed for ungodly stupid reasons
25 NUX_IMPLEMENT_OBJECT_TYPE(AbstractLauncherIcon);
26}
27}
0\ No newline at end of file28\ No newline at end of file
129
=== modified file 'plugins/unityshell/src/AbstractLauncherIcon.h'
--- plugins/unityshell/src/AbstractLauncherIcon.h 2012-02-04 05:28:23 +0000
+++ plugins/unityshell/src/AbstractLauncherIcon.h 2012-02-12 19:58:19 +0000
@@ -75,8 +75,9 @@
7575
76class AbstractLauncherIcon : public ui::IconTextureSource, public debug::Introspectable76class AbstractLauncherIcon : public ui::IconTextureSource, public debug::Introspectable
77{77{
78 NUX_DECLARE_OBJECT_TYPE(AbstractLauncherIcon, ui::IconTextureSource);
78public:79public:
7980 typedef nux::ObjectPtr<AbstractLauncherIcon> Ptr;
80 typedef std::vector<nux::Vector4> TransformVector;81 typedef std::vector<nux::Vector4> TransformVector;
8182
82 typedef enum83 typedef enum
@@ -168,7 +169,7 @@
168169
169 virtual void ResetQuirkTime(Quirk quirk) = 0;170 virtual void ResetQuirkTime(Quirk quirk) = 0;
170171
171 virtual IconType Type() = 0;172 virtual IconType GetIconType() = 0;
172173
173 virtual const gchar* RemoteUri() = 0;174 virtual const gchar* RemoteUri() = 0;
174175
@@ -186,16 +187,26 @@
186187
187 virtual void RemoveEntryRemote(LauncherEntryRemote* remote) = 0;188 virtual void RemoveEntryRemote(LauncherEntryRemote* remote) = 0;
188189
190 virtual std::string DesktopFile() = 0;
191
192 virtual bool IsSticky() const = 0;
193
194 virtual bool IsVisible() const = 0;
195
196 virtual void AboutToRemove() = 0;
197
198 virtual void Stick(bool save = true) = 0;
199
200 virtual void UnStick() = 0;
201
189 sigc::signal<void, int, int> mouse_down;202 sigc::signal<void, int, int> mouse_down;
190 sigc::signal<void, int, int> mouse_up;203 sigc::signal<void, int, int> mouse_up;
191 sigc::signal<void, int, int> mouse_click;204 sigc::signal<void, int, int> mouse_click;
192 sigc::signal<void, int> mouse_enter;205 sigc::signal<void, int> mouse_enter;
193 sigc::signal<void, int> mouse_leave;206 sigc::signal<void, int> mouse_leave;
194207
195 sigc::signal<void, AbstractLauncherIcon*> show;208 sigc::signal<void, AbstractLauncherIcon::Ptr> needs_redraw;
196 sigc::signal<void, AbstractLauncherIcon*> hide;209 sigc::signal<void, AbstractLauncherIcon::Ptr> remove;
197 sigc::signal<void, AbstractLauncherIcon*> needs_redraw;
198 sigc::signal<void, AbstractLauncherIcon*> remove;
199210
200 sigc::connection needs_redraw_connection;211 sigc::connection needs_redraw_connection;
201 sigc::connection on_icon_added_connection;212 sigc::connection on_icon_added_connection;
202213
=== modified file 'plugins/unityshell/src/BamfLauncherIcon.cpp'
--- plugins/unityshell/src/BamfLauncherIcon.cpp 2012-02-11 07:34:27 +0000
+++ plugins/unityshell/src/BamfLauncherIcon.cpp 2012-02-12 19:58:19 +0000
@@ -39,6 +39,8 @@
39namespace launcher39namespace launcher
40{40{
4141
42NUX_IMPLEMENT_OBJECT_TYPE(BamfLauncherIcon);
43
42BamfLauncherIcon::BamfLauncherIcon(BamfApplication* app)44BamfLauncherIcon::BamfLauncherIcon(BamfApplication* app)
43 : SimpleLauncherIcon()45 : SimpleLauncherIcon()
44 , _bamf_app(app, glib::AddRef())46 , _bamf_app(app, glib::AddRef())
@@ -120,7 +122,7 @@
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));
121 WindowManager::Default()->terminate_expo.connect(sigc::mem_fun(this, &BamfLauncherIcon::EnsureWindowState));123 WindowManager::Default()->terminate_expo.connect(sigc::mem_fun(this, &BamfLauncherIcon::EnsureWindowState));
122124
123 EnsureWindowState();125 //EnsureWindowState();
124 UpdateMenus();126 UpdateMenus();
125 UpdateDesktopFile();127 UpdateDesktopFile();
126128
@@ -653,7 +655,7 @@
653 for (int i = 0; i < max_num_monitors; i++)655 for (int i = 0; i < max_num_monitors; i++)
654 SetWindowVisibleOnMonitor(monitors[i], i);656 SetWindowVisibleOnMonitor(monitors[i], i);
655657
656 needs_redraw.emit(this);658 EmitNeedsRedraw();
657659
658 g_list_free(children);660 g_list_free(children);
659}661}
660662
=== modified file 'plugins/unityshell/src/BamfLauncherIcon.h'
--- plugins/unityshell/src/BamfLauncherIcon.h 2012-02-08 00:32:46 +0000
+++ plugins/unityshell/src/BamfLauncherIcon.h 2012-02-12 19:58:19 +0000
@@ -38,6 +38,7 @@
3838
39class BamfLauncherIcon : public SimpleLauncherIcon39class BamfLauncherIcon : public SimpleLauncherIcon
40{40{
41 NUX_DECLARE_OBJECT_TYPE(BamfLauncherIcon, SimpleLauncherIcon);
41public:42public:
42 BamfLauncherIcon(BamfApplication* app);43 BamfLauncherIcon(BamfApplication* app);
43 virtual ~BamfLauncherIcon();44 virtual ~BamfLauncherIcon();
4445
=== modified file 'plugins/unityshell/src/DesktopLauncherIcon.cpp'
--- plugins/unityshell/src/DesktopLauncherIcon.cpp 2012-02-08 00:32:46 +0000
+++ plugins/unityshell/src/DesktopLauncherIcon.cpp 2012-02-12 19:58:19 +0000
@@ -36,6 +36,7 @@
36 SetQuirk(QUIRK_VISIBLE, true);36 SetQuirk(QUIRK_VISIBLE, true);
37 SetQuirk(QUIRK_RUNNING, false);37 SetQuirk(QUIRK_RUNNING, false);
38 SetIconType(TYPE_BEGIN);38 SetIconType(TYPE_BEGIN);
39 SetShowInSwitcher(false);
39}40}
4041
41DesktopLauncherIcon::~DesktopLauncherIcon()42DesktopLauncherIcon::~DesktopLauncherIcon()
4243
=== modified file 'plugins/unityshell/src/DeviceLauncherSection.cpp'
--- plugins/unityshell/src/DeviceLauncherSection.cpp 2012-02-04 05:28:23 +0000
+++ plugins/unityshell/src/DeviceLauncherSection.cpp 2012-02-12 19:58:19 +0000
@@ -81,7 +81,7 @@
81 DeviceLauncherIcon* icon = new DeviceLauncherIcon(volume);81 DeviceLauncherIcon* icon = new DeviceLauncherIcon(volume);
8282
83 self->map_[volume] = icon;83 self->map_[volume] = icon;
84 self->IconAdded.emit(icon);84 self->IconAdded.emit(AbstractLauncherIcon::Ptr(icon));
85 }85 }
8686
87 g_list_free(volumes);87 g_list_free(volumes);
@@ -102,7 +102,7 @@
102 DeviceLauncherIcon* icon = new DeviceLauncherIcon(volume);102 DeviceLauncherIcon* icon = new DeviceLauncherIcon(volume);
103 103
104 self->map_[volume] = icon;104 self->map_[volume] = icon;
105 self->IconAdded.emit(icon);105 self->IconAdded.emit(AbstractLauncherIcon::Ptr(icon));
106}106}
107107
108void DeviceLauncherSection::OnVolumeRemoved(GVolumeMonitor* monitor,108void DeviceLauncherSection::OnVolumeRemoved(GVolumeMonitor* monitor,
109109
=== modified file 'plugins/unityshell/src/DeviceLauncherSection.h'
--- plugins/unityshell/src/DeviceLauncherSection.h 2012-02-04 05:28:23 +0000
+++ plugins/unityshell/src/DeviceLauncherSection.h 2012-02-12 19:58:19 +0000
@@ -42,7 +42,7 @@
42 DeviceLauncherSection();42 DeviceLauncherSection();
43 ~DeviceLauncherSection();43 ~DeviceLauncherSection();
4444
45 sigc::signal<void, LauncherIcon*> IconAdded;45 sigc::signal<void, AbstractLauncherIcon::Ptr> IconAdded;
4646
47private:47private:
48 static bool PopulateEntries(DeviceLauncherSection* self);48 static bool PopulateEntries(DeviceLauncherSection* self);
4949
=== modified file 'plugins/unityshell/src/IconTextureSource.cpp'
--- plugins/unityshell/src/IconTextureSource.cpp 2012-02-01 05:22:29 +0000
+++ plugins/unityshell/src/IconTextureSource.cpp 2012-02-12 19:58:19 +0000
@@ -24,6 +24,7 @@
24{24{
25namespace ui25namespace ui
26{26{
27NUX_IMPLEMENT_OBJECT_TYPE(IconTextureSource);
2728
28IconTextureSource::IconTextureSource()29IconTextureSource::IconTextureSource()
29{30{
3031
=== modified file 'plugins/unityshell/src/IconTextureSource.h'
--- plugins/unityshell/src/IconTextureSource.h 2012-02-01 03:39:14 +0000
+++ plugins/unityshell/src/IconTextureSource.h 2012-02-12 19:58:19 +0000
@@ -32,6 +32,7 @@
3232
33class IconTextureSource : public nux::InitiallyUnownedObject33class IconTextureSource : public nux::InitiallyUnownedObject
34{34{
35 NUX_DECLARE_OBJECT_TYPE(IconTextureSource, nux::InitiallyUnownedObject);
35public:36public:
36 typedef nux::ObjectPtr<IconTextureSource> Ptr;37 typedef nux::ObjectPtr<IconTextureSource> Ptr;
3738
3839
=== modified file 'plugins/unityshell/src/Launcher.cpp'
--- plugins/unityshell/src/Launcher.cpp 2012-02-11 08:11:04 +0000
+++ plugins/unityshell/src/Launcher.cpp 2012-02-12 19:58:19 +0000
@@ -498,7 +498,7 @@
498 NeedRedraw();498 NeedRedraw();
499}499}
500500
501bool Launcher::IconNeedsAnimation(AbstractLauncherIcon* icon, struct timespec const& current) const501bool Launcher::IconNeedsAnimation(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
502{502{
503 struct timespec time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_VISIBLE);503 struct timespec time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_VISIBLE);
504 if (unity::TimeUtil::TimeDelta(&current, &time) < ANIM_DURATION_SHORT)504 if (unity::TimeUtil::TimeDelta(&current, &time) < ANIM_DURATION_SHORT)
@@ -618,7 +618,7 @@
618}618}
619619
620620
621float Launcher::IconVisibleProgress(AbstractLauncherIcon* icon, struct timespec const& current) const621float Launcher::IconVisibleProgress(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
622{622{
623 if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE))623 if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE))
624 {624 {
@@ -636,16 +636,15 @@
636636
637void Launcher::SetDndDelta(float x, float y, nux::Geometry const& geo, timespec const& current)637void Launcher::SetDndDelta(float x, float y, nux::Geometry const& geo, timespec const& current)
638{638{
639 AbstractLauncherIcon* anchor = nullptr;639 AbstractLauncherIcon::Ptr anchor;
640 LauncherModel::iterator it;
641 anchor = MouseIconIntersection(x, _enter_y);640 anchor = MouseIconIntersection(x, _enter_y);
642641
643 if (anchor)642 if (anchor)
644 {643 {
645 float position = y;644 float position = y;
646 for (it = _model->begin(); it != _model->end(); it++)645 for (AbstractLauncherIcon::Ptr model_icon : *_model)
647 {646 {
648 if (*it == anchor)647 if (model_icon == anchor)
649 {648 {
650 position += _icon_size / 2;649 position += _icon_size / 2;
651 _launcher_drag_delta = _enter_y - position;650 _launcher_drag_delta = _enter_y - position;
@@ -655,12 +654,12 @@
655654
656 break;655 break;
657 }656 }
658 position += (_icon_size + _space_between_icons) * IconVisibleProgress(*it, current);657 position += (_icon_size + _space_between_icons) * IconVisibleProgress(model_icon, current);
659 }658 }
660 }659 }
661}660}
662661
663float Launcher::IconPresentProgress(AbstractLauncherIcon* icon, struct timespec const& current) const662float Launcher::IconPresentProgress(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
664{663{
665 struct timespec icon_present_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_PRESENTED);664 struct timespec icon_present_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_PRESENTED);
666 int ms = unity::TimeUtil::TimeDelta(&current, &icon_present_time);665 int ms = unity::TimeUtil::TimeDelta(&current, &icon_present_time);
@@ -672,7 +671,7 @@
672 return 1.0f - result;671 return 1.0f - result;
673}672}
674673
675float Launcher::IconUrgentProgress(AbstractLauncherIcon* icon, struct timespec const& current) const674float Launcher::IconUrgentProgress(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
676{675{
677 struct timespec urgent_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_URGENT);676 struct timespec urgent_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_URGENT);
678 int urgent_ms = unity::TimeUtil::TimeDelta(&current, &urgent_time);677 int urgent_ms = unity::TimeUtil::TimeDelta(&current, &urgent_time);
@@ -689,7 +688,7 @@
689 return 1.0f - result;688 return 1.0f - result;
690}689}
691690
692float Launcher::IconDropDimValue(AbstractLauncherIcon* icon, struct timespec const& current) const691float Launcher::IconDropDimValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
693{692{
694 struct timespec dim_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_DROP_DIM);693 struct timespec dim_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_DROP_DIM);
695 int dim_ms = unity::TimeUtil::TimeDelta(&current, &dim_time);694 int dim_ms = unity::TimeUtil::TimeDelta(&current, &dim_time);
@@ -701,7 +700,7 @@
701 return result;700 return result;
702}701}
703702
704float Launcher::IconDesatValue(AbstractLauncherIcon* icon, struct timespec const& current) const703float Launcher::IconDesatValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
705{704{
706 struct timespec dim_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_DESAT);705 struct timespec dim_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_DESAT);
707 int ms = unity::TimeUtil::TimeDelta(&current, &dim_time);706 int ms = unity::TimeUtil::TimeDelta(&current, &dim_time);
@@ -713,21 +712,21 @@
713 return result;712 return result;
714}713}
715714
716float Launcher::IconShimmerProgress(AbstractLauncherIcon* icon, struct timespec const& current) const715float Launcher::IconShimmerProgress(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
717{716{
718 struct timespec shimmer_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_SHIMMER);717 struct timespec shimmer_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_SHIMMER);
719 int shimmer_ms = unity::TimeUtil::TimeDelta(&current, &shimmer_time);718 int shimmer_ms = unity::TimeUtil::TimeDelta(&current, &shimmer_time);
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);
721}720}
722721
723float Launcher::IconCenterTransitionProgress(AbstractLauncherIcon* icon, struct timespec const& current) const722float Launcher::IconCenterTransitionProgress(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
724{723{
725 struct timespec save_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_CENTER_SAVED);724 struct timespec save_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_CENTER_SAVED);
726 int save_ms = unity::TimeUtil::TimeDelta(&current, &save_time);725 int save_ms = unity::TimeUtil::TimeDelta(&current, &save_time);
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);
728}727}
729728
730float Launcher::IconUrgentPulseValue(AbstractLauncherIcon* icon, struct timespec const& current) const729float Launcher::IconUrgentPulseValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
731{730{
732 if (!icon->GetQuirk(AbstractLauncherIcon::QUIRK_URGENT))731 if (!icon->GetQuirk(AbstractLauncherIcon::QUIRK_URGENT))
733 return 1.0f; // we are full on in a normal condition732 return 1.0f; // we are full on in a normal condition
@@ -736,7 +735,7 @@
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;
737}736}
738737
739float Launcher::IconPulseOnceValue(AbstractLauncherIcon *icon, struct timespec const &current) const738float Launcher::IconPulseOnceValue(AbstractLauncherIcon::Ptr icon, struct timespec const &current) const
740{739{
741 struct timespec pulse_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_PULSE_ONCE);740 struct timespec pulse_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_PULSE_ONCE);
742 int pulse_ms = unity::TimeUtil::TimeDelta(&current, &pulse_time);741 int pulse_ms = unity::TimeUtil::TimeDelta(&current, &pulse_time);
@@ -748,7 +747,7 @@
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;
749}748}
750749
751float Launcher::IconUrgentWiggleValue(AbstractLauncherIcon* icon, struct timespec const& current) const750float Launcher::IconUrgentWiggleValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
752{751{
753 if (!icon->GetQuirk(AbstractLauncherIcon::QUIRK_URGENT))752 if (!icon->GetQuirk(AbstractLauncherIcon::QUIRK_URGENT))
754 return 0.0f; // we are full on in a normal condition753 return 0.0f; // we are full on in a normal condition
@@ -757,7 +756,7 @@
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;
758}757}
759758
760float Launcher::IconStartingBlinkValue(AbstractLauncherIcon* icon, struct timespec const& current) const759float Launcher::IconStartingBlinkValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
761{760{
762 struct timespec starting_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_STARTING);761 struct timespec starting_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_STARTING);
763 int starting_ms = unity::TimeUtil::TimeDelta(&current, &starting_time);762 int starting_ms = unity::TimeUtil::TimeDelta(&current, &starting_time);
@@ -766,7 +765,7 @@
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;
767}766}
768767
769float Launcher::IconStartingPulseValue(AbstractLauncherIcon* icon, struct timespec const& current) const768float Launcher::IconStartingPulseValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
770{769{
771 struct timespec starting_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_STARTING);770 struct timespec starting_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_STARTING);
772 int starting_ms = unity::TimeUtil::TimeDelta(&current, &starting_time);771 int starting_ms = unity::TimeUtil::TimeDelta(&current, &starting_time);
@@ -781,7 +780,7 @@
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;
782}781}
783782
784float Launcher::IconBackgroundIntensity(AbstractLauncherIcon* icon, struct timespec const& current) const783float Launcher::IconBackgroundIntensity(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
785{784{
786 float result = 0.0f;785 float result = 0.0f;
787786
@@ -848,7 +847,7 @@
848 return result;847 return result;
849}848}
850849
851float Launcher::IconProgressBias(AbstractLauncherIcon* icon, struct timespec const& current) const850float Launcher::IconProgressBias(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
852{851{
853 struct timespec icon_progress_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_PROGRESS);852 struct timespec icon_progress_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_PROGRESS);
854 int ms = unity::TimeUtil::TimeDelta(&current, &icon_progress_time);853 int ms = unity::TimeUtil::TimeDelta(&current, &icon_progress_time);
@@ -860,7 +859,7 @@
860 return result;859 return result;
861}860}
862861
863bool Launcher::IconDrawEdgeOnly(AbstractLauncherIcon* icon) const862bool Launcher::IconDrawEdgeOnly(AbstractLauncherIcon::Ptr icon) const
864{863{
865 if (options()->backlight_mode() == BACKLIGHT_EDGE_TOGGLE)864 if (options()->backlight_mode() == BACKLIGHT_EDGE_TOGGLE)
866 return true;865 return true;
@@ -871,10 +870,10 @@
871 return false;870 return false;
872}871}
873872
874void Launcher::SetupRenderArg(AbstractLauncherIcon* icon, struct timespec const& current, RenderArg& arg)873void Launcher::SetupRenderArg(AbstractLauncherIcon::Ptr icon, struct timespec const& current, RenderArg& arg)
875{874{
876 float desat_value = IconDesatValue(icon, current);875 float desat_value = IconDesatValue(icon, current);
877 arg.icon = icon;876 arg.icon = icon.GetPointer();
878 arg.alpha = 0.5f + 0.5f * desat_value;877 arg.alpha = 0.5f + 0.5f * desat_value;
879 arg.saturation = desat_value;878 arg.saturation = desat_value;
880 arg.colorify = nux::color::White;879 arg.colorify = nux::color::White;
@@ -892,13 +891,13 @@
892 arg.progress_bias = IconProgressBias(icon, current);891 arg.progress_bias = IconProgressBias(icon, current);
893 arg.progress = CLAMP(icon->GetProgress(), 0.0f, 1.0f);892 arg.progress = CLAMP(icon->GetProgress(), 0.0f, 1.0f);
894 arg.draw_shortcut = _shortcuts_shown && !_hide_machine->GetQuirk(LauncherHideMachine::PLACES_VISIBLE);893 arg.draw_shortcut = _shortcuts_shown && !_hide_machine->GetQuirk(LauncherHideMachine::PLACES_VISIBLE);
895 arg.system_item = icon->Type() == AbstractLauncherIcon::TYPE_HOME;894 arg.system_item = icon->GetIconType() == AbstractLauncherIcon::TYPE_HOME;
896 arg.colorify_background = icon->Type() == AbstractLauncherIcon::TYPE_HOME ||895 arg.colorify_background = icon->GetIconType() == AbstractLauncherIcon::TYPE_HOME ||
897 icon->Type() == AbstractLauncherIcon::TYPE_TRASH ||896 icon->GetIconType() == AbstractLauncherIcon::TYPE_TRASH ||
898 icon->Type() == AbstractLauncherIcon::TYPE_EXPO;897 icon->GetIconType() == AbstractLauncherIcon::TYPE_EXPO;
899898
900 if (_dash_is_open)899 if (_dash_is_open)
901 arg.active_arrow = icon->Type() == AbstractLauncherIcon::TYPE_HOME;900 arg.active_arrow = icon->GetIconType() == AbstractLauncherIcon::TYPE_HOME;
902 else901 else
903 arg.active_arrow = icon->GetQuirk(AbstractLauncherIcon::QUIRK_ACTIVE);902 arg.active_arrow = icon->GetQuirk(AbstractLauncherIcon::QUIRK_ACTIVE);
904903
@@ -947,7 +946,7 @@
947 }946 }
948}947}
949948
950void Launcher::FillRenderArg(AbstractLauncherIcon* icon,949void Launcher::FillRenderArg(AbstractLauncherIcon::Ptr icon,
951 RenderArg& arg,950 RenderArg& arg,
952 nux::Point3& center,951 nux::Point3& center,
953 nux::Geometry const& parent_abs_geo,952 nux::Geometry const& parent_abs_geo,
@@ -1190,7 +1189,7 @@
1190 for (it = _model->main_begin(); it != _model->main_end(); it++)1189 for (it = _model->main_begin(); it != _model->main_end(); it++)
1191 {1190 {
1192 RenderArg arg;1191 RenderArg arg;
1193 AbstractLauncherIcon* icon = *it;1192 AbstractLauncherIcon::Ptr icon = *it;
11941193
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,
1196 autohide_offset, folded_z_distance, animation_neg_rads, current);1195 autohide_offset, folded_z_distance, animation_neg_rads, current);
@@ -1218,7 +1217,7 @@
1218 for (it = _model->shelf_begin(); it != _model->shelf_end(); it++)1217 for (it = _model->shelf_begin(); it != _model->shelf_end(); it++)
1219 {1218 {
1220 RenderArg arg;1219 RenderArg arg;
1221 AbstractLauncherIcon* icon = *it;1220 AbstractLauncherIcon::Ptr icon = *it;
12221221
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,
1224 autohide_offset, folded_z_distance, animation_neg_rads, current);1223 autohide_offset, folded_z_distance, animation_neg_rads, current);
@@ -1268,7 +1267,7 @@
1268{1267{
1269 for (auto icon : *_model)1268 for (auto icon : *_model)
1270 {1269 {
1271 if (icon->Type () != AbstractLauncherIcon::TYPE_HOME)1270 if (icon->GetIconType () != AbstractLauncherIcon::TYPE_HOME)
1272 icon->SetQuirk(AbstractLauncherIcon::QUIRK_DESAT, true);1271 icon->SetQuirk(AbstractLauncherIcon::QUIRK_DESAT, true);
1273 icon->HideTooltip();1272 icon->HideTooltip();
1274 }1273 }
@@ -1700,14 +1699,14 @@
17001699
1701}1700}
17021701
1703void Launcher::OnIconAdded(AbstractLauncherIcon* icon)1702void Launcher::OnIconAdded(AbstractLauncherIcon::Ptr icon)
1704{1703{
1705 EnsureAnimation();1704 EnsureAnimation();
17061705
1707 icon->needs_redraw.connect(sigc::mem_fun(this, &Launcher::OnIconNeedsRedraw));1706 icon->needs_redraw.connect(sigc::mem_fun(this, &Launcher::OnIconNeedsRedraw));
1708}1707}
17091708
1710void Launcher::OnIconRemoved(AbstractLauncherIcon* icon)1709void Launcher::OnIconRemoved(AbstractLauncherIcon::Ptr icon)
1711{1710{
1712 if (icon->needs_redraw_connection.connected())1711 if (icon->needs_redraw_connection.connected())
1713 icon->needs_redraw_connection.disconnect();1712 icon->needs_redraw_connection.disconnect();
@@ -1742,7 +1741,7 @@
1742 return _model;1741 return _model;
1743}1742}
17441743
1745void Launcher::EnsureIconOnScreen(AbstractLauncherIcon* selection)1744void Launcher::EnsureIconOnScreen(AbstractLauncherIcon::Ptr selection)
1746{1745{
1747 nux::Geometry geo = GetGeometry();1746 nux::Geometry geo = GetGeometry();
17481747
@@ -1764,7 +1763,7 @@
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));
1765}1764}
17661765
1767void Launcher::OnSelectionChanged(AbstractLauncherIcon* selection)1766void Launcher::OnSelectionChanged(AbstractLauncherIcon::Ptr selection)
1768{1767{
1769 if (IsInKeyNavMode())1768 if (IsInKeyNavMode())
1770 {1769 {
@@ -1773,7 +1772,7 @@
1773 }1772 }
1774}1773}
17751774
1776void Launcher::OnIconNeedsRedraw(AbstractLauncherIcon* icon)1775void Launcher::OnIconNeedsRedraw(AbstractLauncherIcon::Ptr icon)
1777{1776{
1778 EnsureAnimation();1777 EnsureAnimation();
1779}1778}
@@ -2007,7 +2006,7 @@
20072006
2008void Launcher::StartIconDragRequest(int x, int y)2007void Launcher::StartIconDragRequest(int x, int y)
2009{2008{
2010 AbstractLauncherIcon* drag_icon = MouseIconIntersection((int)(GetGeometry().x / 2.0f), y);2009 AbstractLauncherIcon::Ptr drag_icon = MouseIconIntersection((int)(GetGeometry().x / 2.0f), y);
20112010
2012 // FIXME: nux doesn't give nux::GetEventButton (button_flags) there, relying2011 // FIXME: nux doesn't give nux::GetEventButton (button_flags) there, relying
2013 // on an internal Launcher property then2012 // on an internal Launcher property then
@@ -2036,7 +2035,7 @@
2036 }2035 }
2037}2036}
20382037
2039void Launcher::StartIconDrag(AbstractLauncherIcon* icon)2038void Launcher::StartIconDrag(AbstractLauncherIcon::Ptr icon)
2040{2039{
2041 if (!icon)2040 if (!icon)
2042 return;2041 return;
@@ -2065,9 +2064,9 @@
2065{2064{
2066 if (_drag_window)2065 if (_drag_window)
2067 {2066 {
2068 AbstractLauncherIcon* hovered_icon = MouseIconIntersection(_mouse_position.x, _mouse_position.y);2067 AbstractLauncherIcon::Ptr hovered_icon = MouseIconIntersection(_mouse_position.x, _mouse_position.y);
20692068
2070 if (hovered_icon && hovered_icon->Type() == AbstractLauncherIcon::TYPE_TRASH)2069 if (hovered_icon && hovered_icon->GetIconType() == AbstractLauncherIcon::TYPE_TRASH)
2071 {2070 {
2072 hovered_icon->SetQuirk(AbstractLauncherIcon::QUIRK_PULSE_ONCE, true);2071 hovered_icon->SetQuirk(AbstractLauncherIcon::QUIRK_PULSE_ONCE, true);
20732072
@@ -2107,7 +2106,7 @@
2107 nux::Geometry geo = _drag_window->GetGeometry();2106 nux::Geometry geo = _drag_window->GetGeometry();
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);
21092108
2110 AbstractLauncherIcon* hovered_icon = MouseIconIntersection((int)(GetGeometry().x / 2.0f), y);2109 AbstractLauncherIcon::Ptr hovered_icon = MouseIconIntersection((int)(GetGeometry().x / 2.0f), y);
21112110
2112 struct timespec current;2111 struct timespec current;
2113 clock_gettime(CLOCK_MONOTONIC, &current);2112 clock_gettime(CLOCK_MONOTONIC, &current);
@@ -2355,7 +2354,7 @@
2355 GetActionState() == ACTION_DRAG_LAUNCHER)2354 GetActionState() == ACTION_DRAG_LAUNCHER)
2356 return;2355 return;
23572356
2358 AbstractLauncherIcon* launcher_icon = nullptr;2357 AbstractLauncherIcon::Ptr launcher_icon;
23592358
2360 if (!_hidden && !IsInKeyNavMode() && _hovered)2359 if (!_hidden && !IsInKeyNavMode() && _hovered)
2361 {2360 {
@@ -2380,7 +2379,7 @@
23802379
2381void Launcher::MouseDownLogic(int x, int y, unsigned long button_flags, unsigned long key_flags)2380void Launcher::MouseDownLogic(int x, int y, unsigned long button_flags, unsigned long key_flags)
2382{2381{
2383 AbstractLauncherIcon* launcher_icon = nullptr;2382 AbstractLauncherIcon::Ptr launcher_icon;
2384 launcher_icon = MouseIconIntersection(_mouse_position.x, _mouse_position.y);2383 launcher_icon = MouseIconIntersection(_mouse_position.x, _mouse_position.y);
23852384
2386 _hide_machine->SetQuirk(LauncherHideMachine::LAST_ACTION_ACTIVATE, false);2385 _hide_machine->SetQuirk(LauncherHideMachine::LAST_ACTION_ACTIVATE, false);
@@ -2399,7 +2398,7 @@
23992398
2400void Launcher::MouseUpLogic(int x, int y, unsigned long button_flags, unsigned long key_flags)2399void Launcher::MouseUpLogic(int x, int y, unsigned long button_flags, unsigned long key_flags)
2401{2400{
2402 AbstractLauncherIcon* launcher_icon = nullptr;2401 AbstractLauncherIcon::Ptr launcher_icon;
24032402
2404 launcher_icon = MouseIconIntersection(_mouse_position.x, _mouse_position.y);2403 launcher_icon = MouseIconIntersection(_mouse_position.x, _mouse_position.y);
24052404
@@ -2430,7 +2429,7 @@
2430 _icon_mouse_down = nullptr;2429 _icon_mouse_down = nullptr;
2431}2430}
24322431
2433AbstractLauncherIcon* Launcher::MouseIconIntersection(int x, int y)2432AbstractLauncherIcon::Ptr Launcher::MouseIconIntersection(int x, int y)
2434{2433{
2435 LauncherModel::iterator it;2434 LauncherModel::iterator it;
2436 // We are looking for the icon at screen coordinates x, y;2435 // We are looking for the icon at screen coordinates x, y;
@@ -2454,11 +2453,11 @@
2454 return (*it);2453 return (*it);
2455 }2454 }
24562455
2457 return 0;2456 return AbstractLauncherIcon::Ptr();
2458}2457}
24592458
2460void2459void
2461Launcher::RenderIconToTexture(nux::GraphicsEngine& GfxContext, AbstractLauncherIcon* icon, nux::ObjectPtr<nux::IOpenGLBaseTexture> texture)2460Launcher::RenderIconToTexture(nux::GraphicsEngine& GfxContext, AbstractLauncherIcon::Ptr icon, nux::ObjectPtr<nux::IOpenGLBaseTexture> texture)
2462{2461{
2463 RenderArg arg;2462 RenderArg arg;
2464 struct timespec current;2463 struct timespec current;
@@ -2671,15 +2670,15 @@
2671 }2670 }
26722671
2673 EventLogic();2672 EventLogic();
2674 AbstractLauncherIcon* hovered_icon = MouseIconIntersection(_mouse_position.x, _mouse_position.y);2673 AbstractLauncherIcon::Ptr hovered_icon = MouseIconIntersection(_mouse_position.x, _mouse_position.y);
26752674
2676 bool hovered_icon_is_appropriate = false;2675 bool hovered_icon_is_appropriate = false;
2677 if (hovered_icon)2676 if (hovered_icon)
2678 {2677 {
2679 if (hovered_icon->Type() == AbstractLauncherIcon::TYPE_TRASH)2678 if (hovered_icon->GetIconType() == AbstractLauncherIcon::TYPE_TRASH)
2680 _steal_drag = false;2679 _steal_drag = false;
26812680
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)
2683 hovered_icon_is_appropriate = true;2682 hovered_icon_is_appropriate = true;
2684 }2683 }
26852684
@@ -2788,11 +2787,11 @@
2788 * Returns the current selected icon if it is in keynavmode2787 * Returns the current selected icon if it is in keynavmode
2789 * It will return NULL if it is not on keynavmode2788 * It will return NULL if it is not on keynavmode
2790 */2789 */
2791AbstractLauncherIcon*2790AbstractLauncherIcon::Ptr
2792Launcher::GetSelectedMenuIcon() const2791Launcher::GetSelectedMenuIcon() const
2793{2792{
2794 if (!IsInKeyNavMode())2793 if (!IsInKeyNavMode())
2795 return NULL;2794 return AbstractLauncherIcon::Ptr();
2796 return _model->Selection();2795 return _model->Selection();
2797}2796}
27982797
@@ -2822,7 +2821,7 @@
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);
28232822
2824 Launcher* self = (Launcher*)user_data;2823 Launcher* self = (Launcher*)user_data;
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);
28262825
2827 g_dbus_method_invocation_return_value(invocation, nullptr);2826 g_dbus_method_invocation_return_value(invocation, nullptr);
2828 g_free(icon);2827 g_free(icon);
28292828
=== modified file 'plugins/unityshell/src/Launcher.h'
--- plugins/unityshell/src/Launcher.h 2012-02-09 22:47:21 +0000
+++ plugins/unityshell/src/Launcher.h 2012-02-12 19:58:19 +0000
@@ -65,7 +65,7 @@
65 virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);65 virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
66 virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw);66 virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw);
6767
68 AbstractLauncherIcon* GetSelectedMenuIcon() const;68 AbstractLauncherIcon::Ptr GetSelectedMenuIcon() const;
6969
70 void SetIconSize(int tile_size, int icon_size);70 void SetIconSize(int tile_size, int icon_size);
7171
@@ -85,7 +85,7 @@
85 void StartKeyShowLauncher();85 void StartKeyShowLauncher();
86 void EndKeyShowLauncher();86 void EndKeyShowLauncher();
8787
88 void EnsureIconOnScreen(AbstractLauncherIcon* icon);88 void EnsureIconOnScreen(AbstractLauncherIcon::Ptr icon);
8989
90 void SetBacklightMode(BacklightMode mode);90 void SetBacklightMode(BacklightMode mode);
91 BacklightMode GetBacklightMode() const;91 BacklightMode GetBacklightMode() const;
@@ -112,9 +112,9 @@
112112
113 void Resize();113 void Resize();
114114
115 sigc::signal<void, char*, AbstractLauncherIcon*> launcher_addrequest;115 sigc::signal<void, char*, AbstractLauncherIcon::Ptr> launcher_addrequest;
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;
117 sigc::signal<void, AbstractLauncherIcon*> launcher_removerequest;117 sigc::signal<void, AbstractLauncherIcon::Ptr> launcher_removerequest;
118 sigc::signal<void> selection_change;118 sigc::signal<void> selection_change;
119 sigc::signal<void> hidden_changed;119 sigc::signal<void> hidden_changed;
120120
@@ -181,7 +181,7 @@
181181
182 void OnPluginStateChanged();182 void OnPluginStateChanged();
183183
184 void OnSelectionChanged(AbstractLauncherIcon* selection);184 void OnSelectionChanged(AbstractLauncherIcon::Ptr selection);
185185
186 static gboolean AnimationTimeout(gpointer data);186 static gboolean AnimationTimeout(gpointer data);
187 static gboolean StrutHack(gpointer data);187 static gboolean StrutHack(gpointer data);
@@ -195,8 +195,8 @@
195195
196 void OnDragWindowAnimCompleted();196 void OnDragWindowAnimCompleted();
197197
198 bool IconNeedsAnimation(AbstractLauncherIcon* icon, struct timespec const& current) const;198 bool IconNeedsAnimation(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const;
199 bool IconDrawEdgeOnly(AbstractLauncherIcon* icon) const;199 bool IconDrawEdgeOnly(AbstractLauncherIcon::Ptr icon) const;
200 bool AnimationInProgress() const;200 bool AnimationInProgress() const;
201201
202 void SetActionState(LauncherActionState actionstate);202 void SetActionState(LauncherActionState actionstate);
@@ -221,20 +221,20 @@
221 float DragThresholdProgress(struct timespec const& current) const;221 float DragThresholdProgress(struct timespec const& current) const;
222 float DragHideProgress(struct timespec const& current) const;222 float DragHideProgress(struct timespec const& current) const;
223 float DragOutProgress(struct timespec const& current) const;223 float DragOutProgress(struct timespec const& current) const;
224 float IconDesatValue(AbstractLauncherIcon* icon, struct timespec const& current) const;224 float IconDesatValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const;
225 float IconPresentProgress(AbstractLauncherIcon* icon, struct timespec const& current) const;225 float IconPresentProgress(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const;
226 float IconUrgentProgress(AbstractLauncherIcon* icon, struct timespec const& current) const;226 float IconUrgentProgress(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const;
227 float IconShimmerProgress(AbstractLauncherIcon* icon, struct timespec const& current) const;227 float IconShimmerProgress(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const;
228 float IconUrgentPulseValue(AbstractLauncherIcon* icon, struct timespec const& current) const;228 float IconUrgentPulseValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const;
229 float IconPulseOnceValue(AbstractLauncherIcon *icon, struct timespec const &current) const;229 float IconPulseOnceValue(AbstractLauncherIcon::Ptr icon, struct timespec const &current) const;
230 float IconUrgentWiggleValue(AbstractLauncherIcon* icon, struct timespec const& current) const;230 float IconUrgentWiggleValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const;
231 float IconStartingBlinkValue(AbstractLauncherIcon* icon, struct timespec const& current) const;231 float IconStartingBlinkValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const;
232 float IconStartingPulseValue(AbstractLauncherIcon* icon, struct timespec const& current) const;232 float IconStartingPulseValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const;
233 float IconBackgroundIntensity(AbstractLauncherIcon* icon, struct timespec const& current) const;233 float IconBackgroundIntensity(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const;
234 float IconProgressBias(AbstractLauncherIcon* icon, struct timespec const& current) const;234 float IconProgressBias(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const;
235 float IconDropDimValue(AbstractLauncherIcon* icon, struct timespec const& current) const;235 float IconDropDimValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const;
236 float IconCenterTransitionProgress(AbstractLauncherIcon* icon, struct timespec const& current) const;236 float IconCenterTransitionProgress(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const;
237 float IconVisibleProgress(AbstractLauncherIcon* icon, struct timespec const& current) const;237 float IconVisibleProgress(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const;
238238
239 void SetHover(bool hovered);239 void SetHover(bool hovered);
240 void SetHidden(bool hidden);240 void SetHidden(bool hidden);
@@ -242,8 +242,8 @@
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);
243 float DragLimiter(float x);243 float DragLimiter(float x);
244244
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);
246 void FillRenderArg(AbstractLauncherIcon* icon,246 void FillRenderArg(AbstractLauncherIcon::Ptr icon,
247 ui::RenderArg& arg,247 ui::RenderArg& arg,
248 nux::Point3& center,248 nux::Point3& center,
249 nux::Geometry const& parent_abs_geo,249 nux::Geometry const& parent_abs_geo,
@@ -258,11 +258,11 @@
258 void RenderArgs(std::list<ui::RenderArg> &launcher_args,258 void RenderArgs(std::list<ui::RenderArg> &launcher_args,
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);
260260
261 void OnIconAdded(AbstractLauncherIcon* icon);261 void OnIconAdded(AbstractLauncherIcon::Ptr icon);
262 void OnIconRemoved(AbstractLauncherIcon* icon);262 void OnIconRemoved(AbstractLauncherIcon::Ptr icon);
263 void OnOrderChanged();263 void OnOrderChanged();
264264
265 void OnIconNeedsRedraw(AbstractLauncherIcon* icon);265 void OnIconNeedsRedraw(AbstractLauncherIcon::Ptr icon);
266266
267 void OnOverlayHidden(GVariant* data);267 void OnOverlayHidden(GVariant* data);
268 void OnOverlayShown(GVariant* data);268 void OnOverlayShown(GVariant* data);
@@ -276,15 +276,15 @@
276276
277 void OnActionDone(GVariant* data);277 void OnActionDone(GVariant* data);
278278
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);
280280
281 AbstractLauncherIcon* MouseIconIntersection(int x, int y);281 AbstractLauncherIcon::Ptr MouseIconIntersection(int x, int y);
282 void EventLogic();282 void EventLogic();
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);
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);
285285
286 void StartIconDragRequest(int x, int y);286 void StartIconDragRequest(int x, int y);
287 void StartIconDrag(AbstractLauncherIcon* icon);287 void StartIconDrag(AbstractLauncherIcon::Ptr icon);
288 void EndIconDrag();288 void EndIconDrag();
289 void UpdateDragWindowPosition(int x, int y);289 void UpdateDragWindowPosition(int x, int y);
290290
@@ -305,9 +305,9 @@
305 nux::HLayout* m_Layout;305 nux::HLayout* m_Layout;
306306
307 // used by keyboard/a11y-navigation307 // used by keyboard/a11y-navigation
308 AbstractLauncherIcon* _icon_under_mouse;308 AbstractLauncherIcon::Ptr _icon_under_mouse;
309 AbstractLauncherIcon* _icon_mouse_down;309 AbstractLauncherIcon::Ptr _icon_mouse_down;
310 AbstractLauncherIcon* _drag_icon;310 AbstractLauncherIcon::Ptr _drag_icon;
311311
312 QuicklistView* _active_quicklist;312 QuicklistView* _active_quicklist;
313313
@@ -368,7 +368,7 @@
368 bool _data_checked;368 bool _data_checked;
369 bool _steal_drag;369 bool _steal_drag;
370 bool _drag_edge_touching;370 bool _drag_edge_touching;
371 AbstractLauncherIcon* _dnd_hovered_icon;371 AbstractLauncherIcon::Ptr _dnd_hovered_icon;
372 unity::DNDCollectionWindow* _collection_window;372 unity::DNDCollectionWindow* _collection_window;
373 sigc::connection _on_data_collected_connection;373 sigc::connection _on_data_collected_connection;
374374
375375
=== modified file 'plugins/unityshell/src/LauncherController.cpp'
--- plugins/unityshell/src/LauncherController.cpp 2012-02-08 08:58:05 +0000
+++ plugins/unityshell/src/LauncherController.cpp 2012-02-12 19:58:19 +0000
@@ -80,12 +80,12 @@
80 void Save();80 void Save();
81 void SortAndUpdate();81 void SortAndUpdate();
8282
83 void OnIconAdded(AbstractLauncherIcon* icon);83 void OnIconAdded(AbstractLauncherIcon::Ptr icon);
84 void OnIconRemoved(AbstractLauncherIcon* icon);84 void OnIconRemoved(AbstractLauncherIcon::Ptr icon);
8585
86 void OnLauncherAddRequest(char* path, AbstractLauncherIcon* before);86 void OnLauncherAddRequest(char* path, AbstractLauncherIcon::Ptr before);
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);
88 void OnLauncherRemoveRequest(AbstractLauncherIcon* icon);88 void OnLauncherRemoveRequest(AbstractLauncherIcon::Ptr icon);
8989
90 void OnLauncherEntryRemoteAdded(LauncherEntryRemote* entry);90 void OnLauncherEntryRemoteAdded(LauncherEntryRemote* entry);
91 void OnLauncherEntryRemoteRemoved(LauncherEntryRemote* entry);91 void OnLauncherEntryRemoteRemoved(LauncherEntryRemote* entry);
@@ -111,11 +111,11 @@
111111
112 void InsertTrash();112 void InsertTrash();
113113
114 void RegisterIcon(AbstractLauncherIcon* icon);114 void RegisterIcon(AbstractLauncherIcon::Ptr icon);
115115
116 AbstractLauncherIcon* CreateFavorite(const char* file_path);116 AbstractLauncherIcon::Ptr CreateFavorite(const char* file_path);
117117
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);
119119
120 void SetupBamf();120 void SetupBamf();
121121
@@ -145,9 +145,9 @@
145 int sort_priority_;145 int sort_priority_;
146 DeviceLauncherSection* device_section_;146 DeviceLauncherSection* device_section_;
147 LauncherEntryRemoteModel remote_model_;147 LauncherEntryRemoteModel remote_model_;
148 SimpleLauncherIcon* expo_icon_;148 AbstractLauncherIcon::Ptr expo_icon_;
149 DesktopLauncherIcon* desktop_launcher_icon_;149 AbstractLauncherIcon::Ptr desktop_launcher_icon_;
150 nux::ObjectPtr<AbstractLauncherIcon> desktop_icon_;150 AbstractLauncherIcon::Ptr desktop_icon_;
151 int num_workspaces_;151 int num_workspaces_;
152 bool show_desktop_icon_;152 bool show_desktop_icon_;
153 Display* display_;153 Display* display_;
@@ -234,8 +234,8 @@
234 FavoriteStore::GetDefault().favorite_removed.connect(sigc::mem_fun(this, &Impl::OnFavoriteStoreFavoriteRemoved));234 FavoriteStore::GetDefault().favorite_removed.connect(sigc::mem_fun(this, &Impl::OnFavoriteStoreFavoriteRemoved));
235 FavoriteStore::GetDefault().reordered.connect(sigc::mem_fun(this, &Impl::OnFavoriteStoreReordered));235 FavoriteStore::GetDefault().reordered.connect(sigc::mem_fun(this, &Impl::OnFavoriteStoreReordered));
236236
237 RegisterIcon(new BFBLauncherIcon());237 RegisterIcon(AbstractLauncherIcon::Ptr(new BFBLauncherIcon()));
238 desktop_icon_ = new DesktopLauncherIcon();238 desktop_icon_ = AbstractLauncherIcon::Ptr(new DesktopLauncherIcon());
239239
240 uscreen->changed.connect(sigc::mem_fun(this, &Controller::Impl::OnScreenChanged));240 uscreen->changed.connect(sigc::mem_fun(this, &Controller::Impl::OnScreenChanged));
241241
@@ -333,7 +333,7 @@
333 return launcher;333 return launcher;
334}334}
335335
336void Controller::Impl::OnLauncherAddRequest(char* path, AbstractLauncherIcon* before)336void Controller::Impl::OnLauncherAddRequest(char* path, AbstractLauncherIcon::Ptr before)
337{337{
338 for (auto it : model_->GetSublist<BamfLauncherIcon> ())338 for (auto it : model_->GetSublist<BamfLauncherIcon> ())
339 {339 {
@@ -346,7 +346,7 @@
346 }346 }
347 }347 }
348348
349 AbstractLauncherIcon* result = CreateFavorite(path);349 AbstractLauncherIcon::Ptr result = CreateFavorite(path);
350 if (result)350 if (result)
351 {351 {
352 RegisterIcon(result);352 RegisterIcon(result);
@@ -362,7 +362,7 @@
362 unity::FavoriteList desktop_paths;362 unity::FavoriteList desktop_paths;
363363
364 // Updates gsettings favorites.364 // Updates gsettings favorites.
365 std::list<BamfLauncherIcon*> launchers = model_->GetSublist<BamfLauncherIcon> ();365 auto launchers = model_->GetSublist<BamfLauncherIcon> ();
366 for (auto icon : launchers)366 for (auto icon : launchers)
367 {367 {
368 if (!icon->IsSticky())368 if (!icon->IsSticky())
@@ -379,20 +379,18 @@
379379
380void380void
381Controller::Impl::OnLauncherAddRequestSpecial(std::string const& path,381Controller::Impl::OnLauncherAddRequestSpecial(std::string const& path,
382 AbstractLauncherIcon* before,382 AbstractLauncherIcon::Ptr before,
383 std::string const& aptdaemon_trans_id,383 std::string const& aptdaemon_trans_id,
384 std::string const& icon_path)384 std::string const& icon_path)
385{385{
386 std::list<BamfLauncherIcon*> launchers;386 auto launchers = model_->GetSublist<BamfLauncherIcon>();
387
388 launchers = model_->GetSublist<BamfLauncherIcon>();
389 for (auto icon : launchers)387 for (auto icon : launchers)
390 {388 {
391 if (icon->DesktopFile() == path)389 if (icon->DesktopFile() == path)
392 return;390 return;
393 }391 }
394392
395 SoftwareCenterLauncherIcon* result = CreateSCLauncherIcon(path, aptdaemon_trans_id, icon_path);393 AbstractLauncherIcon::Ptr result = CreateSCLauncherIcon(path, aptdaemon_trans_id, icon_path);
396 if (result)394 if (result)
397 {395 {
398 RegisterIcon(result);396 RegisterIcon(result);
@@ -407,7 +405,7 @@
407{405{
408 gint shortcut = 1;406 gint shortcut = 1;
409407
410 std::list<BamfLauncherIcon*> launchers = model_->GetSublist<BamfLauncherIcon> ();408 auto launchers = model_->GetSublist<BamfLauncherIcon> ();
411 for (auto icon : launchers)409 for (auto icon : launchers)
412 {410 {
413 if (shortcut <= 10 && icon->IsVisible())411 if (shortcut <= 10 && icon->IsVisible())
@@ -425,23 +423,23 @@
425 }423 }
426}424}
427425
428void Controller::Impl::OnIconAdded(AbstractLauncherIcon* icon)426void Controller::Impl::OnIconAdded(AbstractLauncherIcon::Ptr icon)
429{427{
430 this->RegisterIcon(icon);428 this->RegisterIcon(icon);
431}429}
432430
433void Controller::Impl::OnIconRemoved(AbstractLauncherIcon* icon)431void Controller::Impl::OnIconRemoved(AbstractLauncherIcon::Ptr icon)
434{432{
435 SortAndUpdate();433 SortAndUpdate();
436}434}
437435
438void Controller::Impl::OnLauncherRemoveRequest(AbstractLauncherIcon* icon)436void Controller::Impl::OnLauncherRemoveRequest(AbstractLauncherIcon::Ptr icon)
439{437{
440 switch (icon->Type())438 switch (icon->GetIconType())
441 {439 {
442 case AbstractLauncherIcon::TYPE_APPLICATION:440 case AbstractLauncherIcon::TYPE_APPLICATION:
443 {441 {
444 BamfLauncherIcon* bamf_icon = dynamic_cast<BamfLauncherIcon*>(icon);442 BamfLauncherIcon* bamf_icon = dynamic_cast<BamfLauncherIcon*>(icon.GetPointer());
445443
446 if (bamf_icon)444 if (bamf_icon)
447 {445 {
@@ -453,7 +451,7 @@
453 }451 }
454 case AbstractLauncherIcon::TYPE_DEVICE:452 case AbstractLauncherIcon::TYPE_DEVICE:
455 {453 {
456 DeviceLauncherIcon* device_icon = dynamic_cast<DeviceLauncherIcon*>(icon);454 DeviceLauncherIcon* device_icon = dynamic_cast<DeviceLauncherIcon*>(icon.GetPointer());
457455
458 if (device_icon && device_icon->CanEject())456 if (device_icon && device_icon->CanEject())
459 device_icon->Eject();457 device_icon->Eject();
@@ -490,7 +488,9 @@
490void Controller::Impl::OnFavoriteStoreFavoriteAdded(std::string const& entry, std::string const& pos, bool before)488void Controller::Impl::OnFavoriteStoreFavoriteAdded(std::string const& entry, std::string const& pos, bool before)
491{489{
492 auto bamf_list = model_->GetSublist<BamfLauncherIcon>();490 auto bamf_list = model_->GetSublist<BamfLauncherIcon>();
493 AbstractLauncherIcon* other = (bamf_list.size() > 0) ? *(bamf_list.begin()) : nullptr;491 AbstractLauncherIcon::Ptr other;
492 if (bamf_list.size() > 0)
493 other = *(bamf_list.begin());
494494
495 if (!pos.empty())495 if (!pos.empty())
496 {496 {
@@ -514,7 +514,7 @@
514 }514 }
515 }515 }
516516
517 AbstractLauncherIcon* result = CreateFavorite(entry.c_str());517 AbstractLauncherIcon::Ptr result = CreateFavorite(entry.c_str());
518 if (result)518 if (result)
519 {519 {
520 RegisterIcon(result);520 RegisterIcon(result);
@@ -546,7 +546,7 @@
546 for (auto it : favs)546 for (auto it : favs)
547 {547 {
548 auto icon = std::find_if(bamf_list.begin(), bamf_list.end(),548 auto icon = std::find_if(bamf_list.begin(), bamf_list.end(),
549 [&it](BamfLauncherIcon* x) { return (x->DesktopFile() == it); });549 [&it](AbstractLauncherIcon::Ptr x) { return (x->DesktopFile() == it); });
550550
551 if (icon != bamf_list.end())551 if (icon != bamf_list.end())
552 {552 {
@@ -570,8 +570,7 @@
570570
571void Controller::Impl::InsertTrash()571void Controller::Impl::InsertTrash()
572{572{
573 TrashLauncherIcon* icon;573 AbstractLauncherIcon::Ptr icon(new TrashLauncherIcon());
574 icon = new TrashLauncherIcon();
575 RegisterIcon(icon);574 RegisterIcon(icon);
576}575}
577576
@@ -591,17 +590,19 @@
591590
592void Controller::Impl::InsertExpoAction()591void Controller::Impl::InsertExpoAction()
593{592{
594 expo_icon_ = new SimpleLauncherIcon();593 expo_icon_ = AbstractLauncherIcon::Ptr(new SimpleLauncherIcon());
595594
596 expo_icon_->tooltip_text = _("Workspace Switcher");595 SimpleLauncherIcon* icon = static_cast<SimpleLauncherIcon*>(expo_icon_.GetPointer());
597 expo_icon_->icon_name = "workspace-switcher";596 icon->tooltip_text = _("Workspace Switcher");
598 expo_icon_->SetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE, true);597 icon->icon_name = "workspace-switcher";
599 expo_icon_->SetQuirk(AbstractLauncherIcon::QUIRK_RUNNING, false);598 icon->SetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE, true);
600 expo_icon_->SetIconType(AbstractLauncherIcon::TYPE_EXPO);599 icon->SetQuirk(AbstractLauncherIcon::QUIRK_RUNNING, false);
601 expo_icon_->SetShortcut('s');600 icon->SetIconType(AbstractLauncherIcon::TYPE_EXPO);
602601 icon->SetShortcut('s');
603 on_expoicon_activate_connection_ = expo_icon_->activate.connect(sigc::mem_fun(this, &Impl::OnExpoActivated));602
604603 on_expoicon_activate_connection_ = icon->activate.connect(sigc::mem_fun(this, &Impl::OnExpoActivated));
604
605
605 RegisterIcon(expo_icon_);606 RegisterIcon(expo_icon_);
606}607}
607608
@@ -614,10 +615,7 @@
614615
615void Controller::Impl::InsertDesktopIcon()616void Controller::Impl::InsertDesktopIcon()
616{617{
617 desktop_launcher_icon_ = new DesktopLauncherIcon();618 desktop_launcher_icon_ = AbstractLauncherIcon::Ptr(new DesktopLauncherIcon());
618 desktop_launcher_icon_->SetIconType(AbstractLauncherIcon::TYPE_DESKTOP);
619 desktop_launcher_icon_->SetShowInSwitcher(false);
620
621 RegisterIcon(desktop_launcher_icon_);619 RegisterIcon(desktop_launcher_icon_);
622}620}
623621
@@ -626,20 +624,16 @@
626 model_->RemoveIcon(desktop_launcher_icon_);624 model_->RemoveIcon(desktop_launcher_icon_);
627}625}
628626
629void Controller::Impl::RegisterIcon(AbstractLauncherIcon* icon)627void Controller::Impl::RegisterIcon(AbstractLauncherIcon::Ptr icon)
630{628{
631 model_->AddIcon(icon);629 model_->AddIcon(icon);
632630
633 BamfLauncherIcon* bamf_icon = dynamic_cast<BamfLauncherIcon*>(icon);631 LauncherEntryRemote* entry = NULL;
634 if (bamf_icon)632 std::string const& path = icon->DesktopFile();
635 {633 if (!path.empty())
636 LauncherEntryRemote* entry = NULL;634 entry = remote_model_.LookupByDesktopFile(path.c_str());
637 std::string const& path = bamf_icon->DesktopFile();635 if (entry)
638 if (!path.empty())636 icon->InsertEntryRemote(entry);
639 entry = remote_model_.LookupByDesktopFile(path.c_str());
640 if (entry)
641 icon->InsertEntryRemote(entry);
642 }
643}637}
644638
645/* static private */639/* static private */
@@ -659,71 +653,69 @@
659 return;653 return;
660 }654 }
661655
662 BamfLauncherIcon* icon = new BamfLauncherIcon(app);656 AbstractLauncherIcon::Ptr icon (new BamfLauncherIcon(app));
663 icon->SetIconType(AbstractLauncherIcon::TYPE_APPLICATION);
664 icon->SetSortPriority(self->sort_priority_++);657 icon->SetSortPriority(self->sort_priority_++);
665658
666 self->RegisterIcon(icon);659 self->RegisterIcon(icon);
667}660}
668661
669AbstractLauncherIcon* Controller::Impl::CreateFavorite(const char* file_path)662AbstractLauncherIcon::Ptr Controller::Impl::CreateFavorite(const char* file_path)
670{663{
671 BamfApplication* app;664 BamfApplication* app;
672 BamfLauncherIcon* icon;665 AbstractLauncherIcon::Ptr result;
673666
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);
675 if (!app)668 if (!app)
676 return NULL;669 return result;
677670
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")))
679 {672 {
680 bamf_view_set_sticky(BAMF_VIEW(app), true);673 bamf_view_set_sticky(BAMF_VIEW(app), true);
681 return 0;674 return result;
682 }675 }
683676
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));
685678
686 bamf_view_set_sticky(BAMF_VIEW(app), true);679 bamf_view_set_sticky(BAMF_VIEW(app), true);
687 icon = new BamfLauncherIcon(app);680 AbstractLauncherIcon::Ptr icon (new BamfLauncherIcon(app));
688 icon->SetIconType(AbstractLauncherIcon::TYPE_APPLICATION);
689 icon->SetSortPriority(sort_priority_++);681 icon->SetSortPriority(sort_priority_++);
682 result = icon;
690683
691 return icon;684 return result;
692}685}
693686
694SoftwareCenterLauncherIcon*687AbstractLauncherIcon::Ptr
695Controller::Impl::CreateSCLauncherIcon(std::string const& file_path,688Controller::Impl::CreateSCLauncherIcon(std::string const& file_path,
696 std::string const& aptdaemon_trans_id,689 std::string const& aptdaemon_trans_id,
697 std::string const& icon_path)690 std::string const& icon_path)
698{691{
699 BamfApplication* app;692 BamfApplication* app;
700 SoftwareCenterLauncherIcon* icon;693 AbstractLauncherIcon::Ptr result;
701694
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);
703 if (!BAMF_IS_APPLICATION(app))696 if (!BAMF_IS_APPLICATION(app))
704 return NULL;697 return result;
705698
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")))
707 {700 {
708 bamf_view_set_sticky(BAMF_VIEW(app), true);701 bamf_view_set_sticky(BAMF_VIEW(app), true);
709 return 0;702 return result;
710 }703 }
711704
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));
713706
714 bamf_view_set_sticky(BAMF_VIEW(app), true);707 bamf_view_set_sticky(BAMF_VIEW(app), true);
715 icon = new SoftwareCenterLauncherIcon(app, aptdaemon_trans_id, icon_path);708 AbstractLauncherIcon::Ptr icon(new SoftwareCenterLauncherIcon(app, aptdaemon_trans_id, icon_path));
716 icon->SetIconType(LauncherIcon::TYPE_APPLICATION);
717 icon->SetSortPriority(sort_priority_++);709 icon->SetSortPriority(sort_priority_++);
718710
719 return icon;711 result = icon;
712 return result;
720}713}
721714
722void Controller::Impl::SetupBamf()715void Controller::Impl::SetupBamf()
723{716{
724 GList* apps, *l;717 GList* apps, *l;
725 BamfApplication* app;718 BamfApplication* app;
726 BamfLauncherIcon* icon;
727719
728 // Sufficiently large number such that we ensure proper sorting720 // Sufficiently large number such that we ensure proper sorting
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)
@@ -736,7 +728,7 @@
736 for (FavoriteList::const_iterator i = favs.begin(), end = favs.end();728 for (FavoriteList::const_iterator i = favs.begin(), end = favs.end();
737 i != end; ++i)729 i != end; ++i)
738 {730 {
739 AbstractLauncherIcon* fav = CreateFavorite(i->c_str());731 AbstractLauncherIcon::Ptr fav = CreateFavorite(i->c_str());
740732
741 if (fav)733 if (fav)
742 {734 {
@@ -757,7 +749,7 @@
757 continue;749 continue;
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));
759751
760 icon = new BamfLauncherIcon(app);752 AbstractLauncherIcon::Ptr icon(new BamfLauncherIcon(app));
761 icon->SetSortPriority(sort_priority_++);753 icon->SetSortPriority(sort_priority_++);
762 RegisterIcon(icon);754 RegisterIcon(icon);
763 }755 }
@@ -827,11 +819,11 @@
827 return shortcuts;819 return shortcuts;
828}820}
829821
830std::vector<AbstractLauncherIcon*> Controller::GetAltTabIcons(bool current) const822std::vector<AbstractLauncherIcon::Ptr> Controller::GetAltTabIcons(bool current) const
831{823{
832 std::vector<AbstractLauncherIcon*> results;824 std::vector<AbstractLauncherIcon::Ptr> results;
833825
834 results.push_back(pimpl->desktop_icon_.GetPointer());826 results.push_back(pimpl->desktop_icon_);
835827
836 for (auto icon : *(pimpl->model_))828 for (auto icon : *(pimpl->model_))
837 if (icon->ShowInSwitcher(current))829 if (icon->ShowInSwitcher(current))
838830
=== modified file 'plugins/unityshell/src/LauncherController.h'
--- plugins/unityshell/src/LauncherController.h 2012-02-04 05:28:23 +0000
+++ plugins/unityshell/src/LauncherController.h 2012-02-12 19:58:19 +0000
@@ -53,7 +53,7 @@
5353
54 void UpdateNumWorkspaces(int workspaces);54 void UpdateNumWorkspaces(int workspaces);
55 std::vector<char> GetAllShortcuts() const;55 std::vector<char> GetAllShortcuts() const;
56 std::vector<AbstractLauncherIcon*> GetAltTabIcons(bool current) const;56 std::vector<AbstractLauncherIcon::Ptr> GetAltTabIcons(bool current) const;
5757
58 void PushToFront();58 void PushToFront();
5959
6060
=== modified file 'plugins/unityshell/src/LauncherIcon.cpp'
--- plugins/unityshell/src/LauncherIcon.cpp 2012-02-11 07:34:27 +0000
+++ plugins/unityshell/src/LauncherIcon.cpp 2012-02-12 19:58:19 +0000
@@ -706,7 +706,7 @@
706 return;706 return;
707707
708 _has_visible_window[monitor] = val;708 _has_visible_window[monitor] = val;
709 needs_redraw.emit(this);709 EmitNeedsRedraw();
710}710}
711711
712gboolean712gboolean
@@ -760,7 +760,7 @@
760 _quicklist->Hide();760 _quicklist->Hide();
761761
762 SetQuirk(QUIRK_VISIBLE, false);762 SetQuirk(QUIRK_VISIBLE, false);
763 remove.emit(this);763 EmitRemove();
764}764}
765765
766void766void
@@ -782,7 +782,7 @@
782}782}
783783
784LauncherIcon::IconType784LauncherIcon::IconType
785LauncherIcon::Type()785LauncherIcon::GetIconType()
786{786{
787 return _icon_type;787 return _icon_type;
788}788}
@@ -804,7 +804,7 @@
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);
805 else805 else
806 clock_gettime(CLOCK_MONOTONIC, &(_quirk_times[quirk]));806 clock_gettime(CLOCK_MONOTONIC, &(_quirk_times[quirk]));
807 needs_redraw.emit(this);807 EmitNeedsRedraw();
808808
809 // Present on urgent as a general policy809 // Present on urgent as a general policy
810 if (quirk == QUIRK_VISIBLE && value)810 if (quirk == QUIRK_VISIBLE && value)
@@ -828,7 +828,7 @@
828 LauncherIcon* self = arg->self;828 LauncherIcon* self = arg->self;
829829
830 clock_gettime(CLOCK_MONOTONIC, &(self->_quirk_times[arg->quirk]));830 clock_gettime(CLOCK_MONOTONIC, &(self->_quirk_times[arg->quirk]));
831 self->needs_redraw.emit(self);831 self->EmitNeedsRedraw();
832832
833 self->_time_delay_handle = 0;833 self->_time_delay_handle = 0;
834834
@@ -849,7 +849,7 @@
849LauncherIcon::UpdateQuirkTime(LauncherIcon::Quirk quirk)849LauncherIcon::UpdateQuirkTime(LauncherIcon::Quirk quirk)
850{850{
851 clock_gettime(CLOCK_MONOTONIC, &(_quirk_times[quirk]));851 clock_gettime(CLOCK_MONOTONIC, &(_quirk_times[quirk]));
852 needs_redraw.emit(this);852 EmitNeedsRedraw();
853}853}
854854
855void855void
@@ -872,7 +872,7 @@
872 return;872 return;
873873
874 _progress = progress;874 _progress = progress;
875 needs_redraw.emit(this);875 EmitNeedsRedraw();
876}876}
877877
878float878float
@@ -902,7 +902,7 @@
902LauncherIcon::SetEmblem(LauncherIcon::BaseTexturePtr const& emblem)902LauncherIcon::SetEmblem(LauncherIcon::BaseTexturePtr const& emblem)
903{903{
904 _emblem = emblem;904 _emblem = emblem;
905 needs_redraw.emit(this);905 EmitNeedsRedraw();
906}906}
907907
908void908void
@@ -1135,5 +1135,18 @@
1135 SetProgress((float) remote->Progress());1135 SetProgress((float) remote->Progress());
1136}1136}
11371137
1138void LauncherIcon::EmitNeedsRedraw()
1139{
1140 if (OwnsTheReference())
1141 needs_redraw.emit(AbstractLauncherIcon::Ptr(this));
1142}
1143
1144void LauncherIcon::EmitRemove()
1145{
1146 if (OwnsTheReference())
1147 remove.emit(AbstractLauncherIcon::Ptr(this));
1148}
1149
1150
1138} // namespace launcher1151} // namespace launcher
1139} // namespace unity1152} // namespace unity
11401153
=== modified file 'plugins/unityshell/src/LauncherIcon.h'
--- plugins/unityshell/src/LauncherIcon.h 2012-02-09 04:14:31 +0000
+++ plugins/unityshell/src/LauncherIcon.h 2012-02-12 19:58:19 +0000
@@ -141,7 +141,7 @@
141141
142 struct timespec GetQuirkTime(Quirk quirk);142 struct timespec GetQuirkTime(Quirk quirk);
143143
144 IconType Type();144 IconType GetIconType();
145145
146 virtual nux::Color BackgroundColor();146 virtual nux::Color BackgroundColor();
147147
@@ -184,6 +184,18 @@
184184
185 void SetIconType(IconType type);185 void SetIconType(IconType type);
186186
187 virtual std::string DesktopFile() { return std::string(""); }
188
189 virtual bool IsSticky() const { return false; }
190
191 virtual bool IsVisible() const { return false; }
192
193 virtual void AboutToRemove() {}
194
195 virtual void Stick(bool save = true) {}
196
197 virtual void UnStick() {}
198
187protected:199protected:
188 std::vector<nux::Point3> GetCenters();200 std::vector<nux::Point3> GetCenters();
189201
@@ -263,6 +275,9 @@
263275
264 void OnRemoteProgressVisibleChanged(LauncherEntryRemote* remote);276 void OnRemoteProgressVisibleChanged(LauncherEntryRemote* remote);
265277
278 void EmitNeedsRedraw();
279
280 void EmitRemove();
266281
267 // This looks like a case for boost::logical::tribool282 // This looks like a case for boost::logical::tribool
268 static int _current_theme_is_mono;283 static int _current_theme_is_mono;
269284
=== modified file 'plugins/unityshell/src/LauncherModel.cpp'
--- plugins/unityshell/src/LauncherModel.cpp 2012-02-08 00:32:46 +0000
+++ plugins/unityshell/src/LauncherModel.cpp 2012-02-12 19:58:19 +0000
@@ -30,7 +30,7 @@
3030
31typedef struct31typedef struct
32{32{
33 AbstractLauncherIcon* icon;33 AbstractLauncherIcon::Ptr icon;
34 LauncherModel* self;34 LauncherModel* self;
35} RemoveArg;35} RemoveArg;
3636
@@ -41,11 +41,6 @@
4141
42LauncherModel::~LauncherModel()42LauncherModel::~LauncherModel()
43{43{
44 for (auto icon : _inner_shelf)
45 icon->UnReference();
46
47 for (auto icon : _inner_main)
48 icon->UnReference();
49}44}
5045
51std::string LauncherModel::GetName() const46std::string LauncherModel::GetName() const
@@ -64,21 +59,21 @@
64 introspection_results_.clear();59 introspection_results_.clear();
65 60
66 for (auto icon : _inner)61 for (auto icon : _inner)
67 introspection_results_.push_back(icon);62 introspection_results_.push_back(icon.GetPointer());
68 63
69 return introspection_results_;64 return introspection_results_;
70}65}
7166
72bool LauncherModel::IconShouldShelf(AbstractLauncherIcon* icon) const67bool LauncherModel::IconShouldShelf(AbstractLauncherIcon::Ptr icon) const
73{68{
74 return icon->Type() == AbstractLauncherIcon::TYPE_TRASH;69 return icon->GetIconType() == AbstractLauncherIcon::TYPE_TRASH;
75}70}
7671
77bool LauncherModel::CompareIcons(AbstractLauncherIcon* first, AbstractLauncherIcon* second)72bool LauncherModel::CompareIcons(AbstractLauncherIcon::Ptr first, AbstractLauncherIcon::Ptr second)
78{73{
79 if (first->Type() < second->Type())74 if (first->GetIconType() < second->GetIconType())
80 return true;75 return true;
81 else if (first->Type() > second->Type())76 else if (first->GetIconType() > second->GetIconType())
82 return false;77 return false;
8378
84 return first->SortPriority() < second->SortPriority();79 return first->SortPriority() < second->SortPriority();
@@ -112,10 +107,8 @@
112}107}
113108
114void109void
115LauncherModel::AddIcon(AbstractLauncherIcon* icon)110LauncherModel::AddIcon(AbstractLauncherIcon::Ptr icon)
116{111{
117 icon->SinkReference();
118
119 if (IconShouldShelf(icon))112 if (IconShouldShelf(icon))
120 _inner_shelf.push_back(icon);113 _inner_shelf.push_back(icon);
121 else114 else
@@ -131,7 +124,7 @@
131}124}
132125
133void126void
134LauncherModel::RemoveIcon(AbstractLauncherIcon* icon)127LauncherModel::RemoveIcon(AbstractLauncherIcon::Ptr icon)
135{128{
136 size_t size;129 size_t size;
137130
@@ -144,7 +137,6 @@
144 if (size != _inner.size())137 if (size != _inner.size())
145 {138 {
146 icon_removed.emit(icon);139 icon_removed.emit(icon);
147 icon->UnReference();
148 }140 }
149}141}
150142
@@ -160,7 +152,7 @@
160}152}
161153
162void154void
163LauncherModel::OnIconRemove(AbstractLauncherIcon* icon)155LauncherModel::OnIconRemove(AbstractLauncherIcon::Ptr icon)
164{156{
165 RemoveArg* arg = (RemoveArg*) g_malloc0(sizeof(RemoveArg));157 RemoveArg* arg = (RemoveArg*) g_malloc0(sizeof(RemoveArg));
166 arg->icon = icon;158 arg->icon = icon;
@@ -186,12 +178,12 @@
186}178}
187179
188bool180bool
189LauncherModel::IconHasSister(AbstractLauncherIcon* icon) const181LauncherModel::IconHasSister(AbstractLauncherIcon::Ptr icon) const
190{182{
191 const_iterator it;183 const_iterator it;
192 const_iterator end;184 const_iterator end;
193185
194 if (icon && icon->Type() == AbstractLauncherIcon::TYPE_DEVICE)186 if (icon && icon->GetIconType() == AbstractLauncherIcon::TYPE_DEVICE)
195 return true;187 return true;
196188
197 if (IconShouldShelf(icon))189 if (IconShouldShelf(icon))
@@ -207,9 +199,9 @@
207199
208 for (; it != end; ++it)200 for (; it != end; ++it)
209 {201 {
210 AbstractLauncherIcon* iter_icon = *it;202 AbstractLauncherIcon::Ptr iter_icon = *it;
211 if ((iter_icon != icon)203 if ((iter_icon != icon)
212 && iter_icon->Type() == icon->Type())204 && iter_icon->GetIconType() == icon->GetIconType())
213 return true;205 return true;
214 }206 }
215207
@@ -217,7 +209,7 @@
217}209}
218210
219void211void
220LauncherModel::ReorderAfter(AbstractLauncherIcon* icon, AbstractLauncherIcon* other)212LauncherModel::ReorderAfter(AbstractLauncherIcon::Ptr icon, AbstractLauncherIcon::Ptr other)
221{213{
222 if (icon == other)214 if (icon == other)
223 return;215 return;
@@ -247,7 +239,7 @@
247}239}
248240
249void241void
250LauncherModel::ReorderBefore(AbstractLauncherIcon* icon, AbstractLauncherIcon* other, bool save)242LauncherModel::ReorderBefore(AbstractLauncherIcon::Ptr icon, AbstractLauncherIcon::Ptr other, bool save)
251{243{
252 if (icon == other)244 if (icon == other)
253 return;245 return;
@@ -288,7 +280,7 @@
288}280}
289281
290void282void
291LauncherModel::ReorderSmart(AbstractLauncherIcon* icon, AbstractLauncherIcon* other, bool save)283LauncherModel::ReorderSmart(AbstractLauncherIcon::Ptr icon, AbstractLauncherIcon::Ptr other, bool save)
292{284{
293 if (icon == other)285 if (icon == other)
294 return;286 return;
@@ -347,7 +339,7 @@
347 return _inner.size();339 return _inner.size();
348}340}
349341
350AbstractLauncherIcon* LauncherModel::Selection () const342AbstractLauncherIcon::Ptr LauncherModel::Selection () const
351{343{
352 return _inner[selection_];344 return _inner[selection_];
353}345}
354346
=== modified file 'plugins/unityshell/src/LauncherModel.h'
--- plugins/unityshell/src/LauncherModel.h 2012-02-08 00:32:46 +0000
+++ plugins/unityshell/src/LauncherModel.h 2012-02-12 19:58:19 +0000
@@ -35,7 +35,7 @@
35{35{
36public:36public:
37 typedef std::shared_ptr<LauncherModel> Ptr;37 typedef std::shared_ptr<LauncherModel> Ptr;
38 typedef std::vector<AbstractLauncherIcon*> Base;38 typedef std::vector<AbstractLauncherIcon::Ptr> Base;
39 typedef Base::iterator iterator;39 typedef Base::iterator iterator;
40 typedef Base::const_iterator const_iterator;40 typedef Base::const_iterator const_iterator;
41 typedef Base::reverse_iterator reverse_iterator;41 typedef Base::reverse_iterator reverse_iterator;
@@ -44,22 +44,22 @@
44 LauncherModel();44 LauncherModel();
45 ~LauncherModel();45 ~LauncherModel();
4646
47 void AddIcon(AbstractLauncherIcon* icon);47 void AddIcon(AbstractLauncherIcon::Ptr icon);
48 void RemoveIcon(AbstractLauncherIcon* icon);48 void RemoveIcon(AbstractLauncherIcon::Ptr icon);
49 void Save();49 void Save();
50 void Sort();50 void Sort();
51 int Size() const;51 int Size() const;
5252
53 void OnIconRemove(AbstractLauncherIcon* icon);53 void OnIconRemove(AbstractLauncherIcon::Ptr icon);
5454
55 bool IconHasSister(AbstractLauncherIcon* icon) const;55 bool IconHasSister(AbstractLauncherIcon::Ptr icon) const;
5656
57 void ReorderAfter(AbstractLauncherIcon* icon, AbstractLauncherIcon* other);57 void ReorderAfter(AbstractLauncherIcon::Ptr icon, AbstractLauncherIcon::Ptr other);
58 void ReorderBefore(AbstractLauncherIcon* icon, AbstractLauncherIcon* other, bool save);58 void ReorderBefore(AbstractLauncherIcon::Ptr icon, AbstractLauncherIcon::Ptr other, bool save);
5959
60 void ReorderSmart(AbstractLauncherIcon* icon, AbstractLauncherIcon* other, bool save);60 void ReorderSmart(AbstractLauncherIcon::Ptr icon, AbstractLauncherIcon::Ptr other, bool save);
6161
62 AbstractLauncherIcon* Selection() const;62 AbstractLauncherIcon::Ptr Selection() const;
63 int SelectionIndex() const;63 int SelectionIndex() const;
64 void SetSelection(int selection);64 void SetSelection(int selection);
65 void SelectNext();65 void SelectNext();
@@ -81,11 +81,11 @@
81 reverse_iterator shelf_rbegin();81 reverse_iterator shelf_rbegin();
82 reverse_iterator shelf_rend();82 reverse_iterator shelf_rend();
8383
84 sigc::signal<void, AbstractLauncherIcon*> icon_added;84 sigc::signal<void, AbstractLauncherIcon::Ptr> icon_added;
85 sigc::signal<void, AbstractLauncherIcon*> icon_removed;85 sigc::signal<void, AbstractLauncherIcon::Ptr> icon_removed;
86 sigc::signal<void> order_changed;86 sigc::signal<void> order_changed;
87 sigc::signal<void> saved;87 sigc::signal<void> saved;
88 sigc::signal<void, AbstractLauncherIcon*> selection_changed;88 sigc::signal<void, AbstractLauncherIcon::Ptr> selection_changed;
8989
90 IntrospectableList const& GetIntrospectableChildren();90 IntrospectableList const& GetIntrospectableChildren();
91protected:91protected:
@@ -102,26 +102,26 @@
102102
103 bool Populate();103 bool Populate();
104104
105 bool IconShouldShelf(AbstractLauncherIcon* icon) const;105 bool IconShouldShelf(AbstractLauncherIcon::Ptr icon) const;
106106
107 static gboolean RemoveCallback(gpointer data);107 static gboolean RemoveCallback(gpointer data);
108108
109 static bool CompareIcons(AbstractLauncherIcon* first, AbstractLauncherIcon* second);109 static bool CompareIcons(AbstractLauncherIcon::Ptr first, AbstractLauncherIcon::Ptr second);
110110
111 /* Template Methods */111 /* Template Methods */
112public:112public:
113 template<class T>113 template<class T>
114 std::list<T*> GetSublist()114 std::list<AbstractLauncherIcon::Ptr> GetSublist()
115 {115 {
116 std::list<T*> result;116 std::list<AbstractLauncherIcon::Ptr> result;
117117
118 iterator it;118 iterator it;
119 for (it = begin(); it != end(); it++)119 for (it = begin(); it != end(); it++)
120 {120 {
121 T* var = dynamic_cast<T*>(*it);121 T* var = dynamic_cast<T*>((*it).GetPointer());
122122
123 if (var)123 if (var)
124 result.push_back(var);124 result.push_back(*it);
125 }125 }
126126
127 return result;127 return result;
128128
=== modified file 'plugins/unityshell/src/MockLauncherIcon.h'
--- plugins/unityshell/src/MockLauncherIcon.h 2012-02-04 05:28:23 +0000
+++ plugins/unityshell/src/MockLauncherIcon.h 2012-02-12 19:58:19 +0000
@@ -42,6 +42,7 @@
4242
43class MockLauncherIcon : public AbstractLauncherIcon43class MockLauncherIcon : public AbstractLauncherIcon
44{44{
45 NUX_DECLARE_OBJECT_TYPE(MockLauncherIcon, AbstractLauncherIcon);
45public:46public:
46 MockLauncherIcon()47 MockLauncherIcon()
47 : icon_(0)48 : icon_(0)
@@ -185,7 +186,7 @@
185 return tv;186 return tv;
186 }187 }
187188
188 IconType Type()189 IconType GetIconType()
189 {190 {
190 return type_;191 return type_;
191 }192 }
@@ -239,6 +240,18 @@
239240
240 void SendDndLeave() {}241 void SendDndLeave() {}
241242
243 std::string DesktopFile() { return std::string(""); }
244
245 bool IsSticky() const { return false; }
246
247 bool IsVisible() const { return false; }
248
249 void AboutToRemove() {}
250
251 void Stick(bool save = true) {}
252
253 void UnStick() {}
254
242private:255private:
243 nux::BaseTexture* TextureFromGtkTheme(const char* icon_name, int size)256 nux::BaseTexture* TextureFromGtkTheme(const char* icon_name, int size)
244 {257 {
@@ -292,6 +305,8 @@
292 IconType type_;305 IconType type_;
293};306};
294307
308NUX_IMPLEMENT_OBJECT_TYPE(MockLauncherIcon);
309
295}310}
296}311}
297312
298313
=== modified file 'plugins/unityshell/src/SimpleLauncherIcon.cpp'
--- plugins/unityshell/src/SimpleLauncherIcon.cpp 2012-02-08 00:32:46 +0000
+++ plugins/unityshell/src/SimpleLauncherIcon.cpp 2012-02-12 19:58:19 +0000
@@ -40,6 +40,8 @@
40 nux::logging::Logger logger("unity.dash.CategoryViewGrid");40 nux::logging::Logger logger("unity.dash.CategoryViewGrid");
41}41}
4242
43NUX_IMPLEMENT_OBJECT_TYPE(SimpleLauncherIcon);
44
43SimpleLauncherIcon::SimpleLauncherIcon()45SimpleLauncherIcon::SimpleLauncherIcon()
44 : LauncherIcon()46 : LauncherIcon()
45 , icon_name("", sigc::mem_fun(this, &SimpleLauncherIcon::SetIconName))47 , icon_name("", sigc::mem_fun(this, &SimpleLauncherIcon::SetIconName))
@@ -130,7 +132,7 @@
130 element.second->UnReference();132 element.second->UnReference();
131133
132 texture_map.clear ();134 texture_map.clear ();
133 needs_redraw.emit(this);135 EmitNeedsRedraw();
134}136}
135137
136void SimpleLauncherIcon::OnIconThemeChanged(GtkIconTheme* icon_theme, gpointer data)138void SimpleLauncherIcon::OnIconThemeChanged(GtkIconTheme* icon_theme, gpointer data)
137139
=== modified file 'plugins/unityshell/src/SimpleLauncherIcon.h'
--- plugins/unityshell/src/SimpleLauncherIcon.h 2012-02-08 00:32:46 +0000
+++ plugins/unityshell/src/SimpleLauncherIcon.h 2012-02-12 19:58:19 +0000
@@ -31,6 +31,7 @@
3131
32class SimpleLauncherIcon : public LauncherIcon32class SimpleLauncherIcon : public LauncherIcon
33{33{
34 NUX_DECLARE_OBJECT_TYPE(SimpleLauncherIcon, LauncherIcon);
34public:35public:
35 SimpleLauncherIcon();36 SimpleLauncherIcon();
36 virtual ~SimpleLauncherIcon();37 virtual ~SimpleLauncherIcon();
3738
=== modified file 'plugins/unityshell/src/SoftwareCenterLauncherIcon.cpp'
--- plugins/unityshell/src/SoftwareCenterLauncherIcon.cpp 2012-02-03 01:24:53 +0000
+++ plugins/unityshell/src/SoftwareCenterLauncherIcon.cpp 2012-02-12 19:58:19 +0000
@@ -43,6 +43,7 @@
43 SetProgress(0.0f);43 SetProgress(0.0f);
44 });44 });
4545
46 SetIconType(TYPE_APPLICATION);
46 icon_name = icon_path.c_str();47 icon_name = icon_path.c_str();
47 tooltip_text = _("Waiting to install");48 tooltip_text = _("Waiting to install");
48}49}
4950
=== modified file 'plugins/unityshell/src/SwitcherController.cpp'
--- plugins/unityshell/src/SwitcherController.cpp 2012-02-04 05:28:23 +0000
+++ plugins/unityshell/src/SwitcherController.cpp 2012-02-12 19:58:19 +0000
@@ -74,7 +74,7 @@
74}74}
7575
76void Controller::Show(ShowMode show, SortMode sort, bool reverse,76void Controller::Show(ShowMode show, SortMode sort, bool reverse,
77 std::vector<AbstractLauncherIcon*> results)77 std::vector<AbstractLauncherIcon::Ptr> results)
78{78{
79 if (sort == SortMode::FOCUS_ORDER)79 if (sort == SortMode::FOCUS_ORDER)
80 {80 {
@@ -147,7 +147,7 @@
147 return FALSE;147 return FALSE;
148}148}
149149
150void Controller::OnModelSelectionChanged(AbstractLauncherIcon *icon)150void Controller::OnModelSelectionChanged(AbstractLauncherIcon::Ptr icon)
151{151{
152 if (detail_on_timeout)152 if (detail_on_timeout)
153 {153 {
@@ -205,7 +205,7 @@
205205
206 if (accept_state)206 if (accept_state)
207 {207 {
208 AbstractLauncherIcon* selection = model_->Selection();208 AbstractLauncherIcon::Ptr selection = model_->Selection();
209 if (selection)209 if (selection)
210 {210 {
211 if (model_->detail_selection)211 if (model_->detail_selection)
@@ -374,12 +374,12 @@
374 return view_->ExternalTargets();374 return view_->ExternalTargets();
375}375}
376376
377bool Controller::CompareSwitcherItemsPriority(AbstractLauncherIcon* first,377bool Controller::CompareSwitcherItemsPriority(AbstractLauncherIcon::Ptr first,
378 AbstractLauncherIcon* second)378 AbstractLauncherIcon::Ptr second)
379{379{
380 if (first->Type() == second->Type())380 if (first->GetIconType() == second->GetIconType())
381 return first->SwitcherPriority() > second->SwitcherPriority();381 return first->SwitcherPriority() > second->SwitcherPriority();
382 return first->Type() < second->Type();382 return first->GetIconType() < second->GetIconType();
383}383}
384384
385void Controller::SelectFirstItem()385void Controller::SelectFirstItem()
@@ -387,8 +387,8 @@
387 if (!model_)387 if (!model_)
388 return;388 return;
389389
390 AbstractLauncherIcon* first = model_->at(1);390 AbstractLauncherIcon::Ptr first = model_->at(1);
391 AbstractLauncherIcon* second = model_->at(2);391 AbstractLauncherIcon::Ptr second = model_->at(2);
392392
393 if (!first)393 if (!first)
394 {394 {
395395
=== modified file 'plugins/unityshell/src/SwitcherController.h'
--- plugins/unityshell/src/SwitcherController.h 2012-02-04 05:28:23 +0000
+++ plugins/unityshell/src/SwitcherController.h 2012-02-12 19:58:19 +0000
@@ -70,7 +70,7 @@
70 nux::Property<bool> detail_on_timeout;70 nux::Property<bool> detail_on_timeout;
71 nux::Property<int> detail_timeout_length;71 nux::Property<int> detail_timeout_length;
7272
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);
74 void Hide(bool accept_state=true);74 void Hide(bool accept_state=true);
7575
76 bool Visible();76 bool Visible();
@@ -108,7 +108,7 @@
108108
109 void ConstructView();109 void ConstructView();
110110
111 void OnModelSelectionChanged(launcher::AbstractLauncherIcon *icon);111 void OnModelSelectionChanged(launcher::AbstractLauncherIcon::Ptr icon);
112112
113 static void OnBackgroundUpdate(GVariant* data, Controller* self);113 static void OnBackgroundUpdate(GVariant* data, Controller* self);
114114
@@ -131,7 +131,7 @@
131 static gboolean OnShowTimer(gpointer data);131 static gboolean OnShowTimer(gpointer data);
132 static gboolean OnDetailTimer(gpointer data);132 static gboolean OnDetailTimer(gpointer data);
133133
134 static bool CompareSwitcherItemsPriority(launcher::AbstractLauncherIcon* first, launcher::AbstractLauncherIcon* second);134 static bool CompareSwitcherItemsPriority(launcher::AbstractLauncherIcon::Ptr first, launcher::AbstractLauncherIcon::Ptr second);
135};135};
136136
137}137}
138138
=== modified file 'plugins/unityshell/src/SwitcherModel.cpp'
--- plugins/unityshell/src/SwitcherModel.cpp 2012-02-07 07:42:12 +0000
+++ plugins/unityshell/src/SwitcherModel.cpp 2012-02-12 19:58:19 +0000
@@ -30,7 +30,7 @@
30namespace switcher30namespace switcher
31{31{
3232
33SwitcherModel::SwitcherModel(std::vector<AbstractLauncherIcon*> icons)33SwitcherModel::SwitcherModel(std::vector<AbstractLauncherIcon::Ptr> icons)
34 : _inner(icons)34 : _inner(icons)
35 , _index(0)35 , _index(0)
36 , _last_index(0)36 , _last_index(0)
@@ -41,8 +41,7 @@
4141
42 for (auto icon : _inner)42 for (auto icon : _inner)
43 {43 {
44 AddChild(icon);44 AddChild(icon.GetPointer());
45 icon->Reference();
46 }45 }
47}46}
4847
@@ -50,8 +49,7 @@
50{49{
51 for (auto icon : _inner)50 for (auto icon : _inner)
52 {51 {
53 RemoveChild(icon);52 RemoveChild(icon.GetPointer());
54 icon->UnReference();
55 }53 }
56}54}
5755
@@ -94,11 +92,11 @@
94 return _inner.rend();92 return _inner.rend();
95}93}
9694
97AbstractLauncherIcon*95AbstractLauncherIcon::Ptr
98SwitcherModel::at(unsigned int index)96SwitcherModel::at(unsigned int index)
99{97{
100 if ((int) index >= Size ())98 if ((int) index >= Size ())
101 return 0;99 return AbstractLauncherIcon::Ptr();
102 return _inner[index];100 return _inner[index];
103}101}
104102
@@ -108,7 +106,7 @@
108 return _inner.size();106 return _inner.size();
109}107}
110108
111AbstractLauncherIcon*109AbstractLauncherIcon::Ptr
112SwitcherModel::Selection()110SwitcherModel::Selection()
113{111{
114 return _inner.at(_index);112 return _inner.at(_index);
@@ -120,7 +118,7 @@
120 return _index;118 return _index;
121}119}
122120
123AbstractLauncherIcon*121AbstractLauncherIcon::Ptr
124SwitcherModel::LastSelection()122SwitcherModel::LastSelection()
125{123{
126 return _inner.at(_last_index);124 return _inner.at(_last_index);
@@ -229,7 +227,7 @@
229}227}
230228
231void229void
232SwitcherModel::Select(AbstractLauncherIcon* selection)230SwitcherModel::Select(AbstractLauncherIcon::Ptr selection)
233{231{
234 int i = 0;232 int i = 0;
235 for (iterator it = begin(), e = end(); it != e; ++it)233 for (iterator it = begin(), e = end(); it != e; ++it)
236234
=== modified file 'plugins/unityshell/src/SwitcherModel.h'
--- plugins/unityshell/src/SwitcherModel.h 2011-12-08 01:23:11 +0000
+++ plugins/unityshell/src/SwitcherModel.h 2012-02-12 19:58:19 +0000
@@ -41,7 +41,7 @@
41public:41public:
42 typedef boost::shared_ptr<SwitcherModel> Ptr;42 typedef boost::shared_ptr<SwitcherModel> Ptr;
4343
44 typedef std::vector<launcher::AbstractLauncherIcon*> Base;44 typedef std::vector<launcher::AbstractLauncherIcon::Ptr> Base;
45 typedef Base::iterator iterator;45 typedef Base::iterator iterator;
46 typedef Base::reverse_iterator reverse_iterator;46 typedef Base::reverse_iterator reverse_iterator;
4747
@@ -52,7 +52,7 @@
52 // Icons are owned externally and assumed valid for life of switcher.52 // Icons are owned externally and assumed valid for life of switcher.
53 // When AbstractLauncherIcon is complete, it will be passed as a shared pointer and this53 // When AbstractLauncherIcon is complete, it will be passed as a shared pointer and this
54 // will no longer be a worry.54 // will no longer be a worry.
55 SwitcherModel(std::vector<launcher::AbstractLauncherIcon*> icons);55 SwitcherModel(std::vector<launcher::AbstractLauncherIcon::Ptr> icons);
56 virtual ~SwitcherModel();56 virtual ~SwitcherModel();
5757
58 iterator begin();58 iterator begin();
@@ -61,14 +61,14 @@
61 reverse_iterator rbegin();61 reverse_iterator rbegin();
62 reverse_iterator rend();62 reverse_iterator rend();
6363
64 launcher::AbstractLauncherIcon* at(unsigned int index);64 launcher::AbstractLauncherIcon::Ptr at(unsigned int index);
6565
66 int Size();66 int Size();
6767
68 launcher::AbstractLauncherIcon* Selection();68 launcher::AbstractLauncherIcon::Ptr Selection();
69 int SelectionIndex();69 int SelectionIndex();
7070
71 launcher::AbstractLauncherIcon* LastSelection();71 launcher::AbstractLauncherIcon::Ptr LastSelection();
72 int LastSelectionIndex();72 int LastSelectionIndex();
7373
74 std::vector<Window> DetailXids ();74 std::vector<Window> DetailXids ();
@@ -80,10 +80,10 @@
80 void NextDetail();80 void NextDetail();
81 void PrevDetail();81 void PrevDetail();
8282
83 void Select(launcher::AbstractLauncherIcon* selection);83 void Select(launcher::AbstractLauncherIcon::Ptr selection);
84 void Select(int index);84 void Select(int index);
8585
86 sigc::signal<void, launcher::AbstractLauncherIcon*> selection_changed;86 sigc::signal<void, launcher::AbstractLauncherIcon::Ptr> selection_changed;
8787
88protected:88protected:
89 // Introspectable methods89 // Introspectable methods
9090
=== modified file 'plugins/unityshell/src/SwitcherView.cpp'
--- plugins/unityshell/src/SwitcherView.cpp 2012-02-04 05:28:23 +0000
+++ plugins/unityshell/src/SwitcherView.cpp 2012-02-12 19:58:19 +0000
@@ -172,7 +172,7 @@
172 QueueDraw ();172 QueueDraw ();
173}173}
174174
175void SwitcherView::OnSelectionChanged(AbstractLauncherIcon* selection)175void SwitcherView::OnSelectionChanged(AbstractLauncherIcon::Ptr selection)
176{176{
177 if (selection)177 if (selection)
178 text_view_->SetText(selection->tooltip_text().c_str());178 text_view_->SetText(selection->tooltip_text().c_str());
@@ -185,10 +185,10 @@
185 return model_;185 return model_;
186}186}
187187
188RenderArg SwitcherView::CreateBaseArgForIcon(AbstractLauncherIcon* icon)188RenderArg SwitcherView::CreateBaseArgForIcon(AbstractLauncherIcon::Ptr icon)
189{189{
190 RenderArg arg;190 RenderArg arg;
191 arg.icon = icon;191 arg.icon = icon.GetPointer();
192 arg.alpha = 0.95f;192 arg.alpha = 0.95f;
193193
194 // tells the renderer to render arrows by number194 // tells the renderer to render arrows by number
@@ -569,7 +569,7 @@
569 std::list<RenderArg>::iterator it;569 std::list<RenderArg>::iterator it;
570 for (it = last_args_.begin(); it != last_args_.end(); ++it)570 for (it = last_args_.begin(); it != last_args_.end(); ++it)
571 {571 {
572 if (it->icon == model_->Selection())572 if (model_->Selection() == it->icon)
573 {573 {
574 int view_width = text_view_->GetBaseWidth();574 int view_width = text_view_->GetBaseWidth();
575 int start_x = it->render_center.x - view_width / 2;575 int start_x = it->render_center.x - view_width / 2;
576576
=== modified file 'plugins/unityshell/src/SwitcherView.h'
--- plugins/unityshell/src/SwitcherView.h 2012-02-04 05:28:23 +0000
+++ plugins/unityshell/src/SwitcherView.h 2012-02-12 19:58:19 +0000
@@ -88,9 +88,9 @@
8888
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);
9090
91 ui::RenderArg CreateBaseArgForIcon(launcher::AbstractLauncherIcon* icon);91 ui::RenderArg CreateBaseArgForIcon(launcher::AbstractLauncherIcon::Ptr icon);
92private:92private:
93 void OnSelectionChanged(launcher::AbstractLauncherIcon* selection);93 void OnSelectionChanged(launcher::AbstractLauncherIcon::Ptr selection);
94 void OnDetailSelectionChanged (bool detail);94 void OnDetailSelectionChanged (bool detail);
95 void OnDetailSelectionIndexChanged (unsigned int index);95 void OnDetailSelectionIndexChanged (unsigned int index);
9696
9797
=== modified file 'plugins/unityshell/src/unity-launcher-accessible.cpp'
--- plugins/unityshell/src/unity-launcher-accessible.cpp 2012-02-04 05:28:23 +0000
+++ plugins/unityshell/src/unity-launcher-accessible.cpp 2012-02-12 19:58:19 +0000
@@ -64,8 +64,8 @@
6464
65/* private */65/* private */
66static void on_selection_change_cb(UnityLauncherAccessible* launcher_accessible);66static void on_selection_change_cb(UnityLauncherAccessible* launcher_accessible);
67static void on_icon_added_cb(AbstractLauncherIcon* icon, UnityLauncherAccessible* self);67static void on_icon_added_cb(AbstractLauncherIcon::Ptr icon, UnityLauncherAccessible* self);
68static void on_icon_removed_cb(AbstractLauncherIcon* icon, UnityLauncherAccessible* self);68static void on_icon_removed_cb(AbstractLauncherIcon::Ptr icon, UnityLauncherAccessible* self);
69static void on_order_change_cb(UnityLauncherAccessible* self);69static void on_order_change_cb(UnityLauncherAccessible* self);
70static void update_children_index(UnityLauncherAccessible* self);70static void update_children_index(UnityLauncherAccessible* self);
7171
@@ -227,7 +227,7 @@
227 it = launcher_model->begin();227 it = launcher_model->begin();
228 std::advance(it, i);228 std::advance(it, i);
229229
230 child = dynamic_cast<nux::Object*>(*it);230 child = dynamic_cast<nux::Object*>((*it).GetPointer());
231 child_accessible = unity_a11y_get_accessible(child);231 child_accessible = unity_a11y_get_accessible(child);
232232
233 parent = atk_object_get_parent(child_accessible);233 parent = atk_object_get_parent(child_accessible);
@@ -287,7 +287,7 @@
287 gint i)287 gint i)
288{288{
289 Launcher* launcher = NULL;289 Launcher* launcher = NULL;
290 AbstractLauncherIcon* selected_icon = NULL;290 AbstractLauncherIcon::Ptr selected_icon;
291 nux::Object* nux_object = NULL;291 nux::Object* nux_object = NULL;
292 AtkObject* accessible_selected = NULL;292 AtkObject* accessible_selected = NULL;
293293
@@ -302,9 +302,9 @@
302 launcher = dynamic_cast<Launcher*>(nux_object);302 launcher = dynamic_cast<Launcher*>(nux_object);
303 selected_icon = launcher->GetSelectedMenuIcon();303 selected_icon = launcher->GetSelectedMenuIcon();
304304
305 if (selected_icon != 0)305 if (selected_icon)
306 {306 {
307 accessible_selected = unity_a11y_get_accessible(selected_icon);307 accessible_selected = unity_a11y_get_accessible(selected_icon.GetPointer());
308 g_object_ref(accessible_selected);308 g_object_ref(accessible_selected);
309 }309 }
310310
@@ -315,7 +315,7 @@
315unity_launcher_accessible_get_selection_count(AtkSelection* selection)315unity_launcher_accessible_get_selection_count(AtkSelection* selection)
316{316{
317 Launcher* launcher = NULL;317 Launcher* launcher = NULL;
318 AbstractLauncherIcon* selected_icon = NULL;318 AbstractLauncherIcon::Ptr selected_icon;
319 nux::Object* nux_object = NULL;319 nux::Object* nux_object = NULL;
320320
321 g_return_val_if_fail(UNITY_IS_LAUNCHER_ACCESSIBLE(selection), 0);321 g_return_val_if_fail(UNITY_IS_LAUNCHER_ACCESSIBLE(selection), 0);
@@ -327,7 +327,7 @@
327 launcher = dynamic_cast<Launcher*>(nux_object);327 launcher = dynamic_cast<Launcher*>(nux_object);
328 selected_icon = launcher->GetSelectedMenuIcon();328 selected_icon = launcher->GetSelectedMenuIcon();
329329
330 if (selected_icon == 0)330 if (!selected_icon)
331 return 0;331 return 0;
332 else332 else
333 return 1;333 return 1;
@@ -338,8 +338,8 @@
338 gint i)338 gint i)
339{339{
340 Launcher* launcher = NULL;340 Launcher* launcher = NULL;
341 AbstractLauncherIcon* icon = NULL;341 AbstractLauncherIcon::Ptr icon;
342 AbstractLauncherIcon* selected_icon = NULL;342 AbstractLauncherIcon::Ptr selected_icon;
343 LauncherModel* launcher_model = NULL;343 LauncherModel* launcher_model = NULL;
344 LauncherModel::iterator it;344 LauncherModel::iterator it;
345 nux::Object* nux_object = NULL;345 nux::Object* nux_object = NULL;
@@ -354,7 +354,7 @@
354 launcher_model = launcher->GetModel();354 launcher_model = launcher->GetModel();
355 it = launcher_model->begin();355 it = launcher_model->begin();
356 std::advance(it, i);356 std::advance(it, i);
357 icon = dynamic_cast<AbstractLauncherIcon*>(*it);357 icon = *it;
358358
359 selected_icon = launcher->GetSelectedMenuIcon();359 selected_icon = launcher->GetSelectedMenuIcon();
360360
@@ -372,7 +372,7 @@
372372
373373
374static void374static void
375on_icon_added_cb(AbstractLauncherIcon* icon,375on_icon_added_cb(AbstractLauncherIcon::Ptr icon,
376 UnityLauncherAccessible* self)376 UnityLauncherAccessible* self)
377{377{
378 AtkObject* icon_accessible = NULL;378 AtkObject* icon_accessible = NULL;
@@ -385,7 +385,7 @@
385 if (nux_object == NULL) /* state is defunct */385 if (nux_object == NULL) /* state is defunct */
386 return;386 return;
387387
388 icon_accessible = unity_a11y_get_accessible(icon);388 icon_accessible = unity_a11y_get_accessible(icon.GetPointer());
389389
390 update_children_index(self);390 update_children_index(self);
391391
@@ -396,7 +396,7 @@
396}396}
397397
398static void398static void
399on_icon_removed_cb(AbstractLauncherIcon* icon,399on_icon_removed_cb(AbstractLauncherIcon::Ptr icon,
400 UnityLauncherAccessible* self)400 UnityLauncherAccessible* self)
401{401{
402 AtkObject* icon_accessible = NULL;402 AtkObject* icon_accessible = NULL;
@@ -409,7 +409,7 @@
409 if (nux_object == NULL) /* state is defunct */409 if (nux_object == NULL) /* state is defunct */
410 return;410 return;
411411
412 icon_accessible = unity_a11y_get_accessible(icon);412 icon_accessible = unity_a11y_get_accessible(icon.GetPointer());
413413
414 index = atk_object_get_index_in_parent(icon_accessible);414 index = atk_object_get_index_in_parent(icon_accessible);
415415
@@ -442,7 +442,7 @@
442442
443 for (it = launcher_model->begin(); it != launcher_model->end(); it++)443 for (it = launcher_model->begin(); it != launcher_model->end(); it++)
444 {444 {
445 child = dynamic_cast<nux::Object*>(*it);445 child = dynamic_cast<nux::Object*>((*it).GetPointer());
446 child_accessible = unity_a11y_get_accessible(child);446 child_accessible = unity_a11y_get_accessible(child);
447447
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),
449449
=== modified file 'plugins/unityshell/src/unity-switcher-accessible.cpp'
--- plugins/unityshell/src/unity-switcher-accessible.cpp 2012-02-04 05:28:23 +0000
+++ plugins/unityshell/src/unity-switcher-accessible.cpp 2012-02-12 19:58:19 +0000
@@ -64,7 +64,7 @@
64static gboolean unity_switcher_accessible_check_pending_notification(NuxAreaAccessible* self);64static gboolean unity_switcher_accessible_check_pending_notification(NuxAreaAccessible* self);
6565
66/* private */66/* private */
67static void on_selection_changed_cb(AbstractLauncherIcon* icon,67static void on_selection_changed_cb(AbstractLauncherIcon::Ptr icon,
68 UnitySwitcherAccessible* switcher_accessible);68 UnitySwitcherAccessible* switcher_accessible);
69static void create_children(UnitySwitcherAccessible* self);69static void create_children(UnitySwitcherAccessible* self);
7070
@@ -311,7 +311,7 @@
311{311{
312 SwitcherView* switcher = NULL;312 SwitcherView* switcher = NULL;
313 SwitcherModel::Ptr switcher_model;313 SwitcherModel::Ptr switcher_model;
314 AbstractLauncherIcon* selected_icon = NULL;314 AbstractLauncherIcon::Ptr selected_icon;
315 nux::Object* nux_object = NULL;315 nux::Object* nux_object = NULL;
316316
317 g_return_val_if_fail(UNITY_IS_SWITCHER_ACCESSIBLE(selection), 0);317 g_return_val_if_fail(UNITY_IS_SWITCHER_ACCESSIBLE(selection), 0);
@@ -325,7 +325,7 @@
325325
326 selected_icon = switcher_model->Selection();326 selected_icon = switcher_model->Selection();
327327
328 if (selected_icon == 0)328 if (!selected_icon)
329 return 0;329 return 0;
330 else330 else
331 return 1;331 return 1;
@@ -377,7 +377,7 @@
377377
378/* private */378/* private */
379static void379static void
380on_selection_changed_cb(AbstractLauncherIcon* icon,380on_selection_changed_cb(AbstractLauncherIcon::Ptr icon,
381 UnitySwitcherAccessible* switcher_accessible)381 UnitySwitcherAccessible* switcher_accessible)
382{382{
383 g_signal_emit_by_name(ATK_OBJECT(switcher_accessible), "selection-changed");383 g_signal_emit_by_name(ATK_OBJECT(switcher_accessible), "selection-changed");
@@ -391,7 +391,7 @@
391 SwitcherView* switcher = NULL;391 SwitcherView* switcher = NULL;
392 SwitcherModel::Ptr switcher_model;392 SwitcherModel::Ptr switcher_model;
393 SwitcherModel::iterator it;393 SwitcherModel::iterator it;
394 AbstractLauncherIcon* child = NULL;394 AbstractLauncherIcon::Ptr child;
395 AtkObject* child_accessible = NULL;395 AtkObject* child_accessible = NULL;
396396
397 nux_object = nux_object_accessible_get_object(NUX_OBJECT_ACCESSIBLE(self));397 nux_object = nux_object_accessible_get_object(NUX_OBJECT_ACCESSIBLE(self));
@@ -406,8 +406,8 @@
406406
407 for (it = switcher_model->begin(); it != switcher_model->end(); it++)407 for (it = switcher_model->begin(); it != switcher_model->end(); it++)
408 {408 {
409 child = dynamic_cast<AbstractLauncherIcon*>(*it);409 child = *it;
410 child_accessible = unity_launcher_icon_accessible_new(child);410 child_accessible = unity_launcher_icon_accessible_new(child.GetPointer());
411 atk_object_set_parent(child_accessible, ATK_OBJECT(self));411 atk_object_set_parent(child_accessible, ATK_OBJECT(self));
412 self->priv->children = g_slist_append(self->priv->children,412 self->priv->children = g_slist_append(self->priv->children,
413 child_accessible);413 child_accessible);
414414
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2012-02-12 05:21:59 +0000
+++ plugins/unityshell/src/unityshell.cpp 2012-02-12 19:58:19 +0000
@@ -1595,9 +1595,9 @@
15951595
1596 int show_monitor = (show_mode == switcher::ShowMode::CURRENT_VIEWPORT) ? device : -1;1596 int show_monitor = (show_mode == switcher::ShowMode::CURRENT_VIEWPORT) ? device : -1;
15971597
1598 std::vector<unity::launcher::AbstractLauncherIcon*> results = launcher_controller_->GetAltTabIcons(show_monitor);1598 auto results = launcher_controller_->GetAltTabIcons(show_monitor);
15991599
1600 if (!(results.size() == 1 && results[0]->Type() == AbstractLauncherIcon::IconType::TYPE_BEGIN))1600 if (!(results.size() == 1 && results[0]->GetIconType() == AbstractLauncherIcon::IconType::TYPE_BEGIN))
1601 switcher_controller_->Show(show_mode, switcher::SortMode::FOCUS_ORDER, false, results);1601 switcher_controller_->Show(show_mode, switcher::SortMode::FOCUS_ORDER, false, results);
16021602
1603 return true;1603 return true;
16041604
=== modified file 'tests/CMakeLists.txt'
--- tests/CMakeLists.txt 2012-02-07 13:38:59 +0000
+++ tests/CMakeLists.txt 2012-02-12 19:58:19 +0000
@@ -123,6 +123,7 @@
123 test_grabhandle.cpp123 test_grabhandle.cpp
124 test_unityshell_private.cpp124 test_unityshell_private.cpp
125 ${UNITY_SRC}/AbstractLauncherIcon.h125 ${UNITY_SRC}/AbstractLauncherIcon.h
126 ${UNITY_SRC}/AbstractLauncherIcon.cpp
126 ${UNITY_SRC}/AbstractShortcutHint.h127 ${UNITY_SRC}/AbstractShortcutHint.h
127 ${UNITY_SRC}/Animator.cpp128 ${UNITY_SRC}/Animator.cpp
128 ${UNITY_SRC}/Animator.h129 ${UNITY_SRC}/Animator.h
129130
=== modified file 'tests/test_launcher_model.cpp'
--- tests/test_launcher_model.cpp 2012-01-29 21:50:37 +0000
+++ tests/test_launcher_model.cpp 2012-02-12 19:58:19 +0000
@@ -41,12 +41,12 @@
41 icon_removed = false;41 icon_removed = false;
42 }42 }
4343
44 void OnIconAdded (AbstractLauncherIcon* icon)44 void OnIconAdded (AbstractLauncherIcon::Ptr icon)
45 {45 {
46 icon_added = true;46 icon_added = true;
47 }47 }
4848
49 void OnIconRemoved (AbstractLauncherIcon* icon)49 void OnIconRemoved (AbstractLauncherIcon::Ptr icon)
50 {50 {
51 icon_removed = true;51 icon_removed = true;
52 }52 }
@@ -64,7 +64,7 @@
6464
65TEST(TestLauncherModel, TestAdd)65TEST(TestLauncherModel, TestAdd)
66{66{
67 AbstractLauncherIcon* first = new MockLauncherIcon();67 AbstractLauncherIcon::Ptr first(new MockLauncherIcon());
68 LauncherModel::Ptr model(new LauncherModel());68 LauncherModel::Ptr model(new LauncherModel());
6969
70 EXPECT_EQ(model->Size(), 0);70 EXPECT_EQ(model->Size(), 0);
@@ -74,7 +74,7 @@
7474
75TEST(TestLauncherModel, TestRemove)75TEST(TestLauncherModel, TestRemove)
76{76{
77 AbstractLauncherIcon* first = new MockLauncherIcon();77 AbstractLauncherIcon::Ptr first(new MockLauncherIcon());
78 LauncherModel::Ptr model(new LauncherModel());78 LauncherModel::Ptr model(new LauncherModel());
7979
80 EXPECT_EQ(model->Size(), 0);80 EXPECT_EQ(model->Size(), 0);
@@ -86,7 +86,7 @@
8686
87TEST(TestLauncherModel, TestAddSignal)87TEST(TestLauncherModel, TestAddSignal)
88{88{
89 AbstractLauncherIcon* first = new MockLauncherIcon();89 AbstractLauncherIcon::Ptr first(new MockLauncherIcon());
90 LauncherModel::Ptr model(new LauncherModel());90 LauncherModel::Ptr model(new LauncherModel());
9191
92 EventListener *listener = new EventListener();92 EventListener *listener = new EventListener();
@@ -100,7 +100,7 @@
100100
101TEST(TestLauncherModel, TestRemoveSignal)101TEST(TestLauncherModel, TestRemoveSignal)
102{102{
103 AbstractLauncherIcon* first = new MockLauncherIcon();103 AbstractLauncherIcon::Ptr first(new MockLauncherIcon());
104 LauncherModel::Ptr model(new LauncherModel());104 LauncherModel::Ptr model(new LauncherModel());
105105
106 EventListener *listener = new EventListener();106 EventListener *listener = new EventListener();
@@ -116,10 +116,10 @@
116116
117TEST(TestLauncherModel, TestSort)117TEST(TestLauncherModel, TestSort)
118{118{
119 AbstractLauncherIcon* first = new MockLauncherIcon();119 AbstractLauncherIcon::Ptr first(new MockLauncherIcon());
120 AbstractLauncherIcon* second = new MockLauncherIcon();120 AbstractLauncherIcon::Ptr second(new MockLauncherIcon());
121 AbstractLauncherIcon* third = new MockLauncherIcon();121 AbstractLauncherIcon::Ptr third(new MockLauncherIcon());
122 AbstractLauncherIcon* fourth = new MockLauncherIcon();122 AbstractLauncherIcon::Ptr fourth(new MockLauncherIcon());
123123
124 LauncherModel::Ptr model(new LauncherModel());124 LauncherModel::Ptr model(new LauncherModel());
125125
@@ -149,10 +149,10 @@
149149
150TEST(TestLauncherModel, TestReorderBefore)150TEST(TestLauncherModel, TestReorderBefore)
151{151{
152 AbstractLauncherIcon* first = new MockLauncherIcon();152 AbstractLauncherIcon::Ptr first(new MockLauncherIcon());
153 AbstractLauncherIcon* second = new MockLauncherIcon();153 AbstractLauncherIcon::Ptr second(new MockLauncherIcon());
154 AbstractLauncherIcon* third = new MockLauncherIcon();154 AbstractLauncherIcon::Ptr third(new MockLauncherIcon());
155 AbstractLauncherIcon* fourth = new MockLauncherIcon();155 AbstractLauncherIcon::Ptr fourth(new MockLauncherIcon());
156156
157 LauncherModel::Ptr model(new LauncherModel());157 LauncherModel::Ptr model(new LauncherModel());
158158
@@ -182,10 +182,10 @@
182182
183TEST(TestLauncherModel, TestReorderSmart)183TEST(TestLauncherModel, TestReorderSmart)
184{184{
185 AbstractLauncherIcon* first = new MockLauncherIcon();185 AbstractLauncherIcon::Ptr first(new MockLauncherIcon());
186 AbstractLauncherIcon* second = new MockLauncherIcon();186 AbstractLauncherIcon::Ptr second(new MockLauncherIcon());
187 AbstractLauncherIcon* third = new MockLauncherIcon();187 AbstractLauncherIcon::Ptr third(new MockLauncherIcon());
188 AbstractLauncherIcon* fourth = new MockLauncherIcon();188 AbstractLauncherIcon::Ptr fourth(new MockLauncherIcon());
189189
190 LauncherModel::Ptr model(new LauncherModel());190 LauncherModel::Ptr model(new LauncherModel());
191191