properties: cleanup Label creation

This commit is contained in:
Stéphane Cerveau 2022-02-10 13:23:22 +01:00
parent 57160b3bce
commit 088aff1576

View file

@ -195,10 +195,12 @@ pub fn display_plugin_properties(app: &GPSApp, element_name: &str, node_id: u32)
}), }),
); );
if let Some(widget) = widget { if let Some(widget) = widget {
let label = gtk::Label::new(Some(name)); let label = gtk::Label::builder()
label.set_hexpand(true); .label(name)
label.set_halign(gtk::Align::Start); .hexpand(true)
label.set_margin_start(4); .halign(gtk::Align::Start)
.margin_start(4)
.build();
grid.attach(&label, 0, i, 1, 1); grid.attach(&label, 0, i, 1, 1);
grid.attach(&widget, 1, i, 1, 1); grid.attach(&widget, 1, i, 1, 1);
i += 1; i += 1;
@ -236,10 +238,12 @@ pub fn display_pad_properties(
let mut i = 0; let mut i = 0;
let properties = app.pad_properties(node_id, port_id); let properties = app.pad_properties(node_id, port_id);
for (name, value) in properties { for (name, value) in properties {
let property_name = gtk::Label::new(Some(&name)); let property_name = gtk::Label::builder()
property_name.set_hexpand(true); .label(&name)
property_name.set_halign(gtk::Align::Start); .hexpand(true)
property_name.set_margin_start(4); .halign(gtk::Align::Start)
.margin_start(4)
.build();
let property_value = gtk::Entry::new(); let property_value = gtk::Entry::new();
property_value.set_width_request(150); property_value.set_width_request(150);
property_value.set_text(&value); property_value.set_text(&value);
@ -254,10 +258,12 @@ pub fn display_pad_properties(
} }
// Add a new property allowing to set pads property. // Add a new property allowing to set pads property.
let label = gtk::Label::new(Some("Add a new Property")); let label = gtk::Label::builder()
label.set_hexpand(true); .label("Add a new Property")
label.set_halign(gtk::Align::Start); .hexpand(true)
label.set_margin_start(4); .halign(gtk::Align::Start)
.margin_start(4)
.build();
let property_name = gtk::Entry::new(); let property_name = gtk::Entry::new();
property_name.set_width_request(150); property_name.set_width_request(150);