[Monodevelop-patches-list] r1050 - in trunk/MonoDevelop/src: Libraries/MonoDevelop.Gui.Widgets/FileBrowser Main/Base/Gui/Pads
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Fri Feb 27 18:46:26 EST 2004
Author: jluke
Date: 2004-02-27 18:46:26 -0500 (Fri, 27 Feb 2004)
New Revision: 1050
Modified:
trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/FileBrowser/FileBrowser.cs
trunk/MonoDevelop/src/Main/Base/Gui/Pads/FileScout.cs
Log:
use .PopupMenu event instead of ButtonReleaseEvent for menu
simplify the open file routine, because it is not .SelectMultiple
Modified: trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/FileBrowser/FileBrowser.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/FileBrowser/FileBrowser.cs 2004-02-27 23:15:12 UTC (rev 1049)
+++ trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/FileBrowser/FileBrowser.cs 2004-02-27 23:46:26 UTC (rev 1050)
@@ -86,7 +86,7 @@
tv.Model = store;
tv.RowActivated += new RowActivatedHandler (OnRowActivated);
- tv.ButtonReleaseEvent += new ButtonReleaseEventHandler (OnButtonReleaseEvent);
+ tv.PopupMenu += new PopupMenuHandler (OnPopupMenu);
scrolledwindow.Add (tv);
this.Homogeneous = false;
@@ -210,23 +210,19 @@
}
}
- // FIXME: implement .PopupMenu event instead
- private void OnButtonReleaseEvent (object o, ButtonReleaseEventArgs args)
+ private void OnPopupMenu (object o, PopupMenuArgs args)
{
- if (args.Event.Button == 3)
- {
- Gtk.Menu menu = new Menu ();
- Gtk.MenuItem openfilebrowser = new MenuItem ("Open with file browser");
- openfilebrowser.Activated += new EventHandler (OpenFileBrowser);
+ Menu menu = new Menu ();
+ MenuItem openfilebrowser = new MenuItem ("Open with file browser");
+ openfilebrowser.Activated += new EventHandler (OpenFileBrowser);
- Gtk.MenuItem openterminal = new MenuItem ("Open with terminal");
- openterminal.Activated += new EventHandler (OpenTerminal);
+ MenuItem openterminal = new MenuItem ("Open with terminal");
+ openterminal.Activated += new EventHandler (OpenTerminal);
- menu.Append (openterminal);
- menu.Append (openfilebrowser);
- menu.Popup (null, null, null, IntPtr.Zero, 3, Global.CurrentEventTime);
- menu.ShowAll ();
- }
+ menu.Append (openterminal);
+ menu.Append (openfilebrowser);
+ menu.Popup (null, null, null, IntPtr.Zero, 3, Global.CurrentEventTime);
+ menu.ShowAll ();
}
private void OpenFileBrowser (object o, EventArgs args)
Modified: trunk/MonoDevelop/src/Main/Base/Gui/Pads/FileScout.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Pads/FileScout.cs 2004-02-27 23:15:12 UTC (rev 1049)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Pads/FileScout.cs 2004-02-27 23:46:26 UTC (rev 1050)
@@ -315,7 +315,7 @@
public FileScout()
{
fb.DirectoryChangedEvent += new DirectoryChangedEventHandler (OnDirChanged);
- filelister.RowActivated += new Gtk.RowActivatedHandler(FileSelected);
+ filelister.RowActivated += new Gtk.RowActivatedHandler (FileSelected);
Gtk.Frame treef = new Gtk.Frame ();
treef.Add (fb);
@@ -359,33 +359,36 @@
}
}
- void FileSelected(object sender, Gtk.RowActivatedArgs e)
+ void FileSelected (object sender, Gtk.RowActivatedArgs e)
{
IProjectService projectService = (IProjectService)ICSharpCode.Core.Services.ServiceManager.Services.GetService(typeof(IProjectService));
IFileService fileService = (IFileService)ICSharpCode.Core.Services.ServiceManager.Services.GetService(typeof(IFileService));
FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
Gtk.TreeIter iter;
- if (filelister.Model.GetIterFirst(out iter) == false) {
- return;
- }
- do {
- if (filelister.Selection.IterIsSelected(iter) == false) {
- continue;
- }
- FileList.FileListItem item = (FileList.FileListItem)filelister.Model.GetValue(iter, 3);
- switch (System.IO.Path.GetExtension(item.FullName)) {
+ Gtk.TreeModel model;
+
+ // we are not using SelectMultiple
+ // nor can more than one be activated here
+ if (filelister.Selection.GetSelected (out model, out iter))
+ {
+ FileList.FileListItem item = (FileList.FileListItem) filelister.Model.GetValue (iter, 3);
+
+ //FIXME: use mimetypes not extensions
+ // also change to Project tab when its a project
+ switch (System.IO.Path.GetExtension (item.FullName)) {
case ".cmbx":
case ".prjx":
- projectService.OpenCombine(item.FullName);
+ projectService.OpenCombine (item.FullName);
break;
default:
- Console.WriteLine (item.FullName);
- fileService.OpenFile(item.FullName);
+ //Console.WriteLine (item.FullName);
+ fileService.OpenFile (item.FullName);
break;
}
- } while (filelister.Model.IterNext(out iter) == true);
+ }
}
+
/*
protected virtual void OnTitleChanged(EventArgs e)
{
More information about the Monodevelop-patches-list
mailing list