summaryrefslogtreecommitdiff
path: root/gtk/gtkmodelmenuitem.c
Commit message (Collapse)AuthorAgeFilesLines
* GtkModelMenuItem: set initial accessible roleMatthias Clasen2014-01-041-0/+2
| | | | | | | The initial state of GtkModelMenuItem is that of a normal menu item, but the accessible we are using, GtkCheckMenuItemAccessible, starts out with a role of 'check menu item'. Fix that up by explicitly setting the initial accessible role.
* GtkModelMenuItem: Add some property notificationMatthias Clasen2014-01-041-0/+1
| | | | | | | GtkModelMenuItem emits no property notification, since none of its properties are readable. But the toggled property is just a proxy for GtkCheckMenuItem::active, so we should ensure that property notification is emitted for the ::active property.
* add GtkMenuTrackerItemRyan Lortie2013-05-131-172/+208
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new class, GtkMenuTrackerItem that represents a menu item, to be used with GtkMenuTracker. GtkMenuTracker's insert callback now works in terms of this new type (instead of passing reference to the model and an index to the item). GtkMenuShell now handles all of the binding tasks internally, mostly through the use of property bindings. Having bindings for the label and visibility attributes, in partiular, will help with supporting upcoming extensions to GMenuModel. GtkModelMenu has been reduced to a helper class that has nothing to do with GMenuModel. It represents something closer to an "ideal" API for GtkMenuItem if we didn't have compatibility concerns (eg: not emitting "activate" when setting toggle state, no separate subclasses per menu item type, supporting icons, etc.) Improvements to GtkMenuItem could eventually shrink the size of this class or remove the need for it entirely. Some GtkActionHelper functionality has been duplicated in GtkMenuTracker, which is suboptimal. The duplication exists so that other codebases (such as Unity and gnome-shell) can reuse the GtkMenuTracker code, whereas GtkActionHelper is very much tied to GtkWidget. Supporting binding arbitrary GtkWidgets to actions vs. supporting the full range of GMenuModel features for menu items turns out to be two overlapping but not entirely similar problems. Some of the duplication (such as roles) can be removed from GtkActionHelper once Gtk's internal Mac OS menubar support is ported to GtkMenuTracker. The intent to reuse the code outside of Gtk is also the reason for the unusual treatment of the enum type introduced in this comment. This adds no new "public" API to the Gtk library, other than types that we cannot make private due to GType limitations.
* GtkModelMenuItem: add support for 'icon' attributeRyan Lortie2013-04-221-11/+49
| | | | | | Add support for icons on a GMenuModel. https://bugzilla.gnome.org/show_bug.cgi?id=688820
* Introduce GtkMenuTrackerRyan Lortie2013-04-011-2/+2
| | | | | | | | | | | | | | | | | GtkMenuTracker folds a nested structure of sections in a GMenuModel into a single linear menu, which it expresses to its user by means of 'insert item at position' and 'remove item at position' callbacks. The logic for where to insert separators and how to handle action namespaces is contained within the tracker, removing the need to have this logic duplicated in the 3 or 4 places that consume GMenuModel. In comparison with the previous code, the tracker no longer completely destroys and rebuilds menus every time a single change occurs. As a result, the new gtkmenu testcase now runs in approximately 3 seconds instead of ~60 before. https://bugzilla.gnome.org/show_bug.cgi?id=696468
* gtkmodelmenu: simplify logic, expose bind APIRyan Lortie2012-09-171-5/+3
| | | | | | | | | | | | | | | Make the main (and only) entry-point to gtkmodelmenu.c the now-public gtk_menu_shell_bind_model(). Move the convenience constructors (gtk_menu_new_from_model() and gtk_menu_bar_new_from_model()) to their proper files. Remove the private header file. Simplify the code a bit by making the initial populate part of the bind() call. https://bugzilla.gnome.org/show_bug.cgi?id=682831
* GtkAccelLabel: add manual accel APIRyan Lortie2012-09-171-7/+26
| | | | | | | | | | | | | | | | | Add an API to GtkAccelLabel for hardcoding the accel key to be displayed (ie: allowing us to bypass the GtkAccelGroup lookup). Use that from the GMenuModel-based GtkMenu construction code instead of passing around the accel group. This makes accel labels work in bloatpad again. This patch effectively removes any hope of automatic runtime accel changes in GMenuModel-based menus without additional application support but it leaves the door open for this to be supported again in the future (if we decide that it's important). https://bugzilla.gnome.org/show_bug.cgi?id=683738
* GtkModelMenuItem: add a submenu action attributeRyan Lortie2012-09-171-0/+45
| | | | | | | | | | | | | | | | | | Add support for a stateful action associated with a submenu. The action state is set to TRUE when the menu is shown and FALSE when it is unshown. This is useful to avoid unnecessary processing for menus that have frequently-changing content. A possible future feature is to add support for asynchronously filling the initial state of the menu by waiting until the action actually emits its state-change signal to TRUE before showing the menu. A silly example has been added to Bloatpad to demonstrate the new feature. https://bugzilla.gnome.org/show_bug.cgi?id=682630
* gtkmodelmenu: add support for action namespacesLars Uebernickel2012-08-201-3/+41
| | | | | | 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.
* gtkmodelmenu: move to new action regimeRyan Lortie2012-08-201-176/+59
| | | | | | | | | 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).
* Change FSF AddressJavier Jardón2012-02-271-3/+1
|
* Add API to create menus from modelsMatthias Clasen2012-01-241-7/+11
| | | | This is needed to bring context menus, etc into the GAction world.
* gtkmodelmenuitem: don't crash on missing actionRyan Lortie2011-12-201-4/+5
|
* Introduce gtkaccelmapprivate.hMatthias Clasen2011-12-191-18/+2
| | | | | | | Move internal accel map API there and update all users. Also, add an internal function to create an accel path for an action and parameter, and use it in gtkapplication.c and gtkmodelmenuitem.c instead of duplicating that code.
* GtkApplicationWindow: Set the accel group on constructed windowsMatthias Clasen2011-12-191-4/+28
| | | | | | This will make the menuitems pick up matching accel map entries automatically. Currently, nothing creates such accel map entries, though.
* Split off GMenuModel -> GtkMenuBar codeRyan Lortie2011-12-191-0/+9
| | | | | | | | | 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.
* GtkModelMenuItem: don't leak a GVariantRyan Lortie2011-12-191-0/+3
|
* GtkModelMenuItem: omit indicator if not requiredRyan Lortie2011-12-191-0/+37
| | | | | | | | GtkModelMenuItem, being based on GtkCheckMenuItem, was always reserving space for a check/radio indicator. This ends up looking pretty strange in a GtkMenuBar. Don't reserve space for the indicator unless it's appropriate.
* introduce GtkModelMenuItemRyan Lortie2011-12-191-0/+247
This GtkMenuItem subclass (and GActionObserver implementation) contains all the knowledge necessary for converting a GMenuModel item description into a GtkMenuItem. Remove much of the code that used to do this from gtkapplicationwindow.c.