[f-spot] Clean cruft in UriList, move to FSpot.Utils.
- From: Ruben Vermeersch <rubenv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [f-spot] Clean cruft in UriList, move to FSpot.Utils.
- Date: Tue, 10 Aug 2010 11:06:15 +0000 (UTC)
commit 37d1022d0ce5895230e45faa39a16a55305c309c
Author: Ruben Vermeersch <ruben savanne be>
Date: Tue Aug 10 13:01:01 2010 +0200
Clean cruft in UriList, move to FSpot.Utils.
src/Clients/MainApp/FSpot.Utils/UriList.cs | 94 --------------------
src/Clients/MainApp/FSpot/MainWindow.cs | 10 +--
.../MainApp/FSpot/SelectionDataExtensions.cs | 4 +-
src/Clients/MainApp/MainApp.csproj | 4 +-
src/Clients/MainApp/Makefile.am | 1 -
src/Core/FSpot.Utils/FSpot.Utils.csproj | 1 +
src/Core/FSpot.Utils/FSpot.Utils/UriList.cs | 66 ++++++++++++++
src/Core/FSpot.Utils/Makefile.am | 1 +
.../FSpot.Exporters.PicasaWeb/PicasaWebExport.cs | 1 -
9 files changed, 75 insertions(+), 107 deletions(-)
---
diff --git a/src/Clients/MainApp/FSpot/MainWindow.cs b/src/Clients/MainApp/FSpot/MainWindow.cs
index 305e545..61ddbd1 100644
--- a/src/Clients/MainApp/FSpot/MainWindow.cs
+++ b/src/Clients/MainApp/FSpot/MainWindow.cs
@@ -8,6 +8,7 @@
using System;
using System.Text;
+using System.Linq;
using System.Collections;
using System.Collections.Generic;
@@ -993,11 +994,6 @@ namespace FSpot
return;
IBrowsableItem photo = icon_view.Collection [cell_num];
- #if false
- group_selector.Adaptor.GlassSet -= HandleAdaptorGlassSet;
- group_selector.Adaptor.SetGlass (group_selector.Adaptor.IndexFromPhoto (photo));
- group_selector.Adaptor.GlassSet = HandleAdaptorGlassSet;
- #else
/*
* FIXME this is a lame hack to get around a delegate chain. This should
* actually operate directly on the adaptor not on the selector but I don't have
@@ -1006,7 +1002,6 @@ namespace FSpot
if (!group_selector.GlassUpdating) {
group_selector.SetPosition (group_selector.Adaptor.IndexFromPhoto (photo));
}
- #endif
}
void HandleIconViewScroll (object sender, EventArgs args)
@@ -1088,7 +1083,8 @@ namespace FSpot
void HandleIconViewDragDataGet (object sender, DragDataGetArgs args)
{
if (args.Info == DragDropTargets.UriListEntry.Info) {
- args.SelectionData.SetUriListData (new UriList (SelectedPhotos ()), args.Context.Targets[0]);
+ var uris = from p in SelectedPhotos () select p.DefaultVersion.Uri;
+ args.SelectionData.SetUriListData (new UriList (uris), args.Context.Targets[0]);
return;
}
diff --git a/src/Clients/MainApp/FSpot/SelectionDataExtensions.cs b/src/Clients/MainApp/FSpot/SelectionDataExtensions.cs
index fe8f8dc..718e62b 100644
--- a/src/Clients/MainApp/FSpot/SelectionDataExtensions.cs
+++ b/src/Clients/MainApp/FSpot/SelectionDataExtensions.cs
@@ -111,9 +111,7 @@ namespace FSpot
public static UriList GetUriListData (this SelectionData selection_data)
{
- string [] uris = GetStringData (selection_data).Split ('\n');
-
- return new UriList (uris);
+ return new UriList (GetStringData (selection_data));
}
}
}
diff --git a/src/Clients/MainApp/MainApp.csproj b/src/Clients/MainApp/MainApp.csproj
index be83c82..ba4cb34 100644
--- a/src/Clients/MainApp/MainApp.csproj
+++ b/src/Clients/MainApp/MainApp.csproj
@@ -211,7 +211,6 @@
<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">
@@ -380,4 +379,7 @@
<Name>FSpot.Utils</Name>
</ProjectReference>
</ItemGroup>
+ <ItemGroup>
+ <Folder Include="FSpot.Utils\" />
+ </ItemGroup>
</Project>
\ No newline at end of file
diff --git a/src/Clients/MainApp/Makefile.am b/src/Clients/MainApp/Makefile.am
index 168df48..bf0672c 100644
--- a/src/Clients/MainApp/Makefile.am
+++ b/src/Clients/MainApp/Makefile.am
@@ -88,7 +88,6 @@ SOURCES = \
FSpot.UI.Dialog/SelectionRatioDialog.cs \
FSpot.UI.Dialog/TagSelectionDialog.cs \
FSpot.UI.Dialog/ThreadProgressDialog.cs \
- FSpot.Utils/UriList.cs \
FSpot.Widgets/CellRendererTextProgress.cs \
FSpot.Widgets/CompositeUtils.cs \
FSpot.Widgets/Dissolve.cs \
diff --git a/src/Core/FSpot.Utils/FSpot.Utils.csproj b/src/Core/FSpot.Utils/FSpot.Utils.csproj
index 54f70b5..b65226f 100644
--- a/src/Core/FSpot.Utils/FSpot.Utils.csproj
+++ b/src/Core/FSpot.Utils/FSpot.Utils.csproj
@@ -54,6 +54,7 @@
<Compile Include="FSpot.Utils\Tests\SafeUriTests.cs" />
<Compile Include="FSpot.Utils\Tests\SidecarXmpExtensionsTests.cs" />
<Compile Include="FSpot.Utils\Tests\XdgThumbnailSpecTests.cs" />
+ <Compile Include="FSpot.Utils\UriList.cs" />
</ItemGroup>
<ProjectExtensions>
<MonoDevelop>
diff --git a/src/Core/FSpot.Utils/FSpot.Utils/UriList.cs b/src/Core/FSpot.Utils/FSpot.Utils/UriList.cs
new file mode 100644
index 0000000..1befb6c
--- /dev/null
+++ b/src/Core/FSpot.Utils/FSpot.Utils/UriList.cs
@@ -0,0 +1,66 @@
+using System.Collections.Generic;
+using System.Text;
+using System;
+using Hyena;
+
+namespace FSpot.Utils
+{
+ public class UriList : List<SafeUri>
+ {
+ public UriList () : base()
+ {
+ }
+
+ public UriList (string data)
+ {
+ LoadFromStrings (data.Split ('\n'));
+ }
+
+ public UriList (IEnumerable<SafeUri> uris)
+ {
+ foreach (SafeUri uri in uris) {
+ Add (uri);
+ }
+ }
+
+ private void LoadFromStrings (IEnumerable<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);
+ }
+
+ try {
+ uri = new SafeUri (s);
+ } catch {
+ continue;
+ }
+ Add (uri);
+ }
+ }
+ }
+
+ public void AddUnknown (string unknown)
+ {
+ Add (new SafeUri (unknown));
+ }
+
+ 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/Core/FSpot.Utils/Makefile.am b/src/Core/FSpot.Utils/Makefile.am
index 1f145ec..d3666fa 100644
--- a/src/Core/FSpot.Utils/Makefile.am
+++ b/src/Core/FSpot.Utils/Makefile.am
@@ -23,6 +23,7 @@ SOURCES = \
FSpot.Utils/Tests/SidecarXmpExtensionsTests.cs \
FSpot.Utils/Tests/XdgThumbnailSpecTests.cs \
FSpot.Utils/UriExtensions.cs \
+ FSpot.Utils/UriList.cs \
FSpot.Utils/UriUtils.cs \
FSpot.Utils/XdgThumbnailSpec.cs
diff --git a/src/Extensions/Exporters/FSpot.Exporters.PicasaWeb/FSpot.Exporters.PicasaWeb/PicasaWebExport.cs b/src/Extensions/Exporters/FSpot.Exporters.PicasaWeb/FSpot.Exporters.PicasaWeb/PicasaWebExport.cs
index c9e32a8..033e9cf 100644
--- a/src/Extensions/Exporters/FSpot.Exporters.PicasaWeb/FSpot.Exporters.PicasaWeb/PicasaWebExport.cs
+++ b/src/Extensions/Exporters/FSpot.Exporters.PicasaWeb/FSpot.Exporters.PicasaWeb/PicasaWebExport.cs
@@ -22,7 +22,6 @@ using FSpot;
using FSpot.Core;
using FSpot.Filters;
using FSpot.Widgets;
-using FSpot.Utils;
using FSpot.Imaging;
using FSpot.UI.Dialog;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]