application: Use gio::ActionEntryBuilder for actions

Allows us to drop the action! macro and usage of the clone! macro
in the application file.

The first occurrence of clone! is now in window.rs, so the comment
explaining it has moved there.
This commit is contained in:
Christopher Davis 2022-11-23 13:51:27 -05:00 • committed by Sophie Herold
parent 29198b68f9
commit aa781d3864
2 changed files with 29 additions and 43 deletions

View file

@ -159,6 +159,14 @@ mod imp {
.chain_property::<LpImage>("best-fit")
.watch(
glib::Object::NONE,
// clone! is a macro from glib-rs that allows
// you to easily handle references in callbacks
// without refcycles or leaks.
//
// When you don't want the callback to keep the
// Object alive, pass as @weak. Otherwise, pass
// as @strong. Most of the time you will want
// to use @weak.
glib::clone!(@weak obj => move || {
let enabled = obj
.imp()