event-widget: Properly overflow

This explicitely allows the hour widget and the content as a whole to
overflow horizontally, and hides what overflows, keeping the data within
the boundaries of the widget while still allowing it to reach very
narrow sizes without error messages.

This purposefully leaves the indentation broken to help reviewing the
actual changes.
This commit is contained in:
Adrien Plazas
2022-06-15 11:34:03 -03:00
committed by Georges Basile Stavracas Neto
parent ca0a5de0f9
commit 2baa96d29f
2 changed files with 16 additions and 0 deletions
+3
View File
@@ -28,6 +28,7 @@
#include "gcal-debug.h" #include "gcal-debug.h"
#include "gcal-event-popover.h" #include "gcal-event-popover.h"
#include "gcal-event-widget.h" #include "gcal-event-widget.h"
#include "gcal-overflow-bin.h"
#include "gcal-utils.h" #include "gcal-utils.h"
#define DESC_MAX_CHAR 200 #define DESC_MAX_CHAR 200
@@ -759,6 +760,8 @@ gcal_event_widget_init (GcalEventWidget *self)
widget = GTK_WIDGET (self); widget = GTK_WIDGET (self);
self->clock_format_24h = is_clock_format_24h (); self->clock_format_24h = is_clock_format_24h ();
g_type_ensure (GCAL_TYPE_OVERFLOW_BIN);
gtk_widget_init_template (widget); gtk_widget_init_template (widget);
gtk_widget_set_cursor_from_name (GTK_WIDGET (self), "pointer"); gtk_widget_set_cursor_from_name (GTK_WIDGET (self), "pointer");
+13
View File
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<interface> <interface>
<template class="GcalEventWidget" parent="GtkWidget"> <template class="GcalEventWidget" parent="GtkWidget">
<property name="overflow">hidden</property>
<!-- Drag Source --> <!-- Drag Source -->
<child> <child>
@@ -19,6 +20,11 @@
</object> </object>
</child> </child>
<!-- Overflow Bin -->
<child>
<object class="GcalOverflowBin">
<property name="request-mode">width-for-height</property>
<!-- Main Stack --> <!-- Main Stack -->
<child> <child>
<object class="AdwSqueezer" id="squeezer"> <object class="AdwSqueezer" id="squeezer">
@@ -40,6 +46,9 @@
</closure> </closure>
</binding> </binding>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<child>
<object class="GcalOverflowBin">
<property name="request-mode">width-for-height</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="label" bind-source="hour_label" bind-property="label" bind-flags="default" /> <property name="label" bind-source="hour_label" bind-property="label" bind-flags="default" />
@@ -48,6 +57,8 @@
<class name="dim-label" /> <class name="dim-label" />
</style> </style>
</object> </object>
</child>
</object>
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
@@ -95,5 +106,7 @@
</object> </object>
</child> </child>
</object>
</child>
</template> </template>
</interface> </interface>