// Take a look at the license at the top of the repository in the LICENSE file.

use crate::MapListModel;
use glib::translate::*;
use glib::IsA;

impl MapListModel {
    #[doc(alias = "gtk_map_list_model_new")]
    pub fn without_map_func<P: IsA<gio::ListModel>>(model: Option<&P>) -> Self {
        assert_initialized_main_thread!();
        unsafe {
            from_glib_full(ffi::gtk_map_list_model_new(
                model.map(|p| p.as_ref()).to_glib_full(),
                None,
                std::ptr::null_mut(),
                None,
            ))
        }
    }

    #[doc(alias = "gtk_map_list_model_set_map_func")]
    #[doc(alias = "set_map_func")]
    pub fn unset_map_func(&self) {
        unsafe {
            ffi::gtk_map_list_model_set_map_func(
                self.to_glib_none().0,
                None,
                std::ptr::null_mut(),
                None,
            );
        }
    }
}
