From 34602b0fabd8236297fb5033b43a458fc574ea8f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 26 May 2013 22:09:33 +0000 Subject: Fix port menu to allow disconnecting a single port from everything. git-svn-id: http://svn.drobilla.net/lad/trunk/patchage@5111 a436a847-0d15-0410-975c-d299462d15a1 --- src/PatchagePort.hpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/PatchagePort.hpp b/src/PatchagePort.hpp index 66e7d2b..24617f9 100644 --- a/src/PatchagePort.hpp +++ b/src/PatchagePort.hpp @@ -45,6 +45,8 @@ public: : Port(module, name, is_input, color) , _type(type) { + signal_event().connect( + sigc::mem_fun(this, &PatchagePort::on_event)); } virtual ~PatchagePort() {} @@ -54,17 +56,17 @@ public: return std::string(get_module()->get_label()) + ":" + get_label(); } - bool on_click(GdkEventButton* ev) { - if (ev->button != 3) { - return Ganv::Port::on_click(ev); + bool on_event(GdkEvent* ev) { + if (ev->type != GDK_BUTTON_PRESS || ev->button.button != 3) { + return false; } Gtk::Menu* menu = Gtk::manage(new Gtk::Menu()); menu->items().push_back( Gtk::Menu_Helpers::MenuElem( - "Disconnect All", sigc::mem_fun(this, &Port::disconnect))); + "Disconnect", sigc::mem_fun(this, &Port::disconnect))); - menu->popup(ev->button, ev->time); + menu->popup(ev->button.button, ev->button.time); return true; } -- cgit v1.2.1