Strange behavior with Linux GTK+ library

Steve Teale steve.teale at britseyeview.com
Thu Jul 28 04:12:01 PDT 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



More information about the Digitalmars-d mailing list