summaryrefslogtreecommitdiff
path: root/src/items.h
blob: ffad0861768fd256e727013b42fbbafad9d0c0d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*   Cataract - Static web photo gallery generator
 *   Copyright (C) 2008 Tomas Bzatek <tbzatek@users.sourceforge.net>
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License
 *   as published by the Free Software Foundation; either version 2
 *   of the License, or any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
#ifndef __ITEMS_H__
#define __ITEMS_H__


#include <glib.h>


typedef enum {
  GALLERY_TYPE_INDEX = 1 << 0,
  GALLERY_TYPE_ALBUM = 1 << 1
} TGalleryType;

typedef enum {
  INDEX_ITEM_TYPE_PICTURE = 1 << 0,
  INDEX_ITEM_TYPE_SEPARATOR = 1 << 1,
  INDEX_ITEM_TYPE_INTERSPACE = 1 << 2
} TIndexItemType;

typedef struct {
  TGalleryType type;
  gchar *ID;
  gchar *title;
  gchar *desc;
  gchar *footnote;
  GPtrArray *items;
  gchar *base_dir;
  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;
  gboolean nofullsize;
  gboolean fullsize;
  gchar **extra_files;
} TAlbum;

typedef struct {
  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;

  /*  generated item info  */
  /*  !! be careful with writes to this structure during thread work !!  */
  gboolean gen_portrait;   /*  thumbnail orientation, don't use for original image orientation  */
} TIndexItem;



/*
 *   parse_album_xml: XML parser for gallery index.xml files
 */
gboolean parse_album_xml (const gchar *filename, TAlbum *index);

/*
 *   free_album_data: free allocated album data
 */
void free_album_data (TAlbum *index);

/*
 *   get_album_objects_count: retrieve number of items in specified album
 */
int get_album_objects_count (const gchar *filename);

/*
 *   get_album_titles: retrieve title, description and first thumbnail from specified album
 */
void get_album_titles (const gchar *filename, gchar **title, gchar **description, gchar **thumbnail);

#endif /* __ITEMS_H__ */