Commit Graph

10 Commits

Author SHA1 Message Date
Cosimo Cecchi
5dbf3a576a modelmenu: listen for toplevel changes on the attach widget
Right now, when we create a GtkModelMenu for a GMenuModel, we listen to
changes to the menu's attach-widget to detect when a toplevel
GtkApplicationWindow becomes available to fetch actions from it.

This unfortunately breaks this simple code:

  GtkWidget *application_window = gtk_application_window_new();
  GtkWidget *menu_button = gtk_menu_button_new();
  GMenuModel *menu_model = get_menu_model();

  gtk_menu_button_set_menu_model(menu_button, menu_model);
  gtk_container_add(GTK_CONTAINER(application_window), menu_button);

Since GtkMenuButton creates a GtkModelMenu and sets itself as its attach
widget before it's added to a hierarchy containing a
GtkApplicationWindow.

Fix the bug by simply listening for changes in the window hierarchy, and
creating the menu model when the attach widget is added to an
application window.

https://bugzilla.gnome.org/show_bug.cgi?id=679454
2012-07-06 11:14:15 -04:00
Cosimo Cecchi
06c8739de4 modelmenu: set the accel group on the GtkMenu
Or the accelerators added for actions in the menu won't be displayed in
the menu items.

https://bugzilla.gnome.org/show_bug.cgi?id=679166
2012-07-05 10:21:55 -04:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Ryan Lortie
8abc74680d Bring back the GMenu separators
4240bfb74a contained a likely copy/paste
mishap that accidentally disabled all separators for GtkMenus created
from GMenuModels.

Bring them back.
2012-01-31 13:23:34 -05:00
Matthias Clasen
4240bfb74a Add API to create menus from models
This is needed to bring context menus, etc into the GAction world.
2012-01-24 22:25:35 -05:00
Matthias Clasen
1819543e1e GtkModelMenu: Plug a memleak 2012-01-24 21:30:33 -05:00
Ryan Lortie
182fbba2bf GtkModelMenu: drop extra & added by mistake 2011-12-21 17:15:16 -05:00
Matthias Clasen
1c6d0c3e27 GtkApplicationWindow: Set the accel group on constructed windows
This will make the menuitems pick up matching accel map entries
automatically. Currently, nothing creates such accel map entries,
though.
2011-12-19 12:51:11 -05:00
Matthias Clasen
7ef340fb87 Clean up includes 2011-12-19 12:51:10 -05:00
Ryan Lortie
cd7ce867a7 Split off GMenuModel -> GtkMenuBar code
Put this in a separate file and substantially refactor it.

Move handling of submenu creation into gtkmodelmenuitem where it
belongs.

Improve our handling of when to show separators or not.
2011-12-19 12:51:10 -05:00