From 0e34138a6ab02d2cc5c95ccdcc4cf78ffeef7e54 Mon Sep 17 00:00:00 2001 From: Julian Mutter Date: Sun, 26 May 2024 09:36:57 +0200 Subject: [PATCH] Make dialog look good --- src/ui/sheet_edit_dialog.rs | 67 ++++++++++++++++++++++++------------- 1 file changed, 43 insertions(+), 24 deletions(-) diff --git a/src/ui/sheet_edit_dialog.rs b/src/ui/sheet_edit_dialog.rs index 6fc5bac..99968e0 100644 --- a/src/ui/sheet_edit_dialog.rs +++ b/src/ui/sheet_edit_dialog.rs @@ -48,41 +48,60 @@ impl AsyncComponent for SheetEditDialogModel { set_visible: !model.hidden, set_modal: true, set_title: Some("Edit sheet"), + set_default_width: 10, + set_default_height: 10, gtk::Box { set_orientation: gtk::Orientation::Vertical, - set_margin_all : 5, - gtk::Label { - set_text: "Sheet name" + set_margin_all : 15, + set_spacing: 5, + gtk::Box { + set_spacing: 10, + gtk::Label { + set_text: "Sheet name" + }, + gtk::Entry { + #[watch] + set_text: &model.sheet_name, + set_width_chars: 40, + }, }, - gtk::Entry { - #[watch] - set_text: &model.sheet_name, + gtk::Box { + set_spacing: 10, + gtk::Label { + set_text: "Sheet composer" + }, + gtk::Entry { + #[watch] + set_text : &model.sheet_composer, + set_hexpand: true, + }, }, - gtk::Label { - set_text: "Sheet composer" - }, - gtk::Entry { - #[watch] - set_text : &model.sheet_composer, - }, - gtk::Label { - set_text: "Book" - }, - gtk::CheckButton { - #[watch] - set_active: model.is_book, + gtk::Box { + set_spacing: 10, + gtk::Label { + set_text: "Book" + }, + gtk::CheckButton { + #[watch] + set_active: model.is_book, + }, }, gtk::Box { set_orientation: gtk::Orientation::Horizontal, - set_margin_top:5, + set_margin_top: 10, + set_spacing: 10, + set_homogeneous: true, + set_halign: gtk::Align::Center, + set_hexpand: true, + + gtk::Button { + set_label: "Cancel", + connect_clicked[sender] => move |_| sender.input(SheetEditDialogInput::Cancel) + }, gtk::Button { set_label : "Confirm", connect_clicked[sender] => move |_| sender.input(SheetEditDialogInput::Accept) }, - gtk::Button { - set_label: "Cancel", - connect_clicked[sender] => move |_| sender.input(SheetEditDialogInput::Cancel) - } } } }