Re: gtksourceview



Hi,

(The specific list for discussion of gtksourceview is
gnome-devtools gnome org   I saw your message just by chance :-)

On Wed, 2003-12-17 at 19:48, E^r7hW( )rm wrote:
> Hi,
> 
> anyone know if you can create a new language for syntax highlighting in 
> gtksourceview on the fly? As in, without putting the xml in a certain 
> place on disk, but from code instead?

Yes, it should still be possible by adding GtkPatternTag/GtkSyntaxTag
tags to the buffer's tag table (see the installed gtksourcetag.h). 
That's the way it used to work before the introduction of
GtkSourceLanguage.  

BUT, keep in mind that such method is deprecated and might no longer
work in the future.

There are two possible workarounds:

1) GtkSourceLanguagesManager has a construct only property
"lang_files_dirs" to tell it where to go search for .lang files.  It
takes a GSList of strings.

2) Patch GtkSourceView to add a function to create a GtkSourceLanguage
from a string in memory.  The patch would be welcome ;-)  This is not a
planned feature, but it makes some sense, so we might consider it for 
future releases.

> in the example, we have ...
> 
> language = gtk_source_languages_manager_get_language_from_mime_type 
> (manager,
>                                              mime_type);
> 
> can i not do something along the lines of ...
> 
> language = gtk_source_languages_manager_get_language_from_file (manager,
>                                              gchar * path);

Right.  Again, this is not a planned feature, but we might consider
including it if we had a patch :-)

HTH,
Gustavo






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]