// Copyright 2013-2015, The Gtk-rs Project Developers.
// See the COPYRIGHT file at the top-level directory of this distribution.
// Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT>

use Error;
use CssProvider;
use ffi;
use glib::object::IsA;
use glib::translate::*;
use std::ptr;
use libc::ssize_t;

pub trait CssProviderExtManual {
    fn load_from_data(&self, data: &str) -> Result<(), Error>;
}

//Other functions autogenerated in src\auto\css_provider.rs
impl<O: IsA<CssProvider>> CssProviderExtManual for O {
    fn 
(&self, data: &str) -> Result<(), Error> {
        unsafe {
            let mut error = ptr::null_mut();
            let _ = ffi::gtk_css_provider_load_from_data(self.to_glib_none().0, mut_override(data.as_bytes().as_ptr()),
                    data.len() as ssize_t, &mut error);
            if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
        }
    }
}

load_from_data