Commit Graph

61683 Commits

Author SHA1 Message Date
Matthias Clasen
f0217ad62d modelbutton: Make activatable
This is necessary to make keynav in popover menus
work as expected.
2020-03-24 00:31:38 -04:00
Matthias Clasen
375deefbe1 modelbutton: remove accel poking 2020-03-24 00:31:36 -04:00
Emmanuele Bassi
473db57ed8 Turn GtkShortcutAction into a GObject
Just like we did for GtkShortcutTrigger.

This allows language bindings to properly deal with all the actions.
2020-03-24 00:05:40 -04:00
Emmanuele Bassi
50e5240a11 Turn GtkShortcutTrigger into an object
The lightweight inheritance mechanism used for GtkShortcutTrigger is not
going to be usable by bindings, because boxed types cannot have derived
types.

We could use GTypeInstance and derive everything from that, like
GParamSpec, but in the end shortcuts are not really a performance
critical paths, unlike CSS values or render nodes.
2020-03-24 00:05:40 -04:00
Emmanuele Bassi
42bbd40711 Add definition macro for internal types
GTK defines various types that are meant to be derivable only within GTK
itself, and "final" from the perspective of consumers of the GTK API.
The existing macros defined by GObject, such as G_DECLARE_FINAL_TYPE and
G_DECLARE_DERIVABLE_TYPE, lack this functionality.

While we wait for GObject to get this kind of macro, we should define
our own.
2020-03-24 00:05:40 -04:00
Matthias Clasen
71eccc649d widget: Remove some leftover accel group plumbing
The ::can-activate-accel and ::accel-closures-changed signals
are not used anymore, remove them.
2020-03-24 00:05:40 -04:00
Matthias Clasen
4478c96b8f shortcutcontroller: Only activate shortcuts of visible widgets
Our shortcuts are like mnemonics in this respect - they only
activate when the widget is viewable.
2020-03-24 00:05:40 -04:00
Matthias Clasen
f2754fbdfa Drop GtkKeyHash 2020-03-24 00:05:39 -04:00
Matthias Clasen
14263e2c20 window: Remove GtkKeyHash remnants
It is not used anymore.
2020-03-24 00:05:39 -04:00
Matthias Clasen
5363eb60a4 Drop the keyhash test
GtkKeyHash is going away.
2020-03-24 00:05:39 -04:00
Matthias Clasen
223c985bdd shortcutcontroller: Implement mnemonic cycling
Make GtkShortcutController collect matching shortcuts
in the same way GtkKeyHash did (accept fuzzy matches
if we don't have any exact matches), and cycle among
the matches if we have multiple.
2020-03-24 00:05:39 -04:00
Matthias Clasen
e530e5bf05 Drop the concat model
It is no longer used.
2020-03-24 00:05:39 -04:00
Matthias Clasen
b999cb6226 Drop an unused include 2020-03-24 00:05:39 -04:00
Matthias Clasen
411e9cdf56 shortcuts: Use a flatten list model 2020-03-24 00:05:39 -04:00
Matthias Clasen
6dac48c156 flattenlistmodel: Give access to child models
Add an api to retrieve the model containing a given
item in a flatten listmodel. With this api addition,
the flatten listmodel can replace the concat one.
2020-03-24 00:05:39 -04:00
Matthias Clasen
07e886515f shortcuttrigger: Do elaborate matching for key events
Copy the logic from GtkKeyHash for matching key events
to shortcuts.
2020-03-24 00:05:39 -04:00
Matthias Clasen
35d03a14a2 shortcuttrigger: Introduce partial matches
Allow GtkShortcutTrigger to return partial matches.
Currently, no triggers produce such results, and
GtkShortcutController treats partial matches like
exact ones.
2020-03-24 00:05:39 -04:00
Matthias Clasen
d47fe4fef1 shortcutcontroller: Plug a memory leak
g_list_model_get_item is transfer full :(
2020-03-24 00:05:39 -04:00
Matthias Clasen
101b5139ff Add tests for shortcut actions 2020-03-24 00:05:39 -04:00
Matthias Clasen
f971a61a09 Add a test for shortcut triggers 2020-03-24 00:05:39 -04:00
Matthias Clasen
49379ad7ab Fix the action test
We have a test that enumerates the GtkText actions,
so when a new open appears, the test needs to be updated.
2020-03-24 00:05:39 -04:00
Matthias Clasen
5ac21a2a9e Fix a compiler warning 2020-03-24 00:05:39 -04:00
Matthias Clasen
434cb0817e text view: Fix touch selection
We forgot to allocated that popover.
2020-03-24 00:05:39 -04:00
Matthias Clasen
5f5d5abf0e widget: Drop the ::popup-menu signal
This is now done in widgets which have context
menus.
2020-03-24 00:05:39 -04:00
Matthias Clasen
cf08b132ed placesview: Stop using ::popup-menu
This signal is going away.
2020-03-24 00:05:39 -04:00
Matthias Clasen
253d91b187 filechooser: Stop using ::popup-menu
This signal is going away.
2020-03-24 00:05:39 -04:00
Matthias Clasen
8db75f1150 mountoperation: Stop using ::popup-menu
We can just use a shortcut controller directly.
2020-03-24 00:05:39 -04:00
Matthias Clasen
a2ef8f5379 gtk-demo: Stop emitting ::popup-menu
The signal was not used anyway, in the font explorer demo.
2020-03-24 00:05:39 -04:00
Matthias Clasen
dad7fb6c4c colorchooser: Stop using ::popup-menu
This signal is going away. Use an action instead.
2020-03-24 00:05:39 -04:00
Matthias Clasen
cd78efc246 range: Remove ::popup-menu emission
This signal is going away, and having context menus
on sliders is not really a thing anyway.
2020-03-24 00:05:39 -04:00
Matthias Clasen
67c9d44de5 scrollbar: Remove :popup-menu forwarding
This signal is going away.
2020-03-24 00:05:39 -04:00
Matthias Clasen
8d737d2c72 emojichooser: Stop using ::popup-menu
This signal is going away. Use an action instead.
2020-03-24 00:05:39 -04:00
Matthias Clasen
baab727f51 Use an action for the context menu keybinding
The ::popup-menu signal is going away.
2020-03-24 00:05:39 -04:00
Matthias Clasen
a15b9ae2b2 Print mnemonic triggers clearly 2020-03-24 00:05:39 -04:00
Matthias Clasen
92c5f513a3 inspector: Show shortcuts
At a tab that lists the shortcuts contained in a
GtkShortcutController.
2020-03-24 00:05:39 -04:00
Matthias Clasen
1d559e8be6 Only create a class shortcut controller if we have shortcuts
No point in creating objects that just hold empty lists.
2020-03-24 00:05:39 -04:00
Matthias Clasen
ff78b765fb widget: Name the controllers 2020-03-24 00:05:39 -04:00
Matthias Clasen
0f7a8b533e window: Name the the controllers 2020-03-24 00:05:39 -04:00
Matthias Clasen
00f9295408 shortcutmanager: Name the controllers
This is helpful in the inspector.
2020-03-24 00:05:39 -04:00
Matthias Clasen
7d27b92077 Move shortcut manager initialization code
It is just too ugly to use quarks across multiple
source files, so add a private helper function that
attaches the controllers.
2020-03-24 00:05:39 -04:00
Benjamin Otte
04f70c6038 filechooser: Trigger the location popup via bindings
Simplifies code quite a bit.
2020-03-24 00:05:39 -04:00
Benjamin Otte
41e21e169b accels: Remove GtkAccelGroup 2020-03-24 00:05:39 -04:00
Benjamin Otte
9a35a25140 testmenubutton: Don't create a GtkAccelGroup
It's unused.
2020-03-24 00:05:39 -04:00
Benjamin Otte
e3d99cc6f9 testsuite: Remove GtkAccelGroup usage 2020-03-24 00:05:39 -04:00
Benjamin Otte
9645805e01 widget: Remove gtk_widget_add_accelerator()
People should use shortcut controllers instead (global, capture).

A side effect of this is that GtkAccelLabel now lost its method to
magically look up accelerators to display. Somebody needs to add that
back later.
2020-03-24 00:05:39 -04:00
Benjamin Otte
a1efa03163 doc tools: Create AccelLabel image without using GtkAccelGroup 2020-03-24 00:05:39 -04:00
Emmanuele Bassi
c5d6665d96 testgtk: Port keyval example to shortcut controllers 2020-03-24 00:05:39 -04:00
Benjamin Otte
5a618b8312 shortcutcontroller: Implement GtkBuildable
Use it to allow adding shortcuts to the controller via the usual <child>
method.
2020-03-24 00:05:39 -04:00
Benjamin Otte
7702a1f112 shortcutaction: INtegrate with GtkBuilder property parsing
<property name="action">action(win.quit)</property> style action
specifications now work for GtkShortcutAction properties.
2020-03-24 00:05:39 -04:00
Benjamin Otte
d2eb06dc37 shortcuttrigger: Add gtk_shortcut_triger_new_parse_string()
And hook it up into the GtkBuilder infrastructure.
2020-03-24 00:05:39 -04:00