relm4_icons/
lib.rs

1//! More than 3000 icons, ready for use in your app!
2//!
3//! # Sources
4//!
5//! Icons are from
6//!
7//! + [icon-development-kit](https://gitlab.gnome.org/Teams/Design/icon-development-kit) ([CC0 license](https://gitlab.gnome.org/Teams/Design/icon-development-kit/-/blob/main/COPYING.md))
8//! + [fluentui-system-icons](https://github.com/microsoft/fluentui-system-icons) ([MIT license](https://github.com/microsoft/fluentui-system-icons/blob/main/LICENSE))
9
10#![warn(
11    missing_debug_implementations,
12    missing_docs,
13    rust_2018_idioms,
14    unreachable_pub,
15    unused_qualifications,
16    clippy::cargo,
17    clippy::must_use_candidate
18)]
19#![allow(clippy::negative_feature_names, clippy::multiple_crate_versions)]
20#![cfg_attr(docsrs, feature(doc_cfg))]
21
22/// Module containing constants for icons names.
23pub mod icon_names;
24
25use gtk::{gdk, gio};
26
27/// Initialized the icons and registers them globally for your application.
28pub fn initialize_icons() {
29    gio::resources_register_include!("resources.gresource").unwrap();
30
31    #[allow(clippy::const_is_empty)]
32    if icon_names::APP_ID.is_empty() && icon_names::BASE_RESOURCE_PATH.is_empty() {
33        gtk::init().unwrap();
34
35        let display = gdk::Display::default().unwrap();
36        let theme = gtk::IconTheme::for_display(&display);
37        theme.add_resource_path("/org/relm4/icons/");
38        theme.add_resource_path("/org/relm4/icons/scalable/actions/");
39    }
40}