1
/* Copyright 2011 Yorba Foundation
3
* This software is licensed under the GNU Lesser General Public License
4
* (version 2.1 or later). See the COPYING file in this distribution.
7
namespace AlienDb.FSpot {
10
* The object that implements an F-Spot photo and provides access to all the
11
* elements necessary to read data from the photographic source.
13
public class FSpotDatabasePhoto : Object, AlienDatabasePhoto {
14
private FSpotPhotoRow photo_row;
15
private FSpotPhotoVersionRow? photo_version_row;
16
private FSpotRollRow? roll_row;
17
private Gee.Collection<AlienDatabaseTag> tags;
18
private AlienDatabaseEvent? event;
19
private Rating rating;
21
public FSpotDatabasePhoto(
22
FSpotPhotoRow photo_row,
23
FSpotPhotoVersionRow? photo_version_row,
24
FSpotRollRow? roll_row,
25
Gee.Collection<AlienDatabaseTag> tags,
26
AlienDatabaseEvent? event,
30
this.photo_row = photo_row;
31
this.photo_version_row = photo_version_row;
32
this.roll_row = roll_row;
35
if (photo_row.rating > 0)
36
this.rating = Rating.unserialize(photo_row.rating);
38
this.rating = Rating.REJECTED;
40
this.rating = Rating.FIVE;
42
this.rating = Rating.UNRATED;
45
public string get_folder_path() {
46
return (photo_version_row != null) ?
47
photo_version_row.base_path.get_path() :
48
photo_row.base_path.get_path();
51
public string get_filename() {
52
return (photo_version_row != null) ?
53
photo_version_row.filename :
57
public Gee.Collection<AlienDatabaseTag> get_tags() {
61
public AlienDatabaseEvent? get_event() {
65
public Rating get_rating() {
69
public string? get_title() {
70
return is_string_empty(photo_row.description) ? null : photo_row.description;
73
public ImportID? get_import_id() {
75
return ImportID((int64)roll_row.time);