82 lines
1.9 KiB
Rust
82 lines
1.9 KiB
Rust
use adw::Application;
|
|
use std::time::Duration;
|
|
use gtk::Video;
|
|
use gtk::gio;
|
|
use std::fs::File;
|
|
use std::path::Path;
|
|
use gtk::prelude::*;
|
|
use gtk::{self, ApplicationWindow, Button, prelude::*, ListBox, FlowBox, PolicyType, ScrolledWindow, Box, Orientation, Align::*};
|
|
use crate::inv::inv;
|
|
mod inv;
|
|
|
|
|
|
const APP_ID: &str = "org.gtk_rs.MainEventLoop1";
|
|
|
|
fn main() {
|
|
// Create a new application
|
|
let app = Application::builder().application_id(APP_ID).build();
|
|
|
|
// Connect to "activate" signal of `app`
|
|
app.connect_activate(build_ui);
|
|
|
|
let output = inv::inv();
|
|
|
|
print!("{:?}", output);
|
|
// Run the application
|
|
app.run();
|
|
}
|
|
|
|
fn build_ui(app: &Application) {
|
|
// Create a button
|
|
let button = Button::builder()
|
|
.label("Press me!")
|
|
.icon_name("fingerprint-authentication-symbolic")
|
|
.valign(Fill)
|
|
.vexpand(true)
|
|
.margin_top(12)
|
|
.margin_bottom(12)
|
|
.margin_start(12)
|
|
.margin_end(12)
|
|
.build();
|
|
|
|
//button.connect_clicked(move |_| trig_play());
|
|
|
|
let video = Video::for_file(Some(&gio::File::for_path("/home/midou/Vidéos/miui.mp4")));
|
|
|
|
/*
|
|
// Set a listBox
|
|
let listbox = ListBox::builder()
|
|
.child(&video)
|
|
.build();
|
|
|
|
*/
|
|
|
|
// Set a box
|
|
let boxy = Box::new(Orientation::Vertical, 0);
|
|
boxy.append(&video);
|
|
boxy.append(&button);
|
|
|
|
// Then make the window scrollable
|
|
let scrolled_window = ScrolledWindow::builder()
|
|
// .hscrollbar_policy(PolicyType::Never) // Disable horizontal scrolling
|
|
// .hscrollbar_policy()
|
|
.min_content_width(360)
|
|
.child(&boxy)
|
|
.build();
|
|
|
|
// Create a window
|
|
let window = ApplicationWindow::builder()
|
|
.application(app)
|
|
.default_width(1280)
|
|
.default_height(720)
|
|
.title("My GTK App")
|
|
.child(&scrolled_window)
|
|
.build();
|
|
|
|
// Present window
|
|
window.present();
|
|
}
|
|
|
|
//fn trig_play() {
|
|
// let trigger =
|
|
//}
|