From 28505c15cbed5b8ac99688c34a9310dc0649ccc1 Mon Sep 17 00:00:00 2001 From: Savanni D'Gerinel Date: Thu, 25 Jan 2024 09:03:17 -0500 Subject: [PATCH] Add a test program for gnome icons --- Cargo.lock | 11 +++++++++++ Cargo.toml | 1 + flake.nix | 1 + icon-test/Cargo.toml | 12 ++++++++++++ icon-test/src/main.rs | 38 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 63 insertions(+) create mode 100644 icon-test/Cargo.toml create mode 100644 icon-test/src/main.rs diff --git a/Cargo.lock b/Cargo.lock index c823cc8..54edc50 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1026,6 +1026,7 @@ dependencies = [ "dimensioned 0.8.0", "emseries", "ft-core", + "gdk4", "gio", "glib", "glib-build-tools 0.18.0", @@ -1941,6 +1942,16 @@ dependencies = [ "cc", ] +[[package]] +name = "icon-test" +version = "0.1.0" +dependencies = [ + "gio", + "glib", + "gtk4", + "libadwaita", +] + [[package]] name = "idna" version = "0.1.5" diff --git a/Cargo.toml b/Cargo.toml index af6549d..08220fc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,7 @@ members = [ "geo-types", "gm-control-panel", "hex-grid", + "icon-test", "ifc", "kifu/core", "kifu/gtk", diff --git a/flake.nix b/flake.nix index 0854e20..88677a7 100644 --- a/flake.nix +++ b/flake.nix @@ -36,6 +36,7 @@ pkgs.gst_all_1.gstreamer pkgs.gtk4 pkgs.libadwaita + pkgs.librsvg pkgs.nodejs pkgs.openssl pkgs.pipewire diff --git a/icon-test/Cargo.toml b/icon-test/Cargo.toml new file mode 100644 index 0000000..27b7f1c --- /dev/null +++ b/icon-test/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "icon-test" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +adw = { version = "0.5", package = "libadwaita", features = [ "v1_4" ] } +gio = { version = "0.18" } +glib = { version = "0.18" } +gtk = { version = "0.7", package = "gtk4", features = [ "v4_10" ] } diff --git a/icon-test/src/main.rs b/icon-test/src/main.rs new file mode 100644 index 0000000..7349f55 --- /dev/null +++ b/icon-test/src/main.rs @@ -0,0 +1,38 @@ +use adw::prelude::*; + +fn main() { + let adw_app = adw::Application::builder().build(); + + adw_app.connect_activate(move |adw_app| { + let window = gtk::ApplicationWindow::builder() + .application(adw_app) + .width_request(400) + .height_request(400) + .build(); + + let sunrise_button = gtk::Button::builder() + .icon_name("daytime-sunrise-symbolic") + .width_request(64) + .height_request(64) + .build(); + + let walking_button = gtk::Button::builder() + .icon_name("walking2-symbolic") + .width_request(64) + .height_request(64) + .build(); + + let layout = gtk::Box::builder() + .orientation(gtk::Orientation::Horizontal) + .valign(gtk::Align::Start) + .build(); + layout.append(&sunrise_button); + layout.append(&walking_button); + + window.set_child(Some(&layout)); + window.present(); + }); + + let args: Vec = std::env::args().collect(); + ApplicationExtManual::run_with_args(&adw_app, &args); +}