Commit Graph

13 Commits

Author SHA1 Message Date
Cosimo Cecchi
de3cfa6034 modelmenu: fix a GCC warning
This should not be a const string, since the caller is supposed to free
it.
2012-08-21 11:15:32 +02:00
Lars Uebernickel
710674720e gtkmodelmenu: add support for action namespaces
If a section or submenu item has a "action-namespace" attribute, the
action names of the created GtkModelMenuItems will be prefixed with that
namespace.  Namespaces can be cascaded.
2012-08-20 13:13:50 -04:00
Ryan Lortie
dd45862a06 gtkmodelmenu: move to new action regime
Drop the explicit passing of GActionGroup into the GtkMenu(Bar)
constructors and operate from the action context instead.

With GtkMenuItem implementing GtkActionable, this turns out to be pretty
easy (and most of the code can be removed from GtkModelMenuItem,
including the GActionObserver implementation).
2012-08-20 13:13:49 -04:00
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