[Mono-docs-list] patch for Monodoc to use managed TreeView

John Luke jluke@cfl.rr.com
22 Jun 2003 15:44:44 -0400


--=-rDKYzEIVEH0b93k/e3tb
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hello,

Here is a small patch to switch monodoc/browser.cs to using the newer
managed treeview style.  It removes the using GLib; and is easier to
read. I also removed three commented lines at the top that are no longer
used.

If it is ok, can I commit?

Thanks
John

--=-rDKYzEIVEH0b93k/e3tb
Content-Disposition: attachment; filename=browser.diff
Content-Type: text/x-patch; name=browser.diff; charset=UTF-8
Content-Transfer-Encoding: 7bit

Index: browser.cs
===================================================================
RCS file: /cvs/public/monodoc/browser/browser.cs,v
retrieving revision 1.26
diff -u -r1.26 browser.cs
--- browser.cs	1 Jun 2003 15:26:45 -0000	1.26
+++ browser.cs	22 Jun 2003 19:45:05 -0000
@@ -12,7 +12,6 @@
 //   Add search facility
 //   Add Index
 //
-using GLib;
 using Gtk;
 using GtkSharp;
 using Glade;
@@ -99,9 +98,6 @@
 
 		MainWindow = (Gtk.Window) ui["window1"];
 		MainWindow.DeleteEvent += new DeleteEventHandler (delete_event_cb);
-		//reference_tree = (TreeView) ui ["reference_tree"];
-		//help_container = (Box) ui ["help_container"];
-		//html_container = (ScrolledWindow) ui ["html_container"];
 
 		help_tree = RootTree.LoadTree ();
 		tree_browser = new TreeBrowser (help_tree, reference_tree, this);
@@ -267,11 +263,7 @@
 		node_parent = new Hashtable ();
 
 		// Setup the TreeView
-		TreeViewColumn name_col = new TreeViewColumn ();
-		CellRenderer name_render = new CellRendererText ();
-		name_col.PackStart (name_render, true);
-		name_col.AddAttribute (name_render, "text", 0);
-		tree_view.AppendColumn (name_col);
+		tree_view.AppendColumn ("name_col", new CellRendererText (), "text", 0);
 
 		// Bind events
 		tree_view.RowExpanded += new GtkSharp.RowExpandedHandler (RowExpanded);
@@ -279,10 +271,9 @@
 
 		// Setup the model
 		this.help_tree = help_tree;
-		store = new TreeStore ((int) TypeFundamentals.TypeString);
+		store = new TreeStore (typeof (string));
 
-		store.Append (out root_iter);
-		store.SetValue (root_iter, 0, new Value ("Mono Documentation"));
+		root_iter = store.AppendValues ("Mono Documentation");
 		iter_to_node [root_iter] = help_tree;
 		node_to_iter [help_tree] = root_iter;
 		PopulateNode (help_tree, root_iter);
@@ -297,9 +288,7 @@
 
 		TreeIter iter;
 		foreach (Node n in node.Nodes){
-			store.Append (out iter, parent);
-
-			store.SetValue (iter, 0, new Value (n.Caption));
+			iter = store.AppendValues (parent, n.Caption);
 			iter_to_node [iter] = n;
 			node_to_iter [n] = iter;
 		}

--=-rDKYzEIVEH0b93k/e3tb--