views/month-view: Add and update accessible elements
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/564>
This commit is contained in:
@@ -13,6 +13,13 @@ template $GcalMonthCell: Adw.BreakpointBin {
|
||||
}
|
||||
}
|
||||
|
||||
accessibility {
|
||||
labelled-by: day_label;
|
||||
has-popup: true;
|
||||
selected: false;
|
||||
}
|
||||
|
||||
accessible-role: grid_cell;
|
||||
width-request: 50;
|
||||
height-request: 50;
|
||||
hexpand: true;
|
||||
|
||||
@@ -624,6 +624,9 @@ gcal_month_cell_set_selected (GcalMonthCell *self,
|
||||
return;
|
||||
|
||||
self->selected = selected;
|
||||
gtk_accessible_update_state (GTK_ACCESSIBLE (self),
|
||||
GTK_ACCESSIBLE_STATE_SELECTED, selected,
|
||||
-1);
|
||||
|
||||
/* Update style context state */
|
||||
flags = gtk_widget_get_state_flags (GTK_WIDGET (self));
|
||||
|
||||
@@ -1111,6 +1111,9 @@ gcal_month_view_row_init (GcalMonthViewRow *self)
|
||||
gcal_month_cell_set_overflow (GCAL_MONTH_CELL (self->day_cells[i]), 0);
|
||||
gtk_widget_set_parent (self->day_cells[i], GTK_WIDGET (self));
|
||||
g_signal_connect (self->day_cells[i], "show-overflow", G_CALLBACK (on_month_cell_show_overflow_cb), self);
|
||||
gtk_accessible_update_relation (GTK_ACCESSIBLE (self->day_cells[i]),
|
||||
GTK_ACCESSIBLE_RELATION_COL_INDEX, i + 1,
|
||||
-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ using Gtk 4.0;
|
||||
|
||||
template $GcalMonthView: Widget {
|
||||
overflow: hidden;
|
||||
accessible-role: grid;
|
||||
|
||||
styles [
|
||||
"month-view",
|
||||
|
||||
@@ -1694,6 +1694,11 @@ gcal_month_view_init (GcalMonthView *self)
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
update_weekday_labels (self);
|
||||
|
||||
gtk_accessible_update_relation (GTK_ACCESSIBLE (self),
|
||||
GTK_ACCESSIBLE_RELATION_COL_COUNT, 7,
|
||||
GTK_ACCESSIBLE_RELATION_ROW_COUNT, N_ROWS_PER_PAGE,
|
||||
-1);
|
||||
|
||||
self->week_rows = g_ptr_array_new_full (N_TOTAL_ROWS, (GDestroyNotify) gtk_widget_unparent);
|
||||
for (gint i = 0; i < N_TOTAL_ROWS; i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user