diff options
author | Michael Hutchinson <m.j.hutchinson@gmail.com> | 2011-10-26 01:08:45 +0400 |
---|---|---|
committer | Michael Hutchinson <m.j.hutchinson@gmail.com> | 2011-10-26 01:08:45 +0400 |
commit | 74e1817c2280a64525b08ce559c61ff8c7ef3c37 (patch) | |
tree | a93ba0a5af0e3301abd88f8f104ec103474f8219 /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads | |
parent | b5ba3a5e02ea2e99896ea1801c5748b2666dd436 (diff) |
[Ide] Remove unused classes from the old file pad
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/FileList.cs | 213 | ||||
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/FileListItem.cs | 105 |
2 files changed, 0 insertions, 318 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/FileList.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/FileList.cs deleted file mode 100644 index d880024326..0000000000 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/FileList.cs +++ /dev/null @@ -1,213 +0,0 @@ -// FileList.cs -// -// Author: -// John Luke <jluke@cfl.rr.com> -// -// Copyright (c) 2004 John Luke -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// -// - -using System; -using System.IO; -using System.Collections; - -using MonoDevelop.Core; -using MonoDevelop.Components; - -namespace MonoDevelop.Ide.Gui.Pads -{ - internal class FileList : Gtk.TreeView - { - private FileSystemWatcher watcher; - private ArrayList Items; - private Gtk.ListStore store; - FileListItem selectedItem = null; - Gtk.TreeIter selectedIter; - Gtk.CellRendererText textRender = new Gtk.CellRendererText (); - - public FileList () - { - Items = new ArrayList (); - store = new Gtk.ListStore (typeof (string), typeof (string), typeof (string), typeof (FileListItem), typeof (Gdk.Pixbuf)); - Model = store; - - HeadersVisible = true; - HeadersClickable = true; - RulesHint = true; - - Gtk.TreeViewColumn name_column = new Gtk.TreeViewColumn (); - name_column.Title = GettextCatalog.GetString ("Files"); - - Gtk.TreeViewColumn size_column = new Gtk.TreeViewColumn (); - size_column.Title = GettextCatalog.GetString ("Size"); - - Gtk.TreeViewColumn modi_column = new Gtk.TreeViewColumn (); - modi_column.Title = GettextCatalog.GetString ("Last modified"); - - Gtk.CellRendererPixbuf pix_render = new Gtk.CellRendererPixbuf (); - name_column.PackStart (pix_render, false); - name_column.AddAttribute (pix_render, "pixbuf", 4); - - name_column.PackStart (textRender, false); - name_column.AddAttribute (textRender, "text", 0); - - size_column.PackStart (textRender, false); - size_column.AddAttribute (textRender, "text", 1); - - modi_column.PackStart (textRender, false); - modi_column.AddAttribute (textRender, "text", 2); - - AppendColumn (name_column); - AppendColumn (size_column); - AppendColumn (modi_column); - - this.PopupMenu += new Gtk.PopupMenuHandler (OnPopupMenu); - this.ButtonReleaseEvent += new Gtk.ButtonReleaseEventHandler (OnButtonReleased); - this.Selection.Changed += new EventHandler (OnSelectionChanged); - - watcher = new FileSystemWatcher (); - watcher.EnableRaisingEvents = false; - watcher.NotifyFilter = NotifyFilters.FileName; - - watcher.Created += DispatchService.GuiDispatch (new FileSystemEventHandler (fileCreated)); - watcher.Deleted += DispatchService.GuiDispatch (new FileSystemEventHandler (fileDeleted)); - watcher.Changed += DispatchService.GuiDispatch (new FileSystemEventHandler (fileChanged)); - watcher.Renamed += DispatchService.GuiDispatch (new RenamedEventHandler (fileRenamed)); - } - - private void fileCreated (Object o, FileSystemEventArgs e) - { - FileInfo fileInfo = new FileInfo (e.FullPath); - Items.Add(new FileListItem(e.FullPath, String.Format("{0} KB", fileInfo.Length / 512 * 2), fileInfo.LastWriteTime.ToString())); - } - - private void fileDeleted (Object o, FileSystemEventArgs e) - { - foreach (FileListItem fileListItem in Items) { - if (String.Compare (fileListItem.FullName, e.FullPath, StringComparison.InvariantCultureIgnoreCase) == 0) - Items.Remove (fileListItem); - } - } - - private void fileChanged (Object o, FileSystemEventArgs e) - { - foreach (FileListItem fileListItem in Items) { - if (String.Compare (fileListItem.FullName, e.FullPath, StringComparison.InvariantCultureIgnoreCase) == 0) { - FileInfo info = new FileInfo(e.FullPath); - fileListItem.Size = String.Format("{0} KB", info.Length / 512 * 2); - fileListItem.LastModified = info.LastWriteTime.ToString (); - } - } - } - - private void fileRenamed (Object o, RenamedEventArgs e) - { - foreach (FileListItem fileListItem in Items) { - if (String.Compare (fileListItem.FullName, e.OldFullPath, StringComparison.InvariantCultureIgnoreCase) == 0) { - fileListItem.FullName = e.FullPath; - } - } - } - - internal void ItemAdded(FileListItem item) { - store.AppendValues(item.Text, item.Size, item.LastModified, item, item.Icon); - } - - void ItemRemoved (FileListItem item) { - store.Remove (ref selectedIter); - } - - internal void Clear() { - store.Clear(); - } - - - - - - private void OnRenameFile (object sender, EventArgs e) - { - } - - private void OnDeleteFiles (object sender, EventArgs e) - { - if (MessageService.Confirm (GettextCatalog.GetString ("Are you sure you want to delete this file?"), AlertButton.Delete)) - { - try - { - FileService.DeleteFile (selectedItem.FullName); - ItemRemoved (selectedItem); - } - catch (Exception ex) - { - MessageService.ShowException (ex, "Could not delete file '" + System.IO.Path.GetFileName (selectedItem.FullName) + "'"); - } - } - } - - private void OnPopupMenu (object o, Gtk.PopupMenuArgs args) - { - ShowPopup (); - } - - private void OnButtonReleased (object o, Gtk.ButtonReleaseEventArgs args) - { - if (args.Event.Button == 3) - ShowPopup (); - } - - private void ShowPopup () - { - Gtk.Menu menu = new Gtk.Menu (); - - Gtk.MenuItem deleteFile = new Gtk.MenuItem (GettextCatalog.GetString ("Delete file")); - deleteFile.Activated += new EventHandler (OnDeleteFiles); - - Gtk.MenuItem renameFile = new Gtk.MenuItem (GettextCatalog.GetString ("Rename file")); - renameFile.Activated += new EventHandler (OnRenameFile); - renameFile.Sensitive = false; - - menu.Append (deleteFile); - menu.Append (renameFile); - - menu.Popup (null, null, null, 3, Gtk.Global.CurrentEventTime); - menu.ShowAll (); - } - - void OnSelectionChanged (object o, EventArgs args) - { - Gtk.TreeIter iter; - Gtk.TreeModel model; - - if (this.Selection.GetSelected (out model, out iter)) - { - selectedItem = (FileListItem) model.GetValue (iter, 3); - selectedIter = iter; - } - } - - internal void SetCustomFont (Pango.FontDescription desc) - { - textRender.FontDesc = desc; - } - } -} - diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/FileListItem.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/FileListItem.cs deleted file mode 100644 index f69cf621d1..0000000000 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/FileListItem.cs +++ /dev/null @@ -1,105 +0,0 @@ -// FileListItem.cs -// -// Author: -// John Luke <john.luke@gmail.com> -// -// Copyright (c) 2007 John Luke -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// -// - -using System; -using System.IO; - -using MonoDevelop.Core; - -namespace MonoDevelop.Ide.Gui.Pads -{ - internal class FileListItem - { - string fullname; - string text; - string size; - string lastModified; - Gdk.Pixbuf icon; - - public string FullName { - get { - return fullname; - } - set { - fullname = System.IO.Path.GetFullPath(value); - text = System.IO.Path.GetFileName(fullname); - } - } - - public string Text { - get { - return text; - } - } - - public string Size { - get { - return size; - } - set { - size = value; - } - } - - public string LastModified { - get { - return lastModified; - } - set { - lastModified = value; - } - } - - public Gdk.Pixbuf Icon { - get { - return icon; - } - set { - icon = value; - } - } - - public FileListItem(string fullname, string size, string lastModified) - { - this.size = size; - this.lastModified = lastModified; - //FIXME: This is because //home/blah is not the same as /home/blah according to Icon.LookupSync, if we get weird behaviours, lets look at this again, see if we still need it. - FullName = fullname.Substring (1); - icon = DesktopService.GetPixbufForFile (FullName, Gtk.IconSize.Menu); - } - - public FileListItem (string name) - { - FileInfo fi = new FileInfo (name); - this.size = Math.Round ((double) fi.Length / 1024).ToString () + " KB"; - this.lastModified = fi.LastWriteTime.ToString (); - FullName = System.IO.Path.GetFullPath (name); - icon = DesktopService.GetPixbufForFile (FullName, Gtk.IconSize.Menu); - } - } -} - |