зеркало из https://github.com/mono/mail-archives.git
370 строки
12 KiB
HTML
370 строки
12 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE> [Monodevelop-patches-list] r1170 - trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/FileBrowser
|
|
</TITLE>
|
|
<LINK REL="Index" HREF="index.html" >
|
|
<LINK REL="made" HREF="mailto:monodevelop-patches-list%40lists.ximian.com?Subject=%5BMonodevelop-patches-list%5D%20r1170%20-%20trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/FileBrowser&In-Reply-To=">
|
|
<META NAME="robots" CONTENT="index,nofollow">
|
|
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
|
|
<LINK REL="Previous" HREF="000775.html">
|
|
<LINK REL="Next" HREF="000778.html">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#ffffff">
|
|
<H1>[Monodevelop-patches-list] r1170 - trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/FileBrowser</H1>
|
|
<B>commit-watcher at mono-cvs.ximian.com</B>
|
|
<A HREF="mailto:monodevelop-patches-list%40lists.ximian.com?Subject=%5BMonodevelop-patches-list%5D%20r1170%20-%20trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/FileBrowser&In-Reply-To="
|
|
TITLE="[Monodevelop-patches-list] r1170 - trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/FileBrowser">commit-watcher at mono-cvs.ximian.com
|
|
</A><BR>
|
|
<I>Sat Mar 13 21:31:24 EST 2004</I>
|
|
<P><UL>
|
|
<LI>Previous message: <A HREF="000775.html">[Monodevelop-patches-list] r1169 - trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/FileBrowser
|
|
</A></li>
|
|
<LI>Next message: <A HREF="000778.html">[Monodevelop-patches-list] r1171 - in trunk/MonoDevelop: . src/Main/Base/Gui/CompletionDatabaseWizard
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#776">[ date ]</a>
|
|
<a href="thread.html#776">[ thread ]</a>
|
|
<a href="subject.html#776">[ subject ]</a>
|
|
<a href="author.html#776">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
<HR>
|
|
<!--beginarticle-->
|
|
<PRE>Author: jluke
|
|
Date: 2004-03-13 21:31:22 -0500 (Sat, 13 Mar 2004)
|
|
New Revision: 1170
|
|
|
|
Modified:
|
|
trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/FileBrowser/FileBrowser.cs
|
|
Log:
|
|
whitespace sillyness
|
|
|
|
|
|
Modified: trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/FileBrowser/FileBrowser.cs
|
|
===================================================================
|
|
--- trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/FileBrowser/FileBrowser.cs 2004-03-13 22:58:24 UTC (rev 1169)
|
|
+++ trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/FileBrowser/FileBrowser.cs 2004-03-14 02:31:22 UTC (rev 1170)
|
|
@@ -1,7 +1,10 @@
|
|
//
|
|
// Author: John Luke <<A HREF="http://lists.ximian.com/mailman/listinfo/monodevelop-patches-list">jluke at cfl.rr.com</A>>
|
|
+// Author: Inigo Illan <<A HREF="http://lists.ximian.com/mailman/listinfo/monodevelop-patches-list">kodeport at terra.es</A>>
|
|
// License: LGPL
|
|
//
|
|
+// Copyright 2004 John Luke
|
|
+//
|
|
|
|
using System;
|
|
using System.Collections;
|
|
@@ -28,6 +31,7 @@
|
|
{
|
|
public DirectoryChangedEventHandler DirectoryChangedEvent;
|
|
private static GLib.GType gtype;
|
|
+
|
|
private Gtk.TreeView tv;
|
|
private Gtk.ScrolledWindow scrolledwindow;
|
|
private Gtk.Button upbutton, homebutton;
|
|
@@ -35,23 +39,25 @@
|
|
private IMessageService messageService;
|
|
private Gtk.CellRendererText text_render;
|
|
private ListStore store;
|
|
- private PerformingTask performingtask = PerformingTask.None;
|
|
- private Hashtable hiddenfolders = new Hashtable();
|
|
private string currentDir;
|
|
private bool ignoreHidden = true;
|
|
- private ArrayList files = new ArrayList();
|
|
private bool init = false;
|
|
+
|
|
+ private PerformingTask performingtask = PerformingTask.None;
|
|
+ private ArrayList files = new ArrayList ();
|
|
+ private Hashtable hiddenfolders = new Hashtable ();
|
|
+
|
|
PropertyService PropertyService = (PropertyService) ServiceManager.Services.GetService (typeof (PropertyService));
|
|
|
|
public FileBrowser () : base (GType)
|
|
{
|
|
if (!Vfs.Initialized) {
|
|
- Vfs.Init();
|
|
+ Vfs.Init ();
|
|
}
|
|
|
|
- messageService = (IMessageService)ServiceManager.Services.GetService(typeof(IMessageService));
|
|
+ messageService = (IMessageService) ServiceManager.Services.GetService (typeof (IMessageService));
|
|
|
|
- scrolledwindow = new ScrolledWindow();
|
|
+ scrolledwindow = new ScrolledWindow ();
|
|
scrolledwindow.VscrollbarPolicy = PolicyType.Automatic;
|
|
scrolledwindow.HscrollbarPolicy = PolicyType.Automatic;
|
|
|
|
@@ -125,7 +131,7 @@
|
|
*/
|
|
|
|
ignoreHidden = value;
|
|
- Populate();
|
|
+ Populate ();
|
|
}
|
|
}
|
|
|
|
@@ -134,11 +140,11 @@
|
|
get { return currentDir; }
|
|
set {
|
|
currentDir = System.IO.Path.GetFullPath (value);
|
|
- GetListOfHiddenFolders();
|
|
+ GetListOfHiddenFolders ();
|
|
Populate ();
|
|
|
|
if (DirectoryChangedEvent != null) {
|
|
- DirectoryChangedEvent(CurrentDir);
|
|
+ DirectoryChangedEvent (CurrentDir);
|
|
}
|
|
}
|
|
}
|
|
@@ -146,7 +152,7 @@
|
|
public string[] Files
|
|
{
|
|
get {
|
|
- return (string[]) files.ToArray(typeof(string));
|
|
+ return (string[]) files.ToArray (typeof (string));
|
|
}
|
|
}
|
|
|
|
@@ -197,7 +203,7 @@
|
|
entry.Text = CurrentDir;
|
|
string[] filesaux = Directory.GetFiles (CurrentDir);
|
|
|
|
- files.Clear();
|
|
+ files.Clear ();
|
|
for (int cont = 0; cont < filesaux.Length; cont++)
|
|
{
|
|
if (ignoreHidden)
|
|
@@ -208,7 +214,9 @@
|
|
}
|
|
}
|
|
else
|
|
+ {
|
|
files.Add (filesaux[cont]);
|
|
+ }
|
|
}
|
|
}
|
|
|
|
@@ -247,20 +255,20 @@
|
|
MenuItem openterminal = new MenuItem ("Open with terminal");
|
|
openterminal.Activated += new EventHandler (OpenTerminal);
|
|
|
|
- Gtk.MenuItem rename = new MenuItem("Rename");
|
|
- rename.Activated += new EventHandler(OnDirRename);
|
|
+ MenuItem rename = new MenuItem ("Rename");
|
|
+ rename.Activated += new EventHandler (OnDirRename);
|
|
|
|
- Gtk.MenuItem delete = new MenuItem("Delete");
|
|
- delete.Activated += new EventHandler(OnDirDelete);
|
|
+ MenuItem delete = new MenuItem ("Delete");
|
|
+ delete.Activated += new EventHandler (OnDirDelete);
|
|
|
|
- Gtk.MenuItem newfolder = new MenuItem("Create new folder");
|
|
- newfolder.Activated += new EventHandler(OnNewDir);
|
|
+ MenuItem newfolder = new MenuItem ("Create new folder");
|
|
+ newfolder.Activated += new EventHandler (OnNewDir);
|
|
|
|
- menu.Append(newfolder);
|
|
- menu.Append(new MenuItem());
|
|
- menu.Append(delete);
|
|
- menu.Append(rename);
|
|
- menu.Append(new MenuItem());
|
|
+ menu.Append (newfolder);
|
|
+ menu.Append (new MenuItem ());
|
|
+ menu.Append (delete);
|
|
+ menu.Append (rename);
|
|
+ menu.Append (new MenuItem ());
|
|
menu.Append (openterminal);
|
|
menu.Append (openfilebrowser);
|
|
menu.Popup (null, null, null, IntPtr.Zero, 3, Global.CurrentEventTime);
|
|
@@ -283,7 +291,7 @@
|
|
}
|
|
}
|
|
|
|
- private void OpenTerminal(object o, EventArgs args)
|
|
+ private void OpenTerminal (object o, EventArgs args)
|
|
{
|
|
TreeIter iter;
|
|
TreeModel model;
|
|
@@ -340,51 +348,50 @@
|
|
switch (performingtask)
|
|
{
|
|
case PerformingTask.Renaming:
|
|
- TreeIter iter;
|
|
+ TreeIter iter;
|
|
+ tv.Model.IterNthChild (out iter, Int32.Parse (args.Path));
|
|
+ string oldpath = (string) store.GetValue (iter, 1);
|
|
|
|
- tv.Model.IterNthChild (out iter, Int32.Parse (args.Path));
|
|
+ if (oldpath != args.NewText)
|
|
+ {
|
|
+ try
|
|
+ {
|
|
+ System.IO.Directory.Move (System.IO.Path.Combine(CurrentDir, oldpath), System.IO.Path.Combine(CurrentDir, args.NewText));
|
|
+ }
|
|
+ catch (Exception ex)
|
|
+ {
|
|
+ messageService.ShowError (ex, "Could not rename folder '" + oldpath + "' to '" + args.NewText + "'");
|
|
+ }
|
|
+ finally
|
|
+ {
|
|
+ Populate ();
|
|
+ }
|
|
+ }
|
|
|
|
- string oldpath = (string) store.GetValue (iter, 1);
|
|
+ break;
|
|
|
|
- if (oldpath != args.NewText)
|
|
- {
|
|
- try
|
|
- {
|
|
- System.IO.Directory.Move (System.IO.Path.Combine(CurrentDir, oldpath), System.IO.Path.Combine(CurrentDir, args.NewText));
|
|
- }
|
|
- catch (Exception ex)
|
|
- {
|
|
- messageService.ShowError (ex, "Could not rename folder '" + oldpath + "' to '" + args.NewText + "'");
|
|
- }
|
|
- finally
|
|
- {
|
|
- Populate();
|
|
- }
|
|
- }
|
|
-
|
|
- break;
|
|
-
|
|
case PerformingTask.CreatingNew:
|
|
- System.IO.DirectoryInfo dirinfo = new DirectoryInfo(CurrentDir);
|
|
- try
|
|
- {
|
|
- dirinfo.CreateSubdirectory(args.NewText);
|
|
- }
|
|
- catch(Exception ex)
|
|
- {
|
|
- messageService.ShowError (ex, "Could not create new folder '" + args.NewText + "'");
|
|
- }
|
|
- finally
|
|
- {
|
|
- Populate();
|
|
- }
|
|
+ System.IO.DirectoryInfo dirinfo = new DirectoryInfo (CurrentDir);
|
|
+ try
|
|
+ {
|
|
+ dirinfo.CreateSubdirectory(args.NewText);
|
|
+ }
|
|
+ catch (Exception ex)
|
|
+ {
|
|
+ messageService.ShowError (ex, "Could not create new folder '" + args.NewText + "'");
|
|
+ }
|
|
+ finally
|
|
+ {
|
|
+ Populate ();
|
|
+ }
|
|
|
|
- break;
|
|
+ break;
|
|
|
|
default:
|
|
- Console.WriteLine("This should not be happening");
|
|
- break;
|
|
+ Console.WriteLine ("This should not be happening");
|
|
+ break;
|
|
}
|
|
+
|
|
performingtask = PerformingTask.None;
|
|
}
|
|
|
|
@@ -393,21 +400,21 @@
|
|
TreeIter iter;
|
|
TreeModel model;
|
|
|
|
- if (messageService.AskQuestion("Are you sure you want to delete this folder?", "Delete folder"))
|
|
+ if (messageService.AskQuestion ("Are you sure you want to delete this folder?", "Delete folder"))
|
|
{
|
|
if (tv.Selection.GetSelected (out model, out iter))
|
|
{
|
|
try
|
|
{
|
|
- Directory.Delete (System.IO.Path.Combine(CurrentDir, (string) store.GetValue (iter, 1)), true);
|
|
+ Directory.Delete (System.IO.Path.Combine (CurrentDir, (string) store.GetValue (iter, 1)), true);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
- messageService.ShowError (ex, "Could not delete folder '" + System.IO.Path.Combine(CurrentDir, (string) store.GetValue (iter, 1)) + "'");
|
|
+ messageService.ShowError (ex, "Could not delete folder '" + System.IO.Path.Combine (CurrentDir, (string) store.GetValue (iter, 1)) + "'");
|
|
}
|
|
finally
|
|
{
|
|
- Populate();
|
|
+ Populate ();
|
|
}
|
|
}
|
|
}
|
|
@@ -430,32 +437,31 @@
|
|
treepath = tv.Model.GetPath(iter);
|
|
|
|
column = tv.GetColumn (0);
|
|
-
|
|
tv.SetCursor (treepath, column, true);
|
|
}
|
|
|
|
- private void GetListOfHiddenFolders()
|
|
+ private void GetListOfHiddenFolders ()
|
|
{
|
|
- hiddenfolders.Clear();
|
|
+ hiddenfolders.Clear ();
|
|
|
|
- if(System.IO.File.Exists(CurrentDir + System.IO.Path.DirectorySeparatorChar + ".hidden"))
|
|
+ if (System.IO.File.Exists (CurrentDir + System.IO.Path.DirectorySeparatorChar + ".hidden"))
|
|
{
|
|
StreamReader stream = new StreamReader (CurrentDir + System.IO.Path.DirectorySeparatorChar + ".hidden");
|
|
- string foldertohide = stream.ReadLine();
|
|
+ string foldertohide = stream.ReadLine ();
|
|
|
|
while (foldertohide != null)
|
|
{
|
|
hiddenfolders.Add (foldertohide, foldertohide);
|
|
- foldertohide = stream.ReadLine();
|
|
+ foldertohide = stream.ReadLine ();
|
|
}
|
|
|
|
- stream.Close();
|
|
+ stream.Close ();
|
|
}
|
|
}
|
|
|
|
- private Boolean NotHidden(string folder)
|
|
+ private Boolean NotHidden (string folder)
|
|
{
|
|
- return !hiddenfolders.Contains(folder);
|
|
+ return !hiddenfolders.Contains (folder);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
</PRE>
|
|
|
|
<!--endarticle-->
|
|
<HR>
|
|
<P><UL>
|
|
<!--threads-->
|
|
<LI>Previous message: <A HREF="000775.html">[Monodevelop-patches-list] r1169 - trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui.Widgets/FileBrowser
|
|
</A></li>
|
|
<LI>Next message: <A HREF="000778.html">[Monodevelop-patches-list] r1171 - in trunk/MonoDevelop: . src/Main/Base/Gui/CompletionDatabaseWizard
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#776">[ date ]</a>
|
|
<a href="thread.html#776">[ thread ]</a>
|
|
<a href="subject.html#776">[ subject ]</a>
|
|
<a href="author.html#776">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
|
|
<hr>
|
|
<a href="http://lists.ximian.com/mailman/listinfo/monodevelop-patches-list">More information about the Monodevelop-patches-list
|
|
mailing list</a><br>
|
|
</body></html>
|