Commit Graph

61659 Commits

Author SHA1 Message Date
Matthias Clasen
70207a8d6c placesview: Stop using ::popup-menu
This signal is going away.
2020-03-22 11:14:07 -04:00
Matthias Clasen
b72d67901b filechooser: Stop using ::popup-menu
This signal is going away.
2020-03-22 11:14:07 -04:00
Matthias Clasen
7cf45aeb73 mountoperation: Stop using ::popup-menu
We can just use a shortcut controller directly.
2020-03-22 11:14:07 -04:00
Matthias Clasen
78a0919e84 gtk-demo: Stop emitting ::popup-menu
The signal was not used anyway, in the font explorer demo.
2020-03-22 11:14:07 -04:00
Matthias Clasen
a29e6dc7ab colorchooser: Stop using ::popup-menu
This signal is going away. Use an action instead.
2020-03-22 11:14:07 -04:00
Matthias Clasen
9b1fea9619 range: Remove ::popup-menu emission
This signal is going away, and having context menus
on sliders is not really a thing anyway.
2020-03-22 11:14:07 -04:00
Matthias Clasen
370dc83bfa scrollbar: Remove :popup-menu forwarding
This signal is going away.
2020-03-22 11:14:07 -04:00
Matthias Clasen
f4129f9e8d emojichooser: Stop using ::popup-menu
This signal is going away. Use an action instead.
2020-03-22 11:14:07 -04:00
Matthias Clasen
cc55491e09 Use an action for the context menu keybinding
The ::popup-menu signal is going away.
2020-03-22 11:14:07 -04:00
Matthias Clasen
b2a61c6dc6 Print mnemonic triggers clearly 2020-03-22 11:14:07 -04:00
Matthias Clasen
4386b9de75 inspector: Show shortcuts
At a tab that lists the shortcuts contained in a
GtkShortcutController.
2020-03-22 11:14:07 -04:00
Matthias Clasen
c5ef926b7d Only create a class shortcut controller if we have shortcuts
No point in creating objects that just hold empty lists.
2020-03-22 11:14:07 -04:00
Matthias Clasen
e121ef1b96 widget: Name the controllers 2020-03-22 11:14:07 -04:00
Matthias Clasen
dc38bcfd0f window: Name the the controllers 2020-03-22 11:14:07 -04:00
Matthias Clasen
69b24e5ccd shortcutmanager: Name the controllers
This is helpful in the inspector.
2020-03-22 11:14:07 -04:00
Matthias Clasen
601711f4fa 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-22 11:14:07 -04:00
Benjamin Otte
211720d107 filechooser: Trigger the location popup via bindings
Simplifies code quite a bit.
2020-03-22 11:14:07 -04:00
Benjamin Otte
b7fcf6c246 accels: Remove GtkAccelGroup 2020-03-22 11:14:07 -04:00
Benjamin Otte
5ea42f9009 testmenubutton: Don't create a GtkAccelGroup
It's unused.
2020-03-22 11:14:07 -04:00
Benjamin Otte
8f9080b3c5 testsuite: Remove GtkAccelGroup usage 2020-03-22 11:14:07 -04:00
Benjamin Otte
93c8a8a1ec 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-22 11:14:07 -04:00
Benjamin Otte
693c134366 doc tools: Create AccelLabel image without using GtkAccelGroup 2020-03-22 11:14:07 -04:00
Emmanuele Bassi
b9b3639af5 testgtk: Port keyval example to shortcut controllers 2020-03-22 11:14:07 -04:00
Benjamin Otte
c5f34ec919 shortcutcontroller: Implement GtkBuildable
Use it to allow adding shortcuts to the controller via the usual <child>
method.
2020-03-22 11:14:07 -04:00
Benjamin Otte
8233e69e48 shortcutaction: INtegrate with GtkBuilder property parsing
<property name="action">action(win.quit)</property> style action
specifications now work for GtkShortcutAction properties.
2020-03-22 11:14:07 -04:00
Benjamin Otte
927b99bb47 shortcuttrigger: Add gtk_shortcut_triger_new_parse_string()
And hook it up into the GtkBuilder infrastructure.
2020-03-22 11:14:07 -04:00
Benjamin Otte
354c9a0b32 application: Replace accelerator handling with shortcuts
API remains the same, but activation is now done via a
shortcutcontroller.

The code uses a controller with global scope so that the
shortcuts are managed with all the other global shortcuts.
2020-03-22 11:14:07 -04:00
Benjamin Otte
b29dce05b1 accel: Add display arg to gtk_accelerator_parse_with_keycode()
It was using the default display unconditionally.
2020-03-22 11:14:07 -04:00
Benjamin Otte
07173a266d accelerators: Make gtk_accelerator_parse() return TRUE/FALSE
A parse function should return success or not. So do that.
2020-03-22 11:14:07 -04:00
Benjamin Otte
349d90927a shortcuttrigger: Add hash(), equal(), and compare() functions
Those are useful for putting triggers in hash tables or getting sorted
output.
2020-03-22 11:14:07 -04:00
Benjamin Otte
fad0e1c5c5 shortcuts: Mananage managed shortcuts with a custom model
Reduce the amount of special casing by using a list model
for global and managed shortcuts, too.

This way, the ListModel API will work for the ShortcutController in the
GtkShortcutManager and GtkRoot.

The only special case remaining is shortcut activation, which needs to
pass the right widget to the controller in the global/managed case.
2020-03-22 11:14:07 -04:00
Benjamin Otte
59bf971e92 shortcutaction: Add gtk_shortcut_action_to_string()
For all but the callback action, we can print something useful.
2020-03-22 11:14:07 -04:00
Benjamin Otte
b282265005 widget: Keep keybindings as a GListStore
This way, we can use shortcut_controller_new_for_model() and avoid all
the special casing about run_class.
2020-03-22 11:14:07 -04:00
Benjamin Otte
d692cea113 shortcutcontroller: Add gtk_shortcut_controller_new_for_model()
This is mainly for internal use, but I can't see a reason to not have it
public for people who want to maintain their own lists.

I'm sure gnome-builder will never ever find a way to misuse it.
2020-03-22 11:14:07 -04:00
Benjamin Otte
158333241b shortcutcontroller: Implement GListModel
After all, this controller is a list of shortcuts.
2020-03-22 11:14:07 -04:00
Benjamin Otte
17439961fd gtk-demo: Port the sliding puzzle demo to shortcuts 2020-03-22 11:14:07 -04:00
Benjamin Otte
83801768fa shortcut: Change the API for creating shortcuts
When creating shortcuts, there almost always are a trigger and an action
available for use. So make gtk_shortcut_new() take those as arguments.

Also add gtk_shortcut_new_with_arguments() so people can easily pass
those in, too.
2020-03-22 11:14:07 -04:00
Benjamin Otte
2f0e94ccad shortcut: Add GtkShortcutAction
Similar to GtkShortcutTrigger, GtkShortCutAction provides all the
different ways to activate a shortcut.

So far, these different ways are supported:

 - do nothing
 - Call a user-provided callback
 - Call gtk_widget_activate()
 - Call gtk_widget_mnemonic_activate()
 - Emit an action signal
 - Activate an action from the widget's action muxer
 - Activate a GAction
2020-03-22 11:14:07 -04:00
Benjamin Otte
05bf6030fa accelgroup: Remove unneeded APIs
After the removal of GtkAccelMap, these things are no longer necessary.
2020-03-22 11:14:07 -04:00
Emmanuele Bassi
b3e3510705 gtk: Remove GtkAccelMap
Now that accel paths are gone, the object managing them isn't needed
anymore either.
2020-03-22 11:14:07 -04:00
Benjamin Otte
bbbed33adc gtk: Remove accel paths
It's an outdated technology now that everybody is using GActionGroups.

If somebody wanted to support changeable shortcuts, they'd need to
reintroduce it in another way.
2020-03-22 11:14:07 -04:00
Benjamin Otte
e55ab3d762 Remove GtkMnemonicHash
It's not used anymore.
2020-03-22 11:14:07 -04:00
Emmanuele Bassi
c2b10280da window: Remove all old mnemonic handling API 2020-03-22 11:14:07 -04:00
Emmanuele Bassi
06e7bf218c Add GtkShortcutManager
This adds an interface for taking care of shortcut controllers with
managed scope.

Only GtkWindow currently implements this interface, so we need to ensure
that we check if any top-level widget we reach is a shortcuts manager
before we call into it.
2020-03-22 11:14:07 -04:00
Benjamin Otte
45d3acf736 label: Implement mnemonics using shortcuts 2020-03-22 11:14:07 -04:00
Benjamin Otte
4c86fbb96b shortcut: Add gtk_shortcut_set_mnemonic_activate()
Makes the shortcut call gtk_widget_mnemonic_activate() upon activation.
2020-03-22 11:14:07 -04:00
Benjamin Otte
7e5d3253bd shortcuttrigger: Add support for mnemonics
Mnemonics need to be triggered with help from the controllers (who
determine the modifiers). Support for that has been added, too.

Mnemonics do not use this yet though.
2020-03-22 11:14:07 -04:00
Benjamin Otte
8564f1cb4f window: Put F10 accelerator into its own shortcut controller
So instead of relying on gtk_window_activate_key(), it's now using
proper infrastructure.
2020-03-22 11:14:07 -04:00
Benjamin Otte
656d3325af window: Get rid of public APIs that shouldn't be
Event controllers should have replaced all of them.
And if they haven't, apps need to fix their code (I'm
looking at you Gimp).
2020-03-22 11:14:07 -04:00
Benjamin Otte
ef066cae85 gdk: Remove GDK_RELEASE_MASK
It was only ever supported by keybindings and those are gone now.
2020-03-22 11:14:07 -04:00