fix gtk3 build, implement workaround for gtk_button_set_can_shrink

Sat, 30 Aug 2025 16:39:37 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 30 Aug 2025 16:39:37 +0200
changeset 740
2fdfb8a15e82
parent 739
3236d5ed3a95
child 741
b653d8296d12

fix gtk3 build, implement workaround for gtk_button_set_can_shrink

ui/gtk/button.c file | annotate | diff | comparison | revisions
--- a/ui/gtk/button.c	Sat Aug 30 16:08:23 2025 +0200
+++ b/ui/gtk/button.c	Sat Aug 30 16:39:37 2025 +0200
@@ -760,7 +760,12 @@
                 data);
     }
     gtk_button_set_label(GTK_BUTTON(button), args->label);
+#if GTK_CHECK_VERSION(4, 0, 0)
     gtk_button_set_can_shrink(GTK_BUTTON(button), TRUE);
+#elif GTK_MAJOR_VERSION == 3
+    GtkWidget *child = gtk_bin_get_child(GTK_BIN(button));
+    gtk_label_set_ellipsize(GTK_LABEL(child), PANGO_ELLIPSIZE_END);
+#endif
     g_object_set_data(G_OBJECT(button), "ui_linkbutton", data);
     g_signal_connect(
             button,
@@ -807,6 +812,11 @@
     if(s->value.free) {
         s->value.free(s->value.ptr);
     }
+#if GTK_MAJOR_VERSION == 3
+    UiLinkButton *data = s->obj;
+    GtkWidget *child = gtk_bin_get_child(GTK_BIN(data->widget));
+    gtk_label_set_ellipsize(GTK_LABEL(child), PANGO_ELLIPSIZE_END);
+#endif
 }
 
 

mercurial