From 1d0f0a3dcbdc1d7fbb6134643ebc4aeb980427f1 Mon Sep 17 00:00:00 2001 From: Rasmus Thomsen Date: Sun, 2 Jun 2019 01:11:51 +0200 Subject: [PATCH] feat(gxi): set gxi's icon as window icon --- Cargo.lock | 1 + src/gxi/Cargo.toml | 1 + src/gxi/src/main_win.rs | 4 ++++ src/gxi/src/ui/resources.xml | 1 + 4 files changed, 7 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index a2e4ff3..e7a24f0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -718,6 +718,7 @@ dependencies = [ "env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "gdk 0.10.0 (git+https://github.com/gtk-rs/gdk)", + "gdk-pixbuf 0.6.0 (git+https://github.com/gtk-rs/gdk-pixbuf)", "gettext-rs 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "gio 0.6.0 (git+https://github.com/gtk-rs/gio)", "glib 0.7.0 (git+https://github.com/gtk-rs/glib)", diff --git a/src/gxi/Cargo.toml b/src/gxi/Cargo.toml index bf358c3..6814d8d 100644 --- a/src/gxi/Cargo.toml +++ b/src/gxi/Cargo.toml @@ -24,6 +24,7 @@ enclose = "1" env_logger = "0.6" failure = "0.1" gdk = { git="https://github.com/gtk-rs/gdk" } +gdk-pixbuf = { git="https://github.com/gtk-rs/gdk-pixbuf" } gettext-rs = { version="0.4", features=["gettext-system"] } gio = { git="https://github.com/gtk-rs/gio" } glib = { git="https://github.com/gtk-rs/glib" } diff --git a/src/gxi/src/main_win.rs b/src/gxi/src/main_win.rs index b154272..8de216c 100644 --- a/src/gxi/src/main_win.rs +++ b/src/gxi/src/main_win.rs @@ -2,6 +2,7 @@ use crate::about_win::AboutWin; use crate::errors::ErrorDialog; use crate::prefs_win::PrefsWin; use editview::{theme::u32_from_color, theme::LineStyle, EditView, MainState, Settings}; +use gdk_pixbuf::Pixbuf; use gettextrs::gettext; use gio::{ActionMapExt, ApplicationExt, Resource, SettingsExt, SimpleAction}; use glib::{Bytes, MainContext}; @@ -98,6 +99,9 @@ impl MainWin { let properties = RefCell::new(WinProp::new(&application)); let window: ApplicationWindow = builder.get_object("appwindow").unwrap(); + let icon = Pixbuf::new_from_resource("/com/github/Cogitri/gxi/com.github.Cogitri.gxi.svg"); + window.set_icon(icon.ok().as_ref()); + if properties.borrow().is_maximized { window.maximize(); } else { diff --git a/src/gxi/src/ui/resources.xml b/src/gxi/src/ui/resources.xml index c409547..958ad10 100644 --- a/src/gxi/src/ui/resources.xml +++ b/src/gxi/src/ui/resources.xml @@ -3,5 +3,6 @@ gxi.glade prefs_win.glade + ../../../../data/icons//hicolor/scalable/apps/com.github.Cogitri.gxi.svg