diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2013-03-21 20:58:52 +0100 |
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2013-03-21 20:58:52 +0100 |
| commit | 7d75b0cec373d58cad273caa06d83eba0edc410d (patch) | |
| tree | ca19d8dae71ddafc8179fc14706ca4bcb17d7459 /launcher | |
| parent | c0a6c5e6ffebbe7cbd0ea4c8110ba82036c6524a (diff) | |
| parent | bcd7a46f0d3608da17bbd9f6c7d7e97aed6f4f1c (diff) | |
Merging with lp:~3v1n0/unity/glib-cancellable-use
(bzr r3212.3.4)
Diffstat (limited to 'launcher')
| -rw-r--r-- | launcher/LauncherIcon.cpp | 10 | ||||
| -rw-r--r-- | launcher/TooltipManager.cpp | 20 | ||||
| -rw-r--r-- | launcher/TrashLauncherIcon.cpp | 6 | ||||
| -rw-r--r-- | launcher/TrashLauncherIcon.h | 4 | ||||
| -rw-r--r-- | launcher/VolumeImp.cpp | 8 |
5 files changed, 23 insertions, 25 deletions
diff --git a/launcher/LauncherIcon.cpp b/launcher/LauncherIcon.cpp index 7efe4b458..b7d12b6c0 100644 --- a/launcher/LauncherIcon.cpp +++ b/launcher/LauncherIcon.cpp @@ -125,10 +125,7 @@ LauncherIcon::LauncherIcon(IconType type) _tooltip->SetOpacity(opacity); if (opacity == 0.0f && _tooltip_fade_animator.GetStartValue() > _tooltip_fade_animator.GetFinishValue()) - { _tooltip->ShowWindow(false); - _tooltip->SetOpacity(0.0f); - } } }); } @@ -692,10 +689,15 @@ void LauncherIcon::HideTooltip() { if (_tooltip) { - if (_tooltip_fade_animator.CurrentState() == nux::animation::Animation::State::Running) + if (_tooltip_fade_animator.CurrentState() == nux::animation::Animation::State::Running && + _tooltip_fade_animator.GetFinishValue() == 1.0) + { _tooltip_fade_animator.Reverse(); + } else + { _tooltip_fade_animator.SetStartValue(1.0f).SetFinishValue(0.0f).Start(); + } } tooltip_visible.emit(nux::ObjectPtr<nux::View>(nullptr)); diff --git a/launcher/TooltipManager.cpp b/launcher/TooltipManager.cpp index dee8a5103..94044b0a4 100644 --- a/launcher/TooltipManager.cpp +++ b/launcher/TooltipManager.cpp @@ -41,19 +41,29 @@ void TooltipManager::MouseMoved(AbstractLauncherIcon::Ptr const& icon_under_mous StopTimer(); if (icon_) icon_->HideTooltip(); - + icon_ = icon_under_mouse; - if (icon_ && !skip_timeout_) + if (!icon_) + return; + + AbstractLauncherIcon::IconType type = icon_->GetIconType(); + if ((type == AbstractLauncherIcon::IconType::HOME || type == AbstractLauncherIcon::IconType::HUD) && + icon_->GetQuirk(AbstractLauncherIcon::Quirk::ACTIVE)) + { + Reset(); + return; + } + + if (!skip_timeout_) ResetTimer(icon_); - else if (icon_ && skip_timeout_) + else if (skip_timeout_) icon_->ShowTooltip(); } void TooltipManager::IconClicked() { - if (icon_) - icon_->HideTooltip(); + Reset(); } void TooltipManager::SetHover(bool hovered) diff --git a/launcher/TrashLauncherIcon.cpp b/launcher/TrashLauncherIcon.cpp index 03adba72b..2d7cb8d8c 100644 --- a/launcher/TrashLauncherIcon.cpp +++ b/launcher/TrashLauncherIcon.cpp @@ -47,7 +47,6 @@ namespace TrashLauncherIcon::TrashLauncherIcon(FileManager::Ptr const& fmo) : SimpleLauncherIcon(IconType::TRASH) , file_manager_(fmo ? fmo : std::make_shared<GnomeFileManager>()) - , cancellable_(g_cancellable_new()) { tooltip_text = _("Trash"); icon_name = "user-trash"; @@ -77,11 +76,6 @@ TrashLauncherIcon::TrashLauncherIcon(FileManager::Ptr const& fmo) UpdateTrashIcon(); } -TrashLauncherIcon::~TrashLauncherIcon() -{ - g_cancellable_cancel(cancellable_); -} - AbstractLauncherIcon::MenuItemsVector TrashLauncherIcon::GetMenus() { MenuItemsVector result; diff --git a/launcher/TrashLauncherIcon.h b/launcher/TrashLauncherIcon.h index b6b5d8e65..7388725a7 100644 --- a/launcher/TrashLauncherIcon.h +++ b/launcher/TrashLauncherIcon.h @@ -35,10 +35,8 @@ namespace launcher class TrashLauncherIcon : public SimpleLauncherIcon { - public: TrashLauncherIcon(FileManager::Ptr const& = nullptr); - ~TrashLauncherIcon(); protected: void UpdateTrashIcon(); @@ -57,7 +55,7 @@ private: bool empty_; FileManager::Ptr file_manager_; - glib::Object<GCancellable> cancellable_; + glib::Cancellable cancellable_; glib::Object<GFileMonitor> trash_monitor_; glib::Signal<void, GFileMonitor*, GFile*, GFile*, GFileMonitorEvent> trash_changed_signal_; glib::Signal<void, DbusmenuMenuitem*, unsigned> empty_activated_signal_; diff --git a/launcher/VolumeImp.cpp b/launcher/VolumeImp.cpp index bba205a49..623049087 100644 --- a/launcher/VolumeImp.cpp +++ b/launcher/VolumeImp.cpp @@ -41,7 +41,6 @@ public: VolumeImp* parent) : parent_(parent) , open_timestamp_(0) - , cancellable_(g_cancellable_new()) , volume_(volume) , file_manager_(file_manager) , device_notification_display_(device_notification_display) @@ -55,11 +54,6 @@ public: }); } - ~Impl() - { - g_cancellable_cancel(cancellable_); - } - bool CanBeEjected() const { return g_volume_can_eject(volume_) != FALSE; @@ -220,7 +214,7 @@ public: VolumeImp* parent_; unsigned long long open_timestamp_; - glib::Object<GCancellable> cancellable_; + glib::Cancellable cancellable_; glib::Object<GVolume> volume_; FileManager::Ptr file_manager_; DeviceNotificationDisplay::Ptr device_notification_display_; |
