diff options
| author | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2014-09-13 20:37:57 +0200 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2014-09-13 20:37:57 +0200 |
| commit | dc32c58499caa8b1ec4e975afad75ca0d862e990 (patch) | |
| tree | 91322afabcb457406ab512d20163f0dd73ce2c5a /src/items.h | |
| parent | 302127b03d44277c829642468561ac9e518b7a21 (diff) | |
| download | cataract-dc32c58499caa8b1ec4e975afad75ca0d862e990.tar.xz | |
Introduce properties table
This is a new internal properties storage for attributes that can be
defined both in the item and album scope, with the item scope taking
priority.
The big advantage is a better distinguishment from an undefined, default
value. It also makes easier to retrieve attributes with properly defined
scope priorities.
Diffstat (limited to 'src/items.h')
| -rw-r--r-- | src/items.h | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/src/items.h b/src/items.h index 792b7f0..46b4c38 100644 --- a/src/items.h +++ b/src/items.h @@ -19,6 +19,7 @@ #define __CGG__ITEMS_H__ #include <glib.h> +#include "properties-table.h" G_BEGIN_DECLS @@ -57,12 +58,6 @@ typedef struct { GPtrArray *items; void *parent_index; /* pointer to the parent TAlbum structure */ int parent_item_index; /* item index in the parent album */ - int quality; - unsigned long landscape_width; - unsigned long landscape_height; - unsigned long portrait_width; - unsigned long portrait_height; - gchar *border_style; gchar *meta_author; gchar *meta_description; gchar *meta_keywords; @@ -73,33 +68,21 @@ typedef struct { gchar *auth_username; gchar *auth_passwd; TAuthType auth_type; - int metadata_tz_shift; /* minutes */ - time_t metadata_override_datetime; - double metadata_override_aperture; - double metadata_override_focal_length; - TCropHint thumbnail_crop_hint; + PropertiesTable *properties; } TAlbum; typedef struct { + TIndexItemType type; gchar *path; gchar *title; gchar *title_description; gchar *thumbnail; gchar *preview; - int quality; - unsigned long width; - unsigned long height; gboolean force_nofullsize; gboolean force_fullsize; - gchar *border_style; - TIndexItemType type; gboolean hidden; gchar *metadata_external_exif; - int metadata_tz_shift; /* minutes */ - time_t metadata_override_datetime; - double metadata_override_aperture; - double metadata_override_focal_length; - TCropHint thumbnail_crop_hint; + PropertiesTable *properties; } TIndexItem; typedef struct { @@ -111,6 +94,21 @@ typedef struct { gchar *album_path; /* current path in the gallery hierarchy, starting with '/' */ } TPathInfo; +typedef enum { + PROP_QUALITY, + PROP_WIDTH, + PROP_HEIGHT, + PROP_LANDSCAPE_W, + PROP_LANDSCAPE_H, + PROP_PORTRAIT_W, + PROP_PORTRAIT_H, + PROP_BORDER_STYLE, + PROP_THUMB_CROP_HINT, + PROP_METADATA_TZ_SHIFT, /* minutes */ + PROP_METADATA_OVERRIDE_DATETIME, + PROP_METADATA_OVERRIDE_APERTURE, + PROP_METADATA_OVERRIDE_FOCAL_LENGTH, +} PropertyName; /* * GET_ITEM_TARGET_FILENAME: get target item filename @@ -157,6 +155,16 @@ TIndexItem *dup_index_item (TIndexItem *item); */ void free_index_item (TIndexItem *item); + +/* + * get_prop_*: retrieve attribute value from properties tables, with item taking priority, using items otherwise or falling back to default if not set anywhere + */ +gchar * get_prop_string (TAlbum *items, TIndexItem *item, PropertyName name, const gchar *_default); +long int get_prop_int (TAlbum *items, TIndexItem *item, PropertyName name, const long int _default); +gboolean get_prop_bool (TAlbum *items, TIndexItem *item, PropertyName name, const gboolean _default); +double get_prop_double (TAlbum *items, TIndexItem *item, PropertyName name, const double _default); + + G_END_DECLS #endif /* __CGG__ITEMS_H__ */ |
