summaryrefslogtreecommitdiff
path: root/src/setup.h
blob: 75cbef7b47aa828f6aca7712220b82f1584782da (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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/*   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 __CGG__SETUP_H__
#define __CGG__SETUP_H__

#include <glib.h>

G_BEGIN_DECLS


#define DEFAULT_INDEX_FILENAME "index.html"
#define THUMBNAIL_NAME_FORMAT "%.3d_%s"
#define TARGET_IMAGE_DIR_PREFIX "_"

#define SETUP_XML "setup.xml"


/*  forward declaration  */
typedef struct TGalleryDesign TGalleryDesign;

typedef enum {
  THUMBNAIL_SQUARE_TYPE_NONE,
  THUMBNAIL_SQUARE_TYPE_SIMPLE
} ThumbnailSquareType;


/*  Global gallery setup  */
typedef struct {
  gboolean verbose;
  gboolean update_mode;
  gboolean override_nofullsize;
  gchar *setup_xml_path;

  TGalleryDesign *design;

  /*  design section  */
  gchar *design_setup_file;
  gboolean supplemental_files_use_common_root;

  /*  images section  */
  gboolean preload;
  gboolean use_iptc_exif;
  gboolean erase_exif_thumbnail;
  gboolean nofullsize;
  ThumbnailSquareType squared_thumbnail_type;

  /*  meta section  */
  gchar *meta_author;
  gchar *meta_author_email;
  gchar *meta_description;
  gchar *meta_keywords;
  gboolean use_title_as_meta;
  gchar *site_title;
  gchar *add_copyright;
  gchar *favicon_file;
  gchar *favicon_type;

  /*  navigation section  */
  gboolean use_inpage_links;
  gboolean show_go_up;
  gboolean show_exif_table;

  /*  feed section  */
  gboolean feed_enabled;
  gchar *feed_filename;
  gchar *feed_title;
  gchar *feed_base_url;

  /*  footer section  */
  gchar *footer;
} TGallerySetup;


typedef struct {
  gchar *name;
  int landscape_width;
  int landscape_height;
  int portrait_width;
  int portrait_height;
  int square_size;
  int quality;
  gboolean no_resize;
} TImageSize;

typedef struct {
  gboolean enabled;
  gchar *index_template;
  gchar *index_filename;
  gchar *album_template;
  gchar *album_filename;
  gchar *album_image_size;
  gchar *picture_template;
  gchar *picture_filename;
  gchar *picture_image_size;
  gchar **supplemental_files;
  GHashTable *defines;
} TGalleryDesignTheme;

struct TGalleryDesign {
  GList *image_sizes;
  GList *themes;
  gchar **supplemental_files;
};



/*
 *   find_setup_xml: try to find setup.xml in standard paths
 */
TGallerySetup * find_setup_xml ();

/*
 *   parse_setup_xml: XML parser for setup.xml file
 */
TGallerySetup * parse_setup_xml (const gchar *filename);

/*
 *   parse_design_setup_xml: XML parser for design.xml file
 */
TGalleryDesign * parse_design_setup_xml (const gchar *filename);

/*
 *   validate_design_setup: validate design.xml file setup
 */
gboolean validate_design_setup (TGalleryDesign *design);

/*
 *   free_setup_data: free allocated setup data
 */
void free_setup_data (TGallerySetup *setup);

/*
 *   free_design_setup_data: free allocated design setup data
 */
void free_design_setup_data (TGalleryDesign *design);

/*
 *   find_design_directory: try to find design templates directory
 *                          - returned string should be freed
 */
gchar * find_design_directory (TGallerySetup *setup);


G_END_DECLS

#endif /* __CGG__SETUP_H__ */