Commit Graph

64 Commits

Author SHA1 Message Date
Matthias Clasen
32001ec638 menu button: Convert to g_object_notify_by_pspec
This avoids pspec lookup overhead in g_object_notify.
2015-09-06 17:13:50 -04:00
Carlos Garnacho
65f7fb04ad GtkMenuButton: explicitly protect against recursion
The visibility toggling happening on ::click() relied implicitly
on the popover animation, but breaks on disabled animations. The
recursion happening within gtk_toggle_button_set_active() (which
triggers ::clicked when changing state) makes this vfunc to run
again, inverting the visibility of the popover in result.

Fix this by explicitly checking about recursion, we want the
button to be toggled to the right state, but we don't want the
callback running again.

https://bugzilla.gnome.org/show_bug.cgi?id=752577
2015-07-30 22:37:53 -04:00
Matthias Clasen
e367c4baa0 Deal with events from wrong display
GtkInspector is opening a separate display connection, which makes
it more likely that gtk_get_current_event() returns an event from
the "wrong" display.
2015-06-15 19:50:02 -04:00
Matthias Clasen
002699402d GtkMenuButton: Make programmatic toggling work again
This was broken in 0796d7b6ff.

https://bugzilla.gnome.org/show_bug.cgi?id=751018
2015-06-15 19:49:49 -04:00
Matthias Clasen
f99375f91e GtkMenuButton: Avoid direct button access
We were getting ourselves in trouble by casting touch events
to GdkEventButton and poking directly at their internals. Instead,
use GdkEvent API to get what we need.

This fixes a crash when using the gear menu in epiphany with
touch. The same crash also occurred in testmenubutton.
2015-06-15 18:54:13 -04:00
Matthias Clasen
03417cf864 menu button: Minor cleanup
Preserve the symmetry in set_align_widget_pointer.
2015-03-22 11:44:37 -04:00
Matthias Clasen
fec8a1ee7f menu button: Improve accessibility
Rework the way we assign an accessible name to menu buttons,
to make sure we pick up a label, should the button contain
one, and only override the name with "Menu" as a fallback.
2015-03-13 18:38:18 -04:00
Carlos Garnacho
0796d7b6ff gtkmenubutton: Popup menu/popover on GtkButton:clicked
This happens on button release, which is more convenient if the gesture
can be consumed by something else (eg. window dragging), and already behaves
correctly wrt cancelled gestures, broken grabs, etc.

This also allows us to unify pointer and keyboard behavior, popping up the
menu widget in a single place.
2015-03-02 12:01:07 +01:00
Carlos Garnacho
fa48b42ef1 menubutton: Fix possible button/popover state inconsistences
While a popover is hiding, the modal grab is already gone and the toggle
button is clickable again, but clicking again at that time will result in
gtk_widget_show() trying to show an already shown widget (although fading
out and hidden soon) and the toggle button activated.

So let the menubutton set the active status only if the menu/popover
widget wasn't already shown, and ensure this doesn't get triggered by
double/triple button press events.
2015-02-20 14:44:17 +01:00
Matthias Clasen
fe82dc5fb2 GtkMenuButton: Don't leak popovers
Detach the previous popover from the toplevel when a new one
is set. This should fix

https://bugzilla.gnome.org/show_bug.cgi?id=741652
2014-12-17 22:56:30 -05:00
Timm Bäder
6e7bf9ca7a menubutton: Fix double freeze_notify 2014-12-16 19:05:23 +01:00
Matthias Clasen
41b53ca603 GtkMenuButton: Submit to action
As an actionable (inherited from GtkButton), a GtkMenuButton
should not set its own sensitivity when it has an action-name
set, but just follow the enabled state of the associated
action.

https://bugzilla.gnome.org/show_bug.cgi?id=738083
2014-10-09 18:12:25 -04:00
Paolo Borelli
d94379183a menubutton: dismiss menu/popover when toggling programmatically
https://bugzilla.gnome.org/show_bug.cgi?id=735545
2014-08-28 21:16:19 +02:00
Paolo Borelli
167f200a0c GtkMenuButton: do not mention GtkArrow in the docs
GtkArrow is deprecated and is not used internally anymore by the
menu button. Document also the fact that if no direction is specified
then the view-context-menu icon is shown.

https://bugzilla.gnome.org/show_bug.cgi?id=733441
2014-07-21 15:26:09 +02:00
Paolo Borelli
8b6bf3a5ea GtkMenuButton: do not use gpointer for the arrow widget
Just a small cleanup, we can use a proper type.
2014-07-21 15:26:09 +02:00
Matthias Clasen
0abb2f57fd Update more places for the changed icon name 2014-07-09 08:03:57 -04:00
Matthias Clasen
89ada16998 GtkMenuButton: Use view-context-menu-symbolic when direction is NONE
This makes it easier to construct gear menus: just set the direction
to 'none', no need to manually construct an image.
2014-07-08 09:30:16 -04:00
Matthias Clasen
cfbfeb1b3c GtkMenuButton: Use G_PARAM_EXPLICIT_NOTIFY 2014-06-09 13:31:06 -04:00
Matthias Clasen
69314ce9e5 Drop GtkArrow use in GtkMenuButton
This is in preparation for GtkArrow getting deprecated.
https://bugzilla.gnome.org/show_bug.cgi?id=729564
2014-05-13 23:50:12 -04:00
Matthias Clasen
a5d2778737 Actually set the default for GtkMenuButton::use-popover
The previous commit changed the property declaration, but
omitted the actual change of the default.
2014-04-26 14:40:52 -04:00
Matthias Clasen
fab2173b31 GtkMenuButton: use popovers by default
When constructing from a menu model, use popovers by default.
This change has the potential to cause some size problems for
applications with big gear menus, so we're doing it early in
the cycle to uncover and fix those.
2014-04-24 23:35:18 -04:00
Matthias Clasen
18749136da menu button: avoid property order dependencies
With the code as written, use-popover has to be set first,
before the model. To avoid this ordering dependency, re-set
the model when use-popover changes.
2014-02-22 12:49:24 -05:00
Matthias Clasen
ca35d1a4c4 menu button: Fix property notification 2014-02-22 12:49:08 -05:00
Matthias Clasen
1de4c698cc GtkModelButton: fix up naming
The convention we follow is that the PROP_foo define should
match the property name. Therefore, change PROP_MODEL to
PROP_MENU_MODEL to match "menu-model".
2014-02-22 12:31:18 -05:00
Matthias Clasen
00e87d2445 Fix GtkMenuToolButton
The addition of popovers to menu buttons broke this, by making
the toolbuttons stay insensitive.

https://bugzilla.gnome.org/show_bug.cgi?id=724799
2014-02-21 21:40:48 -05:00
William Jon McCann
469d333aa2 docs: use Returns: consistently
Instead of Return value:
2014-02-19 18:56:05 -05:00
Paolo Borelli
2f379604d1 Do not call popover_set_relative with NULL
This gives a critical warning since that function expects a
valid widget.

https://bugzilla.gnome.org/show_bug.cgi?id=724407
2014-02-19 00:25:34 -05:00
Matthias Clasen
fefd3bf6cc menu button: Don't set use_popover to TRUE by default
This was changed by accident. The default value is supposed
to be FALSE, for now.
2014-02-10 09:10:22 -05:00
Matthias Clasen
7f6a964c47 Docs: Remove all entities and turn off sgml mode
With all element markup gone, it is time to turn off
sgml mode, and get rid of entities as well.
2014-02-09 17:58:07 -05:00
Matthias Clasen
9822d510a6 GtkMenuButton: Support popovers
Add api to allow explicitly setting a GtkPopover instead of
a GtkMenu as the popup of a GtkMenuButton. Also, add api to
instruct the menu button to construct a popover when given
a menu model.

We set the style class "menu-button" on the button only when
it pops up a menu, to allow different treatment for the active
state of the button in the two cases.

https://bugzilla.gnome.org/show_bug.cgi?id=723878
2014-02-08 20:42:20 -05:00
William Jon McCann
13998c55e7 docs: use proper quotations instead of '*' 2014-02-07 14:22:39 -05:00
William Jon McCann
e34bd4137d docs: use apostrophes in *n't 2014-02-07 13:32:47 -05:00
William Jon McCann
7a208fbbf3 docs: use proper apostrophe
https://wiki.gnome.org/Design/OS/Typography
2014-02-07 13:06:10 -05:00
William Jon McCann
2a45418b67 docs: use proper quotes 2014-02-05 15:08:42 -05:00
William Jon McCann
aeaa35262f docs: use a list instead of a table 2014-02-04 20:00:53 -05:00
William Jon McCann
4b1838bde6 Fix positioning of up menu button popup
Use the menu allocation instead of the request size.

https://bugzilla.gnome.org/show_bug.cgi?id=720939
2014-01-06 12:44:59 -05:00
Matthias Clasen
6a7670efe5 Nicer nicks for GtkMenuButton properties
Requested in
https://bugzilla.gnome.org/show_bug.cgi?id=720945
2014-01-04 23:36:12 -05:00
Matthias Clasen
f200eebfd6 Improve menubutton a11y
The button now claims its menu as a child for a11y purposes,
which makes it possible for ATs to see it when the navigate
the tree top-down.

Update the a11y test to match.
2013-12-20 13:31:08 -05:00
Matthias Clasen
2c007a8691 Set an accessible name on menu buttons
These commonly have just an image in them, so lets at least
call them 'Menu'.
2013-12-20 13:31:08 -05:00
Matthias Clasen
e5317f0f9a Improve struct packing in various places 2013-09-21 23:50:55 -04:00
Matthias Clasen
dc4f555d25 Fix keyboard activation of menu buttons
Keyboard activation relies on the menu not being visible,
so ensure that it isn't when the menu is attached.

Problem tracked down by Vincent Le Garrec,
https://bugzilla.gnome.org/show_bug.cgi?id=688738
2013-08-18 22:22:22 -04:00
Emmanuele Bassi
0899ef7cc9 gtk: Use new macros for defining private data
https://bugzilla.gnome.org/show_bug.cgi?id=702996
2013-07-09 09:30:02 +01:00
Matthias Clasen
fff4c8e841 Documentation fixes
The documentation for GtkMenuButton was still referring to a
"menu" properties in several places, though it has been renamed
to "popup".
2013-01-13 08:27:20 -05:00
Paolo Borelli
1beb9db7b0 gtkmenubutton: remove weak pointer when needed
We must make sure to remove the weak pointer when disposing the widget
or when resetting the align widget otherwise glib will try to nullify
invalid memory.
2012-11-04 17:12:14 +01:00
Paolo Borelli
5830363787 gtkmenubutton: set menu to NULL in dispose.
Prevent menu to be detached multiple times.
2012-11-04 17:12:14 +01:00
Cosimo Cecchi
15fe3038be menubutton: don't refer to the non-existant menu property
7c6454246e removed the property, but
forgot to change the name in a g_object_notify().
2012-10-17 17:05:22 -04:00
Ignacio Casal Quinteiro
7c6454246e GtkMenuButton: remove menu property as it is replaced by popup.
See that it was already announced to be removed before 3.6.0
but we forgot.
2012-10-17 14:07:31 +02:00
Matthias Clasen
4b5db54fa7 Remove gtk_menu_button_[sg]et_menu
These functions were never in a stable release, and have
been renamed to gtk_menu_button_[sg]et_popup.
2012-09-24 00:08:30 -04:00
Matthias Clasen
0b11e08f87 Straigthen includes in gtkmenubutton.[hc]
Don't include gtk.h, but just include whats needed.
2012-09-24 00:01:39 -04:00
Matthias Clasen
d03ceb8b2c GtkMenuButton: improve rtl support
Show the menu at the side the arrow points to,
also in rtl locales.
https://bugzilla.gnome.org/show_bug.cgi?id=684606
2012-09-21 23:53:11 -04:00