[gnome-builder/gnome-builder-43] plugins/platformui: use GtkInscription for label



commit b0bfa8264b3e0768cdc8551109052aa4416a4118
Author: Christian Hergert <chergert redhat com>
Date:   Wed Oct 5 14:59:42 2022 -0700

    plugins/platformui: use GtkInscription for label
    
    We don't want this to change the positioning of the monitors or their
    selection so use GtkInscription with text-overflow set to ellipsize.
    
    To handle cases where the text is ellipsized, provide tooltip-text to
    hover and see the full translation.
    
    Fixes #1834

 src/plugins/platformui/gbp-platformui-tweaks-addin.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/plugins/platformui/gbp-platformui-tweaks-addin.c 
b/src/plugins/platformui/gbp-platformui-tweaks-addin.c
index 2a3768924..e34ddaa5d 100644
--- a/src/plugins/platformui/gbp-platformui-tweaks-addin.c
+++ b/src/plugins/platformui/gbp-platformui-tweaks-addin.c
@@ -71,8 +71,8 @@ platformui_create_style_selector (IdeTweaks       *tweaks,
   for (guint i = 0; i < G_N_ELEMENTS (variants); i++)
     {
       IdeStyleVariantPreview *preview;
+      GtkInscription *label;
       GtkButton *button;
-      GtkLabel *label;
       GtkBox *vbox;
 
       vbox = g_object_new (GTK_TYPE_BOX,
@@ -91,9 +91,11 @@ platformui_create_style_selector (IdeTweaks       *tweaks,
                              "child", preview,
                              NULL);
       gtk_actionable_set_action_target (GTK_ACTIONABLE (button), "s", variants[i].key);
-      label = g_object_new (GTK_TYPE_LABEL,
-                            "xalign", 0.5f,
-                            "label", g_dgettext (NULL, variants[i].title),
+      label = g_object_new (GTK_TYPE_INSCRIPTION,
+                            "xalign", .5f,
+                            "text", g_dgettext (NULL, variants[i].title),
+                            "tooltip-text", g_dgettext (NULL, variants[i].title),
+                            "text-overflow", GTK_INSCRIPTION_OVERFLOW_ELLIPSIZE_END,
                             NULL);
       gtk_box_append (vbox, GTK_WIDGET (button));
       gtk_box_append (vbox, GTK_WIDGET (label));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]