gui/event-widget: Use GtkBoxLayout
The GTK inspector would always target and inspect the `main_widget` box rather than the parent widget, which became repetitive to keep pressing the "Parent widget" button when working with accessibility, as the parent widget contained the accessible properties and states. GtkBoxLayout solves that by allowing us to get rid of the box completely, which exclusively makes it inspect the widget we actually want to target. Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/587>
This commit is contained in:
@@ -17,72 +17,68 @@ template $GcalEventWidget: Widget {
|
||||
released => $on_click_gesture_release_cb(template) not-swapped;
|
||||
}
|
||||
|
||||
Box main_widget {
|
||||
hexpand: false;
|
||||
Adw.Bin edge {
|
||||
styles [
|
||||
"edge",
|
||||
]
|
||||
}
|
||||
|
||||
Adw.Bin edge {
|
||||
styles [
|
||||
"edge",
|
||||
]
|
||||
}
|
||||
$GcalOverflowBin overflow_bin {
|
||||
hexpand: true;
|
||||
request-mode: width-for-height;
|
||||
|
||||
$GcalOverflowBin {
|
||||
hexpand: true;
|
||||
request-mode: width-for-height;
|
||||
styles [
|
||||
"content",
|
||||
]
|
||||
|
||||
styles [
|
||||
"content",
|
||||
]
|
||||
Adw.Squeezer squeezer {
|
||||
hexpand: false;
|
||||
homogeneous: false;
|
||||
orientation: vertical;
|
||||
|
||||
Adw.Squeezer squeezer {
|
||||
hexpand: false;
|
||||
homogeneous: false;
|
||||
Box vertical_box {
|
||||
visible: bind $get_vertical_enabled(template.event, template.orientation) as <bool>;
|
||||
orientation: vertical;
|
||||
|
||||
Box vertical_box {
|
||||
visible: bind $get_vertical_enabled(template.event, template.orientation) as <bool>;
|
||||
orientation: vertical;
|
||||
$GcalOverflowBin {
|
||||
request-mode: width-for-height;
|
||||
|
||||
$GcalOverflowBin {
|
||||
request-mode: width-for-height;
|
||||
|
||||
Label {
|
||||
label: bind timestamp_label.label no-sync-create;
|
||||
xalign: 0.0;
|
||||
|
||||
styles [
|
||||
"dim-label",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Inscription {
|
||||
text: bind summary_inscription.text no-sync-create;
|
||||
hexpand: true;
|
||||
vexpand: true;
|
||||
Label {
|
||||
label: bind timestamp_label.label no-sync-create;
|
||||
xalign: 0.0;
|
||||
yalign: 0.0;
|
||||
min-lines: 1;
|
||||
text-overflow: ellipsize_end;
|
||||
}
|
||||
}
|
||||
|
||||
Box horizontal_box {
|
||||
spacing: 4;
|
||||
|
||||
Inscription summary_inscription {
|
||||
hexpand: true;
|
||||
xalign: 0.0;
|
||||
min-lines: 1;
|
||||
text-overflow: ellipsize_end;
|
||||
}
|
||||
|
||||
Label timestamp_label {
|
||||
styles [
|
||||
"dim-label",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Inscription {
|
||||
text: bind summary_inscription.text no-sync-create;
|
||||
hexpand: true;
|
||||
vexpand: true;
|
||||
xalign: 0.0;
|
||||
yalign: 0.0;
|
||||
min-lines: 1;
|
||||
text-overflow: ellipsize_end;
|
||||
}
|
||||
}
|
||||
|
||||
Box horizontal_box {
|
||||
spacing: 4;
|
||||
|
||||
Inscription summary_inscription {
|
||||
hexpand: true;
|
||||
xalign: 0.0;
|
||||
min-lines: 1;
|
||||
text-overflow: ellipsize_end;
|
||||
}
|
||||
|
||||
Label timestamp_label {
|
||||
styles [
|
||||
"dim-label",
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,8 +53,9 @@ struct _GcalEventWidget
|
||||
|
||||
/* widgets */
|
||||
GtkWidget *horizontal_box;
|
||||
GtkWidget *main_widget;
|
||||
GtkWidget *timestamp_label;
|
||||
GtkWidget *edge;
|
||||
GtkWidget *overflow_bin;
|
||||
GtkWidget *squeezer;
|
||||
GtkWidget *summary_inscription;
|
||||
GtkWidget *vertical_box;
|
||||
@@ -723,7 +724,9 @@ gcal_event_widget_dispose (GObject *object)
|
||||
GcalEventWidget *self = GCAL_EVENT_WIDGET (object);
|
||||
|
||||
g_clear_pointer (&self->preview_popover, gtk_widget_unparent);
|
||||
g_clear_pointer (&self->main_widget, gtk_widget_unparent);
|
||||
g_clear_pointer (&self->overflow_bin, gtk_widget_unparent);
|
||||
g_clear_pointer (&self->horizontal_box, gtk_widget_unparent);
|
||||
g_clear_pointer (&self->edge, gtk_widget_unparent);
|
||||
|
||||
G_OBJECT_CLASS (gcal_event_widget_parent_class)->dispose (object);
|
||||
}
|
||||
@@ -877,7 +880,8 @@ gcal_event_widget_class_init (GcalEventWidgetClass *klass)
|
||||
|
||||
gtk_widget_class_bind_template_child (widget_class, GcalEventWidget, drag_source);
|
||||
gtk_widget_class_bind_template_child (widget_class, GcalEventWidget, horizontal_box);
|
||||
gtk_widget_class_bind_template_child (widget_class, GcalEventWidget, main_widget);
|
||||
gtk_widget_class_bind_template_child (widget_class, GcalEventWidget, edge);
|
||||
gtk_widget_class_bind_template_child (widget_class, GcalEventWidget, overflow_bin);
|
||||
gtk_widget_class_bind_template_child (widget_class, GcalEventWidget, timestamp_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, GcalEventWidget, squeezer);
|
||||
gtk_widget_class_bind_template_child (widget_class, GcalEventWidget, summary_inscription);
|
||||
@@ -892,7 +896,7 @@ gcal_event_widget_class_init (GcalEventWidgetClass *klass)
|
||||
gtk_widget_class_set_css_name (widget_class, "event");
|
||||
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_BUTTON);
|
||||
|
||||
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
|
||||
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user