diff options
| author | Marco Trevisan (TreviƱo) <mail@3v1n0.net> | 2013-07-02 11:37:46 +0000 |
|---|---|---|
| committer | Tarmac <> | 2013-07-02 11:37:46 +0000 |
| commit | 299badeab76807cde45a7cb8c63779154165e05d (patch) | |
| tree | ffaedee3182eedd7b350567ba3a83e4bf8cdc098 /plugins | |
| parent | f5fb3d07cddb778185e622a2f02548838fb64dee (diff) | |
| parent | 5a2b885a620b86e40fdfb69c664ed1427366d66e (diff) | |
Use connection::Manager to handle the sigc::connection disconnection on parent removal.
Approved by PS Jenkins bot, Brandon Schaefer. (bzr r3400)
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/unityshell/src/GesturalWindowSwitcher.cpp | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/plugins/unityshell/src/GesturalWindowSwitcher.cpp b/plugins/unityshell/src/GesturalWindowSwitcher.cpp index d257eb430..0546792b0 100644 --- a/plugins/unityshell/src/GesturalWindowSwitcher.cpp +++ b/plugins/unityshell/src/GesturalWindowSwitcher.cpp @@ -24,6 +24,7 @@ #include <core/timer.h> #include <Nux/Nux.h> #include <NuxCore/Logger.h> +#include <UnityCore/ConnectionManager.h> #include "SwitcherView.h" #include "unityshell.h" @@ -41,7 +42,6 @@ namespace unity { public: GesturalWindowSwitcherPrivate(); - virtual ~GesturalWindowSwitcherPrivate(); void CloseSwitcherAfterTimeout(int timeout); bool OnCloseSwitcherTimeout(); @@ -91,10 +91,7 @@ namespace unity float accumulated_horizontal_drag; int index_icon_hit; - sigc::connection view_built_connection; - sigc::connection mouse_down_connection; - sigc::connection mouse_up_connection; - sigc::connection mouse_drag_connection; + connection::Manager connections_; }; } @@ -112,16 +109,8 @@ GesturalWindowSwitcherPrivate::GesturalWindowSwitcherPrivate() timer_close_switcher.setCallback( boost::bind(&GesturalWindowSwitcherPrivate::OnCloseSwitcherTimeout, this)); - view_built_connection = switcher_controller->ConnectToViewBuilt( - sigc::mem_fun(this, &GesturalWindowSwitcherPrivate::ConnectToSwitcherViewMouseEvents)); -} - -GesturalWindowSwitcherPrivate::~GesturalWindowSwitcherPrivate() -{ - view_built_connection.disconnect(); - mouse_down_connection.disconnect(); - mouse_up_connection.disconnect(); - mouse_drag_connection.disconnect(); + connections_.Add(switcher_controller->ConnectToViewBuilt( + sigc::mem_fun(this, &GesturalWindowSwitcherPrivate::ConnectToSwitcherViewMouseEvents))); } GestureDeliveryRequest GesturalWindowSwitcherPrivate::GestureEvent(nux::GestureEvent const& event) @@ -419,14 +408,14 @@ void GesturalWindowSwitcherPrivate::ConnectToSwitcherViewMouseEvents() auto switcher_view = switcher_controller->GetView(); g_assert(switcher_view); - mouse_down_connection = switcher_view->mouse_down.connect( - sigc::mem_fun(this, &GesturalWindowSwitcherPrivate::ProcessSwitcherViewMouseDown)); + connections_.Add(switcher_view->mouse_down.connect( + sigc::mem_fun(this, &GesturalWindowSwitcherPrivate::ProcessSwitcherViewMouseDown))); - mouse_up_connection = switcher_view->mouse_up.connect( - sigc::mem_fun(this, &GesturalWindowSwitcherPrivate::ProcessSwitcherViewMouseUp)); + connections_.Add(switcher_view->mouse_up.connect( + sigc::mem_fun(this, &GesturalWindowSwitcherPrivate::ProcessSwitcherViewMouseUp))); - mouse_drag_connection = switcher_view->mouse_drag.connect( - sigc::mem_fun(this, &GesturalWindowSwitcherPrivate::ProcessSwitcherViewMouseDrag)); + connections_.Add(switcher_view->mouse_drag.connect( + sigc::mem_fun(this, &GesturalWindowSwitcherPrivate::ProcessSwitcherViewMouseDrag))); } /////////////////////////////////////////// |
