[f-spot] Update ArrayLists to List
- From: Stephen Shaw <sshaw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [f-spot] Update ArrayLists to List
- Date: Fri, 25 Nov 2011 01:07:18 +0000 (UTC)
commit eee66acfe2446136057df23a7038295b200f9624
Author: Stephen Shaw <sshaw decriptor com>
Date: Thu Nov 24 18:02:22 2011 -0700
Update ArrayLists to List
Removed just about all of the ArrayLists for List
Updated some of the names
General code clean up
Replaced a Hashtable
This should in theory improve performance by not
having the boxing/unboxing that comes with ArrayLists
F-Spot.sln | 2 +-
src/Clients/MainApp/FSpot.Database/Updater.cs | 18 +-
src/Clients/MainApp/FSpot.Filters/FilterRequest.cs | 5 +-
src/Clients/MainApp/FSpot.Filters/FilterSet.cs | 11 +-
.../MainApp/FSpot.Filters/WhiteListFilter.cs | 11 +-
src/Clients/MainApp/FSpot.Imaging/Ciff.cs | 6 +-
.../MainApp/FSpot.UI.Dialog/EditTagDialog.cs | 86 ++--
.../MainApp/FSpot.UI.Dialog/LastRollDialog.cs | 54 +-
src/Clients/MainApp/FSpot.Widgets/TagEntry.cs | 24 +-
src/Clients/MainApp/FSpot/ExportStore.cs | 184 ++++---
src/Clients/MainApp/FSpot/MainWindow.cs | 4 +-
src/Clients/MainApp/FSpot/Photo.cs | 120 ++--
src/Clients/MainApp/FSpot/PhotoStore.cs | 8 +-
src/Clients/MainApp/FSpot/PixbufCache.cs | 5 +-
src/Clients/MainApp/FSpot/RollStore.cs | 146 +++---
src/Clients/MainApp/FSpot/TagQueryWidget.cs | 27 +-
src/Clients/MainApp/FSpot/TagSelectionWidget.cs | 24 +-
src/Clients/MainApp/FSpot/ThumbnailCache.cs | 23 +-
src/Clients/MainApp/ImageLoaderThread.cs | 25 +-
src/Clients/MainApp/TagCommands.cs | 8 +-
.../FSpot.Gui/FSpot.Widgets/SelectionCollection.cs | 602 ++++++++++----------
.../FSpot.Exporters.Flickr/FlickrExport.cs | 4 +-
.../FSpot.Exporters.Flickr/FlickrRemote.cs | 11 +-
.../FSpot.Exporters.Folder/FolderExport.cs | 7 +-
.../FSpot.Exporters.Gallery/FormClient.cs | 13 +-
.../GalleryAccountManager.cs | 8 +-
.../FSpot.Exporters.Gallery/GalleryExport.cs | 114 ++--
.../FSpot.Exporters.Gallery/GalleryRemote.cs | 148 ++---
.../GoogleAccountManager.cs | 23 +-
.../FSpot.Exporters.PicasaWeb/PicasaWebExport.cs | 178 +++---
.../SmugMugAccountManager.cs | 9 +-
.../FSpot.Exporters.SmugMug/SmugMugExport.cs | 9 +-
.../ChangePhotoPathController.cs | 14 +-
.../Tools/FSpot.Tools.MetaPixel/MetaPixel.cs | 8 +-
.../Tools/FSpot.Tools.PictureTile/PictureTile.cs | 8 +-
35 files changed, 982 insertions(+), 965 deletions(-)
---
diff --git a/F-Spot.sln b/F-Spot.sln
index 3a715d3..adb2727 100644
--- a/F-Spot.sln
+++ b/F-Spot.sln
@@ -391,7 +391,7 @@ Global
$2.inheritsScope = text/plain
$2.scope = text/x-csharp
$0.CSharpFormattingPolicy = $3
- $3.IfElseBraceForcement = AddBraces
+ $3.IfElseBraceForcement = RemoveBraces
$3.ForBraceForcement = AddBraces
$3.ForEachBraceForcement = AddBraces
$3.WhileBraceForcement = AddBraces
diff --git a/src/Clients/MainApp/FSpot.Database/Updater.cs b/src/Clients/MainApp/FSpot.Database/Updater.cs
index c430979..4f71d87 100644
--- a/src/Clients/MainApp/FSpot.Database/Updater.cs
+++ b/src/Clients/MainApp/FSpot.Database/Updater.cs
@@ -6,6 +6,7 @@
// Ruben Vermeersch <ruben savanne be>
// Gabriel Burt <gabriel burt gmail com>
// Stephane Delcroix <stephane delcroix org>
+// Stephen Shaw <sshaw decriptor com>
//
// Copyright (C) 2006-2010 Novell, Inc.
// Copyright (C) 2009-2010 Mike GemÃnde
@@ -37,6 +38,7 @@ using Mono.Unix;
using Gtk;
using System;
using System.Collections;
+using System.Collections.Generic;
using FSpot.Utils;
using FSpot.UI.Dialog;
@@ -49,7 +51,7 @@ namespace FSpot.Database
public static class Updater
{
private static ProgressDialog dialog;
- private static Hashtable updates = new Hashtable ();
+ private static Dictionary<Version, Update> updates = new Dictionary<Version, Update> ();
private static Version db_version;
private static FSpotDatabaseConnection db;
public static bool silent = false;
@@ -59,9 +61,13 @@ namespace FSpot.Database
if (updates == null || updates.Count == 0)
return new Version (0, 0);
- ArrayList keys = new ArrayList (updates.Keys);
+ List<Version> keys = new List<Version> ();
+ foreach (Version k in updates.Keys) {
+ keys.Add(k);
+ }
keys.Sort ();
- return keys [keys.Count - 1] as Version;
+
+ return keys [keys.Count - 1];
}
}
@@ -772,7 +778,10 @@ namespace FSpot.Database
db.BeginTransaction ();
try {
- ArrayList keys = new ArrayList (updates.Keys);
+ List<Version> keys = new List<Version> ();
+ foreach (Version k in updates.Keys) {
+ keys.Add(k);
+ }
keys.Sort ();
foreach (Version version in keys) {
if (version <= db_version)
@@ -913,6 +922,7 @@ namespace FSpot.Database
}
}
+ // TODO: Look into System.Version
public class Version : IComparable
{
int maj = 0;
diff --git a/src/Clients/MainApp/FSpot.Filters/FilterRequest.cs b/src/Clients/MainApp/FSpot.Filters/FilterRequest.cs
index a44b8e1..e110fab 100644
--- a/src/Clients/MainApp/FSpot.Filters/FilterRequest.cs
+++ b/src/Clients/MainApp/FSpot.Filters/FilterRequest.cs
@@ -33,6 +33,7 @@
using System;
using System.Collections;
+using System.Collections.Generic;
using Hyena;
using FSpot.Utils;
@@ -43,13 +44,13 @@ namespace FSpot.Filters {
{
SafeUri current;
- ArrayList temp_uris;
+ List<SafeUri> temp_uris;
public FilterRequest (SafeUri source)
{
Source = source;
this.current = source;
- temp_uris = new ArrayList ();
+ temp_uris = new List<SafeUri> ();
}
~FilterRequest ()
diff --git a/src/Clients/MainApp/FSpot.Filters/FilterSet.cs b/src/Clients/MainApp/FSpot.Filters/FilterSet.cs
index 3fddb02..22a9404 100644
--- a/src/Clients/MainApp/FSpot.Filters/FilterSet.cs
+++ b/src/Clients/MainApp/FSpot.Filters/FilterSet.cs
@@ -4,6 +4,7 @@
// Author:
// Larry Ewing <lewing novell com>
// Ruben Vermeersch <ruben savanne be>
+// Stephen Shaw <sshaw decriptor com>
//
// Copyright (C) 2006-2010 Novell, Inc.
// Copyright (C) 2006 Larry Ewing
@@ -39,25 +40,25 @@
* I don't like per file copyright notices.
*/
-using System.Collections;
+using System.Collections.Generic;
namespace FSpot.Filters {
public class FilterSet : IFilter {
- public ArrayList list;
+ public List<IFilter> ifilters;
public FilterSet () {
- list = new ArrayList ();
+ ifilters = new List<IFilter> ();
}
public void Add (IFilter filter)
{
- list.Add (filter);
+ ifilters.Add (filter);
}
public bool Convert (FilterRequest req)
{
bool changed = false;
- foreach (IFilter filter in list) {
+ foreach (IFilter filter in ifilters) {
changed |= filter.Convert (req);
}
return changed;
diff --git a/src/Clients/MainApp/FSpot.Filters/WhiteListFilter.cs b/src/Clients/MainApp/FSpot.Filters/WhiteListFilter.cs
index 2563537..b29fbda 100644
--- a/src/Clients/MainApp/FSpot.Filters/WhiteListFilter.cs
+++ b/src/Clients/MainApp/FSpot.Filters/WhiteListFilter.cs
@@ -3,6 +3,7 @@
//
// Author:
// Stephane Delcroix <stephane delcroix org>
+// Stephen Shaw <sshaw decriptor com>
//
// Copyright (C) 2006-2007 Novell, Inc.
// Copyright (C) 2006-2007 Stephane Delcroix
@@ -27,14 +28,16 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+using System.Collections.Generic;
+
namespace FSpot.Filters {
public class WhiteListFilter : IFilter
{
- System.Collections.ArrayList valid_extensions;
+ List<string> valid_extensions;
public WhiteListFilter (string [] valid_extensions)
{
- this.valid_extensions = new System.Collections.ArrayList ();
+ this.valid_extensions = new List<string> ();
foreach (string extension in valid_extensions)
this.valid_extensions.Add (extension.ToLower ());
}
@@ -44,7 +47,9 @@ namespace FSpot.Filters {
if ( valid_extensions.Contains (System.IO.Path.GetExtension(req.Current.LocalPath).ToLower ()) )
return false;
- if ( !valid_extensions.Contains (".jpg") && !valid_extensions.Contains (".jpeg"))
+ // FIXME: Should we add the other jpeg extensions?
+ if ( !valid_extensions.Contains (".jpg") &&
+ !valid_extensions.Contains (".jpeg"))
throw new System.NotImplementedException ("can only save jpeg :(");
return (new JpegFilter ()).Convert (req);
diff --git a/src/Clients/MainApp/FSpot.Imaging/Ciff.cs b/src/Clients/MainApp/FSpot.Imaging/Ciff.cs
index e789cad..55e1724 100644
--- a/src/Clients/MainApp/FSpot.Imaging/Ciff.cs
+++ b/src/Clients/MainApp/FSpot.Imaging/Ciff.cs
@@ -4,6 +4,7 @@
// Author:
// Ruben Vermeersch <ruben savanne be>
// Larry Ewing <lewing src gnome org>
+// Stephen Shaw <sshaw decriptor com>
//
// Copyright (C) 2005-2010 Novell, Inc.
// Copyright (C) 2010 Ruben Vermeersch
@@ -30,6 +31,7 @@
//
using System;
+using System.Collections.Generic;
using FSpot.Utils;
using Hyena;
using TagLib.Image;
@@ -68,7 +70,7 @@ namespace FSpot.Imaging.Ciff {
}
class ImageDirectory {
- System.Collections.ArrayList entry_list;
+ List<Entry> entry_list;
uint Count;
bool little;
uint start;
@@ -81,7 +83,7 @@ namespace FSpot.Imaging.Ciff {
this.little = little;
this.stream = stream;
- entry_list = new System.Collections.ArrayList ();
+ entry_list = new List<Entry> ();
stream.Position = end - 4;
byte [] buf = new byte [10];
diff --git a/src/Clients/MainApp/FSpot.UI.Dialog/EditTagDialog.cs b/src/Clients/MainApp/FSpot.UI.Dialog/EditTagDialog.cs
index ef3031e..57fc7f7 100644
--- a/src/Clients/MainApp/FSpot.UI.Dialog/EditTagDialog.cs
+++ b/src/Clients/MainApp/FSpot.UI.Dialog/EditTagDialog.cs
@@ -26,9 +26,9 @@
// 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.Collections;
+using System.Collections.Generic;
using Mono.Unix;
using Gtk;
using FSpot.Core;
@@ -36,15 +36,20 @@ using FSpot.Database;
namespace FSpot.UI.Dialog
{
- public class EditTagDialog : BuilderDialog {
+ public class EditTagDialog : BuilderDialog
+ {
Db db;
Tag tag;
-
- [GtkBeans.Builder.Object] Button ok_button;
- [GtkBeans.Builder.Object] Entry tag_name_entry;
- [GtkBeans.Builder.Object] Label already_in_use_label;
- [GtkBeans.Builder.Object] Gtk.Image icon_image;
- [GtkBeans.Builder.Object] Gtk.ComboBox category_option_menu;
+ [GtkBeans.Builder.Object]
+ Button ok_button;
+ [GtkBeans.Builder.Object]
+ Entry tag_name_entry;
+ [GtkBeans.Builder.Object]
+ Label already_in_use_label;
+ [GtkBeans.Builder.Object]
+ Gtk.Image icon_image;
+ [GtkBeans.Builder.Object]
+ Gtk.ComboBox category_option_menu;
public EditTagDialog (Db db, Tag t, Gtk.Window parent_window) : base ("EditTagDialog.ui", "edit_tag_dialog")
{
@@ -58,10 +63,10 @@ namespace FSpot.UI.Dialog
icon_image.Pixbuf = t.Icon;
Cms.Profile screen_profile;
if (icon_image.Pixbuf != null && FSpot.ColorManagement.Profiles.TryGetValue (Preferences.Get<string> (Preferences.COLOR_MANAGEMENT_DISPLAY_PROFILE), out screen_profile)) {
- icon_image.Pixbuf = icon_image.Pixbuf.Copy();
+ icon_image.Pixbuf = icon_image.Pixbuf.Copy ();
FSpot.ColorManagement.ApplyProfile (icon_image.Pixbuf, screen_profile);
}
- PopulateCategoryOptionMenu (t);
+ PopulateCategoryOptionMenu (t);
tag_name_entry.GrabFocus ();
@@ -70,6 +75,7 @@ namespace FSpot.UI.Dialog
string orig_name;
string last_valid_name;
+
public string TagName {
get { return last_valid_name; }
}
@@ -78,7 +84,7 @@ namespace FSpot.UI.Dialog
get { return categories [category_option_menu.Active] as Category;}
}
- ArrayList categories;
+ List<Tag> categories;
void HandleTagNameEntryChanged (object sender, EventArgs args)
{
@@ -88,7 +94,7 @@ namespace FSpot.UI.Dialog
ok_button.Sensitive = false;
already_in_use_label.Markup = String.Empty;
} else if (TagNameExistsInCategory (name, db.Tags.RootCategory)
- && String.Compare(name, orig_name, true) != 0) {
+ && String.Compare (name, orig_name, true) != 0) {
ok_button.Sensitive = false;
already_in_use_label.Markup = "<small>" + Catalog.GetString ("This name is already in use") + "</small>";
} else {
@@ -101,7 +107,7 @@ namespace FSpot.UI.Dialog
bool TagNameExistsInCategory (string name, Category category)
{
foreach (Tag tag in category.Children) {
- if (String.Compare(tag.Name, name, true) == 0)
+ if (String.Compare (tag.Name, name, true) == 0)
return true;
if (tag is Category && TagNameExistsInCategory (name, tag as Category))
@@ -111,7 +117,7 @@ namespace FSpot.UI.Dialog
return false;
}
- void PopulateCategories (ArrayList categories, Category parent)
+ void PopulateCategories (List<Tag> categories, Category parent)
{
foreach (Tag tag in parent.Children) {
if (tag is Category && tag != this.tag && !this.tag.IsAncestorOf (tag)) {
@@ -125,21 +131,21 @@ namespace FSpot.UI.Dialog
{
EditTagIconDialog dialog = new EditTagIconDialog (db, tag, this);
- ResponseType response = (ResponseType) dialog.Run ();
- if (response == ResponseType.Ok) {
+ ResponseType response = (ResponseType)dialog.Run ();
+ if (response == ResponseType.Ok)
if (dialog.ThemeIconName != null) {
tag.ThemeIconName = dialog.ThemeIconName;
} else {
tag.ThemeIconName = null;
tag.Icon = dialog.PreviewPixbuf;
}
- } else if (response == (ResponseType)1)
- tag.Icon = null;
+ else if (response == (ResponseType)1)
+ tag.Icon = null;
Cms.Profile screen_profile;
if (tag.Icon != null && FSpot.ColorManagement.Profiles.TryGetValue (Preferences.Get<string> (Preferences.COLOR_MANAGEMENT_DISPLAY_PROFILE), out screen_profile)) {
- icon_image.Pixbuf = tag.Icon.Copy();
- FSpot.ColorManagement.ApplyProfile(icon_image.Pixbuf, screen_profile);
+ icon_image.Pixbuf = tag.Icon.Copy ();
+ FSpot.ColorManagement.ApplyProfile (icon_image.Pixbuf, screen_profile);
} else
icon_image.Pixbuf = tag.Icon;
@@ -150,45 +156,43 @@ namespace FSpot.UI.Dialog
{
int history = 0;
int i = 0;
- categories = new ArrayList ();
+ categories = new List<Tag> ();
Category root = db.Tags.RootCategory;
categories.Add (root);
PopulateCategories (categories, root);
- category_option_menu.Clear();
+ category_option_menu.Clear ();
- CellRendererPixbuf cell2 = new CellRendererPixbuf();
- category_option_menu.PackStart(cell2, false);
- category_option_menu.AddAttribute(cell2, "pixbuf", 0);
+ CellRendererPixbuf cell2 = new CellRendererPixbuf ();
+ category_option_menu.PackStart (cell2, false);
+ category_option_menu.AddAttribute (cell2, "pixbuf", 0);
- CellRendererText cell = new CellRendererText();
- category_option_menu.PackStart(cell, true);
- category_option_menu.AddAttribute(cell, "text", 1);
+ CellRendererText cell = new CellRendererText ();
+ category_option_menu.PackStart (cell, true);
+ category_option_menu.AddAttribute (cell, "text", 1);
- ListStore store = new ListStore(new[] {typeof (Gdk.Pixbuf), typeof(string)});
- category_option_menu.Model = store;
+ ListStore store = new ListStore (new[] {typeof(Gdk.Pixbuf), typeof(string)});
+ category_option_menu.Model = store;
foreach (Category category in categories) {
if (t.Category == category)
history = i;
i++;
+ string categoryName = category.Name;
+ Gdk.Pixbuf categoryImage = category.Icon;
- string categoryName = category.Name;
- Gdk.Pixbuf categoryImage = category.Icon;
-
- store.AppendValues( new object[] {
- categoryImage,
- categoryName
- });
+ store.AppendValues (new object[] {
+ categoryImage,
+ categoryName
+ });
}
category_option_menu.Sensitive = true;
+ category_option_menu.Active = history;
- category_option_menu.Active = history;
-
- //category_option_menu.SetHistory ((uint)history);
- //category_option_menu.Active = (uint)history;
+ //category_option_menu.SetHistory ((uint)history);
+ //category_option_menu.Active = (uint)history;
}
}
}
diff --git a/src/Clients/MainApp/FSpot.UI.Dialog/LastRollDialog.cs b/src/Clients/MainApp/FSpot.UI.Dialog/LastRollDialog.cs
index 0b1452f..2a31caa 100644
--- a/src/Clients/MainApp/FSpot.UI.Dialog/LastRollDialog.cs
+++ b/src/Clients/MainApp/FSpot.UI.Dialog/LastRollDialog.cs
@@ -4,6 +4,7 @@
// Author:
// Ruben Vermeersch <ruben savanne be>
// Stephane Delcroix <sdelcroix src gnome org>
+// Stephen Shaw <sshaw decriptor com>
//
// Copyright (C) 2007-2010 Novell, Inc.
// Copyright (C) 2010 Ruben Vermeersch
@@ -28,25 +29,26 @@
// 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.Collections.Generic;
+
using Gtk;
using FSpot.Core;
using FSpot.Query;
using FSpot.UI.Dialog;
-namespace FSpot.UI.Dialog {
- public class LastRolls : BuilderDialog {
+namespace FSpot.UI.Dialog
+{
+ public class LastRolls : BuilderDialog
+ {
FSpot.PhotoQuery query;
RollStore rollstore;
-
- Roll [] rolls;
-
+ Roll[] rolls;
[GtkBeans.Builder.Object] private ComboBox combo_filter; // at, after, or between
[GtkBeans.Builder.Object] private ComboBox combo_roll_1;
[GtkBeans.Builder.Object] private ComboBox combo_roll_2;
- [GtkBeans.Builder.Object] private Label and_label; // and label between two comboboxes.
- [GtkBeans.Builder.Object] private Label photos_in_selected_rolls;
+ [GtkBeans.Builder.Object] private Label and_label; // and label between two comboboxes.
+ [GtkBeans.Builder.Object] private Label photos_in_selected_rolls;
public LastRolls (FSpot.PhotoQuery query, RollStore rollstore, Window parent) : base ("LastImportRollFilterDialog.ui", "last_import_rolls_filter")
{
@@ -54,7 +56,7 @@ namespace FSpot.UI.Dialog {
this.rollstore = rollstore;
rolls = rollstore.GetRolls (FSpot.Preferences.Get<int> (FSpot.Preferences.IMPORT_GUI_ROLL_HISTORY));
- TransientFor = parent;
+ TransientFor = parent;
PopulateCombos ();
@@ -73,7 +75,7 @@ namespace FSpot.UI.Dialog {
if (args.ResponseId == ResponseType.Ok) {
Roll [] selected_rolls = SelectedRolls ();
- if (selected_rolls != null && selected_rolls.Length > 0 )
+ if (selected_rolls != null && selected_rolls.Length > 0)
query.RollSet = new RollSet (selected_rolls);
}
Destroy ();
@@ -92,26 +94,26 @@ namespace FSpot.UI.Dialog {
UpdateNumberOfPhotos ();
}
- private void UpdateNumberOfPhotos()
+ private void UpdateNumberOfPhotos ()
{
Roll [] selected_rolls = SelectedRolls ();
uint sum = 0;
if (selected_rolls != null)
- foreach (Roll roll in selected_rolls)
+ foreach (Roll roll in selected_rolls) {
sum = sum + rollstore.PhotosInRoll (roll);
- photos_in_selected_rolls.Text = sum.ToString();
+ }
+ photos_in_selected_rolls.Text = sum.ToString ();
}
private void PopulateCombos ()
{
- for (uint k = 0; k < rolls.Length; k++)
- {
+ for (uint k = 0; k < rolls.Length; k++) {
uint numphotos = rollstore.PhotosInRoll (rolls [k]);
// Roll time is in UTC always
DateTime date = rolls [k].Time.ToLocalTime ();
string header = String.Format ("{0} ({1})",
- date.ToString("%dd %MMM, %HH:%mm"),
+ date.ToString ("%dd %MMM, %HH:%mm"),
numphotos);
combo_roll_1.AppendText (header);
@@ -124,28 +126,30 @@ namespace FSpot.UI.Dialog {
if ((combo_roll_1.Active < 0) || ((combo_filter.Active == 2) && (combo_roll_2.Active < 0)))
return null;
- System.Collections.ArrayList result = new System.Collections.ArrayList ();
+ List<Roll> result = new List<Roll> ();
switch (combo_filter.Active) {
case 0 : // at - Return the roll the user selected
result.Add (rolls [combo_roll_1.Active]);
break;
case 1 : // after - Return all rolls from latest to the one the user selected
- for (uint k = 0; k <= combo_roll_1.Active; k++)
+ for (uint k = 0; k <= combo_roll_1.Active; k++) {
result.Add (rolls [k]);
+ }
break;
case 2 : // between - Return all rolls between the two import rolls the user selected
- uint k1 = (uint) combo_roll_1.Active;
- uint k2 = (uint) combo_roll_2.Active;
+ uint k1 = (uint)combo_roll_1.Active;
+ uint k2 = (uint)combo_roll_2.Active;
if (k1 > k2) {
- k1 = (uint) combo_roll_2.Active;
- k2 = (uint) combo_roll_1.Active;
+ k1 = (uint)combo_roll_2.Active;
+ k2 = (uint)combo_roll_1.Active;
+ }
+ for (uint k = k1; k <= k2; k++) {
+ result.Add (rolls [k]);
}
- for (uint k = k1; k <= k2; k++)
- result.Add (rolls[k]);
break;
}
- return (Roll []) result.ToArray (typeof(Roll));
+ return result.ToArray ();
}
}
}
diff --git a/src/Clients/MainApp/FSpot.Widgets/TagEntry.cs b/src/Clients/MainApp/FSpot.Widgets/TagEntry.cs
index bcf5062..6fa569d 100644
--- a/src/Clients/MainApp/FSpot.Widgets/TagEntry.cs
+++ b/src/Clients/MainApp/FSpot.Widgets/TagEntry.cs
@@ -5,6 +5,7 @@
// Stephane Delcroix <stephane delcroix org>
// Joachim Breitner <mail joachim-breitner de>
// Ruben Vermeersch <ruben savanne be>
+// Stephen Shaw <sshaw decriptor com>
//
// Copyright (C) 2006-2010 Novell, Inc.
// Copyright (C) 2006-2008 Stephane Delcroix
@@ -33,9 +34,11 @@
using System.Text;
using System.Collections;
+using System.Collections.Generic;
using FSpot.Core;
-namespace FSpot.Widgets {
+namespace FSpot.Widgets
+{
public delegate void TagsAttachedHandler (object sender, string [] tags);
public delegate void TagsRemovedHandler (object sender, Tag [] tags);
@@ -64,7 +67,7 @@ namespace FSpot.Widgets {
this.FocusOutEvent += HandleFocusOutEvent;
}
- ArrayList selected_photos_tagnames;
+ List<string> selected_photos_tagnames;
public void UpdateFromSelection (IPhoto [] sel)
{
Hashtable taghash = new Hashtable ();
@@ -86,7 +89,7 @@ namespace FSpot.Widgets {
break;
}
- selected_photos_tagnames = new ArrayList ();
+ selected_photos_tagnames = new List<string> ();
foreach (Tag tag in taghash.Keys)
if ((int) (taghash [tag]) == sel.Length)
selected_photos_tagnames.Add (tag.Name);
@@ -96,7 +99,7 @@ namespace FSpot.Widgets {
public void UpdateFromTagNames (string [] tagnames)
{
- selected_photos_tagnames = new ArrayList ();
+ selected_photos_tagnames = new List<string> ();
foreach (string tagname in tagnames)
selected_photos_tagnames.Add (tagname);
@@ -129,15 +132,14 @@ namespace FSpot.Widgets {
{
string [] tagnames = Text.Split (new char [] {','});
- ArrayList list = new ArrayList ();
+ List<string> list = new List<string> ();
for (int i = 0; i < tagnames.Length; i ++) {
string s = tagnames [i].Trim ();
if (s.Length > 0)
list.Add (s);
}
-
- return (string []) (list.ToArray (typeof (string)));
+ return list.ToArray ();
}
int tag_completion_index = -1;
@@ -263,7 +265,7 @@ namespace FSpot.Widgets {
return;
// Add any new tags to the selected photos
- ArrayList new_tags = new ArrayList ();
+ List<string> new_tags = new List<string> ();
for (int i = 0; i < tagnames.Length; i ++) {
if (tagnames [i].Length == 0)
continue;
@@ -281,10 +283,10 @@ namespace FSpot.Widgets {
//Send event
if (new_tags.Count != 0 && TagsAttached != null)
- TagsAttached (this, (string []) new_tags.ToArray (typeof (string)));
+ TagsAttached (this, new_tags.ToArray ());
// Remove any removed tags from the selected photos
- ArrayList remove_tags = new ArrayList ();
+ List<Tag> remove_tags = new List<Tag> ();
foreach (string tagname in selected_photos_tagnames) {
if (! IsTagInList (tagnames, tagname)) {
Tag tag = tag_store.GetTagByName (tagname);
@@ -294,7 +296,7 @@ namespace FSpot.Widgets {
//Send event
if (remove_tags.Count != 0 && TagsRemoved != null)
- TagsRemoved (this, (Tag []) remove_tags.ToArray (typeof (Tag)));
+ TagsRemoved (this, remove_tags.ToArray ());
}
private static bool IsTagInList (string [] tags, string tag)
diff --git a/src/Clients/MainApp/FSpot/ExportStore.cs b/src/Clients/MainApp/FSpot/ExportStore.cs
index 2387e29..a29d187 100644
--- a/src/Clients/MainApp/FSpot/ExportStore.cs
+++ b/src/Clients/MainApp/FSpot/ExportStore.cs
@@ -5,6 +5,7 @@
// Stephane Delcroix <sdelcroix src gnome org>
// Ruben Vermeersch <ruben savanne be>
// Larry Ewing <lewing src gnome org>
+// Stephen Shaw <sshaw decriptor com>
//
// Copyright (C) 2007-2010 Novell, Inc.
// Copyright (C) 2007-2008 Stephane Delcroix
@@ -29,47 +30,56 @@
// 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 Gdk;
using Gtk;
+
+using System;
using System.Collections;
+using System.Collections.Generic;
using System.IO;
-using System;
+
using FSpot;
using FSpot.Core;
using FSpot.Database;
using Hyena.Data.Sqlite;
-namespace FSpot {
-public class ExportItem : DbItem {
-
- public uint ImageId { get; set; }
- public uint ImageVersionId { get; set; }
- public string ExportType { get; set; }
- public string ExportToken { get; set; }
-
- public ExportItem (uint id, uint image_id, uint image_version_id, string export_type, string export_token) : base (id)
- {
- ImageId = image_id;
- ImageVersionId = image_version_id;
- ExportType = export_type;
- ExportToken = export_token;
- }
-}
+namespace FSpot
+{
+ public class ExportItem : DbItem
+ {
+
+ public uint ImageId { get; set; }
+
+ public uint ImageVersionId { get; set; }
-public class ExportStore : DbStore<ExportItem> {
+ public string ExportType { get; set; }
- public const string FlickrExportType = "fspot:Flickr";
- public const string OldFolderExportType = "fspot:Folder"; //This is obsolete and meant to be remove once db reach rev4
- public const string FolderExportType = "fspot:FolderUri";
- public const string PicasaExportType = "fspot:Picasa";
- public const string SmugMugExportType = "fspot:SmugMug";
- public const string Gallery2ExportType = "fspot:Gallery2";
+ public string ExportToken { get; set; }
- private void CreateTable ()
+ public ExportItem (uint id, uint image_id, uint image_version_id, string export_type, string export_token) : base (id)
+ {
+ ImageId = image_id;
+ ImageVersionId = image_version_id;
+ ExportType = export_type;
+ ExportToken = export_token;
+ }
+ }
+
+ public class ExportStore : DbStore<ExportItem>
{
- Database.Execute (
+
+ public const string FlickrExportType = "fspot:Flickr";
+ // TODO: This is obsolete and meant to be remove once db reach rev4
+ public const string OldFolderExportType = "fspot:Folder";
+ public const string FolderExportType = "fspot:FolderUri";
+ public const string PicasaExportType = "fspot:Picasa";
+ public const string SmugMugExportType = "fspot:SmugMug";
+ public const string Gallery2ExportType = "fspot:Gallery2";
+
+ private void CreateTable ()
+ {
+ Database.Execute (
"CREATE TABLE exports (\n" +
" id INTEGER PRIMARY KEY NOT NULL, \n" +
" image_id INTEGER NOT NULL, \n" +
@@ -77,87 +87,87 @@ public class ExportStore : DbStore<ExportItem> {
" export_type TEXT NOT NULL, \n" +
" export_token TEXT NOT NULL\n" +
")");
- }
+ }
- private ExportItem LoadItem (IDataReader reader)
- {
- return new ExportItem (Convert.ToUInt32 (reader["id"]),
- Convert.ToUInt32 (reader["image_id"]),
- Convert.ToUInt32 (reader["image_version_id"]),
- reader["export_type"].ToString (),
- reader["export_token"].ToString ());
- }
+ private ExportItem LoadItem (IDataReader reader)
+ {
+ return new ExportItem (Convert.ToUInt32 (reader ["id"]),
+ Convert.ToUInt32 (reader ["image_id"]),
+ Convert.ToUInt32 (reader ["image_version_id"]),
+ reader ["export_type"].ToString (),
+ reader ["export_token"].ToString ());
+ }
- private void LoadAllItems ()
- {
- IDataReader reader = Database.Query("SELECT id, image_id, image_version_id, export_type, export_token FROM exports");
+ private void LoadAllItems ()
+ {
+ IDataReader reader = Database.Query ("SELECT id, image_id, image_version_id, export_type, export_token FROM exports");
- while (reader.Read ()) {
- AddToCache (LoadItem (reader));
- }
+ while (reader.Read ()) {
+ AddToCache (LoadItem (reader));
+ }
- reader.Dispose ();
- }
+ reader.Dispose ();
+ }
- public ExportItem Create (uint image_id, uint image_version_id, string export_type, string export_token)
- {
- int id = Database.Execute(new HyenaSqliteCommand("INSERT INTO exports (image_id, image_version_id, export_type, export_token) VALUES (?, ?, ?, ?)",
+ public ExportItem Create (uint image_id, uint image_version_id, string export_type, string export_token)
+ {
+ int id = Database.Execute (new HyenaSqliteCommand ("INSERT INTO exports (image_id, image_version_id, export_type, export_token) VALUES (?, ?, ?, ?)",
image_id, image_version_id, export_type, export_token));
- ExportItem item = new ExportItem ((uint)id, image_id, image_version_id, export_type, export_token);
+ ExportItem item = new ExportItem ((uint)id, image_id, image_version_id, export_type, export_token);
- AddToCache (item);
- EmitAdded (item);
+ AddToCache (item);
+ EmitAdded (item);
- return item;
- }
+ return item;
+ }
- public override void Commit (ExportItem item)
- {
- Database.Execute(new HyenaSqliteCommand("UPDATE exports SET image_id = ?, image_version_id = ?, export_type = ? SET export_token = ? WHERE id = ?",
+ public override void Commit (ExportItem item)
+ {
+ Database.Execute (new HyenaSqliteCommand ("UPDATE exports SET image_id = ?, image_version_id = ?, export_type = ? SET export_token = ? WHERE id = ?",
item.ImageId, item.ImageVersionId, item.ExportType, item.ExportToken, item.Id));
- EmitChanged (item);
- }
+ EmitChanged (item);
+ }
- public override ExportItem Get (uint id)
- {
- // we never use this
- return null;
- }
+ public override ExportItem Get (uint id)
+ {
+ // we never use this
+ return null;
+ }
- public ArrayList GetByImageId (uint image_id, uint image_version_id)
- {
+ public List<ExportItem> GetByImageId (uint image_id, uint image_version_id)
+ {
- IDataReader reader = Database.Query(new HyenaSqliteCommand("SELECT id, image_id, image_version_id, export_type, export_token FROM exports WHERE image_id = ? AND image_version_id = ?",
+ IDataReader reader = Database.Query (new HyenaSqliteCommand ("SELECT id, image_id, image_version_id, export_type, export_token FROM exports WHERE image_id = ? AND image_version_id = ?",
image_id, image_version_id));
- ArrayList list = new ArrayList ();
- while (reader.Read ()) {
- list.Add (LoadItem (reader));
- }
- reader.Dispose ();
- return list;
- }
+ List<ExportItem> export_items = new List<ExportItem> ();
+ while (reader.Read ()) {
+ export_items.Add (LoadItem (reader));
+ }
+ reader.Dispose ();
- public override void Remove (ExportItem item)
- {
- RemoveFromCache (item);
+ return export_items;
+ }
- Database.Execute(new HyenaSqliteCommand("DELETE FROM exports WHERE id = ?", item.Id));
+ public override void Remove (ExportItem item)
+ {
+ RemoveFromCache (item);
- EmitRemoved (item);
- }
+ Database.Execute (new HyenaSqliteCommand ("DELETE FROM exports WHERE id = ?", item.Id));
- // Constructor
+ EmitRemoved (item);
+ }
- public ExportStore (FSpotDatabaseConnection database, bool is_new)
- : base (database, true)
- {
- if (is_new || !Database.TableExists ("exports"))
- CreateTable ();
- else
- LoadAllItems ();
+ #region Constructor
+ public ExportStore (FSpotDatabaseConnection database, bool is_new) : base (database, true)
+ {
+ if (is_new || !Database.TableExists ("exports"))
+ CreateTable ();
+ else
+ LoadAllItems ();
+ }
+ #endregion
}
}
-}
diff --git a/src/Clients/MainApp/FSpot/MainWindow.cs b/src/Clients/MainApp/FSpot/MainWindow.cs
index ac8c831..378f2db 100644
--- a/src/Clients/MainApp/FSpot/MainWindow.cs
+++ b/src/Clients/MainApp/FSpot/MainWindow.cs
@@ -2829,7 +2829,7 @@ namespace FSpot
bool create_new_versions = (response == Gtk.ResponseType.Yes);
- ArrayList errors = new ArrayList ();
+ List<EditException> errors = new List<EditException> ();
GLib.List uri_list = new GLib.List (typeof (string));
foreach (Photo photo in selected) {
try {
@@ -2846,7 +2846,7 @@ namespace FSpot
// FIXME need to clean up the error dialog here.
if (errors.Count > 0) {
- Dialog md = new EditExceptionDialog (GetToplevel (sender), errors.ToArray (typeof (EditException)) as EditException []);
+ Dialog md = new EditExceptionDialog (GetToplevel (sender), errors.ToArray ());
md.Run ();
md.Destroy ();
}
diff --git a/src/Clients/MainApp/FSpot/Photo.cs b/src/Clients/MainApp/FSpot/Photo.cs
index 7906365..78c64aa 100644
--- a/src/Clients/MainApp/FSpot/Photo.cs
+++ b/src/Clients/MainApp/FSpot/Photo.cs
@@ -4,6 +4,7 @@
// Author:
// Ruben Vermeersch <ruben savanne be>
// Stephane Delcroix <sdelcroix src gnome org>
+// Stephen Shaw <sshaw decriptor com>
//
// Copyright (C) 2008-2010 Novell, Inc.
// Copyright (C) 2010 Ruben Vermeersch
@@ -28,7 +29,6 @@
// 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 Hyena;
using System;
@@ -46,8 +46,10 @@ using FSpot.Imaging;
namespace FSpot
{
- public class Photo : DbItem, IComparable, IPhoto, IPhotoVersionable {
+ public class Photo : DbItem, IComparable, IPhoto, IPhotoVersionable
+ {
+ #region Properties
PhotoChanges changes = new PhotoChanges ();
public PhotoChanges Changes {
get{ return changes; }
@@ -74,13 +76,10 @@ namespace FSpot
get { return Uri.UnescapeDataString (System.IO.Path.GetFileName (VersionUri (OriginalVersionId).AbsolutePath)); }
}
- private ArrayList tags;
+ private List<Tag> tags;
public Tag [] Tags {
get {
- if (tags == null)
- return new Tag [0];
-
- return (Tag []) tags.ToArray (typeof (Tag));
+ return tags.ToArray ();
}
}
@@ -88,10 +87,9 @@ namespace FSpot
internal bool AllVersionsLoaded {
get { return all_versions_loaded; }
set {
- if (value) {
+ if (value)
if (DefaultVersionId != OriginalVersionId && !versions.ContainsKey (DefaultVersionId))
DefaultVersionId = OriginalVersionId;
- }
all_versions_loaded = value;
}
}
@@ -128,16 +126,18 @@ namespace FSpot
changes.RatingChanged = true;
}
}
+ #endregion
- // Version management
+ #region Properties Version Management
public const int OriginalVersionId = 1;
private uint highest_version_id;
-
private Dictionary<uint, PhotoVersion> versions = new Dictionary<uint, PhotoVersion> ();
+
public IEnumerable<IPhotoVersion> Versions {
get {
- foreach (var version in versions.Values)
+ foreach (var version in versions.Values) {
yield return version;
+ }
}
}
@@ -153,15 +153,8 @@ namespace FSpot
}
}
- public PhotoVersion GetVersion (uint version_id)
- {
- if (versions == null)
- return null;
-
- return versions [version_id];
- }
-
private uint default_version_id = OriginalVersionId;
+
public uint DefaultVersionId {
get { return default_version_id; }
set {
@@ -171,6 +164,16 @@ namespace FSpot
changes.DefaultVersionIdChanged = true;
}
}
+ #endregion
+
+ #region Photo Version Management
+ public PhotoVersion GetVersion (uint version_id)
+ {
+ if (versions == null)
+ return null;
+
+ return versions [version_id];
+ }
// This doesn't check if a version of that name already exists,
// it's supposed to be used only within the Photo and PhotoStore classes.
@@ -212,7 +215,7 @@ namespace FSpot
public bool VersionNameExists (string version_name)
{
- return Versions.Where ((v) => v.Name == version_name).Any ();
+ return Versions.Where ((v) => v.Name == version_name).Any ();
}
public SafeUri VersionUri (uint version_id)
@@ -362,8 +365,9 @@ namespace FSpot
uint count = 0;
GLib.FileEnumerator list = directory.EnumerateChildren ("standard::name",
GLib.FileQueryInfoFlags.None, null);
- foreach (var item in list)
+ foreach (var item in list) {
count++;
+ }
return count == 0;
}
@@ -394,7 +398,7 @@ namespace FSpot
if (destination.Exists)
throw new Exception (String.Format ("An object at this uri {0} already exists", new_uri));
- //FIXME. or better, fix the copy api !
+ //FIXME. or better, fix the copy api !
GLib.File source = GLib.FileFactory.NewForUri (original_uri);
source.Copy (destination, GLib.FileCopyFlags.None, null, null);
}
@@ -419,13 +423,14 @@ namespace FSpot
string parent_filename = Path.GetFileNameWithoutExtension (Name);
string name = null;
if (filename.StartsWith (parent_filename))
- name = filename.Substring (parent_filename.Length).Replace ("(", "").Replace (")", "").Replace ("_", " "). Trim();
+ name = filename.Substring (parent_filename.Length).Replace ("(", "").Replace (")", "").Replace ("_", " "). Trim ();
if (String.IsNullOrEmpty (name)) {
// Note for translators: Reparented is a picture becoming a version of another one
string rep = name = Catalog.GetString ("Reparented");
- for (int num = 1; VersionNameExists (name); num++)
+ for (int num = 1; VersionNameExists (name); num++) {
name = String.Format (rep + " ({0})", num);
+ }
}
highest_version_id ++;
versions [highest_version_id] = new PhotoVersion (this, highest_version_id, version.BaseUri, version.Filename, version.ImportMD5, name, is_protected);
@@ -445,7 +450,7 @@ namespace FSpot
num);
name = String.Format (name, num);
//SafeUri uri = GetUriForVersionName (name, System.IO.Path.GetExtension (VersionUri(base_version_id).GetFilename()));
- string filename = GetFilenameForVersionName (name, System.IO.Path.GetExtension (versions[base_version_id].Filename));
+ string filename = GetFilenameForVersionName (name, System.IO.Path.GetExtension (versions [base_version_id].Filename));
SafeUri uri = DefaultVersion.BaseUri.Append (filename);
GLib.File file = GLib.FileFactory.NewForUri (uri);
@@ -466,7 +471,7 @@ namespace FSpot
(num == 1) ? Catalog.GetString ("Modified in {1}") : Catalog.GetString ("Modified in {1} ({0})"),
num, name);
- string filename = GetFilenameForVersionName (name, System.IO.Path.GetExtension (versions[base_version_id].Filename));
+ string filename = GetFilenameForVersionName (name, System.IO.Path.GetExtension (versions [base_version_id].Filename));
SafeUri uri = DefaultVersion.BaseUri.Append (filename);
GLib.File file = GLib.FileFactory.NewForUri (uri);
@@ -491,11 +496,11 @@ namespace FSpot
//TODO: rename file too ???
- // if (System.IO.File.Exists (new_path))
- // throw new Exception ("File with this name already exists");
- //
- // File.Move (old_path, new_path);
- // PhotoStore.MoveThumbnail (old_path, new_path);
+ // if (System.IO.File.Exists (new_path))
+ // throw new Exception ("File with this name already exists");
+ //
+ // File.Move (old_path, new_path);
+ // PhotoStore.MoveThumbnail (old_path, new_path);
}
public void CopyAttributesFrom (Photo that)
@@ -505,15 +510,12 @@ namespace FSpot
Rating = that.Rating;
AddTag (that.Tags);
}
+ #endregion
- // Tag management.
-
+ #region Tag management
// This doesn't check if the tag is already there, use with caution.
public void AddTagUnsafely (Tag tag)
{
- if (tags == null)
- tags = new ArrayList ();
-
tags.Add (tag);
changes.AddTag (tag);
}
@@ -521,7 +523,7 @@ namespace FSpot
// This on the other hand does, but is O(n) with n being the number of existing tags.
public void AddTag (Tag tag)
{
- if (!HasTag (tag))
+ if (!tags.Contains (tag))
AddTagUnsafely (tag);
}
@@ -530,14 +532,20 @@ namespace FSpot
/*
* FIXME need a better naming convention here, perhaps just
* plain Add.
+ *
+ * tags.AddRange (taglist);
+ * but, AddTag calls AddTagUnsafely which
+ * adds and calls changes.AddTag on each tag?
+ * Need to investigate that.
*/
- foreach (Tag tag in taglist)
+ foreach (Tag tag in taglist) {
AddTag (tag);
+ }
}
public void RemoveTag (Tag tag)
{
- if (!HasTag (tag))
+ if (!tags.Contains (tag))
return;
tags.Remove (tag);
@@ -546,8 +554,9 @@ namespace FSpot
public void RemoveTag (Tag []taglist)
{
- foreach (Tag tag in taglist)
+ foreach (Tag tag in taglist) {
RemoveTag (tag);
+ }
}
public void RemoveCategory (IList<Tag> taglist)
@@ -562,42 +571,42 @@ namespace FSpot
}
}
+ // FIXME: This should be removed (I think)
public bool HasTag (Tag tag)
{
- if (tags == null)
- return false;
-
return tags.Contains (tag);
}
private static IDictionary<SafeUri, string> md5_cache = new Dictionary<SafeUri, string> ();
- public static void ResetMD5Cache () {
+ public static void ResetMD5Cache ()
+ {
if (md5_cache != null)
md5_cache.Clear ();
}
+ #endregion
- // Constructor
+ #region Constructor
public Photo (uint id, long unix_time)
: base (id)
{
time = DateTimeUtil.ToDateTime (unix_time);
+ tags = new List<Tag> ();
description = String.Empty;
rating = 0;
}
+ #endregion
-#region IComparable implementation
-
- // IComparable
- public int CompareTo (object obj) {
- if (this.GetType () == obj.GetType ()) {
+ #region IComparable implementation
+ public int CompareTo (object obj)
+ {
+ if (this.GetType () == obj.GetType ())
return this.Compare((Photo)obj);
- } else if (obj is DateTime) {
+ else if (obj is DateTime)
return this.time.CompareTo ((DateTime)obj);
- } else {
+ else
throw new Exception ("Object must be of type Photo");
- }
}
public int CompareTo (Photo photo)
@@ -609,7 +618,6 @@ namespace FSpot
else
return (this as IPhoto).Compare (photo);
}
-
-#endregion
+ #endregion
}
}
diff --git a/src/Clients/MainApp/FSpot/PhotoStore.cs b/src/Clients/MainApp/FSpot/PhotoStore.cs
index 66c8161..276102e 100644
--- a/src/Clients/MainApp/FSpot/PhotoStore.cs
+++ b/src/Clients/MainApp/FSpot/PhotoStore.cs
@@ -414,13 +414,13 @@ namespace FSpot {
{
EmitRemoved (items);
- ArrayList query_builder = new ArrayList (items.Length);
+ List<string> query_builder = new List<string> (items.Length);
for (int i = 0; i < items.Length; i++) {
query_builder.Add (String.Format ("{0}", items[i].Id));
RemoveFromCache (items[i]);
}
- String id_list = String.Join ("','", ((string []) query_builder.ToArray (typeof (string))));
+ String id_list = String.Join ("','", query_builder.ToArray ());
Database.Execute (String.Format ("DELETE FROM photos WHERE id IN ('{0}')", id_list));
Database.Execute (String.Format ("DELETE FROM photo_tags WHERE photo_id IN ('{0}')", id_list));
Database.Execute (String.Format ("DELETE FROM photo_versions WHERE photo_id IN ('{0}')", id_list));
@@ -899,7 +899,7 @@ namespace FSpot {
// GROUP BY photos.id
StringBuilder query_builder = new StringBuilder ();
- ArrayList where_clauses = new ArrayList ();
+ List<string> where_clauses = new List<string> ();
query_builder.Append ("SELECT id, " +
"time, " +
"base_uri, " +
@@ -940,7 +940,7 @@ namespace FSpot {
if (where_clauses.Count > 0) {
query_builder.Append (" WHERE ");
- query_builder.Append (String.Join (" AND ", ((String []) where_clauses.ToArray (typeof(String)))));
+ query_builder.Append (String.Join (" AND ", where_clauses.ToArray ()));
}
query_builder.Append (" ORDER BY time");
return Query (query_builder.ToString ());
diff --git a/src/Clients/MainApp/FSpot/PixbufCache.cs b/src/Clients/MainApp/FSpot/PixbufCache.cs
index 39508f0..d73059b 100644
--- a/src/Clients/MainApp/FSpot/PixbufCache.cs
+++ b/src/Clients/MainApp/FSpot/PixbufCache.cs
@@ -31,6 +31,7 @@
using System;
using System.Collections;
+using System.Collections.Generic;
using System.Threading;
using Hyena;
@@ -40,7 +41,7 @@ using FSpot.Platform;
namespace FSpot {
public class PixbufCache {
Hashtable items;
- ArrayList items_mru;
+ List<CacheEntry> items_mru;
int total_size;
int max_size = 256 * 256 * 4 * 30;
@@ -52,7 +53,7 @@ namespace FSpot {
public PixbufCache ()
{
items = new Hashtable ();
- items_mru = new ArrayList ();
+ items_mru = new List<CacheEntry> ();
worker = new Thread (new ThreadStart (WorkerTask));
worker.Start ();
diff --git a/src/Clients/MainApp/FSpot/RollStore.cs b/src/Clients/MainApp/FSpot/RollStore.cs
index 67a5913..7f355eb 100644
--- a/src/Clients/MainApp/FSpot/RollStore.cs
+++ b/src/Clients/MainApp/FSpot/RollStore.cs
@@ -5,6 +5,7 @@
// Mike GemÃnde <mike gemuende de>
// Ettore Perazzoli <ettore src gnome org>
// Stephane Delcroix <sdelcroix src gnome org>
+// Stephen Shaw <sshaw decriptor com>
//
// Copyright (C) 2003-2010 Novell, Inc.
// Copyright (C) 2010 Mike GemÃnde
@@ -30,8 +31,8 @@
// 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.Collections;
+using System.Collections.Generic;
using System.IO;
using System;
@@ -43,105 +44,106 @@ using FSpot;
using Hyena;
using Hyena.Data.Sqlite;
-namespace FSpot {
-public class RollStore : DbStore<Roll>
+namespace FSpot
{
- public RollStore (FSpotDatabaseConnection database, bool is_new) : base (database, false)
+ public class RollStore : DbStore<Roll>
{
- if (!is_new && Database.TableExists("rolls"))
- return;
+ public RollStore (FSpotDatabaseConnection database, bool is_new) : base (database, false)
+ {
+ if (!is_new && Database.TableExists ("rolls"))
+ return;
- Database.Execute (
+ Database.Execute (
"CREATE TABLE rolls (\n" +
" id INTEGER PRIMARY KEY NOT NULL, \n" +
" time INTEGER NOT NULL\n" +
")");
- }
+ }
- public Roll Create (DateTime time_in_utc)
- {
- long unix_time = DateTimeUtil.FromDateTime (time_in_utc);
- uint id = (uint) Database.Execute (new HyenaSqliteCommand ("INSERT INTO rolls (time) VALUES (?)", unix_time));
+ public Roll Create (DateTime time_in_utc)
+ {
+ long unix_time = DateTimeUtil.FromDateTime (time_in_utc);
+ uint id = (uint)Database.Execute (new HyenaSqliteCommand ("INSERT INTO rolls (time) VALUES (?)", unix_time));
- Roll roll = new Roll (id, unix_time);
- AddToCache (roll);
+ Roll roll = new Roll (id, unix_time);
+ AddToCache (roll);
- return roll;
- }
+ return roll;
+ }
- public Roll Create ()
- {
- return Create (System.DateTime.UtcNow);
- }
+ public Roll Create ()
+ {
+ return Create (System.DateTime.UtcNow);
+ }
- public override Roll Get (uint id)
- {
- Roll roll = LookupInCache (id) as Roll;
- if (roll != null)
- return roll;
+ public override Roll Get (uint id)
+ {
+ Roll roll = LookupInCache (id) as Roll;
+ if (roll != null)
+ return roll;
- IDataReader reader = Database.Query(new HyenaSqliteCommand ("SELECT time FROM rolls WHERE id = ?", id));
+ IDataReader reader = Database.Query (new HyenaSqliteCommand ("SELECT time FROM rolls WHERE id = ?", id));
- if (reader.Read ()) {
- roll = new Roll (id, Convert.ToUInt32 (reader ["time"]));
- AddToCache (roll);
- }
+ if (reader.Read ()) {
+ roll = new Roll (id, Convert.ToUInt32 (reader ["time"]));
+ AddToCache (roll);
+ }
- reader.Dispose();
+ reader.Dispose ();
- return roll;
- }
+ return roll;
+ }
- public override void Remove (Roll item)
- {
- RemoveFromCache (item);
- Database.Execute (new HyenaSqliteCommand ("DELETE FROM rolls WHERE id = ?", item.Id));
- }
+ public override void Remove (Roll item)
+ {
+ RemoveFromCache (item);
+ Database.Execute (new HyenaSqliteCommand ("DELETE FROM rolls WHERE id = ?", item.Id));
+ }
- public override void Commit (Roll item)
- {
- // Nothing to do here, since all the properties of a roll are immutable.
- }
+ public override void Commit (Roll item)
+ {
+ // Nothing to do here, since all the properties of a roll are immutable.
+ }
- public uint PhotosInRoll (Roll roll)
- {
- uint number_of_photos = 0;
- using (IDataReader reader = Database.Query (new HyenaSqliteCommand ("SELECT count(*) AS count FROM photos WHERE roll_id = ?", roll.Id))) {
- if (reader.Read ())
- number_of_photos = Convert.ToUInt32 (reader ["count"]);
+ public uint PhotosInRoll (Roll roll)
+ {
+ uint number_of_photos = 0;
+ using (IDataReader reader = Database.Query (new HyenaSqliteCommand ("SELECT count(*) AS count FROM photos WHERE roll_id = ?", roll.Id))) {
+ if (reader.Read ())
+ number_of_photos = Convert.ToUInt32 (reader ["count"]);
- reader.Dispose ();
+ reader.Dispose ();
+ }
+ return number_of_photos;
}
- return number_of_photos;
- }
- public Roll [] GetRolls ()
- {
- return GetRolls (-1);
- }
+ public Roll [] GetRolls ()
+ {
+ return GetRolls (-1);
+ }
- public Roll [] GetRolls (int limit)
- {
- ArrayList list = new ArrayList ();
+ public Roll [] GetRolls (int limit)
+ {
+ List<Roll> rolls = new List<Roll> ();
- string query = "SELECT DISTINCT rolls.id AS roll_id, rolls.time AS roll_time FROM rolls, photos WHERE photos.roll_id = rolls.id ORDER BY rolls.time DESC";
- if (limit >= 0)
- query += " LIMIT " + limit;
+ string query = "SELECT DISTINCT rolls.id AS roll_id, rolls.time AS roll_time FROM rolls, photos WHERE photos.roll_id = rolls.id ORDER BY rolls.time DESC";
+ if (limit >= 0)
+ query += " LIMIT " + limit;
- using (IDataReader reader = Database.Query(query)) {
- while (reader.Read ()) {
- uint id = Convert.ToUInt32 (reader["roll_id"]);
+ using (IDataReader reader = Database.Query(query)) {
+ while (reader.Read ()) {
+ uint id = Convert.ToUInt32 (reader ["roll_id"]);
- Roll roll = LookupInCache (id) as Roll;
- if (roll == null) {
- roll = new Roll (id, Convert.ToUInt32 (reader["roll_time"]));
- AddToCache (roll);
+ Roll roll = LookupInCache (id) as Roll;
+ if (roll == null) {
+ roll = new Roll (id, Convert.ToUInt32 (reader ["roll_time"]));
+ AddToCache (roll);
+ }
+ rolls.Add (roll);
}
- list.Add (roll);
+ reader.Dispose ();
}
- reader.Dispose ();
+ return rolls.ToArray ();
}
- return (Roll []) list.ToArray (typeof (Roll));
}
}
-}
diff --git a/src/Clients/MainApp/FSpot/TagQueryWidget.cs b/src/Clients/MainApp/FSpot/TagQueryWidget.cs
index d0a58e5..94fe2e8 100644
--- a/src/Clients/MainApp/FSpot/TagQueryWidget.cs
+++ b/src/Clients/MainApp/FSpot/TagQueryWidget.cs
@@ -149,11 +149,11 @@ namespace FSpot
int sensitive_items = 0;
foreach (Term term in LogicWidget.Root.SubTerms) {
- ArrayList term_parts = new ArrayList ();
+ List<string> term_parts = new List<string> ();
bool contains_tag = AppendTerm (term_parts, term, single_tag);
- string name = "_" + String.Join (", ", (string []) term_parts.ToArray (typeof(string)));
+ string name = "_" + String.Join (", ", term_parts.ToArray ());
Gtk.MenuItem item = GtkUtil.MakeMenuItem (m, name, new EventHandler (App.Instance.Organizer.HandleAddTagToTerm));
item.Sensitive = !contains_tag;
@@ -169,7 +169,7 @@ namespace FSpot
}
}
- private static bool AppendTerm (ArrayList parts, Term term, Tag single_tag)
+ private static bool AppendTerm (List<string> parts, Term term, Tag single_tag)
{
bool tag_matches = false;
if (term != null) {
@@ -421,9 +421,9 @@ namespace FSpot
Remove (term.Widget);
}
- public ArrayList HangersOn (Literal term)
+ public List<Gtk.Widget> HangersOn (Literal term)
{
- ArrayList w = new ArrayList ();
+ List<Gtk.Widget> w = new List<Gtk.Widget> ();
// Find separators that only exist because of this term
if (term.Parent != null) {
@@ -524,7 +524,8 @@ namespace FSpot
public void Include (Tag [] tags)
{
// Filter out any tags that are already included
- ArrayList new_tags = new ArrayList(tags.Length);
+ // FIXME: Does this really need to be set to a length?
+ List<Tag> new_tags = new List<Tag> (tags.Length);
foreach (Tag tag in tags) {
if (! rootTerm.TagIncluded (tag))
new_tags.Add (tag);
@@ -534,14 +535,14 @@ namespace FSpot
if (new_tags.Count == 0)
return;
- tags = (Tag []) new_tags.ToArray (typeof (Tag));
+ tags = new_tags.ToArray ();
InsertTerm (tags, rootTerm, null);
}
public void UnInclude (Tag [] tags)
{
- ArrayList new_tags = new ArrayList(tags.Length);
+ List<Tag> new_tags = new List<Tag> (tags.Length);
foreach (Tag tag in tags) {
if (rootTerm.TagIncluded (tag))
new_tags.Add (tag);
@@ -550,7 +551,7 @@ namespace FSpot
if (new_tags.Count == 0)
return;
- tags = (Tag []) new_tags.ToArray (typeof (Tag));
+ tags = new_tags.ToArray ();
bool needsUpdate = false;
preventUpdate = true;
@@ -578,7 +579,7 @@ namespace FSpot
// OR terms and ANDing the result with this term (eg factored out)
// Trim out tags that are already required
- ArrayList new_tags = new ArrayList(tags.Length);
+ List<Tag> new_tags = new List<Tag> (tags.Length);
foreach (Tag tag in tags) {
if (! rootTerm.TagRequired (tag))
new_tags.Add (tag);
@@ -587,7 +588,7 @@ namespace FSpot
if (new_tags.Count == 0)
return;
- tags = (Tag []) new_tags.ToArray (typeof (Tag));
+ tags = new_tags.ToArray ();
bool added = false;
preventUpdate = true;
@@ -612,7 +613,7 @@ namespace FSpot
public void UnRequire (Tag [] tags)
{
// Trim out tags that are not required
- ArrayList new_tags = new ArrayList(tags.Length);
+ List<Tag> new_tags = new List<Tag> (tags.Length);
foreach (Tag tag in tags) {
if (rootTerm.TagRequired (tag))
new_tags.Add (tag);
@@ -621,7 +622,7 @@ namespace FSpot
if (new_tags.Count == 0)
return;
- tags = (Tag []) new_tags.ToArray (typeof (Tag));
+ tags = new_tags.ToArray ();
preventUpdate = true;
foreach (Term parent in rootTerm.LiteralParents ()) {
diff --git a/src/Clients/MainApp/FSpot/TagSelectionWidget.cs b/src/Clients/MainApp/FSpot/TagSelectionWidget.cs
index fe90643..afc3a8e 100644
--- a/src/Clients/MainApp/FSpot/TagSelectionWidget.cs
+++ b/src/Clients/MainApp/FSpot/TagSelectionWidget.cs
@@ -416,24 +416,27 @@ namespace FSpot {
}
}
- // Returns a flattened array of TreeIter's from the Model
+ /// <summary>
+ /// Returns a flattened array of TreeIter's from the Model
+ /// </summary>
+ /// <returns>
+ /// TreeIter []
+ /// </returns>
TreeIter [] ModelIters ()
{
TreeIter root;
if (Model.GetIterFirst (out root))
{
- return ModelIters (root, true).ToArray (typeof (TreeIter)) as TreeIter [];
+ return ModelIters (root, true).ToArray ();
}
-
return null;
}
- // Returns ArrayList containing the root TreeIter and all TreeIters at root's level and
+ // Returns a List containing the root TreeIter and all TreeIters at root's level and
// descended from it
- ArrayList ModelIters (TreeIter root, bool first)
+ List<TreeIter> ModelIters (TreeIter root, bool first)
{
- ArrayList model_iters = new ArrayList (Model.IterNChildren ());
-
+ List<TreeIter> model_iters = new List<TreeIter> (Model.IterNChildren ());
model_iters.Add (root);
// Append any children
@@ -453,7 +456,7 @@ namespace FSpot {
public void SaveExpandDefaults ()
{
- ArrayList expanded_tags = new ArrayList ();
+ List<int> expanded_tags = new List<int> ();
TreeIter [] iters = ModelIters ();
if (iters == null)
@@ -469,13 +472,12 @@ namespace FSpot {
}
#if GCONF_SHARP_2_18
- FSpot.Preferences.Set ( FSpot.Preferences.EXPANDED_TAGS, (int []) expanded_tags.ToArray (typeof (int)));
+ FSpot.Preferences.Set ( FSpot.Preferences.EXPANDED_TAGS, expanded_tags.ToArray ());
#else
if (expanded_tags.Count == 0)
expanded_tags.Add (-1);
- FSpot.Preferences.Set ( FSpot.Preferences.EXPANDED_TAGS,
- (int []) expanded_tags.ToArray (typeof (int)));
+ FSpot.Preferences.Set ( FSpot.Preferences.EXPANDED_TAGS, expanded_tags.ToArray ());
#endif
}
diff --git a/src/Clients/MainApp/FSpot/ThumbnailCache.cs b/src/Clients/MainApp/FSpot/ThumbnailCache.cs
index 11cb29d..5ee075e 100644
--- a/src/Clients/MainApp/FSpot/ThumbnailCache.cs
+++ b/src/Clients/MainApp/FSpot/ThumbnailCache.cs
@@ -33,6 +33,7 @@
using System;
using System.Collections;
+using System.Collections.Generic;
using Gdk;
using Hyena;
@@ -53,23 +54,20 @@ namespace FSpot
}
- // Private members and constants
-
+ #region Private members and constants
private const int DEFAULT_CACHE_SIZE = 2;
-
private int max_count;
- private ArrayList pixbuf_mru;
- private Hashtable pixbuf_hash = new Hashtable ();
-
+ private List<Thumbnail> pixbuf_mru;
+ private Hashtable pixbuf_hash;
static private ThumbnailCache defaultcache = new ThumbnailCache (DEFAULT_CACHE_SIZE);
+ #endregion
-
- // Public API
-
+ #region Public API
public ThumbnailCache (int max_count)
{
this.max_count = max_count;
- pixbuf_mru = new ArrayList (max_count);
+ pixbuf_mru = new List<Thumbnail> (max_count);
+ pixbuf_hash = new Hashtable();
}
static public ThumbnailCache Default {
@@ -120,6 +118,7 @@ namespace FSpot
item.pixbuf.Dispose ();
}
+ #endregion
public void Dispose ()
{
@@ -143,8 +142,7 @@ namespace FSpot
pixbuf_mru.Clear ();
}
- // Private utility methods.
-
+ #region Private utility methods.
private void MaybeExpunge ()
{
while (pixbuf_mru.Count > max_count) {
@@ -156,5 +154,6 @@ namespace FSpot
thumbnail.pixbuf.Dispose ();
}
}
+ #endregion
}
}
diff --git a/src/Clients/MainApp/ImageLoaderThread.cs b/src/Clients/MainApp/ImageLoaderThread.cs
index 22578c5..4668f6f 100644
--- a/src/Clients/MainApp/ImageLoaderThread.cs
+++ b/src/Clients/MainApp/ImageLoaderThread.cs
@@ -44,12 +44,15 @@ using FSpot.Imaging;
public class ImageLoaderThread
{
-
// Types.
-
public class RequestItem
{
- /* The uri to the image. */
+ /// <summary>
+ /// Gets or Sets image uri
+ /// </summary>
+ /// <value>
+ /// Image Uri
+ /// </value>
public SafeUri Uri { get; set; }
/* Order value; requests with a lower value get performed first. */
@@ -94,7 +97,7 @@ public class ImageLoaderThread
}
- // Private members.
+ #region Private members.
static List<ImageLoaderThread> instances = new List<ImageLoaderThread> ();
/* The thread used to handle the requests. */
@@ -102,7 +105,7 @@ public class ImageLoaderThread
/* The request queue; it's shared between the threads so it
needs to be locked prior to access. */
- private ArrayList queue;
+ private List<RequestItem> queue;
/* A dict of all the requests; note that the current request
isn't in the dict. */
@@ -125,16 +128,16 @@ public class ImageLoaderThread
already or not. */
private bool pending_notify_notified;
volatile bool should_cancel = false;
+ #endregion
- // Public API.
-
+ #region Public API
public delegate void PixbufLoadedHandler (ImageLoaderThread loader,RequestItem result);
public event PixbufLoadedHandler OnPixbufLoaded;
public ImageLoaderThread ()
{
- queue = new ArrayList ();
+ queue = new List<RequestItem> ();
requests_by_uri = new Dictionary<SafeUri, RequestItem> ();
// requests_by_path = Hashtable.Synchronized (new Hashtable ());
processed_requests = new Queue ();
@@ -214,9 +217,9 @@ public class ImageLoaderThread
}
}
}
+ #endregion
- // Private utility methods.
-
+ #region Private utility methods.
protected virtual void ProcessRequest (RequestItem request)
{
Pixbuf orig_image;
@@ -242,7 +245,6 @@ public class ImageLoaderThread
/* Insert the request in the queue, return TRUE if the queue actually grew.
NOTE: Lock the queue before calling. */
-
private bool InsertRequest (SafeUri uri, int order, int width, int height)
{
StartWorker ();
@@ -346,4 +348,5 @@ public class ImageLoaderThread
EmitLoaded (results);
}
+ #endregion
}
diff --git a/src/Clients/MainApp/TagCommands.cs b/src/Clients/MainApp/TagCommands.cs
index 633916a..82276f4 100644
--- a/src/Clients/MainApp/TagCommands.cs
+++ b/src/Clients/MainApp/TagCommands.cs
@@ -33,9 +33,11 @@
using Gtk;
using Gdk;
+
using System;
using System.Text;
using System.Collections;
+using System.Collections.Generic;
using Mono.Unix;
using FSpot;
@@ -63,9 +65,9 @@ public class TagCommands {
[GtkBeans.Builder.Object] private ComboBox category_option_menu;
[GtkBeans.Builder.Object] private CheckButton auto_icon_checkbutton;
- private ArrayList categories;
+ private List<Tag> categories;
- private void PopulateCategories (ArrayList categories, Category parent)
+ private void PopulateCategories (List<Tag> categories, Category parent)
{
foreach (Tag tag in parent.Children) {
if (tag is Category) {
@@ -87,7 +89,7 @@ public class TagCommands {
private void PopulateCategoryOptionMenu ()
{
- categories = new ArrayList ();
+ categories = new List<Tag> ();
categories.Add (tag_store.RootCategory);
PopulateCategories (categories, tag_store.RootCategory);
diff --git a/src/Core/FSpot.Gui/FSpot.Widgets/SelectionCollection.cs b/src/Core/FSpot.Gui/FSpot.Widgets/SelectionCollection.cs
index 40c3d16..5973bba 100644
--- a/src/Core/FSpot.Gui/FSpot.Widgets/SelectionCollection.cs
+++ b/src/Core/FSpot.Gui/FSpot.Widgets/SelectionCollection.cs
@@ -3,6 +3,7 @@
//
// Author:
// Mike GemÃnde <mike gemuende de>
+// Stephen Shaw <sshaw decriptor com>
//
// Copyright (C) 2010 Novell, Inc.
// Copyright (C) 2010 Mike GemÃnde
@@ -26,7 +27,6 @@
// 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.Linq;
using System.Collections;
@@ -36,304 +36,304 @@ using FSpot.Core;
namespace FSpot.Widgets
{
- public class SelectionCollection : IBrowsableCollection
- {
- IBrowsableCollection parent;
- Dictionary<IPhoto, int> selected_cells;
- BitArray bit_array;
- IPhoto [] items;
- IPhoto [] old;
-
- public SelectionCollection (IBrowsableCollection collection)
- {
- this.selected_cells = new Dictionary<IPhoto, int> ();
- this.parent = collection;
- this.bit_array = new BitArray (this.parent.Count);
- this.parent.Changed += HandleParentChanged;
- this.parent.ItemsChanged += HandleParentItemsChanged;
- }
-
- private void HandleParentChanged (IBrowsableCollection collection)
- {
- IPhoto [] local = old;
- selected_cells.Clear ();
- bit_array = new BitArray (parent.Count);
- ClearCached ();
-
- if (old != null) {
- int i = 0;
-
- for (i = 0; i < local.Length; i++) {
- int parent_index = parent.IndexOf (local [i]);
- if (parent_index >= 0)
- this.Add (parent_index, false);
- }
- }
-
- // Call the directly so that we don't reset old immediately this way the old selection
- // set isn't actually lost until we change it.
- if (this.Changed != null)
- Changed (this);
-
- if (this.DetailedChanged != null)
- DetailedChanged (this, null);
-
- }
-
- public void MarkChanged (int item, IBrowsableItemChanges changes)
- {
- throw new NotImplementedException ();
- }
-
- private void HandleParentItemsChanged (IBrowsableCollection collection, BrowsableEventArgs args)
- {
- if (this.ItemsChanged == null)
- return;
-
- ArrayList local_ids = new ArrayList ();
- foreach (int parent_index in args.Items) {
- // If the item isn't part of the selection ignore it
- if (!this.Contains (collection [parent_index]))
- return;
-
- int local_index = this.IndexOf (parent_index);
- if (local_index >= 0)
- local_ids.Add (local_index);
- }
-
- if (local_ids.Count == 0)
- return;
-
- int [] items = (int [])local_ids.ToArray (typeof (int));
- ItemsChanged (this, new BrowsableEventArgs (items, args.Changes));
- }
-
- public BitArray ToBitArray () {
- return new BitArray (bit_array);
- }
-
- public int [] Ids {
- get {
- // TODO: use IEnumerable<>
- return (from i in selected_cells.Values orderby i select i).ToArray ();
- }
- }
-
- public IPhoto this [int index] {
- get {
- int [] ids = this.Ids;
- return parent [ids[index]];
- }
- }
-
- public IPhoto [] Items {
- get {
- if (items != null)
- return items;
-
- int [] ids = this.Ids;
- items = new IPhoto [ids.Length];
- for (int i = 0; i < items.Length; i++) {
- items [i] = parent [ids[i]];
- }
- return items;
- }
- }
-
- public void Clear ()
- {
- Clear (true);
- }
-
- public void Clear (bool update)
- {
- int [] ids = Ids;
- selected_cells.Clear ();
- bit_array.SetAll (false);
- if (update)
- SignalChange (ids);
- }
-
- public void Add (IPhoto item)
- {
- if (this.Contains (item))
- return;
-
- int index = parent.IndexOf (item);
- this.Add (index);
- }
-
- public int Count {
- get {
- return selected_cells.Count;
- }
- }
-
- public bool Contains (IPhoto item)
- {
- return selected_cells.ContainsKey (item);
- }
-
- public bool Contains (int num)
- {
- if (num < 0 || num >= parent.Count)
- return false;
-
- return this.Contains (parent [num]);
- }
-
- public void Add (int num)
- {
- this.Add (num, true);
- }
-
- public void Add (int num, bool notify)
- {
- if (num == -1)
- return;
-
- if (this.Contains (num))
- return;
-
- IPhoto item = parent [num];
- selected_cells [item] = num;
- bit_array.Set (num, true);
-
- if (notify)
- SignalChange (new int [] {num});
- }
-
- public void Add (int start, int end)
- {
- if (start == -1 || end == -1)
- return;
-
- int current = Math.Min (start, end);
- int final = Math.Max (start, end);
- int count = final - current + 1;
- int [] ids = new int [count];
-
- for (int i = 0; i < count; i++) {
- this.Add (current, false);
- ids [i] = current;
- current++;
- }
-
- SignalChange (ids);
- }
-
- public void Remove (int cell, bool notify)
- {
- IPhoto item = parent [cell];
- if (item != null)
- this.Remove (item, notify);
-
- }
-
- public void Remove (IPhoto item)
- {
- Remove (item, true);
- }
-
- public void Remove (int cell)
- {
- Remove (cell, true);
- }
-
- private void Remove (IPhoto item, bool notify)
- {
- if (item == null)
- return;
-
- int parent_index = (int) selected_cells [item];
- selected_cells.Remove (item);
- bit_array.Set (parent_index, false);
-
- if (notify)
- SignalChange (new int [] {parent_index});
- }
-
- // Remove a range, except the start entry
- public void Remove (int start, int end)
- {
- if (start == -1 || end == -1)
- return;
-
- int current = Math.Min (start + 1, end);
- int final = Math.Max (start - 1, end);
- int count = final - current + 1;
- int [] ids = new int [count];
-
- for (int i = 0; i < count; i++) {
- this.Remove (current, false);
- ids [i] = current;
- current++;
- }
-
- SignalChange (ids);
- }
-
- public int IndexOf (int parent_index)
- {
- return System.Array.IndexOf (this.Ids, parent_index);
- }
-
- public int IndexOf (IPhoto item)
- {
- if (!this.Contains (item))
- return -1;
-
- int parent_index = (int) selected_cells [item];
- return System.Array.IndexOf (Ids, parent_index);
- }
-
- public void ToggleCell (int cell_num, bool notify)
- {
- if (Contains (cell_num))
- Remove (cell_num, notify);
- else
- Add (cell_num, notify);
- }
-
- public void ToggleCell (int cell_num)
- {
- ToggleCell (cell_num, true);
- }
-
- public void SelectionInvert ()
- {
- int [] changed_cell = new int[parent.Count];
- for (int i = 0; i < parent.Count; i++) {
- ToggleCell (i, false);
- changed_cell[i] = i;
- }
-
- SignalChange (changed_cell);
- }
-
- public event IBrowsableCollectionChangedHandler Changed;
- public event IBrowsableCollectionItemsChangedHandler ItemsChanged;
-
- public delegate void DetailedCollectionChanged (IBrowsableCollection collection, int [] ids);
- public event DetailedCollectionChanged DetailedChanged;
-
- private void ClearCached ()
- {
- items = null;
- }
-
- public void SignalChange (int [] ids)
- {
- ClearCached ();
- old = this.Items;
-
-
- if (Changed != null)
- Changed (this);
-
- if (DetailedChanged!= null)
- DetailedChanged (this, ids);
- }
- }
+ public class SelectionCollection : IBrowsableCollection
+ {
+ IBrowsableCollection parent;
+ Dictionary<IPhoto, int> selected_cells;
+ BitArray bit_array;
+ IPhoto[] items;
+ IPhoto[] old;
+
+ public SelectionCollection (IBrowsableCollection collection)
+ {
+ this.selected_cells = new Dictionary<IPhoto, int> ();
+ this.parent = collection;
+ this.bit_array = new BitArray (this.parent.Count);
+ this.parent.Changed += HandleParentChanged;
+ this.parent.ItemsChanged += HandleParentItemsChanged;
+ }
+
+ private void HandleParentChanged (IBrowsableCollection collection)
+ {
+ IPhoto [] local = old;
+ selected_cells.Clear ();
+ bit_array = new BitArray (parent.Count);
+ ClearCached ();
+
+ if (old != null) {
+ int i = 0;
+
+ for (i = 0; i < local.Length; i++) {
+ int parent_index = parent.IndexOf (local [i]);
+ if (parent_index >= 0)
+ this.Add (parent_index, false);
+ }
+ }
+
+ // Call the directly so that we don't reset old immediately this way the old selection
+ // set isn't actually lost until we change it.
+ if (this.Changed != null)
+ Changed (this);
+
+ if (this.DetailedChanged != null)
+ DetailedChanged (this, null);
+ }
+
+ public void MarkChanged (int item, IBrowsableItemChanges changes)
+ {
+ throw new NotImplementedException ();
+ }
+
+ private void HandleParentItemsChanged (IBrowsableCollection collection, BrowsableEventArgs args)
+ {
+ if (this.ItemsChanged == null)
+ return;
+
+ List<int> local_ids = new List<int> ();
+ foreach (int parent_index in args.Items) {
+ // If the item isn't part of the selection ignore it
+ if (!this.Contains (collection [parent_index]))
+ return;
+
+ int local_index = this.IndexOf (parent_index);
+ if (local_index >= 0)
+ local_ids.Add (local_index);
+ }
+
+ if (local_ids.Count == 0)
+ return;
+
+ int [] items = local_ids.ToArray ();
+ ItemsChanged (this, new BrowsableEventArgs (items, args.Changes));
+ }
+
+ public BitArray ToBitArray ()
+ {
+ return new BitArray (bit_array);
+ }
+
+ public int [] Ids {
+ get {
+ // TODO: use IEnumerable<>
+ return (from i in selected_cells.Values orderby i select i).ToArray ();
+ }
+ }
+
+ public IPhoto this [int index] {
+ get {
+ int [] ids = this.Ids;
+ return parent [ids [index]];
+ }
+ }
+
+ public IPhoto [] Items {
+ get {
+ if (items != null)
+ return items;
+
+ int [] ids = this.Ids;
+ items = new IPhoto [ids.Length];
+ for (int i = 0; i < items.Length; i++) {
+ items [i] = parent [ids [i]];
+ }
+ return items;
+ }
+ }
+
+ public void Clear ()
+ {
+ Clear (true);
+ }
+
+ public void Clear (bool update)
+ {
+ int [] ids = Ids;
+ selected_cells.Clear ();
+ bit_array.SetAll (false);
+ if (update)
+ SignalChange (ids);
+ }
+
+ public void Add (IPhoto item)
+ {
+ if (this.Contains (item))
+ return;
+
+ int index = parent.IndexOf (item);
+ this.Add (index);
+ }
+
+ public int Count {
+ get {
+ return selected_cells.Count;
+ }
+ }
+
+ public bool Contains (IPhoto item)
+ {
+ return selected_cells.ContainsKey (item);
+ }
+
+ public bool Contains (int num)
+ {
+ if (num < 0 || num >= parent.Count)
+ return false;
+
+ return this.Contains (parent [num]);
+ }
+
+ public void Add (int num)
+ {
+ this.Add (num, true);
+ }
+
+ public void Add (int num, bool notify)
+ {
+ if (num == -1)
+ return;
+
+ if (this.Contains (num))
+ return;
+
+ IPhoto item = parent [num];
+ selected_cells [item] = num;
+ bit_array.Set (num, true);
+
+ if (notify)
+ SignalChange (new int [] {num});
+ }
+
+ public void Add (int start, int end)
+ {
+ if (start == -1 || end == -1)
+ return;
+
+ int current = Math.Min (start, end);
+ int final = Math.Max (start, end);
+ int count = final - current + 1;
+ int [] ids = new int [count];
+
+ for (int i = 0; i < count; i++) {
+ this.Add (current, false);
+ ids [i] = current;
+ current++;
+ }
+
+ SignalChange (ids);
+ }
+
+ public void Remove (int cell, bool notify)
+ {
+ IPhoto item = parent [cell];
+ if (item != null)
+ this.Remove (item, notify);
+
+ }
+
+ public void Remove (IPhoto item)
+ {
+ Remove (item, true);
+ }
+
+ public void Remove (int cell)
+ {
+ Remove (cell, true);
+ }
+
+ private void Remove (IPhoto item, bool notify)
+ {
+ if (item == null)
+ return;
+
+ int parent_index = (int)selected_cells [item];
+ selected_cells.Remove (item);
+ bit_array.Set (parent_index, false);
+
+ if (notify)
+ SignalChange (new int [] {parent_index});
+ }
+
+ // Remove a range, except the start entry
+ public void Remove (int start, int end)
+ {
+ if (start == -1 || end == -1)
+ return;
+
+ int current = Math.Min (start + 1, end);
+ int final = Math.Max (start - 1, end);
+ int count = final - current + 1;
+ int [] ids = new int [count];
+
+ for (int i = 0; i < count; i++) {
+ this.Remove (current, false);
+ ids [i] = current;
+ current++;
+ }
+
+ SignalChange (ids);
+ }
+
+ public int IndexOf (int parent_index)
+ {
+ return System.Array.IndexOf (this.Ids, parent_index);
+ }
+
+ public int IndexOf (IPhoto item)
+ {
+ if (!this.Contains (item))
+ return -1;
+
+ int parent_index = (int)selected_cells [item];
+ return System.Array.IndexOf (Ids, parent_index);
+ }
+
+ public void ToggleCell (int cell_num, bool notify)
+ {
+ if (Contains (cell_num))
+ Remove (cell_num, notify);
+ else
+ Add (cell_num, notify);
+ }
+
+ public void ToggleCell (int cell_num)
+ {
+ ToggleCell (cell_num, true);
+ }
+
+ public void SelectionInvert ()
+ {
+ int [] changed_cell = new int[parent.Count];
+ for (int i = 0; i < parent.Count; i++) {
+ ToggleCell (i, false);
+ changed_cell [i] = i;
+ }
+
+ SignalChange (changed_cell);
+ }
+
+ public event IBrowsableCollectionChangedHandler Changed;
+ public event IBrowsableCollectionItemsChangedHandler ItemsChanged;
+
+ public delegate void DetailedCollectionChanged (IBrowsableCollection collection,int[] ids);
+
+ public event DetailedCollectionChanged DetailedChanged;
+
+ private void ClearCached ()
+ {
+ items = null;
+ }
+
+ public void SignalChange (int [] ids)
+ {
+ ClearCached ();
+ old = this.Items;
+
+
+ if (Changed != null)
+ Changed (this);
+
+ if (DetailedChanged != null)
+ DetailedChanged (this, ids);
+ }
+ }
}
-
diff --git a/src/Extensions/Exporters/FSpot.Exporters.Flickr/FSpot.Exporters.Flickr/FlickrExport.cs b/src/Extensions/Exporters/FSpot.Exporters.Flickr/FSpot.Exporters.Flickr/FlickrExport.cs
index 353d94b..3a738bc 100644
--- a/src/Extensions/Exporters/FSpot.Exporters.Flickr/FSpot.Exporters.Flickr/FlickrExport.cs
+++ b/src/Extensions/Exporters/FSpot.Exporters.Flickr/FSpot.Exporters.Flickr/FlickrExport.cs
@@ -4,6 +4,7 @@
// Author:
// Lorenzo Milesi <maxxer yetopen it>
// Stephane Delcroix <stephane delcroix org>
+// Stephen Shaw <sshaw decriptor com>
//
// Copyright (C) 2008-2009 Novell, Inc.
// Copyright (C) 2008-2009 Lorenzo Milesi
@@ -32,6 +33,7 @@
using FlickrNet;
using System;
using System.Collections;
+using System.Collections.Generic;
using System.IO;
using System.Threading;
using Mono.Unix;
@@ -373,7 +375,7 @@ namespace FSpot.Exporters.Flickr {
progress_item.Changed += HandleProgressChanged;
fr.Connection.OnUploadProgress += HandleFlickrProgress;
- System.Collections.ArrayList ids = new System.Collections.ArrayList ();
+ List<string> ids = new List<string> ();
IPhoto [] photos = selection.Items;
Array.Sort (photos, new DateComparer ());
diff --git a/src/Extensions/Exporters/FSpot.Exporters.Flickr/FSpot.Exporters.Flickr/FlickrRemote.cs b/src/Extensions/Exporters/FSpot.Exporters.Flickr/FSpot.Exporters.Flickr/FlickrRemote.cs
index 73db977..da35672 100644
--- a/src/Extensions/Exporters/FSpot.Exporters.Flickr/FSpot.Exporters.Flickr/FlickrRemote.cs
+++ b/src/Extensions/Exporters/FSpot.Exporters.Flickr/FSpot.Exporters.Flickr/FlickrRemote.cs
@@ -4,6 +4,7 @@
// Author:
// Lorenzo Milesi <maxxer yetopen it>
// Stephane Delcroix <stephane delcroix org>
+// Stephen Shaw <sshaw decriptor com>
//
// Copyright (C) 2008-2009 Novell, Inc.
// Copyright (C) 2008-2009 Lorenzo Milesi
@@ -44,6 +45,8 @@ using System;
using System.IO;
using System.Text;
using System.Collections;
+using System.Collections.Generic;
+
using FlickrNet;
using FSpot;
using FSpot.Core;
@@ -107,9 +110,9 @@ public class FlickrRemote {
return licenses.LicenseCollection;
}
- public ArrayList Search (string[] tags, int licenseId)
+ public List<string> Search (string[] tags, int licenseId)
{
- ArrayList photos_url = new ArrayList ();
+ List<string> photos_url = new List<string> ();
// Photos photos = flickr.PhotosSearchText (tags, licenseId);
Photos photos = flickr.PhotosSearch (tags);
@@ -122,9 +125,9 @@ public class FlickrRemote {
return photos_url;
}
- public ArrayList Search (string tags, int licenseId)
+ public List<string> Search (string tags, int licenseId)
{
- ArrayList photos_url = new ArrayList ();
+ List<string> photos_url = new List<string> ();
Photos photos = flickr.PhotosSearchText (tags, licenseId);
if (photos != null) {
diff --git a/src/Extensions/Exporters/FSpot.Exporters.Folder/FSpot.Exporters.Folder/FolderExport.cs b/src/Extensions/Exporters/FSpot.Exporters.Folder/FSpot.Exporters.Folder/FolderExport.cs
index ccbe7bb..0d6e0c0 100644
--- a/src/Extensions/Exporters/FSpot.Exporters.Folder/FSpot.Exporters.Folder/FolderExport.cs
+++ b/src/Extensions/Exporters/FSpot.Exporters.Folder/FSpot.Exporters.Folder/FolderExport.cs
@@ -4,6 +4,7 @@
// Author:
// Lorenzo Milesi <maxxer yetopen it>
// Stephane Delcroix <stephane delcroix org>
+// Stephen Shaw <sshaw decriptor com>
//
// Copyright (C) 2008-2009 Novell, Inc.
// Copyright (C) 2008 Lorenzo Milesi
@@ -54,6 +55,7 @@ using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Collections;
+using System.Collections.Generic;
using Hyena;
@@ -116,7 +118,7 @@ namespace FSpot.Exporters.Folder {
string description;
string gallery_name = "Gallery";
- // FIXME this needs to be a real temp directory
+ // FIXME: this needs to be a real temp directory
string gallery_path = Path.Combine (Path.GetTempPath (), "f-spot-original-" + System.DateTime.Now.Ticks.ToString ());
ThreadProgressDialog progress_dialog;
@@ -186,7 +188,7 @@ namespace FSpot.Exporters.Folder {
public void Upload ()
{
- // FIXME use mkstemp
+ // FIXME: use mkstemp
try {
ThreadAssist.ProxyToMain (Dialog.Hide);
@@ -747,6 +749,7 @@ namespace FSpot.Exporters.Folder {
static string light = Catalog.GetString("Light");
static string dark = Catalog.GetString("Dark");
+ // FIXME: Need to clean up the ArrayList and Hashtable at the same time.
ArrayList allTagNames = new ArrayList ();
Hashtable allTags = new Hashtable ();
Hashtable tagSets = new Hashtable ();
diff --git a/src/Extensions/Exporters/FSpot.Exporters.Gallery/FSpot.Exporters.Gallery/FormClient.cs b/src/Extensions/Exporters/FSpot.Exporters.Gallery/FSpot.Exporters.Gallery/FormClient.cs
index 17ddf8c..5b92362 100644
--- a/src/Extensions/Exporters/FSpot.Exporters.Gallery/FSpot.Exporters.Gallery/FormClient.cs
+++ b/src/Extensions/Exporters/FSpot.Exporters.Gallery/FSpot.Exporters.Gallery/FormClient.cs
@@ -34,6 +34,7 @@ using System.Net;
using System.IO;
using System.Text;
using System.Collections;
+using System.Collections.Generic;
using System.Collections.Specialized;
using System.Web;
using Hyena;
@@ -52,8 +53,8 @@ namespace FSpot.Exporters.Gallery {
}
private StreamWriter stream_writer;
- private ArrayList Items;
-
+ private List<FormItem> Items;
+
private string boundary;
private string start_boundary;
private string end_boundary;
@@ -78,12 +79,12 @@ namespace FSpot.Exporters.Gallery {
public FormClient (CookieContainer cookies)
{
this.Cookies = cookies;
- this.Items = new ArrayList ();
+ this.Items = new List<FormItem> ();
}
public FormClient ()
{
- this.Items = new ArrayList ();
+ this.Items = new List<FormItem> ();
this.Cookies = new CookieContainer ();
}
@@ -275,7 +276,7 @@ namespace FSpot.Exporters.Gallery {
long length = 0;
for (int i = 0; i < Items.Count; i++) {
- FormItem item = (FormItem)Items[i];
+ FormItem item = Items[i];
length += MultipartLength (item);
}
@@ -294,7 +295,7 @@ namespace FSpot.Exporters.Gallery {
first_item = true;
for (int i = 0; i < Items.Count; i++) {
- FormItem item = (FormItem)Items[i];
+ FormItem item = Items[i];
Write (item);
}
diff --git a/src/Extensions/Exporters/FSpot.Exporters.Gallery/FSpot.Exporters.Gallery/GalleryAccountManager.cs b/src/Extensions/Exporters/FSpot.Exporters.Gallery/FSpot.Exporters.Gallery/GalleryAccountManager.cs
index 01aec42..c32dca6 100644
--- a/src/Extensions/Exporters/FSpot.Exporters.Gallery/FSpot.Exporters.Gallery/GalleryAccountManager.cs
+++ b/src/Extensions/Exporters/FSpot.Exporters.Gallery/FSpot.Exporters.Gallery/GalleryAccountManager.cs
@@ -3,6 +3,7 @@
//
// Author:
// Paul Lange <palango gmx de>
+// Stephen Shaw <sshaw decriptor com>
//
// Copyright (C) 2010 Novell, Inc.
// Copyright (C) 2010 Paul Lange
@@ -33,6 +34,7 @@ using System.Net;
using System.IO;
using System.Text;
using System.Collections;
+using System.Collections.Generic;
using System.Collections.Specialized;
using System.Web;
using Mono.Unix;
@@ -51,7 +53,7 @@ namespace FSpot.Exporters.Gallery
{
private static GalleryAccountManager instance;
string xml_path;
- ArrayList accounts;
+ List<GalleryAccount> accounts;
public delegate void AccountListChangedHandler (GalleryAccountManager manager, GalleryAccount changed_account);
public event AccountListChangedHandler AccountListChanged;
@@ -70,7 +72,7 @@ namespace FSpot.Exporters.Gallery
// FIXME this xml file path should be be retrieved from a central location not hard coded there
this.xml_path = System.IO.Path.Combine (FSpot.Core.Global.BaseDirectory, "Accounts.xml");
- accounts = new ArrayList ();
+ accounts = new List<GalleryAccount> ();
ReadAccounts ();
}
@@ -88,7 +90,7 @@ namespace FSpot.Exporters.Gallery
AccountListChanged (this, changed_account);
}
- public ArrayList GetAccounts ()
+ public List<GalleryAccount> GetAccounts ()
{
return accounts;
}
diff --git a/src/Extensions/Exporters/FSpot.Exporters.Gallery/FSpot.Exporters.Gallery/GalleryExport.cs b/src/Extensions/Exporters/FSpot.Exporters.Gallery/FSpot.Exporters.Gallery/GalleryExport.cs
index 51c005c..dfaaf06 100644
--- a/src/Extensions/Exporters/FSpot.Exporters.Gallery/FSpot.Exporters.Gallery/GalleryExport.cs
+++ b/src/Extensions/Exporters/FSpot.Exporters.Gallery/FSpot.Exporters.Gallery/GalleryExport.cs
@@ -30,12 +30,12 @@
// 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.Net;
using System.IO;
using System.Text;
using System.Collections;
+using System.Collections.Generic;
using System.Collections.Specialized;
using System.Web;
using Mono.Unix;
@@ -53,8 +53,11 @@ using Hyena.Widgets;
namespace FSpot.Exporters.Gallery
{
- public class GalleryExport : IExporter {
- public GalleryExport () { }
+ public class GalleryExport : IExporter
+ {
+ public GalleryExport ()
+ {
+ }
public void Run (IBrowsableCollection selection)
{
@@ -73,7 +76,7 @@ namespace FSpot.Exporters.Gallery
gallery_optionmenu.Show ();
this.items = selection.Items;
- Array.Sort<IPhoto> (this.items, new IPhotoComparer.CompareDateName());
+ Array.Sort<IPhoto> (this.items, new IPhotoComparer.CompareDateName ());
album_button.Sensitive = false;
var view = new TrayView (selection);
view.DisplayDates = false;
@@ -110,18 +113,15 @@ namespace FSpot.Exporters.Gallery
public const string BROWSER_KEY = Preferences.APP_FSPOT_EXPORT + EXPORT_SERVICE + "browser";
public const string META_KEY = Preferences.APP_FSPOT_EXPORT + EXPORT_SERVICE + "meta";
public const string LIGHTTPD_WORKAROUND_KEY = Preferences.APP_FSPOT_EXPORT + EXPORT_SERVICE + "lighttpd_workaround";
-
private bool scale;
private int size;
private bool browser;
private bool meta;
private bool connect = false;
-
IPhoto[] items;
int photo_index;
ThreadProgressDialog progress_dialog;
-
- ArrayList accounts;
+ List<GalleryAccount> accounts;
private GalleryAccount account;
private Album album;
@@ -133,19 +133,14 @@ namespace FSpot.Exporters.Gallery
[GtkBeans.Builder.Object] Gtk.CheckButton browser_check;
[GtkBeans.Builder.Object] Gtk.CheckButton scale_check;
[GtkBeans.Builder.Object] Gtk.CheckButton meta_check;
-
[GtkBeans.Builder.Object] Gtk.SpinButton size_spin;
-
[GtkBeans.Builder.Object] Gtk.Button album_button;
[GtkBeans.Builder.Object] Gtk.Button edit_button;
-
[GtkBeans.Builder.Object] Gtk.Button export_button;
-
[GtkBeans.Builder.Object] Gtk.ScrolledWindow thumb_scrolledwindow;
System.Threading.Thread command_thread;
-
private void HandleResponse (object sender, Gtk.ResponseArgs args)
{
if (args.ResponseId != Gtk.ResponseType.Ok) {
@@ -164,7 +159,7 @@ namespace FSpot.Exporters.Gallery
if (account != null) {
//System.Console.WriteLine ("history = {0}", album_optionmenu.History);
- album = (Album) account.Gallery.Albums [Math.Max (0, album_optionmenu.Active)];
+ album = account.Gallery.Albums [Math.Max (0, album_optionmenu.Active)];
photo_index = 0;
export_dialog.Destroy ();
@@ -186,7 +181,7 @@ namespace FSpot.Exporters.Gallery
private void HandleProgressChanged (ProgressItem item)
{
//System.Console.WriteLine ("Changed value = {0}", item.Value);
- progress_dialog.Fraction = (photo_index - 1.0 + item.Value) / (double) items.Length;
+ progress_dialog.Fraction = (photo_index - 1.0 + item.Value) / (double)items.Length;
}
public void HandleSizeActive (object sender, EventArgs args)
@@ -194,52 +189,49 @@ namespace FSpot.Exporters.Gallery
size_spin.Sensitive = scale_check.Active;
}
-
private void Upload ()
{
- account.Gallery.Progress = new ProgressItem ();
- account.Gallery.Progress.Changed += HandleProgressChanged;
+ account.Gallery.Progress = new ProgressItem ();
+ account.Gallery.Progress.Changed += HandleProgressChanged;
- Log.Debug ("Starting upload");
+ Log.Debug ("Starting upload");
- FilterSet filters = new FilterSet ();
- if (account.Version == GalleryVersion.Version1)
- filters.Add (new WhiteListFilter (new string []{".jpg", ".jpeg", ".png", ".gif"}));
- if (scale)
- filters.Add (new ResizeFilter ((uint) size));
+ FilterSet filters = new FilterSet ();
+ if (account.Version == GalleryVersion.Version1)
+ filters.Add (new WhiteListFilter (new string []{".jpg", ".jpeg", ".png", ".gif"}));
+ if (scale)
+ filters.Add (new ResizeFilter ((uint)size));
- while (photo_index < items.Length) {
- IPhoto item = items [photo_index];
+ while (photo_index < items.Length) {
+ IPhoto item = items [photo_index];
- Log.DebugFormat ("uploading {0}", photo_index);
+ Log.DebugFormat ("uploading {0}", photo_index);
- progress_dialog.Message = System.String.Format (Catalog.GetString ("Uploading picture \"{0}\""), item.Name);
- progress_dialog.Fraction = photo_index / (double) items.Length;
- photo_index++;
+ progress_dialog.Message = System.String.Format (Catalog.GetString ("Uploading picture \"{0}\""), item.Name);
+ progress_dialog.Fraction = photo_index / (double)items.Length;
+ photo_index++;
- progress_dialog.ProgressText = System.String.Format (Catalog.GetString ("{0} of {1}"), photo_index, items.Length);
+ progress_dialog.ProgressText = System.String.Format (Catalog.GetString ("{0} of {1}"), photo_index, items.Length);
- FilterRequest req = new FilterRequest (item.DefaultVersion.Uri);
+ FilterRequest req = new FilterRequest (item.DefaultVersion.Uri);
- filters.Convert (req);
- try {
- int id = album.Add (item, req.Current.LocalPath);
+ filters.Convert (req);
+ try {
+ int id = album.Add (item, req.Current.LocalPath);
- if (item != null && item is Photo && App.Instance.Database != null && id != 0) {
+ if (item != null && item is Photo && App.Instance.Database != null && id != 0)
App.Instance.Database.Exports.Create ((item as Photo).Id, (item as Photo).DefaultVersionId,
ExportStore.Gallery2ExportType,
String.Format("{0}:{1}",album.Gallery.Uri.ToString (), id.ToString ()));
- }
- } catch (System.Exception e) {
- progress_dialog.Message = String.Format (Catalog.GetString ("Error uploading picture \"{0}\" to Gallery: {1}"), item.Name, e.Message);
- progress_dialog.ProgressText = Catalog.GetString ("Error");
- Log.Exception (e);
+ } catch (System.Exception e) {
+ progress_dialog.Message = String.Format (Catalog.GetString ("Error uploading picture \"{0}\" to Gallery: {1}"), item.Name, e.Message);
+ progress_dialog.ProgressText = Catalog.GetString ("Error");
+ Log.Exception (e);
- if (progress_dialog.PerformRetrySkip ()) {
+ if (progress_dialog.PerformRetrySkip ())
photo_index--;
- }
- }
+ }
}
progress_dialog.Message = Catalog.GetString ("Done Sending Photos");
@@ -247,9 +239,8 @@ namespace FSpot.Exporters.Gallery
progress_dialog.ProgressText = Catalog.GetString ("Upload Complete");
progress_dialog.ButtonLabel = Gtk.Stock.Ok;
- if (browser) {
+ if (browser)
GtkBeans.Global.ShowUri (export_dialog.Screen, album.GetUrl());
- }
}
private void PopulateGalleryOptionMenu (GalleryAccountManager manager, GalleryAccount changed_account)
@@ -259,7 +250,7 @@ namespace FSpot.Exporters.Gallery
accounts = manager.GetAccounts ();
if (accounts == null || accounts.Count == 0) {
- gallery_optionmenu.AppendText(Catalog.GetString("(No Gallery)"));
+ gallery_optionmenu.AppendText (Catalog.GetString ("(No Gallery)"));
gallery_optionmenu.Sensitive = false;
edit_button.Sensitive = false;
@@ -269,14 +260,14 @@ namespace FSpot.Exporters.Gallery
if (account == changed_account)
pos = i;
- gallery_optionmenu.AppendText(account.Name);
+ gallery_optionmenu.AppendText (account.Name);
i++;
}
gallery_optionmenu.Sensitive = true;
edit_button.Sensitive = true;
}
- gallery_optionmenu.Active = pos;
+ gallery_optionmenu.Active = pos;
}
private void Connect ()
@@ -289,7 +280,7 @@ namespace FSpot.Exporters.Gallery
try {
if (accounts.Count != 0 && connect) {
if (selected == null)
- account = (GalleryAccount) accounts [gallery_optionmenu.Active];
+ account = (GalleryAccount)accounts [gallery_optionmenu.Active];
else
account = selected;
@@ -316,23 +307,23 @@ namespace FSpot.Exporters.Gallery
Connect ();
}
- public void HandleAlbumAdded (string title) {
- GalleryAccount account = (GalleryAccount) accounts [gallery_optionmenu.Active];
+ public void HandleAlbumAdded (string title)
+ {
+ GalleryAccount account = (GalleryAccount)accounts [gallery_optionmenu.Active];
PopulateAlbumOptionMenu (account.Gallery);
// make the newly created album selected
- ArrayList albums = account.Gallery.Albums;
+ List<Album> albums = account.Gallery.Albums;
for (int i=0; i < albums.Count; i++) {
- if (((Album)albums[i]).Title == title) {
- album_optionmenu.Active = i;
- }
+ if (((Album)albums [i]).Title == title)
+ album_optionmenu.Active = i;
}
}
private void PopulateAlbumOptionMenu (Gallery gallery)
{
- System.Collections.ArrayList albums = null;
- if (gallery != null) {
+ List<Album> albums = null;
+ if (gallery != null)
//gallery.FetchAlbumsPrune ();
try {
gallery.FetchAlbums ();
@@ -341,7 +332,6 @@ namespace FSpot.Exporters.Gallery
gallery.PopupException (e, export_dialog);
return;
}
- }
bool disconnected = gallery == null || !account.Connected || albums == null;
@@ -349,7 +339,7 @@ namespace FSpot.Exporters.Gallery
string msg = disconnected ? Catalog.GetString ("(Not Connected)")
: Catalog.GetString ("(No Albums)");
- album_optionmenu.AppendText(msg);
+ album_optionmenu.AppendText (msg);
export_button.Sensitive = false;
album_optionmenu.Sensitive = false;
@@ -366,7 +356,7 @@ namespace FSpot.Exporters.Gallery
}
label_builder.Append (album.Title);
- album_optionmenu.AppendText(label_builder.ToString());
+ album_optionmenu.AppendText (label_builder.ToString ());
}
export_button.Sensitive = items.Length > 0;
@@ -402,7 +392,7 @@ namespace FSpot.Exporters.Gallery
break;
case SIZE_KEY:
- size_spin.Value = (double) Preferences.Get<int> (key);
+ size_spin.Value = (double)Preferences.Get<int> (key);
break;
case BROWSER_KEY:
diff --git a/src/Extensions/Exporters/FSpot.Exporters.Gallery/FSpot.Exporters.Gallery/GalleryRemote.cs b/src/Extensions/Exporters/FSpot.Exporters.Gallery/FSpot.Exporters.Gallery/GalleryRemote.cs
index db9e0c4..473cfee 100644
--- a/src/Extensions/Exporters/FSpot.Exporters.Gallery/FSpot.Exporters.Gallery/GalleryRemote.cs
+++ b/src/Extensions/Exporters/FSpot.Exporters.Gallery/FSpot.Exporters.Gallery/GalleryRemote.cs
@@ -4,6 +4,7 @@
// Author:
// Larry Ewing <lewing novell com>
// Stephane Delcroix <sdelcroix*novell.com>
+// Stephen Shaw <sshaw decriptor com>
//
// Copyright (C) 2004-2008 Novell, Inc.
// Copyright (C) 2004-2007 Larry Ewing
@@ -34,12 +35,11 @@ using System.Net;
using System.IO;
using System.Text;
using System.Collections;
-using System.Collections.Specialized;
-using System.Web;
+using System.Collections.Generic;
+
using Mono.Unix;
using FSpot;
using FSpot.Core;
-using FSpot.UI.Dialog;
using Hyena;
using Hyena.Widgets;
@@ -48,7 +48,8 @@ using Hyena.Widgets;
* http://codex.gallery2.org/index.php/Gallery_Remote:Protocol
*/
-namespace FSpot.Exporters.Gallery {
+namespace FSpot.Exporters.Gallery
+{
public enum AlbumPermission : byte
{
None = 0,
@@ -59,43 +60,41 @@ namespace FSpot.Exporters.Gallery {
CreateSubAlbum = 16
}
- public class Album : IComparable {
+ public class Album : IComparable
+ {
public int RefNum;
- public string Name = null;
- public string Title = null;
- public string Summary = null;
+ public string Name = String.Empty;
+ public string Title = String.Empty;
+ public string Summary = String.Empty;
public int ParentRefNum;
public int ResizeSize;
public int ThumbSize;
- public ArrayList Images = null;
- public string BaseURL;
-
+ public List<Image> Images;
+ public string BaseURL = String.Empty;
Gallery gallery;
-
public AlbumPermission Perms = AlbumPermission.None;
public Album Parent {
get {
if (ParentRefNum != 0)
- return gallery.LookupAlbum (ParentRefNum);
+ return Gallery.LookupAlbum (ParentRefNum);
else
return null;
}
}
- protected ArrayList parents = null;
- public ArrayList Parents {
+ protected List<int> parents = null;
+ public List<int> Parents {
get {
if (parents != null)
return parents;
if (Parent == null) {
- parents = new ArrayList ();
+ parents = new List<int> ();
} else {
- parents = Parent.Parents.Clone () as ArrayList;
+ parents = Parent.Parents;
parents.Add (Parent.RefNum);
}
-
return parents;
}
}
@@ -109,7 +108,7 @@ namespace FSpot.Exporters.Gallery {
Name = name;
this.gallery = gallery;
this.RefNum = ref_num;
- Images = new ArrayList ();
+ Images = new List<Image> ();
}
public void Rename (string name)
@@ -187,12 +186,12 @@ namespace FSpot.Exporters.Gallery {
//children of the same parent
retVal = this.RefNum.CompareTo (other.RefNum);
}
-
return retVal;
}
}
- public class Image {
+ public class Image
+ {
public string Name;
public int RawWidth;
public int RawHeight;
@@ -203,13 +202,10 @@ namespace FSpot.Exporters.Gallery {
public int ThumbWidth;
public int ThumbHeight;
public int RawFilesize;
-
public string Caption;
public string Description;
public int Clicks;
-
public Album Owner;
-
public string Url;
public Image (Album album, string name) {
@@ -237,39 +233,32 @@ namespace FSpot.Exporters.Gallery {
UnknownResponse = 1000
}
+ #region Exceptions
public class GalleryException : System.Exception {
- string response_text;
-
- public string ResponseText {
- get { return response_text; }
- }
+ public string ResponseText { get; private set; }
- public GalleryException (string text) : base (text)
- {
- }
+ public GalleryException (string text) : base (text) { }
public GalleryException (string text, string full_response) : base (text)
{
- response_text = full_response;
+ ResponseText = full_response;
}
}
public class GalleryCommandException : GalleryException {
- ResultCode status;
+ public ResultCode Status { get; private set; }
public GalleryCommandException (string status_text, ResultCode result) : base (status_text) {
- status = result;
+ Status = result;
}
- public ResultCode Status {
- get {
- return status;
- }
- }
+
}
+ #endregion
public abstract class Gallery
{
+ #region Properties
protected Uri uri;
public Uri Uri{
get {
@@ -277,7 +266,6 @@ namespace FSpot.Exporters.Gallery {
}
}
-
protected string name;
public string Name {
get {
@@ -299,41 +287,40 @@ namespace FSpot.Exporters.Gallery {
}
protected GalleryVersion version;
-
public GalleryVersion Version {
get {
return version;
}
}
- protected ArrayList albums;
- public ArrayList Albums{
+ protected List<Album> albums;
+ public List<Album> Albums{
get {
return albums;
}
}
+ #endregion
public bool expect_continue = true;
-
protected CookieContainer cookies = null;
public FSpot.ProgressItem Progress = null;
public abstract void Login (string username, string passwd);
- public abstract ArrayList FetchAlbums ();
- public abstract ArrayList FetchAlbumsPrune ();
+ public abstract List<Album> FetchAlbums ();
+ public abstract List<Album> FetchAlbumsPrune ();
public abstract bool MoveAlbum (Album album, string end_name);
public abstract int AddItem (Album album, string path, string filename, string caption, string description, bool autorotate);
//public abstract Album AlbumProperties (string album);
public abstract bool NewAlbum (string parent_name, string name, string title, string description);
- public abstract ArrayList FetchAlbumImages (Album album, bool include_ablums);
+ public abstract List<Image> FetchAlbumImages (Album album, bool include_ablums);
public abstract string GetAlbumUrl (Album album);
public Gallery (string name)
{
- this.name = name;
+ Name = name;
cookies = new CookieContainer ();
- albums = new ArrayList ();
+ albums = new List<Album> ();
}
public static GalleryVersion DetectGalleryVersion (string url)
@@ -349,7 +336,6 @@ namespace FSpot.Exporters.Gallery {
version = GalleryVersion.Version2;
} else {
//check what script is available on the server
-
FormClient client = new FormClient ();
try {
@@ -387,6 +373,7 @@ namespace FSpot.Exporters.Gallery {
//return cookies.GetCookies(Uri).Count > 0;
return retVal;
}
+
//Reads until it finds the start of the response
protected StreamReader findResponse (HttpWebResponse response)
{
@@ -406,9 +393,7 @@ namespace FSpot.Exporters.Gallery {
// failed to find the response
throw new GalleryException (Catalog.GetString ("Server returned response without Gallery content"), full_response);
}
-
return reader;
-
}
protected string [] GetNextLine (StreamReader reader)
@@ -428,19 +413,14 @@ namespace FSpot.Exporters.Gallery {
return null;
}
}
-
return array;
}
private bool LineIgnored (string[] line)
{
- if (line[0].StartsWith ("debug")) {
- return true;
- } else if (line[0].StartsWith ("can_create_root")) {
+ if (line[0].StartsWith ("debug") || line[0].StartsWith ("can_create_root"))
return true;
- } else {
- return false;
- }
+ return false;
}
protected bool ParseLogin (HttpWebResponse response)
@@ -450,7 +430,6 @@ namespace FSpot.Exporters.Gallery {
ResultCode status = ResultCode.UnknownResponse;
string status_text = "Error: Unable to parse server response";
try {
-
reader = findResponse (response);
while ((data = GetNextLine (reader)) != null) {
if (data[0] == "status") {
@@ -466,29 +445,28 @@ namespace FSpot.Exporters.Gallery {
Log.DebugFormat ("Unparsed Line in ParseLogin(): {0}={1}", data[0], data[1]);
}
}
+
//Console.WriteLine ("Found: {0} cookies", response.Cookies.Count);
if (status != ResultCode.Success) {
Log.Debug (status_text);
throw new GalleryCommandException (status_text, status);
}
-
return true;
} finally {
if (reader != null)
reader.Close ();
-
response.Close ();
}
}
- public ArrayList ParseFetchAlbums (HttpWebResponse response)
+ public List<Album> ParseFetchAlbums (HttpWebResponse response)
{
//Console.WriteLine ("in ParseFetchAlbums()");
string [] data;
StreamReader reader = null;
ResultCode status = ResultCode.UnknownResponse;
string status_text = "Error: Unable to parse server response";
- albums = new ArrayList ();
+ albums = new List<Album> ();
try {
Album current_album = null;
@@ -510,7 +488,7 @@ namespace FSpot.Exporters.Gallery {
ref_num = int.Parse (data[1]);
}
current_album = new Album (this, data[1], ref_num);
- albums.Add (current_album);
+ Albums.Add (current_album);
//Console.WriteLine ("current_album: " + data[1]);
} else if (data[0].StartsWith ("album.title")) {
//this is the display name
@@ -563,11 +541,10 @@ namespace FSpot.Exporters.Gallery {
}
//Console.WriteLine (After parse albums.Count + " albums parsed");
- return albums;
+ return Albums;
} finally {
if (reader != null)
reader.Close ();
-
response.Close ();
}
}
@@ -580,7 +557,6 @@ namespace FSpot.Exporters.Gallery {
string status_text = "Error: Unable to parse server response";
int item_id = 0;
try {
-
reader = findResponse (response);
while ((data = GetNextLine (reader)) != null) {
if (data[0] == "status") {
@@ -606,7 +582,6 @@ namespace FSpot.Exporters.Gallery {
} finally {
if (reader != null)
reader.Close ();
-
response.Close ();
}
}
@@ -665,7 +640,6 @@ namespace FSpot.Exporters.Gallery {
ResultCode status = ResultCode.UnknownResponse;
string status_text = "Error: Unable to parse server response";
try {
-
reader = findResponse (response);
while ((data = GetNextLine (reader)) != null) {
if (data[0] == "status") {
@@ -689,7 +663,6 @@ namespace FSpot.Exporters.Gallery {
} finally {
if (reader != null)
reader.Close ();
-
response.Close ();
}
}
@@ -698,7 +671,7 @@ namespace FSpot.Exporters.Gallery {
{
Album match = null;
- foreach (Album album in albums) {
+ foreach (Album album in Albums) {
if (album.Name == name) {
match = album;
break;
@@ -709,10 +682,10 @@ namespace FSpot.Exporters.Gallery {
public Album LookupAlbum (int ref_num)
{
- // FIXME this is really not the best way to do this
+ // FIXME: this is really not the best way to do this
Album match = null;
- foreach (Album album in albums) {
+ foreach (Album album in Albums) {
if (album.RefNum == ref_num) {
match = album;
break;
@@ -746,7 +719,6 @@ namespace FSpot.Exporters.Gallery {
md.Run ();
md.Destroy ();
}
-
}
public class Gallery1 : Gallery
@@ -755,7 +727,7 @@ namespace FSpot.Exporters.Gallery {
public Gallery1 (string url) : this (url, url) {}
public Gallery1 (string name, string url) : base (name)
{
- this.uri = new Uri (FixUrl (url, script_name));
+ uri = new Uri (FixUrl (url, script_name));
version = GalleryVersion.Version1;
}
@@ -769,10 +741,10 @@ namespace FSpot.Exporters.Gallery {
client.Add ("uname", username);
client.Add ("password", passwd);
- ParseLogin (client.Submit (uri));
+ ParseLogin (client.Submit (Uri));
}
- public override ArrayList FetchAlbums ()
+ public override List<Album> FetchAlbums ()
{
FormClient client = new FormClient (cookies);
@@ -847,7 +819,7 @@ namespace FSpot.Exporters.Gallery {
return ParseNewAlbum (client.Submit (uri));
}
- public override ArrayList FetchAlbumImages (Album album, bool include_ablums)
+ public override List<Image> FetchAlbumImages (Album album, bool include_ablums)
{
FormClient client = new FormClient (cookies);
client.Add ("cmd", "fetch-album-images");
@@ -859,18 +831,18 @@ namespace FSpot.Exporters.Gallery {
return album.Images;
}
- public override ArrayList FetchAlbumsPrune ()
+ public override List<Album> FetchAlbumsPrune ()
{
FormClient client = new FormClient (cookies);
client.Add ("cmd", "fetch-albums-prune");
client.Add ("protocol_version", "2.3");
client.Add ("check_writable", "no");
- ArrayList a = ParseFetchAlbums (client.Submit (uri));
+ List<Album> a = ParseFetchAlbums (client.Submit (uri));
a.Sort();
return a;
}
- public ArrayList ParseFetchAlbumImages (HttpWebResponse response, Album album)
+ public List<Image> ParseFetchAlbumImages (HttpWebResponse response, Album album)
{
string [] data;
StreamReader reader = null;
@@ -994,7 +966,7 @@ namespace FSpot.Exporters.Gallery {
ParseLogin (client.Submit (uri));
}
- public override ArrayList FetchAlbums ()
+ public override List<Album> FetchAlbums ()
{
//FetchAlbums doesn't exist for G2, we have to use FetchAlbumsPrune()
return FetchAlbumsPrune ();
@@ -1068,7 +1040,7 @@ namespace FSpot.Exporters.Gallery {
return ParseNewAlbum (client.Submit (uri));
}
- public override ArrayList FetchAlbumImages (Album album, bool include_ablums)
+ public override List<Image> FetchAlbumImages (Album album, bool include_ablums)
{
FormClient client = new FormClient (cookies);
client.Add ("g2_form[cmd]", "fetch-album-images");
@@ -1081,7 +1053,7 @@ namespace FSpot.Exporters.Gallery {
return album.Images;
}
- public override ArrayList FetchAlbumsPrune ()
+ public override List<Album> FetchAlbumsPrune ()
{
FormClient client = new FormClient (cookies);
client.Add ("g2_form[cmd]", "fetch-albums-prune");
@@ -1089,7 +1061,7 @@ namespace FSpot.Exporters.Gallery {
client.Add ("g2_form[check_writable]", "no");
AddG2Specific (client);
- ArrayList a = ParseFetchAlbums (client.Submit (uri));
+ List<Album> a = ParseFetchAlbums (client.Submit (uri));
a.Sort();
return a;
}
@@ -1101,7 +1073,7 @@ namespace FSpot.Exporters.Gallery {
client.Add("g2_controller", "remote.GalleryRemote");
}
- public ArrayList ParseFetchAlbumImages (HttpWebResponse response, Album album)
+ public List<Image> ParseFetchAlbumImages (HttpWebResponse response, Album album)
{
string [] data;
StreamReader reader = null;
diff --git a/src/Extensions/Exporters/FSpot.Exporters.PicasaWeb/FSpot.Exporters.PicasaWeb/GoogleAccountManager.cs b/src/Extensions/Exporters/FSpot.Exporters.PicasaWeb/FSpot.Exporters.PicasaWeb/GoogleAccountManager.cs
index 4b445f0..5389e59 100644
--- a/src/Extensions/Exporters/FSpot.Exporters.PicasaWeb/FSpot.Exporters.PicasaWeb/GoogleAccountManager.cs
+++ b/src/Extensions/Exporters/FSpot.Exporters.PicasaWeb/FSpot.Exporters.PicasaWeb/GoogleAccountManager.cs
@@ -3,6 +3,7 @@
//
// Author:
// Paul Lange <palango gmx de>
+// Stephen Shaw <sshaw decriptor com>
//
// Copyright (C) 2010 Novell, Inc.
// Copyright (C) 2010 Paul Lange
@@ -28,24 +29,10 @@
//
using System;
-using System.Net;
-using System.IO;
-using System.Text;
using System.Collections;
-using System.Collections.Specialized;
-using System.Web;
-using Mono.Unix;
+using System.Collections.Generic;
using Hyena;
-using Hyena.Widgets;
-using FSpot;
-using FSpot.Core;
-using FSpot.Filters;
-using FSpot.Widgets;
-using FSpot.Imaging;
-using FSpot.UI.Dialog;
using Gnome.Keyring;
-using Mono.Google;
-using Mono.Google.Picasa;
namespace FSpot.Exporters.PicasaWeb
{
@@ -53,7 +40,7 @@ namespace FSpot.Exporters.PicasaWeb
{
private static GoogleAccountManager instance;
private const string keyring_item_name = "Google Account";
- ArrayList accounts;
+ List<GoogleAccount> accounts;
public delegate void AccountListChangedHandler (GoogleAccountManager manager, GoogleAccount changed_account);
public event AccountListChangedHandler AccountListChanged;
@@ -69,7 +56,7 @@ namespace FSpot.Exporters.PicasaWeb
private GoogleAccountManager ()
{
- accounts = new ArrayList ();
+ accounts = new List<GoogleAccount> ();
ReadAccounts ();
}
@@ -87,7 +74,7 @@ namespace FSpot.Exporters.PicasaWeb
AccountListChanged (this, changed_account);
}
- public ArrayList GetAccounts ()
+ public List<GoogleAccount> GetAccounts ()
{
return accounts;
}
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 1ddefcf..f40d17d 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
@@ -3,6 +3,7 @@
//
// Author:
// Stephane Delcroix <stephane delcroix org>
+// Stephen Shaw <sshaw decriptor com>
//
// Copyright (C) 2006-2009 Novell, Inc.
// Copyright (C) 2006-2009 Stephane Delcroix
@@ -35,49 +36,46 @@
*
* Copyright (C) 2006 Stephane Delcroix
*/
-
using System;
-using System.Net;
using System.IO;
using System.Text;
using System.Collections;
-using System.Collections.Specialized;
-using System.Web;
+using System.Collections.Generic;
using Mono.Unix;
using Hyena;
-using Hyena.Widgets;
using FSpot;
using FSpot.Core;
using FSpot.Filters;
using FSpot.Widgets;
-using FSpot.Imaging;
using FSpot.UI.Dialog;
-using Gnome.Keyring;
-
using Mono.Google;
using Mono.Google.Picasa;
-namespace FSpot.Exporters.PicasaWeb {
- public class GoogleExport : FSpot.Extensions.IExporter {
- public GoogleExport () {}
+namespace FSpot.Exporters.PicasaWeb
+{
+ public class GoogleExport : FSpot.Extensions.IExporter
+ {
+ public GoogleExport ()
+ {
+ }
public void Run (IBrowsableCollection selection)
{
builder = new GtkBeans.Builder (null, "google_export_dialog.ui", null);
builder.Autoconnect (this);
- gallery_optionmenu = Gtk.ComboBox.NewText();
- album_optionmenu = Gtk.ComboBox.NewText();
+ gallery_optionmenu = Gtk.ComboBox.NewText ();
+ album_optionmenu = Gtk.ComboBox.NewText ();
- (edit_button.Parent as Gtk.HBox).PackStart (gallery_optionmenu);
- (album_button.Parent as Gtk.HBox).PackStart (album_optionmenu);
- (edit_button.Parent as Gtk.HBox).ReorderChild (gallery_optionmenu, 1);
- (album_button.Parent as Gtk.HBox).ReorderChild (album_optionmenu, 1);
-
- gallery_optionmenu.Show ();
- album_optionmenu.Show ();
+ (edit_button.Parent as Gtk.HBox).PackStart (gallery_optionmenu);
+ (album_button.Parent as Gtk.HBox).PackStart (album_optionmenu);
+ (edit_button.Parent as Gtk.HBox).ReorderChild (gallery_optionmenu, 1);
+ (album_button.Parent as Gtk.HBox).ReorderChild (album_optionmenu, 1);
+
+ gallery_optionmenu.Show ();
+ album_optionmenu.Show ();
this.items = selection.Items;
album_button.Sensitive = false;
@@ -116,22 +114,17 @@ namespace FSpot.Exporters.PicasaWeb {
private bool browser;
private bool export_tag;
private bool connect = false;
-
private long approx_size = 0;
private long sent_bytes = 0;
-
- IPhoto [] items;
+ IPhoto[] items;
int photo_index;
ThreadProgressDialog progress_dialog;
-
- ArrayList accounts;
+ List<GoogleAccount> accounts;
private GoogleAccount account;
private PicasaAlbum album;
private PicasaAlbumCollection albums = null;
-
private GtkBeans.Builder builder;
private string dialog_name = "google_export_dialog";
-
public const string EXPORT_SERVICE = "picasaweb/";
public const string SCALE_KEY = Preferences.APP_FSPOT_EXPORT + EXPORT_SERVICE + "scale";
public const string SIZE_KEY = Preferences.APP_FSPOT_EXPORT + EXPORT_SERVICE + "size";
@@ -139,26 +132,30 @@ namespace FSpot.Exporters.PicasaWeb {
public const string TAG_KEY = Preferences.APP_FSPOT_EXPORT + EXPORT_SERVICE + "tag";
// widgets
- [GtkBeans.Builder.Object] Gtk.Dialog dialog;
+ [GtkBeans.Builder.Object]
+ Gtk.Dialog dialog;
Gtk.ComboBox gallery_optionmenu;
Gtk.ComboBox album_optionmenu;
-
- [GtkBeans.Builder.Object] Gtk.Label status_label;
- [GtkBeans.Builder.Object] Gtk.Label album_status_label;
-
- [GtkBeans.Builder.Object] Gtk.CheckButton browser_check;
- [GtkBeans.Builder.Object] Gtk.CheckButton scale_check;
- [GtkBeans.Builder.Object] Gtk.CheckButton tag_check;
-
- [GtkBeans.Builder.Object] Gtk.SpinButton size_spin;
-
- [GtkBeans.Builder.Object] Gtk.Button album_button;
- [GtkBeans.Builder.Object] Gtk.Button edit_button;
-
- [GtkBeans.Builder.Object] Gtk.Button export_button;
-
- [GtkBeans.Builder.Object] Gtk.ScrolledWindow thumb_scrolledwindow;
-
+ [GtkBeans.Builder.Object]
+ Gtk.Label status_label;
+ [GtkBeans.Builder.Object]
+ Gtk.Label album_status_label;
+ [GtkBeans.Builder.Object]
+ Gtk.CheckButton browser_check;
+ [GtkBeans.Builder.Object]
+ Gtk.CheckButton scale_check;
+ [GtkBeans.Builder.Object]
+ Gtk.CheckButton tag_check;
+ [GtkBeans.Builder.Object]
+ Gtk.SpinButton size_spin;
+ [GtkBeans.Builder.Object]
+ Gtk.Button album_button;
+ [GtkBeans.Builder.Object]
+ Gtk.Button edit_button;
+ [GtkBeans.Builder.Object]
+ Gtk.Button export_button;
+ [GtkBeans.Builder.Object]
+ Gtk.ScrolledWindow thumb_scrolledwindow;
System.Threading.Thread command_thread;
private void HandleResponse (object sender, Gtk.ResponseArgs args)
@@ -178,7 +175,7 @@ namespace FSpot.Exporters.PicasaWeb {
export_tag = tag_check.Active;
if (account != null) {
- album = (PicasaAlbum) account.Picasa.GetAlbums() [Math.Max (0, album_optionmenu.Active)];
+ album = (PicasaAlbum)account.Picasa.GetAlbums () [Math.Max (0, album_optionmenu.Active)];
photo_index = 0;
Dialog.Destroy ();
@@ -203,13 +200,13 @@ namespace FSpot.Exporters.PicasaWeb {
size_spin.Sensitive = scale_check.Active;
}
- private void HandleUploadProgress(object o, UploadProgressEventArgs args)
+ private void HandleUploadProgress (object o, UploadProgressEventArgs args)
{
- if (approx_size == 0)
- progress_dialog.ProgressText = System.String.Format (Catalog.GetString ("{0} Sent"), GLib.Format.SizeForDisplay (args.BytesSent));
- else
- progress_dialog.ProgressText = System.String.Format (Catalog.GetString ("{0} of approx. {1}"), GLib.Format.SizeForDisplay (sent_bytes + args.BytesSent), GLib.Format.SizeForDisplay (approx_size));
- progress_dialog.Fraction = ((photo_index - 1) / (double) items.Length) + (args.BytesSent / (args.BytesTotal * (double) items.Length));
+ if (approx_size == 0)
+ progress_dialog.ProgressText = System.String.Format (Catalog.GetString ("{0} Sent"), GLib.Format.SizeForDisplay (args.BytesSent));
+ else
+ progress_dialog.ProgressText = System.String.Format (Catalog.GetString ("{0} of approx. {1}"), GLib.Format.SizeForDisplay (sent_bytes + args.BytesSent), GLib.Format.SizeForDisplay (approx_size));
+ progress_dialog.Fraction = ((photo_index - 1) / (double)items.Length) + (args.BytesSent / (args.BytesTotal * (double)items.Length));
}
private class DateComparer : IComparer
@@ -238,13 +235,13 @@ namespace FSpot.Exporters.PicasaWeb {
while (photo_index < items.Length) {
try {
- IPhoto item = items[photo_index];
+ IPhoto item = items [photo_index];
FileInfo file_info;
Log.Debug ("Picasa uploading " + photo_index);
progress_dialog.Message = String.Format (Catalog.GetString ("Uploading picture \"{0}\" ({1} of {2})"),
- item.Name, photo_index+1, items.Length);
+ item.Name, photo_index + 1, items.Length);
photo_index++;
PicasaPicture picture;
@@ -268,8 +265,9 @@ namespace FSpot.Exporters.PicasaWeb {
//tagging
if (item.Tags != null && export_tag)
- foreach (Tag tag in item.Tags)
+ foreach (Tag tag in item.Tags) {
picture.AddTag (tag.Name);
+ }
} catch (System.Threading.ThreadAbortException te) {
Log.Exception (te);
System.Threading.Thread.ResetAbort ();
@@ -292,9 +290,8 @@ namespace FSpot.Exporters.PicasaWeb {
progress_dialog.ProgressText = Catalog.GetString ("Upload Complete");
progress_dialog.ButtonLabel = Gtk.Stock.Ok;
- if (browser) {
+ if (browser)
GtkBeans.Global.ShowUri (Dialog.Screen, album.Link);
- }
}
private void PopulateGoogleOptionMenu (GoogleAccountManager manager, GoogleAccount changed_account)
@@ -305,34 +302,34 @@ namespace FSpot.Exporters.PicasaWeb {
accounts = manager.GetAccounts ();
if (accounts == null || accounts.Count == 0) {
- if (accounts==null)
- Log.Debug("accounts == null");
- else
- Log.Debug("accounts != null");
+ if (accounts == null)
+ Log.Debug ("accounts == null");
+ else
+ Log.Debug ("accounts != null");
- Log.DebugFormat("accounts.Count = {0}", accounts.Count);
+ Log.DebugFormat ("accounts.Count = {0}", accounts.Count);
- gallery_optionmenu.AppendText (Catalog.GetString ("(No Gallery)"));
+ gallery_optionmenu.AppendText (Catalog.GetString ("(No Gallery)"));
gallery_optionmenu.Sensitive = false;
edit_button.Sensitive = false;
- pos = 0;
+ pos = 0;
} else {
int i = 0;
- pos = 0;
+ pos = 0;
foreach (GoogleAccount account in accounts) {
if (account == changed_account)
pos = i;
- gallery_optionmenu.AppendText (account.Username);
+ gallery_optionmenu.AppendText (account.Username);
i++;
}
gallery_optionmenu.Sensitive = true;
edit_button.Sensitive = true;
}
- Log.DebugFormat("Setting gallery_optionmenu.Active = {0}", pos);
- gallery_optionmenu.Active = pos;
+ Log.DebugFormat ("Setting gallery_optionmenu.Active = {0}", pos);
+ gallery_optionmenu.Active = pos;
}
private void Connect ()
@@ -350,7 +347,7 @@ namespace FSpot.Exporters.PicasaWeb {
try {
if (accounts.Count != 0 && connect) {
if (selected == null)
- account = (GoogleAccount) accounts [gallery_optionmenu.Active];
+ account = (GoogleAccount)accounts [gallery_optionmenu.Active];
else
account = selected;
@@ -362,18 +359,18 @@ namespace FSpot.Exporters.PicasaWeb {
long qu = account.Picasa.QuotaUsed;
long ql = account.Picasa.QuotaLimit;
- StringBuilder sb = new StringBuilder("<small>");
- sb.Append(String.Format (Catalog.GetString ("Available space: {0}, {1}% used out of {2}"),
- GLib.Format.SizeForDisplay(ql - qu),
+ StringBuilder sb = new StringBuilder ("<small>");
+ sb.Append (String.Format (Catalog.GetString ("Available space: {0}, {1}% used out of {2}"),
+ GLib.Format.SizeForDisplay (ql - qu),
(100 * qu / ql),
GLib.Format.SizeForDisplay (ql)));
- sb.Append("</small>");
- status_label.Text = sb.ToString();
+ sb.Append ("</small>");
+ status_label.Text = sb.ToString ();
status_label.UseMarkup = true;
album_button.Sensitive = true;
}
- } catch (CaptchaException exc){
+ } catch (CaptchaException exc) {
Log.Debug ("Your Google account is locked");
if (selected != null)
account = selected;
@@ -404,22 +401,22 @@ namespace FSpot.Exporters.PicasaWeb {
Connect ();
}
- public void HandleAlbumAdded (string title) {
- GoogleAccount account = (GoogleAccount) accounts [gallery_optionmenu.Active];
+ public void HandleAlbumAdded (string title)
+ {
+ GoogleAccount account = (GoogleAccount)accounts [gallery_optionmenu.Active];
PopulateAlbumOptionMenu (account.Picasa);
// make the newly created album selected
// PicasaAlbumCollection albums = account.Picasa.GetAlbums();
for (int i=0; i < albums.Count; i++) {
- if (((PicasaAlbum)albums[i]).Title == title) {
+ if (((PicasaAlbum)albums [i]).Title == title)
album_optionmenu.Active = i;
- }
}
}
private void PopulateAlbumOptionMenu (Mono.Google.Picasa.PicasaWeb picasa)
{
- if (picasa != null) {
+ if (picasa != null)
try {
albums = picasa.GetAlbums();
} catch {
@@ -427,7 +424,6 @@ namespace FSpot.Exporters.PicasaWeb {
albums = null;
picasa = null;
}
- }
bool disconnected = picasa == null || !account.Connected || albums == null;
@@ -435,7 +431,7 @@ namespace FSpot.Exporters.PicasaWeb {
string msg = disconnected ? Catalog.GetString ("(Not Connected)")
: Catalog.GetString ("(No Albums)");
- album_optionmenu.AppendText(msg);
+ album_optionmenu.AppendText (msg);
export_button.Sensitive = false;
album_optionmenu.Sensitive = false;
@@ -450,7 +446,7 @@ namespace FSpot.Exporters.PicasaWeb {
label_builder.Append (album.Title);
label_builder.Append (" (" + album.PicturesCount + ")");
- album_optionmenu.AppendText(label_builder.ToString());
+ album_optionmenu.AppendText (label_builder.ToString ());
}
export_button.Sensitive = items.Length > 0;
@@ -467,16 +463,15 @@ namespace FSpot.Exporters.PicasaWeb {
PicasaAlbum a = albums [album_optionmenu.Active];
export_button.Sensitive = a.PicturesRemaining >= items.Length;
if (album_status_label.Visible = !export_button.Sensitive) {
- StringBuilder sb = new StringBuilder("<small>");
- sb.Append(String.Format (Catalog.GetString ("The selected album has a limit of {0} pictures,\n" +
+ StringBuilder sb = new StringBuilder ("<small>");
+ sb.Append (String.Format (Catalog.GetString ("The selected album has a limit of {0} pictures,\n" +
"which would be passed with the current selection of {1} images"),
a.PicturesCount + a.PicturesRemaining, items.Length));
- sb.Append("</small>");
- album_status_label.Text = String.Format (sb.ToString());
+ sb.Append ("</small>");
+ album_status_label.Text = String.Format (sb.ToString ());
album_status_label.UseMarkup = true;
- } else {
+ } else
album_status_label.Text = String.Empty;
- }
}
public void HandleAddGallery (object sender, System.EventArgs args)
@@ -501,13 +496,12 @@ namespace FSpot.Exporters.PicasaWeb {
{
switch (key) {
case SCALE_KEY:
- if (scale_check.Active != Preferences.Get<bool> (key)) {
+ if (scale_check.Active != Preferences.Get<bool> (key))
scale_check.Active = Preferences.Get<bool> (key);
- }
break;
case SIZE_KEY:
- size_spin.Value = (double) Preferences.Get<int> (key);
+ size_spin.Value = (double)Preferences.Get<int> (key);
break;
case BROWSER_KEY:
diff --git a/src/Extensions/Exporters/FSpot.Exporters.SmugMug/FSpot.Exporters.SmugMug/SmugMugAccountManager.cs b/src/Extensions/Exporters/FSpot.Exporters.SmugMug/FSpot.Exporters.SmugMug/SmugMugAccountManager.cs
index 0397cbb..bd1032c 100644
--- a/src/Extensions/Exporters/FSpot.Exporters.SmugMug/FSpot.Exporters.SmugMug/SmugMugAccountManager.cs
+++ b/src/Extensions/Exporters/FSpot.Exporters.SmugMug/FSpot.Exporters.SmugMug/SmugMugAccountManager.cs
@@ -3,6 +3,7 @@
//
// Author:
// Paul Lange <palango gmx de>
+// Stephen Shaw <sshaw decriptor com>
//
// Copyright (C) 2010 Novell, Inc.
// Copyright (C) 2010 Paul Lange
@@ -33,8 +34,10 @@ using System.IO;
using System.Text;
using System.Threading;
using System.Collections;
+using System.Collections.Generic;
using System.Collections.Specialized;
using System.Web;
+
using Mono.Unix;
using Gtk;
using FSpot;
@@ -52,7 +55,7 @@ namespace FSpot.Exporters.SmugMug
{
private static SmugMugAccountManager instance;
private const string keyring_item_name = "SmugMug Account";
- ArrayList accounts;
+ List<SmugMugAccount> accounts;
public delegate void AccountListChangedHandler (SmugMugAccountManager manager, SmugMugAccount changed_account);
public event AccountListChangedHandler AccountListChanged;
@@ -68,7 +71,7 @@ namespace FSpot.Exporters.SmugMug
private SmugMugAccountManager ()
{
- accounts = new ArrayList ();
+ accounts = new List<SmugMugAccount> ();
ReadAccounts ();
}
@@ -86,7 +89,7 @@ namespace FSpot.Exporters.SmugMug
AccountListChanged (this, changed_account);
}
- public ArrayList GetAccounts ()
+ public List<SmugMugAccount> GetAccounts ()
{
return accounts;
}
diff --git a/src/Extensions/Exporters/FSpot.Exporters.SmugMug/FSpot.Exporters.SmugMug/SmugMugExport.cs b/src/Extensions/Exporters/FSpot.Exporters.SmugMug/FSpot.Exporters.SmugMug/SmugMugExport.cs
index eb95c90..f2417e5 100644
--- a/src/Extensions/Exporters/FSpot.Exporters.SmugMug/FSpot.Exporters.SmugMug/SmugMugExport.cs
+++ b/src/Extensions/Exporters/FSpot.Exporters.SmugMug/FSpot.Exporters.SmugMug/SmugMugExport.cs
@@ -3,6 +3,7 @@
//
// Author:
// Stephane Delcroix <stephane delcroix org>
+// Stephen Shaw <sshaw decriptor com>
//
// Copyright (C) 2006-2009 Novell, Inc.
// Copyright (C) 2006-2009 Stephane Delcroix
@@ -39,13 +40,10 @@
*/
using System;
-using System.Net;
using System.IO;
using System.Text;
using System.Threading;
-using System.Collections;
-using System.Collections.Specialized;
-using System.Web;
+using System.Collections.Generic;
using Mono.Unix;
using Gtk;
@@ -56,7 +54,6 @@ using FSpot.Widgets;
using Hyena;
using FSpot.UI.Dialog;
-using Gnome.Keyring;
using SmugMugNet;
namespace FSpot.Exporters.SmugMug {
@@ -121,7 +118,7 @@ namespace FSpot.Exporters.SmugMug {
int photo_index;
ThreadProgressDialog progress_dialog;
- ArrayList accounts;
+ List<SmugMugAccount> accounts;
private SmugMugAccount account;
private Album album;
diff --git a/src/Extensions/Tools/FSpot.Tools.ChangePhotoPath/FSpot.Tools.ChangePhotoPath/ChangePhotoPathController.cs b/src/Extensions/Tools/FSpot.Tools.ChangePhotoPath/FSpot.Tools.ChangePhotoPath/ChangePhotoPathController.cs
index 5581a65..3e62978 100644
--- a/src/Extensions/Tools/FSpot.Tools.ChangePhotoPath/FSpot.Tools.ChangePhotoPath/ChangePhotoPathController.cs
+++ b/src/Extensions/Tools/FSpot.Tools.ChangePhotoPath/FSpot.Tools.ChangePhotoPath/ChangePhotoPathController.cs
@@ -43,6 +43,7 @@ using FSpot.Query;
using System;
using System.IO;
using System.Collections;
+using System.Collections.Generic;
using System.Collections.Specialized;
using Hyena;
@@ -71,7 +72,8 @@ namespace FSpot.Tools.ChangePhotoPath
public class ChangePathController
{
PhotoStore photo_store = FSpot.App.Instance.Database.Photos;
- ArrayList photo_id_array, version_id_array;
+ List<uint> photo_id_array;
+ List<uint> version_id_array;
StringCollection old_path_array, new_path_array;
int total_photos;
string orig_base_path;
@@ -145,8 +147,8 @@ namespace FSpot.Tools.ChangePhotoPath
private void InitializeArrays()
{
- photo_id_array = new ArrayList();
- version_id_array = new ArrayList();
+ photo_id_array = new List<uint> ();
+ version_id_array = new List<uint> ();
old_path_array = new StringCollection();
new_path_array = new StringCollection();
}
@@ -199,7 +201,7 @@ namespace FSpot.Tools.ChangePhotoPath
return true;
}
- public bool StillOnSamePhotoId (int old_index, int current_index, ArrayList array)
+ public bool StillOnSamePhotoId (int old_index, int current_index, List<uint> array)
{
try {
return (array[old_index] == array[current_index]);
@@ -211,7 +213,7 @@ namespace FSpot.Tools.ChangePhotoPath
public void UpdateThisUri (int index, string path, ref Photo photo)
{
if (photo == null)
- photo = photo_store.Get ( (uint) photo_id_array[index]) as Photo;
+ photo = photo_store.Get (photo_id_array[index]);
PhotoVersion version = photo.GetVersion ( (uint) version_id_array[index]) as PhotoVersion;
version.BaseUri = new SafeUri ( path ).GetBaseUri ();
version.Filename = new SafeUri ( path ).GetFilename ();
@@ -219,7 +221,7 @@ namespace FSpot.Tools.ChangePhotoPath
photo.Changes.ChangeVersion ( (uint) version_id_array[index] );
}
-/// FIXME Refactor, try to use one common method....
+ // FIXME: Refactor, try to use one common method....
public void RevertAllUris (int last_index)
{
gui_controller.remove_progress_dialog();
diff --git a/src/Extensions/Tools/FSpot.Tools.MetaPixel/MetaPixel.cs b/src/Extensions/Tools/FSpot.Tools.MetaPixel/MetaPixel.cs
index 4f33a87..b4bd812 100644
--- a/src/Extensions/Tools/FSpot.Tools.MetaPixel/MetaPixel.cs
+++ b/src/Extensions/Tools/FSpot.Tools.MetaPixel/MetaPixel.cs
@@ -2,7 +2,8 @@
// MetaPixel.cs
//
// Author:
-// Stephane Delcroix <sdelcroix*novell.com>
+// Stephane Delcroix <sdelcroix novell com>
+// Stephen Shaw <sshaw decriptor com>
//
// Copyright (C) 2008 Novell, Inc.
// Copyright (C) 2008 Stephane Delcroix
@@ -30,6 +31,7 @@
using System;
using System.IO;
using System.Collections;
+using System.Collections.Generic;
using Gtk;
using FSpot;
@@ -117,13 +119,13 @@ namespace MetaPixelExtension {
if (tags_radio.Active) {
//Build tag array
- ArrayList taglist = new ArrayList ();
+ List<Tag> taglist = new List<Tag> ();
foreach (string tag_name in miniatures_tags.GetTypedTagNames ()) {
Tag t = db.Tags.GetTagByName (tag_name);
if (t != null)
taglist.Add(t);
}
- mini_query.Terms = FSpot.OrTerm.FromTags ((Tag []) taglist.ToArray (typeof (Tag)));
+ mini_query.Terms = FSpot.OrTerm.FromTags (taglist.ToArray ());
photos = mini_query.Photos;
} else {
photos = App.Instance.Organizer.Query.Photos;
diff --git a/src/Extensions/Tools/FSpot.Tools.PictureTile/PictureTile.cs b/src/Extensions/Tools/FSpot.Tools.PictureTile/PictureTile.cs
index 357bafb..dbf1230 100644
--- a/src/Extensions/Tools/FSpot.Tools.PictureTile/PictureTile.cs
+++ b/src/Extensions/Tools/FSpot.Tools.PictureTile/PictureTile.cs
@@ -2,7 +2,8 @@
// PictureTile.cs
//
// Author:
-// Stephane Delcroix <sdelcroix*novell.com>
+// Stephane Delcroix <sdelcroix novell com>
+// Stephen Shaw <sshaw decriptor com>
//
// Copyright (C) 2008 Novell, Inc.
// Copyright (C) 2008 Stephane Delcroix
@@ -31,6 +32,7 @@ using System;
using System.IO;
using System.Collections;
using System.Globalization;
+using System.Collections.Generic;
using Gtk;
using FSpot;
@@ -130,7 +132,7 @@ namespace PictureTileExtension {
FilterSet filters = new FilterSet ();
filters.Add (new JpegFilter ());
uint counter = 0;
- ArrayList all_tags = new ArrayList ();
+ List<Tag> all_tags = new List<Tag> ();
foreach (Photo p in App.Instance.Organizer.SelectedPhotos ()) {
if (progress_dialog.Update (String.Format (Catalog.GetString ("Processing \"{0}\""), p.Name))) {
progress_dialog.Destroy ();
@@ -158,7 +160,7 @@ namespace PictureTileExtension {
if (progress_dialog != null)
progress_dialog.Destroy ();
- photo_tags = (Tag []) all_tags.ToArray (typeof (Tag));
+ photo_tags = all_tags.ToArray ();
string uniform = "";
if (uniform_images.Active)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]