Skip to content

Commit 4c4ebf8

Browse files
committed
feat(Bluetooth): add setting page
1 parent bb35fa7 commit 4c4ebf8

File tree

16 files changed

+1316
-51
lines changed

16 files changed

+1316
-51
lines changed

Cargo.lock

Lines changed: 53 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cosmic-settings/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ tracing = "0.1.40"
5252
tracing-subscriber = "0.3.18"
5353
udev = "0.9.0"
5454
upower_dbus = { git = "https://github.com/pop-os/dbus-settings-bindings" }
55+
bluez-zbus = { git = "https://github.com/acolombier/dbus-settings-bindings", branch = "feat/bluez" }
5556
url = "2.5.2"
5657
xkb-data = "0.2.1"
5758
zbus = { version = "4.4.0", features = ["tokio"] }

cosmic-settings/src/app.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ use crate::pages::desktop::{
1111
},
1212
};
1313
use crate::pages::input::{self};
14-
use crate::pages::{self, display, power, sound, system, time};
15-
use crate::subscription::desktop_files;
14+
use crate::pages::{self, bluetooth, display, power, sound, system, time};
15+
use crate::subscription::{desktop_files, watch_bluetooth};
1616
use crate::widget::{page_title, search_header};
1717
use crate::PageCommands;
1818
use cosmic::app::DbusActivationMessage;
@@ -59,7 +59,7 @@ impl SettingsApp {
5959
match cmd {
6060
PageCommands::About => self.pages.page_id::<system::about::Page>(),
6161
PageCommands::Appearance => self.pages.page_id::<desktop::appearance::Page>(),
62-
PageCommands::Bluetooth => None,
62+
PageCommands::Bluetooth => self.pages.page_id::<bluetooth::Page>(),
6363
PageCommands::DateTime => self.pages.page_id::<time::date::Page>(),
6464
PageCommands::Desktop => self.pages.page_id::<desktop::Page>(),
6565
PageCommands::Displays => self.pages.page_id::<display::Page>(),
@@ -141,7 +141,8 @@ impl cosmic::Application for SettingsApp {
141141
search_selections: Vec::default(),
142142
};
143143

144-
let desktop_id = app.insert_page::<desktop::Page>().id();
144+
let desktop_id = app.insert_page::<bluetooth::Page>().id();
145+
app.insert_page::<desktop::Page>();
145146
app.insert_page::<display::Page>();
146147
app.insert_page::<sound::Page>();
147148
app.insert_page::<power::Page>();
@@ -250,6 +251,8 @@ impl cosmic::Application for SettingsApp {
250251
wayland_events,
251252
// Watch for changes to installed desktop entries
252253
desktop_files(0).map(|_| Message::DesktopInfo),
254+
watch_bluetooth()
255+
.map(|bluetooth| Message::PageMessage(crate::pages::Message::Bluetooth(bluetooth))),
253256
// Watch for configuration changes to the panel.
254257
self.core()
255258
.watch_config::<CosmicPanelConfig>("com.system76.CosmicPanel.Panel")
@@ -316,6 +319,10 @@ impl cosmic::Application for SettingsApp {
316319
}
317320
}
318321

322+
crate::pages::Message::Bluetooth(message) => {
323+
page::update!(self.pages, message, bluetooth::Page);
324+
}
325+
319326
crate::pages::Message::DateAndTime(message) => {
320327
if let Some(page) = self.pages.page_mut::<time::date::Page>() {
321328
return page.update(message).map(Into::into);

0 commit comments

Comments
 (0)