applet: Place in a popover with a button

This commit is contained in:
Ian Douglas Scott 2022-07-01 21:13:42 -07:00
parent 3b2b01e259
commit ab8131f5e6
2 changed files with 88 additions and 77 deletions

View file

@ -2,11 +2,11 @@
Name=Cosmic Dock App List Name=Cosmic Dock App List
Comment=Write a GTK + Rust application Comment=Write a GTK + Rust application
Type=Application Type=Application
Exec=cosmic-dock-app-list Exec=cosmic-applet-audio
Terminal=false Terminal=false
Categories=GNOME;GTK; Categories=GNOME;GTK;
Keywords=Gnome;GTK; Keywords=Gnome;GTK;
# Translators: Do NOT translate or transliterate this text (this is an icon file name)! # Translators: Do NOT translate or transliterate this text (this is an icon file name)!
Icon=com.system76.CosmicDockAppList.svg Icon=com.system76.CosmicAppletAudio.svg
StartupNotify=true StartupNotify=true
NoDisplay=true NoDisplay=true

View file

@ -79,9 +79,17 @@ fn app(application: &Application) {
window = ApplicationWindow { window = ApplicationWindow {
set_application: Some(application), set_application: Some(application),
set_title: Some("COSMIC Network Applet"), set_title: Some("COSMIC Network Applet"),
set_default_width: 400, set_decorated: false,
set_default_height: 300, set_resizable: false,
set_width_request: 1,
set_height_request: 1,
#[wrap(Some)]
set_child = &gtk4::MenuButton {
// TODO: adjust based on volume, mute
set_icon_name: "multimedia-volume-control-symbolic",
#[wrap(Some)]
set_popover = &gtk4::Popover {
#[wrap(Some)] #[wrap(Some)]
set_child: window_box = &GtkBox { set_child: window_box = &GtkBox {
set_orientation: Orientation::Vertical, set_orientation: Orientation::Vertical,
@ -165,6 +173,9 @@ fn app(application: &Application) {
} }
} }
} }
}
}
glib::MainContext::default().spawn_local( glib::MainContext::default().spawn_local(
clone!(@weak inputs, @weak current_input, @weak input_volume, @strong pa => async move { clone!(@weak inputs, @weak current_input, @weak input_volume, @strong pa => async move {
while let Some(()) = refresh_input_rx.next().await { while let Some(()) = refresh_input_rx.next().await {