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
22use gtk::{
23    gio::{resources_register, Resource},
24    glib,
25};
26
27/// Initialized the icons and registers them globally for your application.
28pub fn initialize_icons(gresource_bytes: &'static [u8], resource_prefix: &str) {
29    let bytes = glib::Bytes::from_static(gresource_bytes);
30    let resource = Resource::from_data(&bytes).unwrap();
31    resources_register(&resource);
32
33    gtk::init().unwrap();
34
35    let display = gtk::gdk::Display::default().unwrap();
36    let theme = gtk::IconTheme::for_display(&display);
37    theme.add_resource_path(resource_prefix);
38}