mirror of
https://gitlab.freedesktop.org/pipewire/helvum.git
synced 2026-04-20 06:20:38 +02:00
ui: Show current remote in the HeaderBar
This commit is contained in:
parent
ad37798bbb
commit
092febcb89
3 changed files with 40 additions and 2 deletions
|
|
@ -31,6 +31,8 @@ static APP_ID: &str = "org.pipewire.Helvum";
|
|||
static VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
static AUTHORS: &str = env!("CARGO_PKG_AUTHORS");
|
||||
|
||||
const DEFAULT_REMOTE_NAME: &str = "Default Remote";
|
||||
|
||||
mod imp {
|
||||
use super::*;
|
||||
|
||||
|
|
@ -145,9 +147,13 @@ mod imp {
|
|||
Some("PATH"),
|
||||
);
|
||||
|
||||
let current_remote_label = obj.imp().window.current_remote_label();
|
||||
obj.connect_handle_local_options(clone!(@strong pw_sender => move |_, opts| {
|
||||
match opts.lookup::<String>("socket") {
|
||||
Ok(p) => pw_sender.send(GtkMessage::Connect(p)).unwrap(),
|
||||
Ok(p) => {
|
||||
current_remote_label.set_label(p.as_deref().unwrap_or(DEFAULT_REMOTE_NAME));
|
||||
pw_sender.send(GtkMessage::Connect(p)).unwrap();
|
||||
},
|
||||
Err(e) => error!("Invalid socket path: {e}"),
|
||||
}
|
||||
-1
|
||||
|
|
|
|||
|
|
@ -15,6 +15,9 @@ mod imp {
|
|||
#[property(type = adw::Banner, get = |_| self.connection_banner.clone())]
|
||||
pub connection_banner: TemplateChild<adw::Banner>,
|
||||
#[template_child]
|
||||
#[property(type = gtk::Label, get = |_| self.current_remote_label.clone())]
|
||||
pub current_remote_label: TemplateChild<gtk::Label>,
|
||||
#[template_child]
|
||||
#[property(type = graph::GraphView, get = |_| self.graph.clone())]
|
||||
pub graph: TemplateChild<graph::GraphView>,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,11 +13,40 @@
|
|||
<template class="HelvumWindow" parent="AdwApplicationWindow">
|
||||
<property name="default-width">1280</property>
|
||||
<property name="default-height">720</property>
|
||||
<property name="title">Helvum - Pipewire Patchbay</property>
|
||||
<child>
|
||||
<object class="AdwToolbarView">
|
||||
<child type="top">
|
||||
<object class="AdwHeaderBar" id="header_bar">
|
||||
<property name="title-widget">
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Helvum - Pipewire Patchbay</property>
|
||||
<property name="single-line-mode">True</property>
|
||||
<property name="ellipsize">end</property>
|
||||
<property name="width-chars">5</property>
|
||||
<property name="vexpand">yes</property>
|
||||
<property name="valign">end</property>
|
||||
<style>
|
||||
<class name="title"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="current_remote_label">
|
||||
<property name="single-line-mode">True</property>
|
||||
<property name="ellipsize">start</property>
|
||||
<property name="vexpand">yes</property>
|
||||
<property name="valign">start</property>
|
||||
<style>
|
||||
<class name="caption"/>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
<child type="end">
|
||||
<object class="GtkMenuButton">
|
||||
<property name="icon-name">open-menu-symbolic</property>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue