[shotwell/shotwell-0.24] Fix side-casting issues in generics handling



commit 147b6c87a0a6be6fa0d0e7b93313a13679ba2614
Author: Jens Georg <mail jensge org>
Date:   Sat Sep 17 08:33:23 2016 +0200

    Fix side-casting issues in generics handling
    
    Signed-off-by: Jens Georg <mail jensge org>

 src/MediaDataRepresentation.vala        |    4 ++--
 src/MediaMonitor.vala                   |    4 ++--
 src/PhotoPage.vala                      |    2 +-
 src/Tag.vala                            |    2 +-
 src/core/ContainerSourceCollection.vala |   13 +++++++------
 src/core/ViewCollection.vala            |    3 ++-
 6 files changed, 15 insertions(+), 13 deletions(-)
---
diff --git a/src/MediaDataRepresentation.vala b/src/MediaDataRepresentation.vala
index f01f147..484404c 100644
--- a/src/MediaDataRepresentation.vala
+++ b/src/MediaDataRepresentation.vala
@@ -400,8 +400,8 @@ public abstract class MediaSourceCollection : DatabaseSourceCollection {
     
     public static void count_media(Gee.Collection<MediaSource> media, out int photo_count,
         out int video_count) {
-        Gee.ArrayList<MediaSource> photos = new Gee.ArrayList<MediaSource>();
-        Gee.ArrayList<MediaSource> videos = new Gee.ArrayList<MediaSource>();
+        var photos = new Gee.ArrayList<LibraryPhoto>();
+        var videos = new Gee.ArrayList<Video>();
         
         filter_media(media, photos, videos);
         
diff --git a/src/MediaMonitor.vala b/src/MediaMonitor.vala
index 3859b97..a36f689 100644
--- a/src/MediaMonitor.vala
+++ b/src/MediaMonitor.vala
@@ -286,8 +286,8 @@ public abstract class MediaMonitor : Object {
         TransactionController controller, ref int op_count) throws Error {
         Gee.Map<Monitorable, File> set_master_file = null;
         Gee.Map<Monitorable, FileInfo> set_master_file_info = null;
-        Gee.ArrayList<MediaSource> to_offline = null;
-        Gee.ArrayList<MediaSource> to_online = null;
+        Gee.ArrayList<Monitorable> to_offline = null;
+        Gee.ArrayList<Monitorable> to_online = null;
         
         foreach (MonitorableUpdates updates in all_updates) {
             if (op_count >= MAX_OPERATIONS_PER_CYCLE)
diff --git a/src/PhotoPage.vala b/src/PhotoPage.vala
index ce57c2f..0e14aab 100644
--- a/src/PhotoPage.vala
+++ b/src/PhotoPage.vala
@@ -3125,7 +3125,7 @@ public class LibraryPhotoPage : EditingHostPage {
     
     private void on_flag_unflag() {
         if (has_photo()) {
-            Gee.ArrayList<DataSource> photo_list = new Gee.ArrayList<DataSource>();
+            var photo_list = new Gee.ArrayList<MediaSource>();
             photo_list.add(get_photo());
             get_command_manager().execute(new FlagUnflagCommand(photo_list,
                 !((LibraryPhoto) get_photo()).is_flagged()));
diff --git a/src/Tag.vala b/src/Tag.vala
index 31b1e40..81d7d7d 100644
--- a/src/Tag.vala
+++ b/src/Tag.vala
@@ -205,7 +205,7 @@ public class TagSourceCollection : ContainerSourceCollection {
     }
     
     protected override void notify_container_contents_added(ContainerSource container, 
-        Gee.Collection<DataSource> added, bool relinking) {
+        Gee.Collection<DataObject> added, bool relinking) {
         Tag tag = (Tag) container;
         Gee.Collection<MediaSource> sources = (Gee.Collection<MediaSource>) added;
         
diff --git a/src/core/ContainerSourceCollection.vala b/src/core/ContainerSourceCollection.vala
index a5b0fbc..cf6218a 100644
--- a/src/core/ContainerSourceCollection.vala
+++ b/src/core/ContainerSourceCollection.vala
@@ -18,15 +18,16 @@ public abstract class ContainerSourceCollection : DatabaseSourceCollection {
     private Gee.HashSet<ContainerSource> holding_tank = new Gee.HashSet<ContainerSource>();
     
     public virtual signal void container_contents_added(ContainerSource container,
-        Gee.Collection<DataSource> added, bool relinked) {
+        Gee.Collection<DataObject> added, bool relinked) {
     }
     
     public virtual signal void container_contents_removed(ContainerSource container, 
-        Gee.Collection<DataSource> removed, bool unlinked) {
+        Gee.Collection<DataObject> removed, bool unlinked) {
     }
     
     public virtual signal void container_contents_altered(ContainerSource container, 
-        Gee.Collection<DataSource>? added, bool relinked, Gee.Collection<DataSource>? removed,
+        Gee.Collection<DataObject>? added, bool relinked,
+        Gee.Collection<DataObject>? removed,
         bool unlinked) {
     }
     
@@ -55,7 +56,7 @@ public abstract class ContainerSourceCollection : DatabaseSourceCollection {
     }
     
     public virtual void notify_container_contents_added(ContainerSource container, 
-        Gee.Collection<DataSource> added, bool relinked) {
+        Gee.Collection<DataObject> added, bool relinked) {
         // if container is in holding tank, remove it now and relink to collection
         if (holding_tank.contains(container)) {
             bool removed = holding_tank.remove(container);
@@ -68,12 +69,12 @@ public abstract class ContainerSourceCollection : DatabaseSourceCollection {
     }
     
     public virtual void notify_container_contents_removed(ContainerSource container, 
-        Gee.Collection<DataSource> removed, bool unlinked) {
+        Gee.Collection<DataObject> removed, bool unlinked) {
         container_contents_removed(container, removed, unlinked);
     }
     
     public virtual void notify_container_contents_altered(ContainerSource container,
-        Gee.Collection<DataSource>? added, bool relinked, Gee.Collection<DataSource>? removed,
+        Gee.Collection<DataObject>? added, bool relinked, Gee.Collection<DataSource>? removed,
         bool unlinked) {
         container_contents_altered(container, added, relinked, removed, unlinked);
     }
diff --git a/src/core/ViewCollection.vala b/src/core/ViewCollection.vala
index ce6fcaf..7e13fb0 100644
--- a/src/core/ViewCollection.vala
+++ b/src/core/ViewCollection.vala
@@ -646,7 +646,8 @@ public class ViewCollection : DataCollection {
     }
     
     public override void items_altered(Gee.Map<DataObject, Alteration> map) {
-        filter_altered_items(map.keys);
+        // Cast - our DataObjects are DataViews.
+        filter_altered_items((Gee.Collection<DataView>)map.keys);
 
         base.items_altered(map);
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]