From 6d0f287cb098a202ad55e198c4737486b731254f Mon Sep 17 00:00:00 2001 From: Javier Date: Sun, 23 Feb 2014 22:19:48 +0100 Subject: prevent actions being added twice --- module/menuproxy.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'module') diff --git a/module/menuproxy.cc b/module/menuproxy.cc index a59a576..81ba1d7 100644 --- a/module/menuproxy.cc +++ b/module/menuproxy.cc @@ -82,7 +82,12 @@ GtkMenuItem * MenuProxy::addAction(QAction* action, QAction* before, QMenu* pare g_parent = m_target; } - GtkMenuItem *item; + GtkMenuItem *item = getItemForAction(action); + if (item) { + // Action is already on this proxy. + return item; + } + if (action->isSeparator()) { item = GTK_MENU_ITEM(gtk_separator_menu_item_new()); } else if (action->isCheckable()) { @@ -163,6 +168,7 @@ void MenuProxy::removeAction(QAction *action) GtkMenuItem *item = m_items.value(action); if (!item) { + // Action is not on this proxy return; } -- cgit v1.2.3