diff --git a/src/gui/toolbarMenubar/AbstractItem.cpp b/src/gui/toolbarMenubar/AbstractItem.cpp
index 769cb497..d55a22fb 100644
--- a/src/gui/toolbarMenubar/AbstractItem.cpp
+++ b/src/gui/toolbarMenubar/AbstractItem.cpp
@@ -10,6 +10,7 @@ AbstractItem::AbstractItem(string id, ActionHandler* handler, ActionType action,
this->menuSignalHandler = 0;
this->group = GROUP_NOGROUP;
this->enabled = true;
+ this->itemActive = false;
ActionEnabledListener::registerListener(handler);
ActionSelectionListener::registerListener(handler);
@@ -51,12 +52,13 @@ void AbstractItem::actionSelected(ActionGroup group, ActionType action)
return;
}
+ itemActive = this->action == action;
+
if (this->menuitem && GTK_IS_CHECK_MENU_ITEM(this->menuitem))
{
- bool selected = this->action == action;
- if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(this->menuitem)) != selected)
+ if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(this->menuitem)) != itemActive)
{
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(this->menuitem), selected);
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(this->menuitem), itemActive);
}
}
selected(group, action);
@@ -98,10 +100,27 @@ void AbstractItem::activated(GdkEvent* event, GtkMenuItem* menuitem, GtkToolButt
if (GTK_IS_CHECK_MENU_ITEM(menuitem))
{
selected = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem));
- if (!selected && gtk_check_menu_item_get_draw_as_radio(GTK_CHECK_MENU_ITEM(menuitem)))
+
+ if (gtk_check_menu_item_get_draw_as_radio(GTK_CHECK_MENU_ITEM(menuitem)))
{
- // Unselect radio menu item
- return;
+ if (itemActive && !selected)
+ {
+ // Unselect radio menu item, select again
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(this->menuitem), true);
+ return;
+ }
+
+ if (itemActive == selected)
+ {
+ // State not changed, this event is probably from GTK generated
+ return;
+ }
+
+ if (!selected)
+ {
+ // Unselect radio menu item
+ return;
+ }
}
}
}
diff --git a/src/gui/toolbarMenubar/AbstractItem.h b/src/gui/toolbarMenubar/AbstractItem.h
index 186cf8a6..f0add8bf 100644
--- a/src/gui/toolbarMenubar/AbstractItem.h
+++ b/src/gui/toolbarMenubar/AbstractItem.h
@@ -60,4 +60,9 @@ protected:
private:
gulong menuSignalHandler;
GtkWidget* menuitem;
+
+ /**
+ * Keep the state for toggle / radio menu handling
+ */
+ bool itemActive;
};
diff --git a/ui/main.glade b/ui/main.glade
index 5650d939..0f88cd0a 100644
--- a/ui/main.glade
+++ b/ui/main.glade
@@ -87,8 +87,8 @@
False
True
True
-
+
@@ -112,8 +112,8 @@
False
Export as...
True
-
+
@@ -354,8 +354,8 @@
False
True
True
-
+
@@ -365,8 +365,8 @@
False
True
True
-
+
@@ -858,7 +858,7 @@
-
-
-
-
-
@@ -927,7 +923,7 @@
True
False
-
-
-
-
-
@@ -990,7 +982,7 @@
True
False
-
-
-
@@ -1025,7 +1015,7 @@
-
+
True
False
_standard
@@ -1034,23 +1024,21 @@
-
-
@@ -1068,7 +1056,7 @@
True
False
-
-
-