diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/DataCollection.vala | 2 | ||||
-rw-r--r-- | src/core/DataSourceTypes.vala | 4 | ||||
-rw-r--r-- | src/core/SourceInterfaces.vala | 15 | ||||
-rw-r--r-- | src/core/util.vala | 11 |
4 files changed, 26 insertions, 6 deletions
diff --git a/src/core/DataCollection.vala b/src/core/DataCollection.vala index 83a216d..044f7b6 100644 --- a/src/core/DataCollection.vala +++ b/src/core/DataCollection.vala @@ -559,7 +559,7 @@ public class DataCollection { if (!properties.unset(name)) return; - // only notify if the propery was unset (that is, was set to begin with) + // only notify if the property was unset (that is, was set to begin with) notify_property_cleared(name); // notify all items diff --git a/src/core/DataSourceTypes.vala b/src/core/DataSourceTypes.vala index a79264f..1baf387 100644 --- a/src/core/DataSourceTypes.vala +++ b/src/core/DataSourceTypes.vala @@ -72,9 +72,9 @@ public abstract class EventSource : ThumbnailSource { base (object_id); } - public abstract time_t get_start_time(); + public abstract DateTime? get_start_time(); - public abstract time_t get_end_time(); + public abstract DateTime? get_end_time(); public abstract uint64 get_total_filesize(); diff --git a/src/core/SourceInterfaces.vala b/src/core/SourceInterfaces.vala index 91a8aca..6e0c149 100644 --- a/src/core/SourceInterfaces.vala +++ b/src/core/SourceInterfaces.vala @@ -42,3 +42,18 @@ public interface Indexable : DataSource { } } +// Positionable DataSources provide a globally locatable point in longitude and latitude degrees + +public struct GpsCoords { + public int has_gps; + public double latitude; + public double longitude; + public bool equals(ref GpsCoords gps) { + return (has_gps == 0 && gps.has_gps == 0) || (latitude == gps.latitude && longitude == gps.longitude); + } +} + +public interface Positionable : DataSource { + public abstract GpsCoords get_gps_coords(); + public abstract void set_gps_coords(GpsCoords gps_coords); +} diff --git a/src/core/util.vala b/src/core/util.vala index 9507895..461d2c0 100644 --- a/src/core/util.vala +++ b/src/core/util.vala @@ -190,7 +190,12 @@ public bool null_progress_monitor(uint64 count, uint64 total) { return true; } +public static int64 nullsafe_date_time_comperator(DateTime? time_a, DateTime? time_b) { + if (time_a == null && time_b == null) return 0; -double degrees_to_radians(double theta) { - return (theta * (GLib.Math.PI / 180.0)); -} + if (time_a == null && time_b != null) return -1; + if (time_a != null && time_b == null) return 1; + + return time_a.compare(time_b); + +}
\ No newline at end of file |