Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
421 views
in Technique[技术] by (71.8m points)

ubuntu - Restrict label size from theme CSS in GTK?

I'm trying to create themes for a program for GNOME that uses GtkLabel in a widget. I see that GTK Label already has a function for constraining the maximum length of a label, similar to the standard CSS text-overflow: ellipsis. GTK uses _ellipsize and max-width-chars.

However, I need to access these properties EXCLUSIVELY from my gtk.css, without changing the source code of the program. I don't even need to use these properties directly, I just want to take advantage of the fact that GTK already has that capability. If there's an indirect way of using them (i.e.: using Pango attributes somehow...), it works.

Here's the source of the program I'm using: https://gitlab.xfce.org/apps/xfce4-notifyd/-/blob/master/xfce4-notifyd/xfce-notify-daemon.c

The part of the GTK code I believe to be relevant: https://code.woboq.org/gtk/gtk/gtk/gtklabel.c.html

I've only been able to find documentation about how to implement Ellipsize in HTML, python, etc. I haven't found a way to use it from CSS.

Is it possible to do this, or should I just try a different program?

question from:https://stackoverflow.com/questions/66057500/restrict-label-size-from-theme-css-in-gtk

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...