Prettier UI
This commit is contained in:
parent
0ba1ea9237
commit
5088ab9a0e
5 changed files with 103 additions and 54 deletions
|
|
@ -49,7 +49,7 @@ impl AsyncComponent for App {
|
|||
view! {
|
||||
adw::Window {
|
||||
set_title: Some("Burrow"),
|
||||
set_default_size: (640, 480),
|
||||
set_default_size: (640, 800),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,39 +32,57 @@ impl AsyncComponent for NetworkCard {
|
|||
|
||||
view! {
|
||||
gtk::ListBoxRow {
|
||||
set_halign: Align::Fill,
|
||||
set_margin_vertical: 5,
|
||||
set_margin_horizontal: 25,
|
||||
set_hexpand: true,
|
||||
set_halign: Align::Center,
|
||||
|
||||
gtk::Box {
|
||||
set_halign: Align::Fill,
|
||||
set_hexpand: true,
|
||||
set_spacing: 10,
|
||||
|
||||
gtk::Box {
|
||||
set_halign: Align::Start,
|
||||
|
||||
gtk::Switch {
|
||||
set_active: init.enabled,
|
||||
},
|
||||
},
|
||||
|
||||
gtk::Box {
|
||||
set_halign: Align::Center,
|
||||
set_hexpand: true,
|
||||
|
||||
gtk::Label {
|
||||
set_label: &init.name
|
||||
},
|
||||
gtk::Switch {
|
||||
set_halign: Align::Center,
|
||||
set_hexpand: false,
|
||||
set_vexpand: false,
|
||||
set_state: init.enabled,
|
||||
},
|
||||
|
||||
|
||||
gtk::Box {
|
||||
set_halign: Align::End,
|
||||
set_spacing: 5,
|
||||
|
||||
gtk::Button {
|
||||
set_icon_name: "list-remove",
|
||||
set_margin_all: 12,
|
||||
|
||||
connect_clicked => NetworkCardMsg::NetworkDelete,
|
||||
},
|
||||
gtk::Button {
|
||||
set_icon_name: "pan-up-symbolic",
|
||||
set_margin_all: 12,
|
||||
|
||||
connect_clicked => NetworkCardMsg::MoveUp,
|
||||
},
|
||||
gtk::Button {
|
||||
set_icon_name: "pan-down-symbolic",
|
||||
set_margin_all: 12,
|
||||
|
||||
connect_clicked => NetworkCardMsg::MoveDown,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async fn init(
|
||||
init: Self::Init,
|
||||
|
|
@ -86,7 +104,7 @@ impl AsyncComponent for NetworkCard {
|
|||
async fn update(
|
||||
&mut self,
|
||||
msg: Self::Input,
|
||||
_: AsyncComponentSender<Self>,
|
||||
_sender: AsyncComponentSender<Self>,
|
||||
_root: &Self::Root,
|
||||
) {
|
||||
match msg {
|
||||
|
|
|
|||
|
|
@ -32,12 +32,21 @@ impl AsyncComponent for Networks {
|
|||
view! {
|
||||
gtk::Box {
|
||||
set_orientation: gtk::Orientation::Vertical,
|
||||
set_spacing: 5,
|
||||
set_spacing: 20,
|
||||
set_margin_all: 5,
|
||||
set_valign: Align::Fill,
|
||||
set_vexpand: true,
|
||||
|
||||
gtk::Box {
|
||||
set_orientation: gtk::Orientation::Horizontal,
|
||||
set_spacing: 10,
|
||||
set_margin_all: 5,
|
||||
set_valign: Align::Start,
|
||||
set_halign: Align::Center,
|
||||
|
||||
#[name = "networks"]
|
||||
gtk::ListBox {},
|
||||
gtk::Label {
|
||||
set_label: "Add Network",
|
||||
},
|
||||
|
||||
gtk::Button {
|
||||
set_icon_name: "list-add",
|
||||
|
|
@ -45,6 +54,21 @@ impl AsyncComponent for Networks {
|
|||
|
||||
connect_clicked => NetworksMsg::NetworkAdd,
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
gtk::ScrolledWindow {
|
||||
set_valign: Align::Fill,
|
||||
set_vexpand: true,
|
||||
set_margin_bottom: 50,
|
||||
set_margin_start: 50,
|
||||
set_margin_end: 50,
|
||||
|
||||
#[name = "networks"]
|
||||
gtk::ListBox {
|
||||
set_vexpand: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -86,10 +110,30 @@ impl AsyncComponent for Networks {
|
|||
enabled: false,
|
||||
})
|
||||
.forward(sender.input_sender(), |_| NetworksMsg::None),
|
||||
NetworkCard::builder()
|
||||
.launch(NetworkCardInit {
|
||||
id: 2,
|
||||
index: 2,
|
||||
index_max: 3,
|
||||
daemon_client: Arc::clone(&init.daemon_client),
|
||||
name: "Yay".to_owned(),
|
||||
enabled: false,
|
||||
})
|
||||
.forward(sender.input_sender(), |_| NetworksMsg::None),
|
||||
NetworkCard::builder()
|
||||
.launch(NetworkCardInit {
|
||||
id: 2,
|
||||
index: 2,
|
||||
index_max: 3,
|
||||
daemon_client: Arc::clone(&init.daemon_client),
|
||||
name: "Yay".to_owned(),
|
||||
enabled: false,
|
||||
})
|
||||
.forward(sender.input_sender(), |_| NetworksMsg::None),
|
||||
];
|
||||
widgets.networks.append(network_cards[0].widget());
|
||||
widgets.networks.append(network_cards[1].widget());
|
||||
widgets.networks.append(network_cards[2].widget());
|
||||
for network_card in network_cards.iter() {
|
||||
widgets.networks.append(network_card.widget());
|
||||
}
|
||||
// let network_cards = vec![];
|
||||
|
||||
let model = Networks {
|
||||
|
|
|
|||
|
|
@ -48,14 +48,13 @@ impl AsyncComponent for Switch {
|
|||
},
|
||||
|
||||
gtk::Box {
|
||||
set_orientation: gtk::Orientation::Vertical,
|
||||
set_orientation: gtk::Orientation::Horizontal,
|
||||
set_spacing: 10,
|
||||
set_margin_all: 5,
|
||||
set_valign: Align::Center,
|
||||
set_vexpand: true,
|
||||
set_halign: Align::Center,
|
||||
|
||||
gtk::Label {
|
||||
set_label: "Burrow Switch",
|
||||
set_label: "Burrow Tunnel",
|
||||
},
|
||||
|
||||
#[name(switch)]
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ impl AsyncComponent for MainScreen {
|
|||
gtk::Box {
|
||||
set_orientation: gtk::Orientation::Vertical,
|
||||
set_valign: Align::Fill,
|
||||
set_valign: Align::Center,
|
||||
set_vexpand: true,
|
||||
|
||||
gtk::Box {
|
||||
set_orientation: gtk::Orientation::Vertical,
|
||||
|
|
@ -43,25 +43,13 @@ impl AsyncComponent for MainScreen {
|
|||
},
|
||||
},
|
||||
|
||||
gtk::Box {
|
||||
set_orientation: gtk::Orientation::Vertical,
|
||||
set_spacing: 10,
|
||||
set_margin_all: 5,
|
||||
set_valign: Align::Center,
|
||||
set_vexpand: true,
|
||||
},
|
||||
|
||||
#[name(content)]
|
||||
gtk::Box {
|
||||
set_orientation: gtk::Orientation::Vertical,
|
||||
set_spacing: 10,
|
||||
set_margin_all: 5,
|
||||
set_valign: Align::Center,
|
||||
set_valign: Align::Fill,
|
||||
set_vexpand: true,
|
||||
|
||||
gtk::Label {
|
||||
set_label: "Main Screen",
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -85,8 +73,8 @@ impl AsyncComponent for MainScreen {
|
|||
|
||||
let widgets = view_output!();
|
||||
|
||||
widgets.content.append(networks.widget());
|
||||
widgets.content.append(switch.widget());
|
||||
widgets.content.append(networks.widget());
|
||||
|
||||
let model = MainScreen {
|
||||
_switch: switch,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue