event-editor/multi-choice: Set accessible label without connecting signal
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/840>
This commit is contained in:
@@ -3,7 +3,6 @@ using Gtk 4.0;
|
||||
template $GcalMultiChoice: Box {
|
||||
spacing: 6;
|
||||
accessible-role: spin_button;
|
||||
notify::category => $set_accessibility_label() swapped;
|
||||
|
||||
Button down_button {
|
||||
icon-name: "pan-start-symbolic";
|
||||
|
||||
@@ -216,14 +216,6 @@ update_sensitivity (GcalMultiChoice *self)
|
||||
GTK_ACCESSIBLE_RELATION_CONTROLS);
|
||||
}
|
||||
|
||||
static void
|
||||
set_accessibility_label (GcalMultiChoice *self)
|
||||
{
|
||||
gtk_accessible_update_property (GTK_ACCESSIBLE (self),
|
||||
GTK_ACCESSIBLE_PROPERTY_LABEL,
|
||||
gcal_multi_choice_get_category (self), -1);
|
||||
}
|
||||
|
||||
static void
|
||||
button_clicked_cb (GtkWidget *button,
|
||||
GcalMultiChoice *self)
|
||||
@@ -617,7 +609,6 @@ gcal_multi_choice_class_init (GcalMultiChoiceClass *class)
|
||||
gtk_widget_class_bind_template_child (widget_class, GcalMultiChoice, label1);
|
||||
gtk_widget_class_bind_template_child (widget_class, GcalMultiChoice, label2);
|
||||
|
||||
gtk_widget_class_bind_template_callback (widget_class, set_accessibility_label);
|
||||
gtk_widget_class_bind_template_callback (widget_class, button_clicked_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, button_toggled_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, button_state_flags_changed_cb);
|
||||
@@ -846,6 +837,10 @@ gcal_multi_choice_set_category (GcalMultiChoice *self,
|
||||
{
|
||||
self->category = g_strdup (category ? category : "");
|
||||
|
||||
gtk_accessible_update_property (GTK_ACCESSIBLE (self),
|
||||
GTK_ACCESSIBLE_PROPERTY_LABEL, category,
|
||||
-1);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_CATEGORY]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user