🚧 fix layout

This commit is contained in:
Vladislav Nepogodin 2023-02-19 01:12:49 +04:00
parent 245c9ef2ae
commit 9a4034dc84
No known key found for this signature in database
GPG Key ID: B62C3D10C54D5DA9
2 changed files with 21 additions and 20 deletions

View File

@ -26,6 +26,7 @@ pub struct ApplicationBrowser {
pub tree_view: gtk::TreeView, pub tree_view: gtk::TreeView,
pub app_browser_box: gtk::Box, pub app_browser_box: gtk::Box,
pub button_box: gtk::Box, pub button_box: gtk::Box,
pub back_btn: gtk::Button,
pub update_system_btn: gtk::Button, pub update_system_btn: gtk::Button,
} }
@ -57,6 +58,17 @@ impl ApplicationBrowser {
let child_name = "appBrowserpage"; let child_name = "appBrowserpage";
let back_image = gtk::Image::from_icon_name(Some("go-previous"), gtk::IconSize::Button);
let back_btn = gtk::Button::new();
back_btn.set_image(Some(&back_image));
back_btn.set_widget_name("home");
let back_grid = gtk::Grid::new();
back_grid.set_hexpand(true);
back_grid.set_margin_start(10);
back_grid.set_margin_top(5);
back_grid.attach(&back_btn, 0, 1, 1, 1);
let button_box = gtk::Box::new(gtk::Orientation::Horizontal, 10); let button_box = gtk::Box::new(gtk::Orientation::Horizontal, 10);
button_box.set_widget_name(child_name); button_box.set_widget_name(child_name);
let advanced_button = gtk::ToggleButton::with_label("advanced"); let advanced_button = gtk::ToggleButton::with_label("advanced");
@ -89,6 +101,7 @@ impl ApplicationBrowser {
button_box.pack_end(&reset_button, false, false, 10); button_box.pack_end(&reset_button, false, false, 10);
// button_box.pack_end(&download_button, false, false, 10); // button_box.pack_end(&download_button, false, false, 10);
app_browser_box.pack_start(&back_grid, false, false, 0);
app_browser_box.pack_start(&button_box, false, false, 10); app_browser_box.pack_start(&button_box, false, false, 10);
let col_types: [glib::Type; 7] = [ let col_types: [glib::Type; 7] = [
@ -112,6 +125,7 @@ impl ApplicationBrowser {
tree_view: gtk::TreeView::new(), tree_view: gtk::TreeView::new(),
app_browser_box, app_browser_box,
button_box, button_box,
back_btn,
update_system_btn, update_system_btn,
} }
} }

View File

@ -310,6 +310,7 @@ pub fn create_tweaks_page(builder: &Builder) {
grid.set_margin_top(5); grid.set_margin_top(5);
grid.set_margin_bottom(5); grid.set_margin_bottom(5);
grid.attach(&back_btn, 0, 1, 1, 1); grid.attach(&back_btn, 0, 1, 1, 1);
let box_collection_s = gtk::Box::new(gtk::Orientation::Vertical, 5);
let box_collection = gtk::Box::new(gtk::Orientation::Vertical, 5); let box_collection = gtk::Box::new(gtk::Orientation::Vertical, 5);
box_collection.set_widget_name(child_name); box_collection.set_widget_name(child_name);
@ -322,8 +323,9 @@ pub fn create_tweaks_page(builder: &Builder) {
box_collection.set_valign(gtk::Align::Center); box_collection.set_valign(gtk::Align::Center);
box_collection.set_halign(gtk::Align::Center); box_collection.set_halign(gtk::Align::Center);
grid.attach(&box_collection, 1, 2, 5, 1); box_collection_s.pack_start(&grid, false, false, 0);
viewport.add(&grid); box_collection_s.pack_start(&box_collection, false, false, 10);
viewport.add(&box_collection_s);
viewport.show_all(); viewport.show_all();
let stack: gtk::Stack = builder.object("stack").unwrap(); let stack: gtk::Stack = builder.object("stack").unwrap();
@ -335,32 +337,17 @@ pub fn create_appbrowser_page(builder: &Builder) {
install.set_visible(true); install.set_visible(true);
let viewport = gtk::Viewport::new(gtk::Adjustment::NONE, gtk::Adjustment::NONE); let viewport = gtk::Viewport::new(gtk::Adjustment::NONE, gtk::Adjustment::NONE);
let image = gtk::Image::from_icon_name(Some("go-previous"), gtk::IconSize::Button); let app_browser_ref = ApplicationBrowser::default_impl().lock().unwrap();
let back_btn = gtk::Button::new(); app_browser_ref.back_btn.connect_clicked(glib::clone!(@weak builder => move |button| {
back_btn.set_image(Some(&image));
back_btn.set_widget_name("home");
back_btn.connect_clicked(glib::clone!(@weak builder => move |button| {
let name = button.widget_name(); let name = button.widget_name();
let stack: gtk::Stack = builder.object("stack").unwrap(); let stack: gtk::Stack = builder.object("stack").unwrap();
stack.set_visible_child_name(&format!("{name}page")); stack.set_visible_child_name(&format!("{name}page"));
})); }));
let grid = gtk::Grid::new();
grid.set_hexpand(true);
grid.set_margin_start(10);
grid.set_margin_end(10);
grid.set_margin_top(5);
grid.set_margin_bottom(5);
grid.attach(&back_btn, 0, 1, 1, 1);
let app_browser_ref = ApplicationBrowser::default_impl().lock().unwrap();
let app_browser_box = app_browser_ref.get_page(); let app_browser_box = app_browser_ref.get_page();
grid.attach(app_browser_box, 0, 2, 1, 1);
// Add grid to the viewport // Add grid to the viewport
// NOTE: we might eliminate that? // NOTE: we might eliminate that?
viewport.add(&grid); viewport.add(app_browser_box);
viewport.show_all(); viewport.show_all();
let stack: gtk::Stack = builder.object("stack").unwrap(); let stack: gtk::Stack = builder.object("stack").unwrap();