commit e2157b76f7510095272b5c28c7db69d51503feaf Author: Midou36O Date: Thu Sep 8 10:15:08 2022 +0100 The mess i'm trying to make diff --git a/inv.rs b/inv.rs new file mode 100644 index 0000000..5c47af1 --- /dev/null +++ b/inv.rs @@ -0,0 +1,10 @@ +use invidious::reqwest::blocking::Client; +use std::error::Error; + +fn main() -> Result<(), Box> { + let client = Client::new(String::from("https://vid.puffyan.us")); + let search_results = client.search(Some("q=rust programming"))?.items; + let video = client.video("5C_HPTJg5ek", None)?; + + Ok(()) +} \ No newline at end of file diff --git a/main.rs b/main.rs new file mode 100644 index 0000000..7af0eab --- /dev/null +++ b/main.rs @@ -0,0 +1,52 @@ +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::*}; +use invidious::reqwest::blocking::functions::video; +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); + + print!("{}: {}", video.title, video.author); + + // Run the application + app.run(); +} + +fn build_ui(app: &Application) { + // Create a button + let button = Button::builder() + .label("Press me!") + .margin_top(12) + .margin_bottom(12) + .margin_start(12) + .margin_end(12) + .build(); + + + let video = Video::for_file(Some(&gio::File::for_path("/home/midou/Vidéos/miui.mp4"))); + + + // Create a window + let window = ApplicationWindow::builder() + .application(app) + .title("My GTK App") + .child(&button) + .child(&video) + .build(); + + // Present window + window.present(); +} diff --git a/uai.rs b/uai.rs new file mode 100644 index 0000000..b71b381 --- /dev/null +++ b/uai.rs @@ -0,0 +1 @@ +pub mod ui; \ No newline at end of file diff --git a/uai/ui.rs b/uai/ui.rs new file mode 100644 index 0000000..bd70cd1 --- /dev/null +++ b/uai/ui.rs @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +