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

Daniel Borgmann spark-mailinglists@web.de
Sun, 08 Feb 2004 07:04:03 +0100


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.SourceLanguage ret;
	if (raw_ret == IntPtr.Zero)
		ret = null;
		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
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.