Commit Graph

49 Commits

Author SHA1 Message Date
Matthias Clasen
4c1a45f9ab Add some menu markup documentation 2012-01-25 20:59:22 -05:00
Matthias Clasen
1e869311c1 GtkApplicationWindow: Some more docs 2012-01-24 22:51:05 -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
Ryan Lortie
880daf8bb2 GtkApplication: change the accel prefix we use
GtkApplication adds to the global accel map using the prefix <Actions>
which is also used by GtkAction.  This causes GtkApplicationWindow to
try to parse GtkAction-added accels as if they were its own (which
fails).

Switch to a different namespace -- <GAction>/.

https://bugzilla.gnome.org/show_bug.cgi?id=668367
2012-01-23 11:17:07 -05:00
Matthias Clasen
835e37f08f GtkApplicationWindow: Improve app menu label
When we are showing the app menu in process, use the application
name, if it has been set. Otherwise, we still fall back to
"Application".
2012-01-20 20:06:25 -05:00
Matthias Clasen
681871dd9e GtkApplicationWindow: Fix resize grip positioning
Based on a patch by Carlos Garcia Campos, bug 668248
2012-01-20 01:01:08 -05:00
Ryan Lortie
60317cbf1a move menus over from GLib
App menu and menubar are now properties of GtkApplication and their bus
location is exported using X window properties.

https://bugzilla.gnome.org/show_bug.cgi?id=668118
2012-01-18 13:40:05 -05:00
Matthias Clasen
9ef2fdf956 GtkApplicationWindow: another size allocation fix
Set the window allocation before giving allocations to children,
in case the children want to refer to the window allocation.
2012-01-14 20:35:19 -05:00
Matthias Clasen
eced73c441 GtkApplicationWindow: Fix size-request logic
When finding the width for a given height, we can pass the full
height to both the menubar and the content. Instead, give the
menubar its minimum height, and give the rest to the content.
2012-01-14 13:26:09 -05:00
Matthias Clasen
7234a2617e GtkApplicationWindow: Fix size-allocation logic
The code was not properly removing the menubar height from the
height given to the content, causing the statusbar to drop off
the bottom of the window in some examples.
2012-01-14 13:24:39 -05:00
Ryan Lortie
ab91527032 Rename gtk_application_window_get_observer
This should have been called _create_observer

https://bugzilla.gnome.org/show_bug.cgi?id=667394

Fixup switch
2012-01-11 00:26:47 -05:00
Matthias Clasen
9cb4518a24 Fix wrong refencences in the docs
Replace all references to g_application_set_app_menu and
g_application_set_menubar by their gtk variants, which
actually exist. Pointed out in bug 667546
2012-01-09 17:30:09 -05:00
Ryan Lortie
88ec007b98 Add new GtkActionable interface
This is the interface for GtkWidgets that can be associated with an
action on a GtkAppicationWindow or associated GtkApplication.

It essentially features 'action-name' and 'action-target' properties
with some associated convenience API.

This interface is implemented by GtkButton and GtkToolButton.

https://bugzilla.gnome.org/show_bug.cgi?id=667394
2012-01-09 15:02:06 +01:00
Matthias Clasen
b5577781d1 GtkApplicationWindow: fix a typo
And add a link to the screenshots.
2011-12-20 14:10:39 -05:00
Ryan Lortie
8578fefaa5 GtkApplication: add menu API
We add the app-menu and menubar public APIs to GtkApplication while
leaving the implementation in GApplication.

The actual implementation will be moved soon.
2011-12-19 12:51:12 -05:00
Ryan Lortie
06c8921975 GtkApplication: document relationship to gdkthreads 2011-12-19 12:51:12 -05:00
Ryan Lortie
6a246a85f2 GtkApplicationWindow: deal with remote actions
Deal with remote action invocations correctly by implementing
GRemoteActionGroup in the same way that GApplication does and pushing
remote activations through the before/after_emit functions of the
GApplication associated with the window.

This is the last part of getting the threading situation right.

https://bugzilla.gnome.org/show_bug.cgi?id=665737
2011-12-19 12:51:12 -05:00
Ryan Lortie
76d671d6a2 Move X property handling to GtkApplicationWindow
Don't try to deal with this using a qdata and signal connections in
GtkApplication.
2011-12-19 12:51:12 -05:00
Ryan Lortie
21f4562d10 GtkApplicationWindow: share one GActionMuxer
Use the same GActionMuxer for menubars and accels instead of recreating
a new one each time.
2011-12-19 12:51:11 -05:00
Matthias Clasen
f485dd3f08 Documentation additions 2011-12-19 12:51:11 -05:00
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
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
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
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
Matthias Clasen
b7de477611 Never add separators to menubars 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
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
Matthias Clasen
45e9d09eab Only add separators when a section actually ends 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
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
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
0683f086bb Whitespace fixes 2011-12-19 12:51:09 -05:00
Matthias Clasen
f10f3bc7e4 GtkApplicationWindow: more docs 2011-12-19 12:51:09 -05:00
Matthias Clasen
65f5a65336 GtkApplicationWindow: mark a string for translation 2011-12-19 12:51:08 -05:00
Matthias Clasen
792c719478 Some coding style fixes 2011-12-19 12:51:08 -05:00
Matthias Clasen
a6794133aa Some initial docs 2011-12-19 12:51:08 -05:00
Colin Walters
1eee7fb103 GtkApplicationWindow: Use dispose for GObjects
This ensures we break cyclic references.
2011-12-19 12:51:08 -05:00
Colin Walters
9e9e1a9fbf gtkapplicationwindow: Pick up gtk-shell-shows-app-menu XSetting
Calling gtk_application_window_set_show_app_menu() is now an override
for that setting.  If you don't call it, we pick up the default.
2011-12-19 12:51:08 -05:00
Ryan Lortie
1a97f4b9ef GtkApplicationWindow: wire up action activations
Wire the 'activate_action' and 'change_action_state' vfuncs through to
the GSimpleActionGroup.
2011-12-19 12:51:08 -05:00
Ryan Lortie
7e34342899 GtkApplicationWindow: implement GActionMap 2011-12-19 12:51:08 -05:00
Ryan Lortie
a93b9dd1cb add GtkApplicationWindow
This is a GtkWindow subclass that "application windows" will use.  Each
is associated with a GtkApplication, has the ability to show menus and
will have its own associated set of actions.
2011-12-19 12:51:08 -05:00