gtksourceview-2.0 with custom paths



First off, sorry if this is the wrong place to ask. I see from http://projects.gnome.org/gtksourceview//development.html that the recommendation is to ask about gtksourceview on gnome-devtools, but that list appears to be pretty much moribund so I'm trying here.
I work on a cross-platform GTK app, and I'm trying to get 
gtksourceview-2.0 working in the context of packages for Windows and 
OS X, where I don't know the final installation path and so I need 
to specify the search paths for language-specs and style files at 
runtime.
Right now I'm emulating this situation on Linux, and while I seem to 
be close to success, no cigar yet. Any help would be appreciated. 
(BTW, my testing is with version 2.10.5, which I take to be "latest 
stable" in the 2.0 series, but should I be using 2.11.N?)
Step 1: Specify a non-standard location for the lang files. Before 
displaying any text I grab the default languages manager with
  gtk_source_language_manager_get_default()

and set a custom location using

  gtk_source_language_manager_set_search_path

Result: Success. I get syntax highlighting OK, even if I hide the standard language-specs directory.
Step 2: Specify a non-standard location for the style files. Again, 
before displaying anything I grab the default style scheme manager 
with
  gtk_source_style_scheme_manager_get_default()

and set a custom directory using

  gtk_source_style_scheme_manager_set_search_path()
  gtk_source_style_scheme_manager_force_rescan()

(I'm not sure the latter call is necessary, but I threw it in for good measure.)
Result: Failure: no syntax highlighting.

Though I don't need styles other than "classic", I've tried this with the custom directory containing the entire contents of the standard styles directory.
I guess I must be missing something. By inserting print statements I 
can see that after Step 2,
  gtk_source_style_scheme_manager_get_scheme_ids()

is giving an apparently valid list of ids, corresponding to the style xml files in the non-standard location (which in some experiments was a subset of the full list, but including "classic").
One more observation: In each case my setting of the "non-standard 
location" was an array of just two *gchars, the custom path followed 
by NULL. In the style-scheme-manager case (only), the result (syntax 
highlighting or none) was conditional on whether or not the standard 
styles directory was "visible" or hidden (renamed) at runtime.
--
Allin Cottrell
Department of Economics
Wake Forest University



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