[f-spot] Remove cruft from UriList.
- From: Ruben Vermeersch <rubenv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [f-spot] Remove cruft from UriList.
- Date: Tue, 10 Aug 2010 11:06:10 +0000 (UTC)
commit 10aa4dca740dab806f8c440f14764bd7960f0266
Author: Ruben Vermeersch <ruben savanne be>
Date: Tue Aug 10 12:51:00 2010 +0200
Remove cruft from UriList.
src/Clients/MainApp/FSpot.Utils/UriList.cs | 94 ++++++++++++++++++
src/Clients/MainApp/FSpot.Utils/Util.cs | 144 ----------------------------
src/Clients/MainApp/MainApp.csproj | 2 +-
src/Clients/MainApp/Makefile.am | 2 +-
4 files changed, 96 insertions(+), 146 deletions(-)
---
diff --git a/src/Clients/MainApp/FSpot.Utils/UriList.cs b/src/Clients/MainApp/FSpot.Utils/UriList.cs
new file mode 100644
index 0000000..2e85443
--- /dev/null
+++ b/src/Clients/MainApp/FSpot.Utils/UriList.cs
@@ -0,0 +1,94 @@
+//
+// Utility functions.
+//
+// Miguel de Icaza (miguel ximian com).
+//
+// (C) 2002 Ximian, Inc.
+//
+//
+
+using System.Runtime.InteropServices;
+using System.Threading;
+using System.Collections;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+using System;
+using Hyena;
+
+using FSpot.Core;
+
+namespace FSpot.Utils
+{
+ public class UriList : List<SafeUri> {
+ public UriList (IBrowsableItem [] photos) {
+ foreach (IBrowsableItem p in photos) {
+ SafeUri uri;
+ try {
+ uri = p.DefaultVersion.Uri;
+ } catch {
+ continue;
+ }
+ Add (uri);
+ }
+ }
+
+ public UriList () : base ()
+ {
+ }
+
+ private void LoadFromStrings (string [] items) {
+ foreach (String i in items) {
+ if (!i.StartsWith ("#")) {
+ SafeUri uri;
+ String s = i;
+
+ if (i.EndsWith ("\r")) {
+ s = i.Substring (0, i.Length - 1);
+ Log.DebugFormat ("uri = {0}", s);
+ }
+
+ try {
+ uri = new SafeUri (s);
+ } catch {
+ continue;
+ }
+ Add (uri);
+ }
+ }
+ }
+
+ public void AddUnknown (string unknown)
+ {
+ Add (new SafeUri (unknown));
+ }
+
+ public UriList (string data)
+ {
+ LoadFromStrings (data.Split ('\n'));
+ }
+
+ public UriList (string [] uris)
+ {
+ LoadFromStrings (uris);
+ }
+
+ public void Add (IBrowsableItem item)
+ {
+ Add (item.DefaultVersion.Uri);
+ }
+
+ public override string ToString () {
+ StringBuilder list = new StringBuilder ();
+
+ foreach (SafeUri uri in this) {
+ if (uri == null)
+ break;
+
+ list.Append (uri.ToString () + Environment.NewLine);
+ }
+
+ return list.ToString ();
+ }
+ }
+}
diff --git a/src/Clients/MainApp/MainApp.csproj b/src/Clients/MainApp/MainApp.csproj
index b5a54be..be83c82 100644
--- a/src/Clients/MainApp/MainApp.csproj
+++ b/src/Clients/MainApp/MainApp.csproj
@@ -158,7 +158,6 @@
<Compile Include="FSpot.UI.Dialog\TagSelectionDialog.cs" />
<Compile Include="FSpot.UI.Dialog\ThreadProgressDialog.cs" />
<Compile Include="FSpot\UriCollection.cs" />
- <Compile Include="FSpot.Utils\Util.cs" />
<Compile Include="FSpot\Vector.cs" />
<Compile Include="FSpot.Widgets\CellRendererTextProgress.cs" />
<Compile Include="FSpot.Widgets\CompositeUtils.cs" />
@@ -212,6 +211,7 @@
<Compile Include="FSpot\TagStore.cs" />
<Compile Include="FSpot.Database\DbException.cs" />
<Compile Include="FSpot.Database\DbStore.cs" />
+ <Compile Include="FSpot.Utils\UriList.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\..\..\COPYING">
diff --git a/src/Clients/MainApp/Makefile.am b/src/Clients/MainApp/Makefile.am
index 58cdd54..168df48 100644
--- a/src/Clients/MainApp/Makefile.am
+++ b/src/Clients/MainApp/Makefile.am
@@ -88,7 +88,7 @@ SOURCES = \
FSpot.UI.Dialog/SelectionRatioDialog.cs \
FSpot.UI.Dialog/TagSelectionDialog.cs \
FSpot.UI.Dialog/ThreadProgressDialog.cs \
- FSpot.Utils/Util.cs \
+ FSpot.Utils/UriList.cs \
FSpot.Widgets/CellRendererTextProgress.cs \
FSpot.Widgets/CompositeUtils.cs \
FSpot.Widgets/Dissolve.cs \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]