LabeledItem works!

This commit is contained in:
Lucy 2022-02-28 15:27:26 -05:00
parent 0b0279b3ed
commit 5b6242d9d9
No known key found for this signature in database
GPG key ID: EBC517FAD666BBF1
3 changed files with 18 additions and 9 deletions

6
Cargo.lock generated
View file

@ -983,7 +983,7 @@ dependencies = [
[[package]] [[package]]
name = "libcosmic-widgets" name = "libcosmic-widgets"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/pop-os/libcosmic?branch=lucy/widgets#6f7d0fad8009b716197c16459492efbd69cf25b6" source = "git+https://github.com/pop-os/libcosmic?branch=lucy/widgets#feee2bacc313dd15768129de5baabb3aece0e8ec"
dependencies = [ dependencies = [
"gtk4", "gtk4",
"relm4", "relm4",
@ -1434,7 +1434,7 @@ checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
[[package]] [[package]]
name = "relm4" name = "relm4"
version = "0.4.1" version = "0.4.1"
source = "git+https://github.com/AaronErhardt/relm4?branch=new-approach#f5b777ff9530f1dffe3c48614e9a855264c779ec" source = "git+https://github.com/AaronErhardt/relm4?branch=new-approach#ca2817bec39b0e7720cee4c653c7366484ca0586"
dependencies = [ dependencies = [
"async-broadcast", "async-broadcast",
"async-oneshot", "async-oneshot",
@ -1450,7 +1450,7 @@ dependencies = [
[[package]] [[package]]
name = "relm4-macros" name = "relm4-macros"
version = "0.4.1" version = "0.4.1"
source = "git+https://github.com/AaronErhardt/relm4?branch=new-approach#f5b777ff9530f1dffe3c48614e9a855264c779ec" source = "git+https://github.com/AaronErhardt/relm4?branch=new-approach#ca2817bec39b0e7720cee4c653c7366484ca0586"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",

View file

@ -9,9 +9,9 @@ use futures_util::StreamExt;
use gtk4::{ use gtk4::{
glib::{self, clone, source::PRIORITY_DEFAULT, MainContext, Sender}, glib::{self, clone, source::PRIORITY_DEFAULT, MainContext, Sender},
prelude::*, prelude::*,
Align, Image, ListBox, ListBoxRow, Separator, Image, ListBox, ListBoxRow, Separator,
}; };
use libcosmic_widgets::LabeledItem; use libcosmic_widgets::{relm4::RelmContainerExt, LabeledItem};
use std::{cell::RefCell, rc::Rc}; use std::{cell::RefCell, rc::Rc};
use zbus::Connection; use zbus::Connection;
@ -45,9 +45,18 @@ fn build_aps_list(
target.remove(&old_ap_box); target.remove(&old_ap_box);
} }
for ap in aps { for ap in aps {
let entry_box = gtk4::Box::new(gtk4::Orientation::Horizontal, 0); view! {
let labeled_item = LabeledItem::new().attach_to(&entry_box).launch(()).detach(); entry = ListBoxRow {
let entry = ListBoxRow::builder().child(&entry_box).build(); set_child: entry_box = Some(&gtk4::Box) {
container_add: labeled_item = &LabeledItem {
set_title: &ap.ssid,
set_child: icon = &Image {
set_icon_name: Some("network-wireless-symbolic")
}
}
}
}
}
target.append(&entry); target.append(&entry);
ap_entries.push(entry); ap_entries.push(entry);
} }

View file

@ -56,7 +56,7 @@ fn display_active_connections(
flags, flags,
rsn_flags, rsn_flags,
wpa_flags, wpa_flags,
} => todo!(), } => continue,
ActiveConnectionInfo::Vpn { name, ip_addresses } => render_vpn(name, ip_addresses), ActiveConnectionInfo::Vpn { name, ip_addresses } => render_vpn(name, ip_addresses),
}; };
let entry = ListBoxRow::builder().child(&entry).build(); let entry = ListBoxRow::builder().child(&entry).build();