update margins

This commit is contained in:
yggverse 2025-02-07 16:16:52 +02:00
parent 41f27e654b
commit 39493d5ced
4 changed files with 17 additions and 22 deletions

View file

@ -34,7 +34,6 @@ impl File for Box {
const MARGIN: i32 = 8; const MARGIN: i32 = 8;
let g_box = Box::builder() let g_box = Box::builder()
.margin_bottom(MARGIN)
.margin_end(MARGIN) .margin_end(MARGIN)
.margin_start(MARGIN) .margin_start(MARGIN)
.orientation(Orientation::Vertical) .orientation(Orientation::Vertical)

View file

@ -8,12 +8,9 @@ impl Form for Button {
fn form() -> Self { fn form() -> Self {
use gtk::prelude::{ButtonExt, WidgetExt}; use gtk::prelude::{ButtonExt, WidgetExt};
const MARGIN: i32 = 8;
let button = Button::builder() let button = Button::builder()
.label("Choose a file..") .label("Choose a file..")
.margin_bottom(MARGIN) .margin_top(4)
.margin_top(MARGIN)
.build(); .build();
button.connect_clicked(|this| { button.connect_clicked(|this| {

View file

@ -29,14 +29,12 @@ impl Text for gtk::Box {
// Init widget // Init widget
let g_box = { let g_box = {
const MARGIN: i32 = 8; const MARGIN: i32 = 8;
const SPACING: i32 = 8;
let g_box = gtk::Box::builder() let g_box = gtk::Box::builder()
.margin_bottom(MARGIN) .margin_bottom(MARGIN / 2)
.margin_end(MARGIN) .margin_end(MARGIN)
.margin_start(MARGIN) .margin_start(MARGIN)
.orientation(Orientation::Vertical) .orientation(Orientation::Vertical)
.spacing(SPACING) .spacing(MARGIN)
.build(); .build();
g_box.append(&form); g_box.append(&form);

View file

@ -6,8 +6,6 @@ use gtk::{
use libspelling::{Checker, TextBufferAdapter}; use libspelling::{Checker, TextBufferAdapter};
use sourceview::Buffer; use sourceview::Buffer;
const MARGIN: i32 = 8;
pub trait Form { pub trait Form {
fn form() -> Self; fn form() -> Self;
fn text(&self) -> GString; fn text(&self) -> GString;
@ -27,17 +25,20 @@ impl Form for TextView {
adapter.set_enabled(true); adapter.set_enabled(true);
// Init main widget // Init main widget
let text_view = TextView::builder()
.bottom_margin(MARGIN) let text_view = {
.buffer(&buffer) const MARGIN: i32 = 8;
.css_classes(["frame", "view"]) TextView::builder()
.extra_menu(&adapter.menu_model()) .bottom_margin(MARGIN)
.left_margin(MARGIN) .buffer(&buffer)
.margin_bottom(MARGIN / 2) .css_classes(["frame", "view"])
.right_margin(MARGIN) .extra_menu(&adapter.menu_model())
.top_margin(MARGIN) .left_margin(MARGIN)
.wrap_mode(WrapMode::Word) .right_margin(MARGIN)
.build(); .top_margin(MARGIN)
.wrap_mode(WrapMode::Word)
.build()
};
text_view.insert_action_group("spelling", Some(&adapter)); text_view.insert_action_group("spelling", Some(&adapter));
text_view.set_size_request(-1, 38); // @TODO [#635](https://gitlab.gnome.org/GNOME/pygobject/-/issues/635) text_view.set_size_request(-1, 38); // @TODO [#635](https://gitlab.gnome.org/GNOME/pygobject/-/issues/635)