gui/event-widget: Set child depending on the orientation
Commit https://gitlab.gnome.org/GNOME/gnome-calendar/-/commit/73abcf19b0e70fb6fdd45394169b00e21ea0734a introduced a bug where it uses the wrong widget on vertical orientation. This patch fixes that bug by using the correct widget for their respective orientation. It also removes the use of AdwClamp, as it was clamping labels above a certain height requested. Fixes https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1414 Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/607>
This commit is contained in:
@@ -34,11 +34,7 @@ template $GcalEventWidget: Widget {
|
|||||||
"content",
|
"content",
|
||||||
]
|
]
|
||||||
|
|
||||||
Adw.Clamp clamp {
|
Box vertical_box {
|
||||||
orientation: vertical;
|
|
||||||
|
|
||||||
child: Box vertical_box {
|
|
||||||
visible: bind $get_vertical_enabled(template.event, template.orientation) as <bool>;
|
|
||||||
orientation: vertical;
|
orientation: vertical;
|
||||||
|
|
||||||
$GcalOverflowBin {
|
$GcalOverflowBin {
|
||||||
@@ -63,7 +59,7 @@ template $GcalEventWidget: Widget {
|
|||||||
min-lines: 1;
|
min-lines: 1;
|
||||||
text-overflow: ellipsize_end;
|
text-overflow: ellipsize_end;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
Box horizontal_box {
|
Box horizontal_box {
|
||||||
spacing: 4;
|
spacing: 4;
|
||||||
@@ -83,4 +79,3 @@ template $GcalEventWidget: Widget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -115,12 +115,19 @@ G_DEFINE_TYPE_WITH_CODE (GcalEventWidget, gcal_event_widget, GTK_TYPE_WIDGET,
|
|||||||
* Auxiliary methods
|
* Auxiliary methods
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static gboolean
|
static void
|
||||||
get_vertical_enabled (gpointer user_data,
|
gcal_event_widget_update_orientation_widgets (GcalEventWidget *self)
|
||||||
GcalEvent *event,
|
|
||||||
GtkOrientation orientation)
|
|
||||||
{
|
{
|
||||||
return orientation == GTK_ORIENTATION_VERTICAL && !gcal_event_get_all_day (event);
|
gboolean is_vertical;
|
||||||
|
gboolean is_all_day;
|
||||||
|
|
||||||
|
is_vertical = self->orientation == GTK_ORIENTATION_VERTICAL;
|
||||||
|
is_all_day = gcal_event_get_all_day (self->event);
|
||||||
|
|
||||||
|
if (is_vertical && !is_all_day)
|
||||||
|
gcal_overflow_bin_set_child (GCAL_OVERFLOW_BIN (self->overflow_bin), self->vertical_box);
|
||||||
|
else
|
||||||
|
gcal_overflow_bin_set_child (GCAL_OVERFLOW_BIN (self->overflow_bin), self->horizontal_box);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -670,7 +677,7 @@ gcal_event_widget_set_property (GObject *object,
|
|||||||
|
|
||||||
case PROP_ORIENTATION:
|
case PROP_ORIENTATION:
|
||||||
self->orientation = g_value_get_enum (value);
|
self->orientation = g_value_get_enum (value);
|
||||||
gtk_widget_set_visible (self->vertical_box, self->orientation == GTK_ORIENTATION_VERTICAL);
|
gcal_event_widget_update_orientation_widgets (self);
|
||||||
gcal_event_widget_update_style (self);
|
gcal_event_widget_update_style (self);
|
||||||
gcal_event_widget_update_timestamp (self);
|
gcal_event_widget_update_timestamp (self);
|
||||||
g_object_notify (object, "orientation");
|
g_object_notify (object, "orientation");
|
||||||
@@ -727,7 +734,6 @@ gcal_event_widget_dispose (GObject *object)
|
|||||||
|
|
||||||
g_clear_pointer (&self->preview_popover, gtk_widget_unparent);
|
g_clear_pointer (&self->preview_popover, gtk_widget_unparent);
|
||||||
g_clear_pointer (&self->overflow_bin, 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_clear_pointer (&self->edge, gtk_widget_unparent);
|
||||||
|
|
||||||
G_OBJECT_CLASS (gcal_event_widget_parent_class)->dispose (object);
|
G_OBJECT_CLASS (gcal_event_widget_parent_class)->dispose (object);
|
||||||
@@ -888,7 +894,6 @@ gcal_event_widget_class_init (GcalEventWidgetClass *klass)
|
|||||||
gtk_widget_class_bind_template_child (widget_class, GcalEventWidget, summary_inscription);
|
gtk_widget_class_bind_template_child (widget_class, GcalEventWidget, summary_inscription);
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalEventWidget, vertical_box);
|
gtk_widget_class_bind_template_child (widget_class, GcalEventWidget, vertical_box);
|
||||||
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, get_vertical_enabled);
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, on_click_gesture_pressed_cb);
|
gtk_widget_class_bind_template_callback (widget_class, on_click_gesture_pressed_cb);
|
||||||
gtk_widget_class_bind_template_callback (widget_class, on_click_gesture_release_cb);
|
gtk_widget_class_bind_template_callback (widget_class, on_click_gesture_release_cb);
|
||||||
gtk_widget_class_bind_template_callback (widget_class, on_drag_source_begin_cb);
|
gtk_widget_class_bind_template_callback (widget_class, on_drag_source_begin_cb);
|
||||||
|
|||||||
Reference in New Issue
Block a user