-
-
Notifications
You must be signed in to change notification settings - Fork 82
Better AccelGroup support? #913
Comments
Why do you think you'll need However I agree that this is far from convenient because of the |
Thanks for your reply. I'm glad to hear that this can be done with safe code. Is there any example about how to create a |
let c = glib::Closure::new(|args| {
let arg0 = args[0].get::<WhateverTypeYouExpectHere>().expect("wrong type");
[...]
// Return some value if the closure is required to return a value, otherwise `None`
Some(true.to_value())
}); Note that this will panic if you get the types of the |
It seems this is not so easy. I tried to add a shortcut which changes state of some widget, and the compiler complains about the closure is not |
Use something like We should probably add a |
There are several things which can be done. Firstly The second thing would be that it should take a I have to admit that I'm not familiar with GTK+ so I may be wrong about how it works. It's just from what I saw when trying to build my UI. |
Also it might be useful to have it accept |
From looking at the docs, it seems like the closure will always have a signature of gboolean
(*GtkAccelGroupActivate) (GtkAccelGroup *accel_group,
GObject *acceleratable,
guint keyval,
GdkModifierType modifier); Not sure why it even goes through
What are you trying to do exactly? |
I've reported a bug for this against GTK so that they maybe can fix it for GTK4: https://gitlab.gnome.org/GNOME/gtk/issues/2257 |
I'm trying to add some shortcuts to a window without widgets, but found it's quite challenging.
I found that
AccelGroup
in GTK+ seems to be for this usecase, but it is not very intuitive how to use it with gtk-rs, and I'm suspecting that I would need someunsafe
for using it at the moment. Specifically I feel thatAccelGroupExt::connect
may need a better wrapping method.It would be greatly appreciated if you can make the binding to
AccelGroup
easier to use with gtk-rs.The text was updated successfully, but these errors were encountered: