[Gtk-sharp-list] gtksourceview-sharp: GetLanguageFromMimeType

Todd Berman tberman@sevenl.net
Sun, 08 Feb 2004 02:52:27 -0500


Im only responding to this just to say that this seems to be a known
issue, and im really confused as to why this .custom hack was removed
before a suitable fix was in place.

I'd rather see an occasional null pointer reference than a constant
breaking every time.

This has caused some issues for MD users, as they are unable to update
their gtksourceview-sharp because of this, and we need to have this
fixed soon, beacause when we release a 0.1 of MD it will require a
sourceview-sharp release.

I am willing to roll gtksourceview-sharp into our tree and build it into
our build dirs, but I think that kinda was against the point of an
established gtksourceview module (one place, one location for
fixes/optimizations).

This really should be fixed one way or another soon.

please ;)

--Todd

On Sun, 2004-02-08 at 01:04, Daniel Borgmann wrote:
> Hello,
> 
> The GetLanguageFromMimeType() function of the SourceLanguagesManager
> class in gtksourceview-sharp has always been broken for me, recently a
> "fix" for it was removed from CVS because it led to null pointer
> exceptions. But this seems to actually work:
> 
> public Gtk.SourceLanguage GetLanguageFromMimeType(string mime_type) {
> 	IntPtr raw_ret =
> gtk_source_languages_manager_get_language_from_mime_type(Handle,
> mime_type);
> 	Gtk.SourceLanguage ret;
> 	if (raw_ret == IntPtr.Zero)
> 		ret = null;
> 	else
> 		ret = new Gtk.SourceLanguage(raw_ret);
> 	return ret;
> }
> 
> Gtk# 0.16 already does the check for null, but the cast is created as
> "(Gtk.SourceLanguage) GLib.Object.GetObject(raw_ret)", which leads to an
> error. 
> It would be nice if this could be fixed in CVS again or maybe in the
> code generator. I'm very new to all of this, so I have no idea what
> would be the right thing to do. :) Thanks.
> 
> Daniel
> 
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list