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;
|
width-request: 50;
|
||||||
height-request: 50;
|
height-request: 50;
|
||||||
hexpand: true;
|
hexpand: true;
|
||||||
|
|||||||
@@ -624,6 +624,9 @@ gcal_month_cell_set_selected (GcalMonthCell *self,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
self->selected = selected;
|
self->selected = selected;
|
||||||
|
gtk_accessible_update_state (GTK_ACCESSIBLE (self),
|
||||||
|
GTK_ACCESSIBLE_STATE_SELECTED, selected,
|
||||||
|
-1);
|
||||||
|
|
||||||
/* Update style context state */
|
/* Update style context state */
|
||||||
flags = gtk_widget_get_state_flags (GTK_WIDGET (self));
|
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);
|
gcal_month_cell_set_overflow (GCAL_MONTH_CELL (self->day_cells[i]), 0);
|
||||||
gtk_widget_set_parent (self->day_cells[i], GTK_WIDGET (self));
|
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);
|
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 {
|
template $GcalMonthView: Widget {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
accessible-role: grid;
|
||||||
|
|
||||||
styles [
|
styles [
|
||||||
"month-view",
|
"month-view",
|
||||||
|
|||||||
@@ -1694,6 +1694,11 @@ gcal_month_view_init (GcalMonthView *self)
|
|||||||
gtk_widget_init_template (GTK_WIDGET (self));
|
gtk_widget_init_template (GTK_WIDGET (self));
|
||||||
update_weekday_labels (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);
|
self->week_rows = g_ptr_array_new_full (N_TOTAL_ROWS, (GDestroyNotify) gtk_widget_unparent);
|
||||||
for (gint i = 0; i < N_TOTAL_ROWS; i++)
|
for (gint i = 0; i < N_TOTAL_ROWS; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user