Trait gtk::prelude::CssProviderExt [−][src]
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_str(&self) -> GString; fn connect_parsing_error<F: Fn(&Self, &CssSection, &Error) + 'static>(
&self,
f: F
) -> SignalHandlerId; }
Expand description
Required methods
Loads data
into self
, and by doing so clears any previously loaded
information.
data
CSS data loaded in memory
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 signal::CssProvider::parsing-error
signal.
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 signal::CssProvider::parsing-error
signal.
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 signal::CssProvider::parsing-error
signal.
fn load_from_resource(&self, resource_path: &str)
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
signal::CssProvider::parsing-error
signal.
resource_path
a GResource
resource path
fn connect_parsing_error<F: Fn(&Self, &CssSection, &Error) + 'static>(
&self,
f: F
) -> SignalHandlerId
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