Hello, I’m a newbie to GTK and C++, and I’m trying to add accessibility relations to GParted. (I’ve already used GTK before, but only with Glade and Rust bindings)
Precisely, here I want to add a relation between a Gtk::Label
and an OptionComboBox: Gtk::ComboBox
.
I tried this:
atk_object_add_relationship(
atk_gobject_accessible_for_object((GObject*) label), // label is Gtk::Label*
ATK_RELATION_LABEL_FOR,
atk_gobject_accessible_for_object((GObject) combo_type)); // combo_type is a class child of Gtk::ComboBox
It compiles, but there is a runtime error, and it does not work:
(gpartedbin:18126): Atk-CRITICAL **: 10:48:35.604: atk_gobject_accessible_for_object: assertion 'G_IS_OBJECT (obj)' failed
(gpartedbin:18126): Atk-CRITICAL **: 10:48:35.604: atk_gobject_accessible_for_object: assertion 'G_IS_OBJECT (obj)' failed
(gpartedbin:18126): Atk-CRITICAL **: 10:48:35.604: atk_object_add_relationship: assertion 'ATK_IS_OBJECT (object)' failed
Unfortunately I do not see any other way to instantiate Atk::Object
, which is needed to add relations.
How can I do this correctly? Thanks.