mirror of
https://gitlab.freedesktop.org/pipewire/helvum
synced 2026-03-15 11:36:11 +08:00
ui: Display node media name in graph view
This commit is contained in:
committed by
Tom Wagner
parent
5d4931b418
commit
96c079d29e
@@ -34,15 +34,26 @@ mod imp {
|
||||
#[property(get, set, construct_only)]
|
||||
pub(super) pipewire_id: Cell<u32>,
|
||||
#[property(
|
||||
name = "name", type = String,
|
||||
get = |this: &Self| this.label.text().to_string(),
|
||||
name = "node-name", type = String,
|
||||
get = |this: &Self| this.node_name.text().to_string(),
|
||||
set = |this: &Self, val| {
|
||||
this.label.set_text(val);
|
||||
this.label.set_tooltip_text(Some(val));
|
||||
this.node_name.set_text(val);
|
||||
this.node_name.set_tooltip_text(Some(val));
|
||||
}
|
||||
)]
|
||||
#[template_child]
|
||||
pub(super) label: TemplateChild<gtk::Label>,
|
||||
pub(super) node_name: TemplateChild<gtk::Label>,
|
||||
#[property(
|
||||
name = "media-name", type = String,
|
||||
get = |this: &Self| this.media_name.text().to_string(),
|
||||
set = |this: &Self, val| {
|
||||
this.media_name.set_text(val);
|
||||
this.media_name.set_tooltip_text(Some(val));
|
||||
this.media_name.set_visible(!val.is_empty());
|
||||
}
|
||||
)]
|
||||
#[template_child]
|
||||
pub(super) media_name: TemplateChild<gtk::Label>,
|
||||
#[template_child]
|
||||
pub(super) separator: TemplateChild<gtk::Separator>,
|
||||
#[template_child]
|
||||
@@ -75,7 +86,7 @@ mod imp {
|
||||
self.parent_constructed();
|
||||
|
||||
// Display a grab cursor when the mouse is over the label so the user knows the node can be dragged.
|
||||
self.label
|
||||
self.node_name
|
||||
.set_cursor(gtk::gdk::Cursor::from_name("grab", None).as_ref());
|
||||
}
|
||||
|
||||
@@ -141,7 +152,7 @@ glib::wrapper! {
|
||||
impl Node {
|
||||
pub fn new(name: &str, pipewire_id: u32) -> Self {
|
||||
glib::Object::builder()
|
||||
.property("name", name)
|
||||
.property("node-name", name)
|
||||
.property("pipewire-id", pipewire_id)
|
||||
.build()
|
||||
}
|
||||
|
||||
@@ -9,14 +9,36 @@
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label">
|
||||
<object class="GtkBox">
|
||||
<style>
|
||||
<class name="heading"></class>
|
||||
<class name="node-title"></class>
|
||||
</style>
|
||||
<property name="wrap">true</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_END</property>
|
||||
<property name="lines">2</property>
|
||||
<property name="max-width-chars">20</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">1</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="node_name">
|
||||
<style>
|
||||
<class name="heading"></class>
|
||||
</style>
|
||||
<property name="wrap">true</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_END</property>
|
||||
<property name="lines">2</property>
|
||||
<property name="max-width-chars">20</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="media_name">
|
||||
<style>
|
||||
<class name="dim-label"></class>
|
||||
<class name="caption"></class>
|
||||
</style>
|
||||
<property name="visible">false</property>
|
||||
<property name="wrap">true</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_END</property>
|
||||
<property name="lines">2</property>
|
||||
<property name="max-width-chars">20</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
||||
Reference in New Issue
Block a user