From e2157b76f7510095272b5c28c7db69d51503feaf Mon Sep 17 00:00:00 2001 From: Midou36O Date: Thu, 8 Sep 2022 10:15:08 +0100 Subject: [PATCH 1/2] The mess i'm trying to make --- inv.rs | 10 ++++++++++ main.rs | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++ uai.rs | 1 + uai/ui.rs | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 120 insertions(+) create mode 100644 inv.rs create mode 100644 main.rs create mode 100644 uai.rs create mode 100644 uai/ui.rs 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 04d80aff962efe50cbd666a1d3069edbec274553 Mon Sep 17 00:00:00 2001 From: Midou36O Date: Thu, 8 Sep 2022 10:16:20 +0100 Subject: [PATCH 2/2] something --- README.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..1376f3c --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# GTubeK + +## Attempt to make a invidious GTK4/Libadwaita client using Rust. + +(Warning: i barely know anything about rust. Open Issues when something is wrong!)