gtk4/
icon_theme.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use glib::{translate::*, Slice};
4
5use crate::IconTheme;
6
7impl IconTheme {
8    #[doc(alias = "gtk_icon_theme_get_icon_sizes")]
9    #[doc(alias = "get_icon_sizes")]
10    pub fn icon_sizes(&self, icon_name: impl IntoGStr) -> Slice<i32> {
11        unsafe {
12            let sizes_ptr = icon_name.run_with_gstr(|icon_name| {
13                crate::ffi::gtk_icon_theme_get_icon_sizes(self.to_glib_none().0, icon_name.as_ptr())
14            });
15            let mut len = 0;
16            if !sizes_ptr.is_null() {
17                while std::ptr::read(sizes_ptr.add(len)) != 0 {
18                    len += 1;
19                }
20            }
21            Slice::from_glib_full_num(sizes_ptr, len)
22        }
23    }
24}