def __init__(self, textview, nms_accessor, device):
		"""
		Create ourself, passing the TreeStore as our Model.
		"""
		self.nms_accessor = nms_accessor
		self.device = device

		self.store = TreeStore(nms_accessor, device)
		gtk.TreeView.__init__(self, self.store)
		self.renderer = gtk.CellRendererText()

		self.column0 = gtk.TreeViewColumn('Name', self.renderer, text=0)
		self.column1 = gtk.TreeViewColumn('OID Part', self.renderer, text=1)
		self.column2 = gtk.TreeViewColumn('Full OID', self.renderer, text=2)

		self.append_column(self.column0)
		self.append_column(self.column1)
		self.append_column(self.column2)

		# set the TextView so we can edit text.
		self.textview = textview

		self.connect('row-activated', self.callback)

		self.func = 'get'
class TreeView(gtk.TreeView):
	"""
	View of the MIB tree structure.
	"""
	def __init__(self, textview, nms_accessor, device):
		"""
		Create ourself, passing the TreeStore as our Model.
		"""
		self.nms_accessor = nms_accessor
		self.device = device

		self.store = TreeStore(nms_accessor, device)
		gtk.TreeView.__init__(self, self.store)
		self.renderer = gtk.CellRendererText()

		self.column0 = gtk.TreeViewColumn('Name', self.renderer, text=0)
		self.column1 = gtk.TreeViewColumn('OID Part', self.renderer, text=1)
		self.column2 = gtk.TreeViewColumn('Full OID', self.renderer, text=2)

		self.append_column(self.column0)
		self.append_column(self.column1)
		self.append_column(self.column2)

		# set the TextView so we can edit text.
		self.textview = textview

		self.connect('row-activated', self.callback)

		self.func = 'get'

	def callback(self, treeview, path, params=None):
		"""
		Callback to process the data from expanding a row.
		"""
		#addr = self.inputbox.get_text()
		self.store.get_data(self.set_text, 'get', 
				self.nms_accessor, self.device, path)

	def set_text(self, sendRequestHandle,
			errorIndication,
			errorStatus,
			errorIndex,
			varBinds,
			callbackContext):
		"""
		Set the text in the textview.
		"""
		text = ''
		if self.func == 'get-next':
			"""
			# get each row of data
			for row in varBinds:
				# for the name and value of the row, add the value to running text
				for name, val in row:
					text = text + '\n' + str(val)
			"""
			text = varBinds

		elif self.func == 'get':
			"""
			# Extract the value out of the singleton
			for name, val in varBinds:
				text = text + '\n' + str(val)
			"""
			text = varBinds
		
		elif self.func == 'get-bulk':
			"""
			for row in varBinds:
				# for the name and value of the row, add value
				# bulk can return zero-length rows
				if len(row) > 0:
					for name, val in row:
						text = text + '\n' + str(val)
			"""
			text = varBinds

		# output can have arbitrary unicode, including embedded null,
		# which gtk, being C, doesn't deal well with.  Replace
		# embedded nulls with empty string
		text = text.replace('\x00', '').decode('utf-8', 'replace').encode('utf-8')
		self.textview.set_text(text)

	def change_func(self, func):
		"""
		Change which function we execute.
		"""
		self.func = func