зеркало из https://github.com/mono/mail-archives.git
261 строка
8.0 KiB
HTML
261 строка
8.0 KiB
HTML
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
||
|
<HTML>
|
||
|
<HEAD>
|
||
|
<TITLE> [Monodevelop-patches-list] r1075 - trunk/MonoDevelop/src/Main/Base/Services/File
|
||
|
</TITLE>
|
||
|
<LINK REL="Index" HREF="index.html" >
|
||
|
<LINK REL="made" HREF="mailto:monodevelop-patches-list%40lists.ximian.com?Subject=%5BMonodevelop-patches-list%5D%20r1075%20-%20trunk/MonoDevelop/src/Main/Base/Services/File&In-Reply-To=">
|
||
|
<META NAME="robots" CONTENT="index,nofollow">
|
||
|
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
|
||
|
<LINK REL="Previous" HREF="000679.html">
|
||
|
<LINK REL="Next" HREF="000681.html">
|
||
|
</HEAD>
|
||
|
<BODY BGCOLOR="#ffffff">
|
||
|
<H1>[Monodevelop-patches-list] r1075 - trunk/MonoDevelop/src/Main/Base/Services/File</H1>
|
||
|
<B>commit-watcher at mono-cvs.ximian.com</B>
|
||
|
<A HREF="mailto:monodevelop-patches-list%40lists.ximian.com?Subject=%5BMonodevelop-patches-list%5D%20r1075%20-%20trunk/MonoDevelop/src/Main/Base/Services/File&In-Reply-To="
|
||
|
TITLE="[Monodevelop-patches-list] r1075 - trunk/MonoDevelop/src/Main/Base/Services/File">commit-watcher at mono-cvs.ximian.com
|
||
|
</A><BR>
|
||
|
<I>Mon Mar 1 19:20:02 EST 2004</I>
|
||
|
<P><UL>
|
||
|
<LI>Previous message: <A HREF="000679.html">[Monodevelop-patches-list] r1074 - in branches/MonoDevelop-playground: . libmonodevelop src src/AddIns/DisplayBindings/SourceEditor src/Plugins/Content src/Plugins/Node src/Util
|
||
|
</A></li>
|
||
|
<LI>Next message: <A HREF="000681.html">[Monodevelop-patches-list] r1076 - trunk/MonoDevelop/gdldock/sources/gdl
|
||
|
</A></li>
|
||
|
<LI> <B>Messages sorted by:</B>
|
||
|
<a href="date.html#680">[ date ]</a>
|
||
|
<a href="thread.html#680">[ thread ]</a>
|
||
|
<a href="subject.html#680">[ subject ]</a>
|
||
|
<a href="author.html#680">[ author ]</a>
|
||
|
</LI>
|
||
|
</UL>
|
||
|
<HR>
|
||
|
<!--beginarticle-->
|
||
|
<PRE>Author: jluke
|
||
|
Date: 2004-03-01 19:20:02 -0500 (Mon, 01 Mar 2004)
|
||
|
New Revision: 1075
|
||
|
|
||
|
Added:
|
||
|
trunk/MonoDevelop/src/Main/Base/Services/File/FdoRecentFiles.cs
|
||
|
trunk/MonoDevelop/src/Main/Base/Services/File/RecentItem.cs
|
||
|
Log:
|
||
|
beginning of Freedesktop.org recent files implementation
|
||
|
untested and not in the build
|
||
|
|
||
|
|
||
|
Added: trunk/MonoDevelop/src/Main/Base/Services/File/FdoRecentFiles.cs
|
||
|
===================================================================
|
||
|
--- trunk/MonoDevelop/src/Main/Base/Services/File/FdoRecentFiles.cs 2004-03-01 21:42:30 UTC (rev 1074)
|
||
|
+++ trunk/MonoDevelop/src/Main/Base/Services/File/FdoRecentFiles.cs 2004-03-02 00:20:02 UTC (rev 1075)
|
||
|
@@ -0,0 +1,125 @@
|
||
|
+//
|
||
|
+// Author: John Luke <<A HREF="http://lists.ximian.com/mailman/listinfo/monodevelop-patches-list">jluke at cfl.rr.com</A>>
|
||
|
+//
|
||
|
+// Copyright 2004 John Luke
|
||
|
+//
|
||
|
+
|
||
|
+using System;
|
||
|
+using System.Collections;
|
||
|
+using System.IO;
|
||
|
+using System.Xml;
|
||
|
+using System.Xml.XPath;
|
||
|
+
|
||
|
+// implementation of the freedesktop.org Recent Files spec
|
||
|
+// <A HREF="http://freedesktop.org/Standards/recent-file-spec/recent-file-spec-0.2.html">http://freedesktop.org/Standards/recent-file-spec/recent-file-spec-0.2.html</A>
|
||
|
+
|
||
|
+namespace ICSharpCode.SharpDevelop.Services
|
||
|
+{
|
||
|
+ public class FdoRecentFiles
|
||
|
+ {
|
||
|
+ // The document should be stored in "~/.recently-used",
|
||
|
+
|
||
|
+ // and it should contain no more than 500 items.
|
||
|
+ int totalMaxLength = 500;
|
||
|
+
|
||
|
+ // MD only wants to save last 10 in its group
|
||
|
+ int maxLength = 10;
|
||
|
+ ArrayList lastfile = new ArrayList();
|
||
|
+ ArrayList lastproject = new ArrayList();
|
||
|
+
|
||
|
+ XmlDocument doc;
|
||
|
+
|
||
|
+ public event EventHandler RecentFileChanged;
|
||
|
+ public event EventHandler RecentProjectChanged;
|
||
|
+
|
||
|
+ public FdoRecentFiles ()
|
||
|
+ {
|
||
|
+ string recentFile = Environment.GetEnvironmentVariable ("HOME");
|
||
|
+ recentFile = Path.Combine (recentFile, ".recently_used");
|
||
|
+ Console.WriteLine (recentFile);
|
||
|
+
|
||
|
+ if (File.Exists (recentFile))
|
||
|
+ {
|
||
|
+ // use POSIX lockf ()
|
||
|
+ doc = new XmlDocument ();
|
||
|
+ doc.Load (recentFile);
|
||
|
+
|
||
|
+ XPathNavigator nav = doc.CreateNavigator ();
|
||
|
+ XPathNodeIterator xni = nav.Select ("/RecentFiles/RecentItem");
|
||
|
+ Console.WriteLine ("Total Items {0}", xni.Count);
|
||
|
+ }
|
||
|
+ else
|
||
|
+ {
|
||
|
+ // use POSIX lockf ()
|
||
|
+ Console.WriteLine ("{0} does not exist.", recentFile);
|
||
|
+ // create it
|
||
|
+ }
|
||
|
+
|
||
|
+ FileSystemWatcher watcher = new FileSystemWatcher (recentFile);
|
||
|
+ watcher.Changed += new FileSystemEventHandler (OnWatcherChanged);
|
||
|
+ }
|
||
|
+
|
||
|
+ void OnWatcherChanged (object o, FileSystemEventArgs args)
|
||
|
+ {
|
||
|
+ // TODO
|
||
|
+ // decide if projects or files changed or both
|
||
|
+ Console.WriteLine ("on watcher changed");
|
||
|
+ }
|
||
|
+
|
||
|
+ void OnRecentFileChange ()
|
||
|
+ {
|
||
|
+ if (RecentFileChanged != null)
|
||
|
+ {
|
||
|
+ RecentFileChanged (this, null);
|
||
|
+ }
|
||
|
+ }
|
||
|
+
|
||
|
+ void OnRecentProjectChange ()
|
||
|
+ {
|
||
|
+ if (RecentProjectChanged != null)
|
||
|
+ {
|
||
|
+ RecentProjectChanged (this, null);
|
||
|
+ }
|
||
|
+ }
|
||
|
+
|
||
|
+ public ArrayList RecentFiles
|
||
|
+ {
|
||
|
+ get
|
||
|
+ {
|
||
|
+ return lastfile;
|
||
|
+ }
|
||
|
+ }
|
||
|
+
|
||
|
+ public ArrayList RecentProjects
|
||
|
+ {
|
||
|
+ get
|
||
|
+ {
|
||
|
+ return lastproject;
|
||
|
+ }
|
||
|
+ }
|
||
|
+
|
||
|
+ public void AddFile (string file_uri)
|
||
|
+ {
|
||
|
+ // uri must be unique
|
||
|
+ // or just update timestamp and group
|
||
|
+ }
|
||
|
+
|
||
|
+ public void AddProject (string file_uri)
|
||
|
+ {
|
||
|
+ // uri must be unique
|
||
|
+ // or just update timestamp and group
|
||
|
+ }
|
||
|
+
|
||
|
+ // spec doesn't mention removal
|
||
|
+ public void ClearFiles ()
|
||
|
+ {
|
||
|
+
|
||
|
+ }
|
||
|
+
|
||
|
+ // spec doesn't mention removal
|
||
|
+ public void ClearProjects ()
|
||
|
+ {
|
||
|
+
|
||
|
+ }
|
||
|
+ }
|
||
|
+}
|
||
|
|
||
|
Added: trunk/MonoDevelop/src/Main/Base/Services/File/RecentItem.cs
|
||
|
===================================================================
|
||
|
--- trunk/MonoDevelop/src/Main/Base/Services/File/RecentItem.cs 2004-03-01 21:42:30 UTC (rev 1074)
|
||
|
+++ trunk/MonoDevelop/src/Main/Base/Services/File/RecentItem.cs 2004-03-02 00:20:02 UTC (rev 1075)
|
||
|
@@ -0,0 +1,55 @@
|
||
|
+//
|
||
|
+// Author: John Luke <<A HREF="http://lists.ximian.com/mailman/listinfo/monodevelop-patches-list">jluke at cfl.rr.com</A>>
|
||
|
+//
|
||
|
+// Copyright 2004 John Luke
|
||
|
+//
|
||
|
+
|
||
|
+// support class for FdoRecentFiles.cs
|
||
|
+
|
||
|
+using System;
|
||
|
+using MonoDevelop.Gui.Utils;
|
||
|
+
|
||
|
+namespace ICSharpCode.SharpDevelop.Services
|
||
|
+{
|
||
|
+ public class RecentItem
|
||
|
+ {
|
||
|
+ // must be a valid uri ex. file://
|
||
|
+ private string uri;
|
||
|
+ private string mime;
|
||
|
+ // the number of seconds sinced the Epoch when the item was added to the list.
|
||
|
+ private string timestamp;
|
||
|
+ // may need to change to allow for > 1
|
||
|
+ // lets wait til it's needed though
|
||
|
+ private string group;
|
||
|
+
|
||
|
+ // these 3 are required
|
||
|
+ public RecentItem (string uri)
|
||
|
+ {
|
||
|
+ this.uri = uri;
|
||
|
+ this.mime = Vfs.GetMimeType (uri);
|
||
|
+ // FIXME 00:00:00 UTC on January 1, 1970 (Unix Epoch)
|
||
|
+ // Now - Epoch in seconds
|
||
|
+ this.timestamp = DateTime.Now.ToString ();
|
||
|
+ }
|
||
|
+
|
||
|
+ public string Mime
|
||
|
+ {
|
||
|
+ get { return mime; }
|
||
|
+ }
|
||
|
+
|
||
|
+ public string Uri
|
||
|
+ {
|
||
|
+ get { return uri; }
|
||
|
+ }
|
||
|
+
|
||
|
+ public string Timestamp
|
||
|
+ {
|
||
|
+ get { return timestamp; }
|
||
|
+ }
|
||
|
+
|
||
|
+ public string Group
|
||
|
+ {
|
||
|
+ get { return group; }
|
||
|
+ }
|
||
|
+ }
|
||
|
+}
|
||
|
|
||
|
|
||
|
</PRE>
|
||
|
|
||
|
<!--endarticle-->
|
||
|
<HR>
|
||
|
<P><UL>
|
||
|
<!--threads-->
|
||
|
<LI>Previous message: <A HREF="000679.html">[Monodevelop-patches-list] r1074 - in branches/MonoDevelop-playground: . libmonodevelop src src/AddIns/DisplayBindings/SourceEditor src/Plugins/Content src/Plugins/Node src/Util
|
||
|
</A></li>
|
||
|
<LI>Next message: <A HREF="000681.html">[Monodevelop-patches-list] r1076 - trunk/MonoDevelop/gdldock/sources/gdl
|
||
|
</A></li>
|
||
|
<LI> <B>Messages sorted by:</B>
|
||
|
<a href="date.html#680">[ date ]</a>
|
||
|
<a href="thread.html#680">[ thread ]</a>
|
||
|
<a href="subject.html#680">[ subject ]</a>
|
||
|
<a href="author.html#680">[ 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>
|