xfconf 0.1.0

Provides access to xfconf, Xfce's desktop configuration system
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files.gtk (https://github.com/gtk-rs/gir-files)
// from gir-files.xfce
// DO NOT EDIT

use crate::ffi;
use glib::translate::*;

/// Initializes the Xfconf library. Can be called multiple times with no
/// adverse effects.
///
/// # Returns
///
/// [`true`] if the library was initialized succesfully, [`false`] on
///  error. If there is an error `error` will be set.
#[doc(alias = "xfconf_init")]
pub fn init() -> Result<(), glib::Error> {
    unsafe {
        let mut error = std::ptr::null_mut();
        let is_ok = ffi::xfconf_init(&mut error);
        debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
        if error.is_null() {
            Ok(())
        } else {
            Err(from_glib_full(error))
        }
    }
}

/// Lists all channels known in the Xfconf configuration store.
///
/// # Returns
///
/// A newly-allocated array of strings.
///  Free with `g_strfreev()` when no longer needed.
#[doc(alias = "xfconf_list_channels")]
pub fn list_channels() -> Vec<glib::GString> {
    unsafe { FromGlibPtrContainer::from_glib_full(ffi::xfconf_list_channels()) }
}