[Gtk-sharp-list] GtkSourceView language and style definitions
Michael Hutchinson
m.j.hutchinson at gmail.com
Fri Apr 10 12:36:17 EDT 2009
2009/4/10 Alexander Krivács Schrøder <alexschrod at gmail.com>:
> Hi everybody.
>
> I'm moving a project of mine from C & Gtk to C# & Gtk#. Most of the
> transition has gone smoothly, but I find myself facing one small issue.
> I'm using the GtkSourceView Widget, and in my original C code, here's
> what I did to load my self-defined language and style scheme:
>
> GtkSourceLanguageManager *lm;
> GtkSourceStyleSchemeManager *ssm;
> gchar *dirs[3];
>
> dirs[0] = g_strdup("lang");
> dirs[1] = g_strdup(DEFAULT_DATA_DIR "/" PACKAGE "/lang");
> dirs[2] = NULL; /* Sentinel */
>
> /* Load the language file */
> lm = gtk_source_language_manager_new();
> gtk_source_language_manager_set_search_path(lm, dirs);
> lang = gtk_source_language_manager_get_language(lm, "mylang");
>
> /* Load the scheme file */
> ssm = gtk_source_style_scheme_manager_new();
> gtk_source_style_scheme_manager_set_search_path(ssm, dirs);
> style =gtk_source_style_scheme_manager_get_scheme(ssm,"mylang");
>
> However, looking at the SourceLanguagesManager class, I couldn't find
> any SearchPath property or SetSearchPath method, and I couldn't even
> find a SourceStyleManager class at all! Can somebody help me figure this
> out?
>
> Essentially what I'm asking is how I load my style scheme and language
> definition file.
The search paths were only added in GtkSourceView2. Because
GtkSourceView2 broke binary compatibility with GtkSourceview1.8, there
are two bindings -- GtkSourceView-Sharp-2.0 (the 2.0 version of the
binding to the 1.8 library) and GtkSourceView2-Sharp. It sounds like
you want the latter.
--
Michael Hutchinson
http://mjhutchinson.com
More information about the Gtk-sharp-list
mailing list