[Monodevelop-patches-list] r536 - in trunk/MonoDevelop: data/resources/glade src/Main/Base/Gui/Dialogs/ReferenceDialog

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Sun Jan 18 03:33:27 EST 2004


Author: tberman
Date: 2004-01-18 03:33:27 -0500 (Sun, 18 Jan 2004)
New Revision: 536

Modified:
   trunk/MonoDevelop/data/resources/glade/Base.glade
   trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/ReferenceDialog/GacReferencePanel.cs
   trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/ReferenceDialog/SelectReferenceDialog.cs
Log:
fixed up the gac reference panel.
This is an ugly hack to workaround the fact that we dont have a gac
and it doesnt work yet, just displays proper data.
and its kinda an ugly dialog, needs some glade lovin
oh, and its fucking slow too


Modified: trunk/MonoDevelop/data/resources/glade/Base.glade
===================================================================
--- trunk/MonoDevelop/data/resources/glade/Base.glade	2004-01-18 06:21:16 UTC (rev 535)
+++ trunk/MonoDevelop/data/resources/glade/Base.glade	2004-01-18 08:33:27 UTC (rev 536)
@@ -698,7 +698,7 @@
   <property name="default_width">400</property>
   <property name="default_height">400</property>
   <property name="resizable">True</property>
-  <property name="destroy_with_parent">False</property>
+  <property name="destroy_with_parent">True</property>
   <property name="has_separator">True</property>
 
   <child internal-child="vbox">
@@ -752,7 +752,7 @@
 	  <property name="spacing">12</property>
 
 	  <child>
-	    <widget class="GtkNotebook" id="notebook2">
+	    <widget class="GtkNotebook" id="mainBook">
 	      <property name="visible">True</property>
 	      <property name="can_focus">True</property>
 	      <property name="show_tabs">True</property>

Modified: trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/ReferenceDialog/GacReferencePanel.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/ReferenceDialog/GacReferencePanel.cs	2004-01-18 06:21:16 UTC (rev 535)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/ReferenceDialog/GacReferencePanel.cs	2004-01-18 08:33:27 UTC (rev 536)
@@ -10,57 +10,64 @@
 using System.Drawing;
 using System.Collections;
 using System.ComponentModel;
-using System.Windows.Forms;
 using MSjogren.GacTool.FusionNative;
 using ICSharpCode.SharpDevelop.Internal.Project;
 
 using ICSharpCode.Core.Services;
 
+using Gtk;
+
 namespace ICSharpCode.SharpDevelop.Gui.Dialogs
 {
-	public class GacReferencePanel : ListView, IReferencePanel
+	public class GacReferencePanel : Frame, IReferencePanel
 	{
 		SelectReferenceDialog selectDialog;
 		ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(IResourceService));
+
+		TreeStore store;
+		TreeView  treeView;
 		
 		public GacReferencePanel(SelectReferenceDialog selectDialog)
 		{
 			this.selectDialog = selectDialog;
 			
-			ColumnHeader referenceHeader = new ColumnHeader();
-			referenceHeader.Text  = resourceService.GetString("Dialog.SelectReferenceDialog.GacReferencePanel.ReferenceHeader");
-			referenceHeader.Width = 160;
-			Columns.Add(referenceHeader);
+			store = new TreeStore (typeof (string), typeof (string), typeof(string), typeof(bool));
+			treeView = new TreeView (store);
+
+			TreeViewColumn firstColumn = new TreeViewColumn ();
+			firstColumn.Title = resourceService.GetString ("Dialog.SelectReferenceDialog.GacReferencePanel.ReferenceHeader");
+			CellRendererToggle tog_render = new CellRendererToggle ();
+			firstColumn.PackStart (tog_render, false);
+			firstColumn.AddAttribute (tog_render, "active", 3);
+
+			CellRendererText text_render = new CellRendererText ();
+			firstColumn.PackStart (text_render, true);
+			firstColumn.AddAttribute (text_render, "text", 0);
 			
-			ColumnHeader versionHeader = new ColumnHeader();
-			versionHeader.Text  = resourceService.GetString("Dialog.SelectReferenceDialog.GacReferencePanel.VersionHeader");
-			versionHeader.Width = 70;
-			Columns.Add(versionHeader);
+			treeView.AppendColumn (firstColumn);
+			treeView.AppendColumn (resourceService.GetString ("Dialog.SelectReferenceDialog.GacReferencePanel.VersionHeader"), new CellRendererText (), "text", 1);
+			treeView.AppendColumn (resourceService.GetString ("Dialog.SelectReferenceDialog.GacReferencePanel.PathHeader"), new CellRendererText (), "text", 2);
+		
 			
-			ColumnHeader pathHeader = new ColumnHeader();
-			pathHeader.Text  = resourceService.GetString("Dialog.SelectReferenceDialog.GacReferencePanel.PathHeader");
-			pathHeader.Width = 100;
-			Columns.Add(pathHeader);
-			
-			View = View.Details;
-			Dock = DockStyle.Fill;
-			FullRowSelect = true;
-			ItemActivate += new EventHandler(AddReference);
-			
 			PrintCache();
+			ScrolledWindow sc = new ScrolledWindow ();
+			sc.AddWithViewport (treeView);
+			this.Add (sc);
+			Shadow = ShadowType.None;
 		}
 		
 		public void AddReference(object sender, EventArgs e)
 		{
-			foreach (ListViewItem item in SelectedItems) {
-				selectDialog.AddReference(ReferenceType.Gac,
-				                          item.Text,
-				                          item.Tag.ToString());
-			}
+		//	foreach (ListViewItem item in SelectedItems) {
+		//		selectDialog.AddReference(ReferenceType.Gac,
+		//		                          item.Text,
+		//		                          item.Tag.ToString());
+		//	}
 		}		
 		
 		void PrintCache()
 		{
+#if false
 			IApplicationContext applicationContext = null;
 			IAssemblyEnum assemblyEnum = null;
 			IAssemblyName assemblyName = null;
@@ -82,6 +89,31 @@
 				item.Tag = sb.ToString();
 				Items.Add(item);
 			}
+#endif
+			//FIXME: Oh wow this is *hackery* but it will work
+			//FIXME: on mono alone. well, this tosses xplatform
+			//FIXME: out the window a hell of a lot more than
+			//FIXME: gnome or not ;)
+			//FIXME: This needs to change once mono gets a real
+			//FIXME: gac.
+			System.Reflection.MethodInfo gac = typeof (System.Environment).GetMethod ("internalGetGacPath", System.Reflection.BindingFlags.Static|System.Reflection.BindingFlags.NonPublic);
+			if (gac == null) {
+				Console.WriteLine ("ERROR: non-mono runtime detected, please use the mono runtime for this piece of MonoDevelop for the time being");
+				Environment.Exit (1);
+			}
+			string gac_path = System.IO.Path.Combine ((string)gac.Invoke (null, null), "");
+			string[] assemblies = System.IO.Directory.GetFiles (gac_path, "*.dll");
+			foreach (string assembly in assemblies) {
+				try {
+					System.Reflection.AssemblyName an = System.Reflection.AssemblyName.GetAssemblyName (assembly);
+
+					string name = an.Name;
+					string ver = an.Version.ToString ();
+					
+					store.AppendValues (name, ver, assembly, false);
+				} catch {
+				}
+			}
 		}
 	}
 }

Modified: trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/ReferenceDialog/SelectReferenceDialog.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/ReferenceDialog/SelectReferenceDialog.cs	2004-01-18 06:21:16 UTC (rev 535)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/ReferenceDialog/SelectReferenceDialog.cs	2004-01-18 08:33:27 UTC (rev 536)
@@ -105,12 +105,15 @@
 				refTreeStore.AppendValues (System.IO.Path.GetFileName (refInfo.Reference), refInfo.ReferenceType.ToString (), System.IO.Path.GetFullPath (refInfo.GetReferencedFileName (configureProject)), refInfo);
 			}
 			//InitializeComponent();
-			
+		
+			mainBook.RemovePage (mainBook.CurrentPage);
+			mainBook.AppendPage (new GacReferencePanel (this), new Gtk.Label (resourceService.GetString("Dialog.SelectReferenceDialog.GacTabPage")));
 			//gacTabPage.Controls.Add(new GacReferencePanel(this));
 			//projectTabPage.Controls.Add(new ProjectReferencePanel(this));
 			//browserTabPage.Controls.Add(new AssemblyReferencePanel(this));
 			
 			//comTabPage.Controls.Add(new COMReferencePanel(this));
+			AddReferenceDialog.ShowAll ();
 		}
 		
 		public void AddReference(ReferenceType referenceType, string referenceName, string referenceLocation)




More information about the Monodevelop-patches-list mailing list