Just merge it

This commit is contained in:
Midou36O 2022-09-08 10:21:06 +01:00
commit 0eccfd03fc
Signed by: midou
GPG Key ID: 08063D5407090BC2
5 changed files with 120 additions and 2 deletions

View File

@ -1,5 +1,3 @@
# GTubeK
## Attempt to make a invidious GTK4/Libadwaita client using Rust.
(Warning: i barely know anything about rust. Open Issues when something is wrong!)

10
inv.rs Normal file
View File

@ -0,0 +1,10 @@
use invidious::reqwest::blocking::Client;
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
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(())
}

52
main.rs Normal file
View File

@ -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();
}

1
uai.rs Normal file
View File

@ -0,0 +1 @@
pub mod ui;

57
uai/ui.rs Normal file
View File

@ -0,0 +1,57 @@