From e85474989b7a2a4840011608d4681dc140519b77 Mon Sep 17 00:00:00 2001 From: Olaf Wintermann Date: Sat, 25 Jul 2026 12:32:52 +0200 Subject: [PATCH] use new widget macros in the newnotebook dialog --- application/note/src/newnotebook.rs | 47 +++++++++++++++-------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/application/note/src/newnotebook.rs b/application/note/src/newnotebook.rs index 7c6a519..78e25f0 100644 --- a/application/note/src/newnotebook.rs +++ b/application/note/src/newnotebook.rs @@ -26,7 +26,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ use backend::backend::BackendHandle; -use ui_rs::{UiModel, ui_actions}; +use ui_rs::{UiModel, ui_actions, grid, rlabel, dropdown, textfield, llabel}; use ui_rs::ui::*; use entity::collection::{Model as Collection}; @@ -109,26 +109,29 @@ pub fn new_notebook_dialog(parent: &UiObject, groups: &Vec, ba data.groups.data_mut().extend(groups.clone()); // create dialog UI - obj.grid(|a| { - a.margin(10); - a.columnspacing(10); - a.rowspacing(10); - a.def_hexpand(true); - a.def_hfill(true); - a.def_vfill(true); - a.fill(true); - }, |obj| { - obj.grid_row(|obj| { - obj.rlabel_builder().label("Group").create(); - obj.dropdown_builder::().value(&data.groups).getvalue(|e, _col, _row| ListValue::String(e.name.clone()) ).create(); - }); - obj.grid_row(|obj| { - obj.rlabel_builder().label("Name").create(); - obj.textfield_builder().value(&data.name).create(); - }); - obj.grid_row(|obj| { - obj.llabel_builder().value(&data.message).colspan(2).create(); - }); - }); + grid!(obj, + margin = 10, + columnspacing = 10, + rowspacing = 10, + def_hexpand = true, + def_hfill = true, + def_vfill = true, + fill = true, + |g|{ + g.grid_row(|obj|{ + rlabel!(obj, label = "Group"); + dropdown!(obj, + value = &data.groups, + getvalue = |e: &Collection, _col, _row| ListValue::String(e.name.clone())); + }); + g.grid_row(|obj|{ + rlabel!(obj, label = "Name"); + textfield!(obj, value = &data.name); + }); + g.grid_row(|obj|{ + llabel!(obj, value = &data.message, colspan = 2); + }); + } + ); }).show(); } \ No newline at end of file -- 2.52.0