Commit Graph

29955 Commits

Author SHA1 Message Date
Matthias Clasen
0baa663182 GtkApplicationWindow: Always install accelerators
We want accelerators to work, even if the menus are not shown
locally, so we can't rely on the GtkMenu code to set them up
for us. Currently, this code only installs accelerators when the
window is realized.
2011-12-19 12:51:11 -05:00
Matthias Clasen
073a924481 Bloatpad: Add an accelerator in the menu 2011-12-19 12:51:11 -05:00
Matthias Clasen
f7244431a9 GtkApplication: Extract accelerators from menus
This allows to specify accelerators in a convenient way, by
adding accel="..." attributes to the menu items in the
XML for the menu.

Currently, the accelerators are extracted only once, when the
menu property is changed on the application.
2011-12-19 12:51:11 -05:00
Matthias Clasen
2398d7e900 Introduce gtkaccelmapprivate.h
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.
2011-12-19 12:51:11 -05:00
Matthias Clasen
f05cfd55f0 Bloatpad: Add an accelerator 2011-12-19 12:51:11 -05:00
Matthias Clasen
153cc818db GtkApplication: Add API to install accelerators for actions 2011-12-19 12:51:11 -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
9d62d24d65 GtkApplicationWindow: Add a GtkAccelGroup
This will be used in the following patches.
2011-12-19 12:51:11 -05:00
Matthias Clasen
d5d896f812 Fix a gtk-doc warning 2011-12-19 12:51:11 -05:00
Ryan Lortie
90fcf994d5 GtkApplication: export windows on the bus
And advertise their location on the bus using X11 properties.
2011-12-19 12:51:11 -05:00
Ryan Lortie
03db3e1ca1 (trivially) implement 'shutdown' in GtkApplication 2011-12-19 12:51:11 -05:00
Matthias Clasen
aa1faa7c70 Add an example 2011-12-19 12:51:10 -05:00
Matthias Clasen
898bc98d3b Update GtkApplicationWindow docs 2011-12-19 12:51:10 -05:00
Matthias Clasen
3205a40b84 Whitespace fix 2011-12-19 12:51:10 -05:00
Matthias Clasen
f119c834c1 Make accelmap initialization more forgiving 2011-12-19 12:51:10 -05:00
Matthias Clasen
7ef340fb87 Clean up includes 2011-12-19 12:51:10 -05:00
Ryan Lortie
43bf430f21 bloatpad: add proper sections to the menus 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
Ryan Lortie
afb0c098cb Watch "shell shows menu" settings for changes
Correctly monitor the GtkSettings for changes to the
"gtk-shell-shows-app-menu" and "gtk-shell-shows-menubar" properties.
2011-12-19 12:51:10 -05:00
Ryan Lortie
88f16b13f3 GtkSettings: quartz: shell always shows menus 2011-12-19 12:51:10 -05:00
Matthias Clasen
f7ce4d7740 Whitespace fixes 2011-12-19 12:51:10 -05:00
Matthias Clasen
b7de477611 Never add separators to menubars 2011-12-19 12:51:10 -05:00
Ryan Lortie
2f78238872 gmenu testcase: update to glib API changes 2011-12-19 12:51:10 -05:00
Ryan Lortie
2ce6a27fa3 bloatpad: move action/menu setup to ::startup
No need to waste time doing this in init() if we are not going to become
the primary instance.
2011-12-19 12:51:10 -05:00
Ryan Lortie
59092e1c00 bloatpad: port to GActionMap for application
g_application_set_action_group() is now deprecated.
2011-12-19 12:51:10 -05:00
Ryan Lortie
2e64177e3f GtkModelMenuItem: don't leak a GVariant 2011-12-19 12:51:10 -05:00
Ryan Lortie
9cc98f9d9b bloatpad: use GtkBuilder for constructing menus
This is closer to what a real application would want to do.
2011-12-19 12:51:10 -05:00
Ryan Lortie
f83530ae3a GtkModelMenuItem: omit indicator if not required
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.
2011-12-19 12:51:10 -05:00
Ryan Lortie
de53b5226d GtkApplicationWindow: nuke some g_print spew 2011-12-19 12:51:10 -05:00
Ryan Lortie
f0c2ff39fc GtkApplcationWindow: plug two obvious leaks 2011-12-19 12:51:10 -05:00
Colin Walters
c7e7237559 GtkApplicationWindow: Consistently unparent menubar
We create it floating, and don't hold an extra ref, so we should
just unparent it.
2011-12-19 12:51:10 -05:00
Ryan Lortie
c299963428 GtkApplicationWindow: clean up menubar logic 2011-12-19 12:51:10 -05:00
Matthias Clasen
e7b6fa4449 Only add a separator when a section ends 2011-12-19 12:51:10 -05:00
Ryan Lortie
612e24dfc6 introduce GtkModelMenuItem
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.
2011-12-19 12:51:09 -05:00
Ryan Lortie
ecfdb834c9 GtkSettings: add shell-shows-menubar property
Unity will set this to tell us that it is going to handle displaying the
menubar.
2011-12-19 12:51:09 -05:00
Matthias Clasen
45e9d09eab Only add separators when a section actually ends 2011-12-19 12:51:09 -05:00
Matthias Clasen
064999cb2a Bloatpad: Add a View menu for fullscreen 2011-12-19 12:51:09 -05:00
Matthias Clasen
396876969a Bloatpad: Don't leak a menu model 2011-12-19 12:51:09 -05:00
Colin Walters
7ad83b6827 bloatpad: Be 640x480 by default
Because otherwise we're just a few pixels, and this is the least lame
solution I know of in GTK+.
2011-12-19 12:51:09 -05:00
Colin Walters
2c6b7eff17 GtkApplicationWindow: Further sanitize handling of merging app menu and menubar
The _set_show_app_menu should really be _set_show_menubar().

Also, correctly display just the window menu in the window when run
under GNOME 3.
2011-12-19 12:51:09 -05:00
Colin Walters
b041d33465 bloatpad: Fix Edit to be a submenu 2011-12-19 12:51:09 -05:00
Colin Walters
65a2962733 GtkApplication: Merge app menu and menubar
Change bloatpad to have both an app menu and a menubar.
2011-12-19 12:51:09 -05:00
Matthias Clasen
aae52d4580 GtkApplicationWindow: Make mnemonics work for stateful actions 2011-12-19 12:51:09 -05:00
Matthias Clasen
dd360d725c Bloatpad: Add mnemonics to the menu 2011-12-19 12:51:09 -05:00
Colin Walters
3a088d9ac2 GtkApplicationWindow: Don't unref a NULL object 2011-12-19 12:51:09 -05:00
Ryan Lortie
b42308f8e3 Adapt to changes in GLib API
g_application_get_menu() -> get_app_menu().
2011-12-19 12:51:09 -05:00
Matthias Clasen
33aaf26dd5 Drop GtkApplicationMenuButton for now
This feels premature; we do have the fallback situation covered
adaequately with the menubar, and people can do their own creative
solutions with gtk_application_window_get_menu(), so we don't have
to offer a widget for this right now.
2011-12-19 12:51:09 -05:00
Matthias Clasen
acbda82199 Remove a redundant test 2011-12-19 12:51:09 -05:00
Matthias Clasen
b893247eeb GtkApplicationMenuButton: add docs 2011-12-19 12:51:09 -05:00
Matthias Clasen
bd30a1c556 Undoccommentify action muxer files 2011-12-19 12:51:09 -05:00