From 4f821fccd55a75ee2857c4af156ef8d655c948b1 Mon Sep 17 00:00:00 2001 From: Max Bradbury Date: Tue, 27 Oct 2020 08:08:03 +0000 Subject: [PATCH] change styling --- src/main.rs | 53 ++++++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/src/main.rs b/src/main.rs index 2f3db00..99aa811 100644 --- a/src/main.rs +++ b/src/main.rs @@ -55,12 +55,33 @@ fn build_ui(application: >k::Application) { window.set_title("lull"); window.set_border_width(SPACING as u32); window.set_position(gtk::WindowPosition::Center); - window.set_default_size(256, 256); + window.set_default_size(256, 128); - let vertical = gtk::Box::new(Orientation::Vertical, SPACING); - vertical.set_homogeneous(true); + let button_manage_sounds = gtk::Button::with_label("manage sounds"); - window.add(&vertical); + button_manage_sounds.connect_clicked(|_| { + let mut file_manager = Command::new(file_manager()); + file_manager.arg(get_data_dir()); + file_manager.output().unwrap(); + }); + + let sounds_manage = gtk::Box::new(Orientation::Vertical, SPACING); + let columns = gtk::Box::new(Orientation::Horizontal, SPACING); + let column_labels = gtk::Box::new(Orientation::Vertical, SPACING); + let column_sliders = gtk::Box::new(Orientation::Vertical, SPACING); + + columns.set_homogeneous(false); + column_labels.set_homogeneous(true); + column_sliders.set_homogeneous(true); + column_labels.set_property_expand(false); + column_sliders.set_property_expand(true); + column_sliders.set_property_width_request(128); + + window.add(&sounds_manage); + sounds_manage.add(&columns); + sounds_manage.add(&button_manage_sounds); + columns.add(&column_labels); + columns.add(&column_sliders); let device = rodio::default_output_device().unwrap(); @@ -97,11 +118,9 @@ fn build_ui(application: >k::Application) { sink.append(source); sink.pause(); - let row = gtk::Box::new(Orientation::Horizontal, SPACING); - row.set_homogeneous(true); - let label = gtk::Label::new(Some(name)); - row.add(&label); + label.set_halign(gtk::Align::End); + column_labels.add(&label); let adjustment = gtk::Adjustment::new( 0.0, @@ -130,25 +149,9 @@ fn build_ui(application: >k::Application) { } }); - row.add(&slider); - - vertical.add(&row); + column_sliders.add(&slider); } - let row_add = gtk::Box::new(Orientation::Horizontal, SPACING); - row_add.set_homogeneous(true); - - let button_manage_sounds = gtk::Button::with_label("manage sounds"); - - button_manage_sounds.connect_clicked(|_| { - let mut file_manager = Command::new(file_manager()); - file_manager.arg(get_data_dir()); - file_manager.output().unwrap(); - }); - - row_add.add(&button_manage_sounds); - vertical.add(&row_add); - window.show_all(); }