Search code examples
buttongtksignalsmenubar

Is it possible for a gtk_menu_item to act like a button and throw a signal for a callback?


I have a gtk_menu_bar and one of the gtk_menu_item must, instead of dropping down a submenu, throw a signal for a callback. Is this possible?
I have tried adding a gtk_event_box, but the menu bar doesn't accept it for it's not a menu item; and connecting a signal to that menu item, but with no success.

Thank you!


Solution

  • I am not quite sure why activate signal is triggering on a double-click (maybe I didn't get that part of the problem right) but as GtkMenuItem is a GtkWidget it is possible to get mouse click events by connecting to button-press-event / button-release-event signals.

    Hope this helps!