From af493395170a5267af48fe0b7a8d3e787a6a0543 Mon Sep 17 00:00:00 2001 From: Max Bradbury Date: Fri, 11 Sep 2020 09:37:02 +0100 Subject: [PATCH] initial mockup --- .gitignore | 2 ++ Cargo.toml | 11 +++++++++++ src/main.rs | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.toml create mode 100644 src/main.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4fffb2f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/target +/Cargo.lock diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..b206e72 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "youtube-dl-gtk" +version = "0.1.0" +authors = ["Max Bradbury "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +gio = "^0" +gtk = "^0" diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..15eb633 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,49 @@ +use gio::prelude::*; +use gtk::prelude::*; +use std::env::args; +use gtk::Orientation; + +const SPACING: i32 = 16; + +fn build_ui(application: >k::Application) { + let window = gtk::ApplicationWindow::new(application); + + window.set_title("youtube-dl"); + window.set_border_width(10); + window.set_position(gtk::WindowPosition::Center); + window.set_default_size(400, 100); + + let vertical = gtk::Box::new(Orientation::Vertical, SPACING); + let url = gtk::Entry::new(); + let horizontal = gtk::Box::new(Orientation::Horizontal, SPACING); + let convert_to_mp3 = gtk::CheckButton::with_label("convert to mp3"); + let button = gtk::Button::with_label("Go!"); + + url.set_placeholder_text(Some("Enter URL here")); + + horizontal.set_spacing(SPACING); + horizontal.set_homogeneous(true); + + window.add(&vertical); + + vertical.add(&url); + vertical.add(&horizontal); + + horizontal.add(&convert_to_mp3); + horizontal.add(&button); + + window.show_all(); +} + +fn main() { + let application = gtk::Application::new( + Some("dev.tinybird.max.youtube-dl-gtk"), + Default::default() + ).expect("Initialization failed..."); + + application.connect_activate(|app| { + build_ui(app); + }); + + application.run(&args().collect::>()); +}