[][src]Trait gtk::CssProviderExt

pub trait CssProviderExt: 'static {
    fn load_from_data(&self, data: &[u8]) -> Result<(), Error>;
fn load_from_file<P: IsA<File>>(&self, file: &P) -> Result<(), Error>;
fn load_from_path(&self, path: &str) -> Result<(), Error>;
fn load_from_resource(&self, resource_path: &str);
fn to_string(&self) -> GString;
fn connect_parsing_error<F: Fn(&Self, &CssSection, &Error) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; }

Trait containing all CssProvider methods.

Implementors

CssProvider

Required methods

fn load_from_data(&self, data: &[u8]) -> Result<(), Error>

Loads data into self, and by doing so clears any previously loaded information.

data

CSS data loaded in memory

length

the length of data in bytes, or -1 for NUL terminated strings. If length is not -1, the code will assume it is not NUL terminated and will potentially do a copy.

Returns

true. The return value is deprecated and false will only be returned for backwards compatibility reasons if an error is not None and a loading error occurred. To track errors while loading CSS, connect to the CssProvider::parsing-error signal.

fn load_from_file<P: IsA<File>>(&self, file: &P) -> Result<(), Error>

Loads the data contained in file into self, making it clear any previously loaded information.

file

gio::File pointing to a file to load

Returns

true. The return value is deprecated and false will only be returned for backwards compatibility reasons if an error is not None and a loading error occurred. To track errors while loading CSS, connect to the CssProvider::parsing-error signal.

fn load_from_path(&self, path: &str) -> Result<(), Error>

Loads the data contained in path into self, making it clear any previously loaded information.

path

the path of a filename to load, in the GLib filename encoding

Returns

true. The return value is deprecated and false will only be returned for backwards compatibility reasons if an error is not None and a loading error occurred. To track errors while loading CSS, connect to the CssProvider::parsing-error signal.

fn load_from_resource(&self, resource_path: &str)

Loads the data contained in the resource at resource_path into the CssProvider, clearing any previously loaded information.

To track errors while loading CSS, connect to the CssProvider::parsing-error signal.

Feature: v3_16

resource_path

a gio::Resource resource path

fn to_string(&self) -> GString

Converts the self into a string representation in CSS format.

Using CssProviderExt::load_from_data with the return value from this function on a new provider created with CssProvider::new will basically create a duplicate of this self.

Returns

a new string representing the self.

fn connect_parsing_error<F: Fn(&Self, &CssSection, &Error) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

Signals that a parsing error occurred. the path, line and position describe the actual location of the error as accurately as possible.

Parsing errors are never fatal, so the parsing will resume after the error. Errors may however cause parts of the given data or even all of it to not be parsed at all. So it is a useful idea to check that the parsing succeeds by connecting to this signal.

Note that this signal may be emitted at any time as the css provider may opt to defer parsing parts or all of the input to a later time than when a loading function was called.

section

section the error happened in

error

The parsing error

Loading content...

Implementors

impl<O: IsA<CssProvider>> CssProviderExt for O[src]

Loading content...