
import gobject
import pygtk
import gtk

class TestBindable(gobject.GObject, gtk.Buildable):
	__gtype_name__ = 'TestBindable'

	def __init__(self):
		gobject.GObject.__init__(self)
		self.name = None

	def do_get_name(self):
		return self.name

	def do_set_name(self, name):
		self.name = name

	def do_add_child(self, builder, child, type):
		print child, type

gobject.type_register(TestBindable)


TEST_UI = """
<?xml version="1.0"?>
<interface>
  <object class="TestBindable" id="myobject">
    <child>
      <object class="TestBindable" id="myobject2" />
    </child>
  </object>
</interface>
"""

builder = gtk.Builder()
builder.add_from_string(TEST_UI)

myobject = builder.get_object('myobject')

