Thread overview
Strange behavior with Linux GTK+ library
Jul 28, 2011
Steve Teale
Jul 28, 2011
Kagamin
Jul 28, 2011
Kagamin
July 28, 2011
I've been trying to add some new methods to ObjectG.d in gtkD. As an example:

	public string getString(string propertyName)
	{
		// void g_object_get(gpointer object, gchar* firstPropertyName, ... )
		// gchar* is described as being a C style string

		char* csz;
		writefln("%s", propertyName);
		g_object_get(gObject, cast(char*) std.string.toStringz(propertyName), &csz);
 // try 1
		//g_object_get(gObject, cast(char*) "font\0".ptr, &csz);
  // try 2
		uint n;
		for (char* p = csz; *p; p++, n++) {}
		return csz[0..n].idup;
	}

When I use this in code to get a property from a GtkTextTag I get a warning from Glib-GObject telling me there's no such property, and then the expected result is returned. I've done this several different ways. It works, but with different warning message string values, like:

font

(thost:9068): GLib-GObject-WARNING **: g_object_get_valist: object class
`GtkTextTag' has no property named `\xb8;\u001a	\u0003'
ArtBrush 12

font

(thost:8524): GLib-GObject-WARNING **: g_object_get_valist: object class
`GtkTextTag' has no property named `XO\xdc\u0008\u0003'
ArtBrush 12

This is with DMD2.054. Can anyone hazard a guess as to what's going on here?

Thanks
Steve

July 28, 2011
Steve Teale Wrote:

> I've been trying to add some new methods to ObjectG.d in gtkD. As an example:

How it works without adding new methods to GObject?
July 28, 2011
http://developer.gnome.org/gobject/stable/gobject-The-Base-Object-Type.html#g-object-get