diff --git a/Cargo.lock b/Cargo.lock index 6fa949e..2d8c689 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -398,6 +398,7 @@ version = "0.1.0" dependencies = [ "anyhow", "gtk4", + "libadwaita", ] [[package]] @@ -410,6 +411,37 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "libadwaita" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ff9c222b5c783729de45185f07b2fec2d43a7f9c63961e777d3667e20443878" +dependencies = [ + "gdk4", + "gio", + "glib", + "gtk4", + "libadwaita-sys", + "libc", + "pango", +] + +[[package]] +name = "libadwaita-sys" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c44d8bdbad31d6639e1f20cc9c1424f1a8e02d751fc28d44659bf743fb9eca6" +dependencies = [ + "gdk4-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "gtk4-sys", + "libc", + "pango-sys", + "system-deps", +] + [[package]] name = "libc" version = "0.2.158" diff --git a/Cargo.toml b/Cargo.toml index 9913a79..a8c1e80 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,5 +4,6 @@ version = "0.1.0" edition = "2021" [dependencies] +adw = { version = "0.7.0", package = "libadwaita", features = ["v1_5"] } anyhow = "1.0.86" gtk = { version = "0.9.0", package = "gtk4", features = ["v4_14"] } diff --git a/src/main.rs b/src/main.rs index 165a87a..94e74cb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,5 @@ use crate::glib::clone; +use adw; use gtk::prelude::*; use gtk::{self, glib, Application, ApplicationWindow, Button, Image}; use std::cell::Cell; @@ -11,7 +12,7 @@ const APP_ID: &str = "org.gtk_rs.GObjectMemoryManagement1"; fn main() -> glib::ExitCode { // Create a new application - let app = Application::builder().application_id(APP_ID).build(); + let app = adw::Application::builder().application_id(APP_ID).build(); // Connect to "activate" signal of `app` app.connect_activate(build_ui); @@ -45,7 +46,7 @@ fn get_pictures_in_folder(folder: String) -> anyhow::Result> { Ok(myvec) } -fn build_ui(application: &Application) { +fn build_ui(application: &adw::Application) { // Create a vertical container let mut vbox = gtk::Box::new(gtk::Orientation::Vertical, 0); @@ -98,7 +99,6 @@ fn build_ui(application: &Application) { curr_pic.set(new_index); image.set_from_file(Some(shared_pics[curr_pic.get()].clone())); dbg!(new_index.clone()); - println!("haaa"); } )); @@ -113,7 +113,6 @@ fn build_ui(application: &Application) { curr_pic.set(new_index); image.set_from_file(Some(shared_pics[curr_pic.get()].clone())); dbg!(new_index.clone()); - println!("haaa"); } ));