event-widget: Use GtkInscription for summary text

It's slightly more performant than a GtkLabel, which is demonstrably
the widget dominating the perf profile of the app.

Related: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1125
This commit is contained in:
Georges Basile Stavracas Neto
2023-12-17 22:32:18 +00:00
parent 41251bac1e
commit 1fbd5e0621
2 changed files with 11 additions and 10 deletions
+4 -4
View File
@@ -55,7 +55,7 @@ struct _GcalEventWidget
GtkWidget *main_widget;
GtkWidget *timestamp_label;
GtkWidget *squeezer;
GtkWidget *summary_label;
GtkWidget *summary_inscription;
GtkWidget *vertical_box;
GtkEventController *drag_source;
GtkWidget *preview_popover;
@@ -455,8 +455,8 @@ gcal_event_widget_set_event_internal (GcalEventWidget *self,
/* Summary label */
g_object_bind_property (event,
"summary",
self->summary_label,
"label",
self->summary_inscription,
"text",
G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
gcal_event_widget_update_style (self);
@@ -771,7 +771,7 @@ gcal_event_widget_class_init (GcalEventWidgetClass *klass)
gtk_widget_class_bind_template_child (widget_class, GcalEventWidget, main_widget);
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_label);
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_callback (widget_class, get_vertical_enabled);
+7 -6
View File
@@ -72,12 +72,12 @@
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label" bind-source="summary_label" bind-property="label" bind-flags="default" />
<property name="wrap">True</property>
<property name="wrap-mode">word-char</property>
<object class="GtkInscription">
<property name="text" bind-source="summary_inscription" bind-property="text" bind-flags="default" />
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="xalign">0.0</property>
<property name="min-lines">1</property>
</object>
</child>
</object>
@@ -88,10 +88,11 @@
<object class="GtkBox" id="horizontal_box">
<property name="spacing">4</property>
<child>
<object class="GtkLabel" id="summary_label">
<object class="GtkInscription" id="summary_inscription">
<property name="hexpand">True</property>
<property name="xalign">0.0</property>
<property name="ellipsize">end</property>
<property name="min-lines">1</property>
<property name="text-overflow">ellipsize-end</property>
</object>
</child>
<child>