mirror of
https://gitlab.freedesktop.org/pipewire/helvum
synced 2026-03-15 11:36:11 +08:00
view: Improve layout of labels on nodes and ports
This sets a maximum width of 20 chars on labels on nodes and ports. Longer labels will wrap to a second line. For labels longer than two lines, the label is ellipsized at the end. The full label can still be viewed via hovering for a tooltip. Co-authored-by: Roger Roger <me@rogerrogert.de>
This commit is contained in:
@@ -48,7 +48,12 @@ mod imp {
|
||||
|
||||
fn new() -> Self {
|
||||
let grid = gtk::Grid::new();
|
||||
|
||||
let label = gtk::Label::new(None);
|
||||
label.set_wrap(true);
|
||||
label.set_lines(2);
|
||||
label.set_max_width_chars(20);
|
||||
label.set_ellipsize(gtk::pango::EllipsizeMode::End);
|
||||
|
||||
grid.attach(&label, 0, 0, 2, 1);
|
||||
|
||||
@@ -95,7 +100,10 @@ mod imp {
|
||||
|
||||
fn set_property(&self, _id: usize, value: &glib::Value, pspec: &glib::ParamSpec) {
|
||||
match pspec.name() {
|
||||
"name" => self.label.set_text(value.get().unwrap()),
|
||||
"name" => {
|
||||
self.label.set_text(value.get().unwrap());
|
||||
self.label.set_tooltip_text(value.get().ok());
|
||||
}
|
||||
"pipewire-id" => self.pipewire_id.set(value.get().unwrap()),
|
||||
_ => unimplemented!(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user