Commit Graph

47 Commits

Author SHA1 Message Date
Matthias Clasen
ea44eade21 Add nesting popover menus
Add a variant of popover menus that are nesting
like traditional menus. This is a better fit for
replacing traditional main menus.
2019-09-08 19:02:06 -04:00
Matthias Clasen
f1b9e7c23b Rename a bunch of private headers
We want to follow the convention that all
private headers have names ending in private.h
2019-06-10 03:10:13 +00:00
Matthias Clasen
609f1659bd Rationalize popover menu apis
Make gtk_popover_new_from_model() return a GtkPopoverMenu,
rename it to gtk_popover_menu_new_from_model() and add
a relative_to argument to gtk_popover_menu_new().

Update all callers.
2019-06-09 17:38:54 +00:00
Matthias Clasen
e080f35d25 menu section box: Add style classes for display hints
This makes it easier to realize some of the new
styles for popover menus.
2019-06-09 17:38:53 +00:00
Matthias Clasen
3313322864 menu section box: Introduce more section variants
Allow display-hint to be circular-buttons or
inline-buttons, to produce variations of horizontal
button layouts.
2019-06-09 17:38:53 +00:00
Matthias Clasen
fc3d3fb3af model button: Show shortcuts
Most of the machinery for this is already
in place. We just need to add an accel property
to GtkMenuButton and pass it through.
2019-06-09 17:38:53 +00:00
Matthias Clasen
eda31dff5d model button: Redo layout
Move checks to the left, and introduce a size group
to align things. The size group is provided by the
parent, using the new ::indicator-size-group property.
2019-06-09 17:38:53 +00:00
Matthias Clasen
30f6bea25f model button: Drop centered, inverted properties
These properties were only useful for titles,
and we have a role for that now.
2019-06-09 17:38:53 +00:00
Matthias Clasen
fc6010be37 model button: Add a role for titles
This gets us out of using direct presentational
markup like 'inverted' and 'centered' and will
make it easier to play with different layout.

Use the new role when creating popover
menus from models.
2019-06-09 17:38:53 +00:00
Matthias Clasen
ad9c2a624f stack: Convert child properties to a child meta object
Create a GtkStackPage public object which holds the former
child properties of GtkStack.

Adjust all callers.
2019-02-08 00:09:44 -05:00
Emmanuele Bassi
25fd230327 gtk: Drop the "plus"
Source names should use "[gtk]" without the plus.
2019-02-05 11:26:20 +01:00
Matthias Clasen
f3f5a896de box: Avoid position in the reorder api
Change the reorder api to insert after a sibling,
so that moving to first place becomes reorder (... NULL).

And add a insert_after api that can replace the common
container_add / reorder_after (... NULL) combination.

Update all callers.
2019-01-23 19:30:47 -05:00
Timm Bäder
bd71e744d2 Stop using gtk_box_pack_end
It might soon go away!
2019-01-23 19:30:46 -05:00
Emmanuele Bassi
334acbfc39 Replace gdk_threads_add_idle* with g_idle_add()
The main GDK thread lock is not portable and deprecated.

The only reason why gdk_threads_add_idle() and
gdk_threads_add_idle_full() exist is to allow invoking a callback with
the GDK lock held, in case 3rd party libraries still use the deprecated
gdk_threads_enter()/gdk_threads_leave() API.

Since we're removing the GDK lock, and we're releasing a new major API,
such code cannot exist any more; this means we can use the GLib API for
installing idle callbacks.

https://bugzilla.gnome.org/show_bug.cgi?id=793124
2018-02-03 12:06:58 +01:00
Timm Bäder
c92b7d4224 box: Remove fill child property
GtkWidget:halign and GtkWidget:valign are sufficient
2017-04-25 20:30:37 +02:00
Timm Bäder
5729ea7744 box: Remove expand child property
GtkWidget already has hexpand/vexpand properties.
2017-04-25 20:30:37 +02:00
Timm Bäder
56a58655fe Remove unnecessary gtk_widget_show calls 2017-01-22 14:38:21 +01:00
Timm Bäder
ea897c6df4 Remove gtk_widget_show_all 2017-01-20 21:37:04 +01:00
Timm Bäder
21a43014ed menusectionbox: Remove margins
So the theme can add the spacing on its own.
2016-10-28 16:33:02 +02:00
Timm Bäder
f45dadadd0 box: Remove 'padding' child property 2016-10-16 18:17:21 +02:00
Christian Hergert
133da65433 menusectionbox: add support for "text-direction" attribute
This allows the use of a "text-direction" hint set to one of "none", "rtl",
or "ltr" to enforce the text direction of a "horizontal-buttons"
display-hint.

This is useful when a menu has buttons that map to physical space in the
UI and therefore must match the application widgetry.

https://bugzilla.gnome.org/show_bug.cgi?id=772775
2016-10-13 06:34:50 -04:00
Matthias Clasen
f3f64d17c2 popover menu: Improved labeled separators
Embed the label in the middle of the separators instead of
putting it above the separator.

https://bugzilla.gnome.org/show_bug.cgi?id=767108
2016-06-01 11:52:20 -04:00
Matthias Clasen
73c91c285e Fix formatting
The previous change was not quite using the right coding style.
2016-04-21 23:24:13 -04:00
Jonathan Matthew
22cd8e9d4f gtkmenusectionbox: remove submenus when the parent item is removed
https://bugzilla.gnome.org/show_bug.cgi?id=749405
2016-04-20 17:28:19 -04:00
Timm Bäder
0b96b8a1ee GtkModelButton: Remove some margins
Now that we can use margins from css for this, remove the margins we set
in code and use css instead.
2016-01-07 19:37:18 +01:00
Carlos Garnacho
6de82c9be3 gtkmenusectionbox: plug a leak
The list returned by gtk_container_get_children() wasn't being freed.
2015-06-25 15:09:56 +02:00
Timm Bäder
d3a18de97e gtkpopover: Update the menu's alignment
... when the popover position changes.
2015-05-29 17:37:04 +02:00
Ryan Lortie
6b26664c41 GtkMenuTracker: add hidden-when='macos-menubar'
Provide a mechanism for hiding the "Quit", "About" and "Preferences"
menu items from the normal places in a traditional menubar layout (in
the File and Edit menus) when the menu is being rendered in the Mac OS
menubar.

These items can already be found in the application menu.

With this feature, applications can now define a single menu to use in
all 'traditional' scenarios.

Use this new attribute in Bloatpad.

https://bugzilla.gnome.org/show_bug.cgi?id=741610
2014-12-22 06:22:26 -05:00
Carlos Soriano
235837ad49 gtkwindow: Use actions from focused widget to activate accel
Currently we only take into account the window GActionGroup for
activating the accels.

However, the application could have some custom GActionGroup in the
chain of focused widgets that could want to activate some action if
some accel is activated while that widget is focused.

To allow applications to set accels on widgets that use custom
GActionGroups, simply use the muxer of the focused widget, which
already contains the actions of the parents.

https://bugzilla.gnome.org/show_bug.cgi?id=740682
2014-12-08 20:19:33 -08:00
Timm Bäder
0fac139057 Revert "GtkMenuSectionBox: Add tooltip to iconic buttons"
This reverts commit 7543e7b279.
2014-11-17 18:39:15 +01:00
Timm Bäder
7543e7b279 GtkMenuSectionBox: Add tooltip to iconic buttons 2014-11-17 18:37:47 +01:00
Matthias Clasen
14e394d3d7 GtkModelButton: Rename action-role to role
Rename action-role to role, and make all properties readable.
2014-10-29 06:49:59 -04:00
Matthias Clasen
e776c665b0 GtkModelButton: Drop unused :accel property 2014-10-29 06:49:59 -04:00
Matthias Clasen
ef22be9bb7 Drop GtkModelButton:has-submenu
Replace the has-submenu property with checking menu-name != NULL.
2014-10-29 06:49:59 -04:00
Matthias Clasen
83976c47f8 Make GtkModelButton a better GtkActionable
Rename the "toggled" property to "active", since that is what
GtkActionHelper expects to update for check and radio actions.
Also make the property readable, since GtkActionHelper wants
to read it.
2014-10-29 06:49:58 -04:00
Matthias Clasen
86f66d26fe Drop an unused variable 2014-10-28 00:53:59 -04:00
Matthias Clasen
f1fe70e4ad Indentation fix 2014-10-27 07:19:50 -04:00
Sebastien Lafargue
17f9eed14e popover menus: Take iconic into account
We don't want separators in both side of an iconic section
and use a 10px margin to separate two iconic sections.

Separators are also updated in case of dynamic insertion
( often used with menu items for plugins )

https://bugzilla.gnome.org/show_bug.cgi?id=738650
2014-10-27 07:08:37 -04:00
Matthias Clasen
e41a8cf6fc Use GtkStack:vhomogeneous for popover menus
This allows us to get rid of a size group.
2014-10-26 15:03:58 -04:00
Garrett Regier
907dae414a Ref the popover before activating the item
Otherwise the item could cause the popover to be destroyed,
for example a Quit item, and cause a warning to be printed.
2014-08-23 07:51:59 -07:00
Matthias Clasen
691dd83580 Improve popover menu spacing
Make iconic buttons have a more reasonable height, and add some
space above an iconic row.
https://bugzilla.gnome.org/show_bug.cgi?id=732229
2014-06-28 00:00:16 -04:00
Matthias Clasen
6061f234a9 GtkMenuSectionBox: Don't show separators for nested subsections
...unless they are labeled.

To implement this, keep track of the nesting depth of section boxes,
starting from 0 for the toplevel and the submenu ones, and only
insert unlabeled separators if the depth is at most 1.
2014-04-29 12:19:53 -04:00
Matthias Clasen
f3ba001a1d GtkMenuSectionBox: Always show separators for labeled sections
...unless they are empty.
2014-04-29 12:19:53 -04:00
Matthias Clasen
4f293c427c Add a comment with rules for separators 2014-04-29 12:19:53 -04:00
Matthias Clasen
effc7514e7 GtkMenuSectionBox: don't leak
This wasn't fully fleshed out yet.
2014-04-29 10:18:22 -04:00
Matthias Clasen
28a567f5a9 GtkMenuSectionBox: add support for iconic sections
Sections that have the display-hint attribute set to
"horizontal-boxes" will be rendered as a row of icon
buttons, instead of menuitem-like.
2014-04-28 14:20:26 -04:00
Ryan Lortie
5137e491dc GtkPopover: new approach to menu model binding
Instead of using GtkMenuTracker to flatten the sections into a single
linear menu, handle the sections ourselves by nesting boxes.

Each section gets an inner and outer box.  The inner box numbers its
children in the way that the tracker instructs.  The outer box
containes the inner box and the separator, if appropriate.

Having the two separate boxes will allow us to change the orientation of
the inner box if we want to pack widgets horizontally within a section.
2014-04-28 14:14:42 -04:00