Struct sourceview5::LanguageManager[][src]

pub struct LanguageManager(_);

Implementations

impl LanguageManager[src]

pub fn new() -> LanguageManager[src]

Creates a new language manager. If you do not need more than one language manager or a private language manager instance then use LanguageManager::get_default instead.

Returns

a new LanguageManager.

pub fn get_language(&self, id: &str) -> Option<Language>[src]

Gets the Language identified by the given id in the language manager.

id

a language id.

Returns

a Language, or None if there is no language identified by the given id. Return value is owned by self and should not be freed.

pub fn get_language_ids(&self) -> Vec<GString>[src]

Returns the ids of the available languages.

Returns

a None-terminated array of strings containing the ids of the available languages or None if no language is available. The array is sorted alphabetically according to the language name. The array is owned by self and must not be modified.

pub fn get_search_path(&self) -> Vec<GString>[src]

Gets the list directories where self looks for language files.

Returns

None-terminated array containing a list of language files directories. The array is owned by self and must not be modified.

pub fn guess_language(
    &self,
    filename: Option<&str>,
    content_type: Option<&str>
) -> Option<Language>
[src]

Picks a Language for given file name and content type, according to the information in lang files. Either filename or content_type may be None. This function can be used as follows:

<informalexample>``<programlisting> Language *lang; lang = gtk_source_language_manager_guess_language (filename, NULL); gtk_source_buffer_set_language (buffer, lang); </programlisting>``</informalexample>

or

<informalexample>``<programlisting> Language *lang = NULL; gboolean result_uncertain; gchar *content_type;

content_type = g_content_type_guess (filename, NULL, 0, &result_uncertain); if (result_uncertain) { g_free (content_type); content_type = NULL; }

lang = gtk_source_language_manager_guess_language (manager, filename, content_type); gtk_source_buffer_set_language (buffer, lang);

g_free (content_type); </programlisting>``</informalexample>

etc. Use Language::get_mime_types and Language::get_globs if you need full control over file -> language mapping.

filename

a filename in Glib filename encoding, or None.

content_type

a content type (as in GIO API), or None.

Returns

a Language, or None if there is no suitable language for given filename and/or content_type. Return value is owned by self and should not be freed.

pub fn set_search_path(&self, dirs: &[&str])[src]

Sets the list of directories where the self looks for language files. If dirs is None, the search path is reset to default.

<note> <para> At the moment this function can be called only before the language files are loaded for the first time. In practice to set a custom search path for a LanguageManager, you have to call this function right after creating it. </para> </note>

dirs

a None-terminated array of strings or None.

pub fn get_default() -> Option<LanguageManager>[src]

Returns the default LanguageManager instance.

Returns

a LanguageManager. Return value is owned by View library and must not be unref’ed.

pub fn connect_property_language_ids_notify<F: Fn(&LanguageManager) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

pub fn connect_property_search_path_notify<F: Fn(&LanguageManager) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

Trait Implementations

impl Clone for LanguageManager[src]

impl Debug for LanguageManager[src]

impl Default for LanguageManager[src]

impl Display for LanguageManager[src]

impl Eq for LanguageManager[src]

impl Hash for LanguageManager[src]

impl Ord for LanguageManager[src]

impl ParentClassIs for LanguageManager[src]

type Parent = Object

impl<T: ObjectType> PartialEq<T> for LanguageManager[src]

impl<T: ObjectType> PartialOrd<T> for LanguageManager[src]

impl StaticType for LanguageManager[src]

impl StructuralEq for LanguageManager[src]

Auto Trait Implementations

impl RefUnwindSafe for LanguageManager

impl !Send for LanguageManager

impl !Sync for LanguageManager

impl Unpin for LanguageManager

impl UnwindSafe for LanguageManager

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Super, Sub> CanDowncast<Sub> for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 

impl<T> Cast for T where
    T: ObjectType, 

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ObjectExt for T where
    T: ObjectType, 

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToSendValue for T where
    T: SetValue + Send + ToValue + ?Sized

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToValue for T where
    T: SetValue + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.