/* Cataract - Static web photo gallery generator * Copyright (C) 2008 Tomas Bzatek * * 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 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" #define SETUP_V2_XML "setup2.xml" #define SETUP_NATIVE_VERSION 200 /* 2.0 */ /* 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; gboolean strip_unused_tags; gchar *setup_xml_path; gint version; 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 strip_xmp; gboolean write_supplied_exif; gboolean nofullsize; ThumbnailSquareType squared_thumbnail_type; gboolean autorotate; /* 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; /* feed section */ gboolean feed_enabled; gchar *feed_filename; gchar *feed_title; /* location section */ gchar *location_base_url; gchar *location_local_path; /* 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 *album_protected_thumbnail; gchar *picture_template; gchar *picture_filename; gchar *picture_image_size; gchar **supplemental_files; GHashTable *defines; } TGalleryDesignTheme; struct TGalleryDesign { gint version; GList *image_sizes; GList *themes; gchar **supplemental_files; }; #define SETUP_IS_LEGACY(s) s->version < SETUP_NATIVE_VERSION #define SETUP_IS_NATIVE(s) s->version == SETUP_NATIVE_VERSION #define SETUP_IS_NEWER(s) s->version > SETUP_NATIVE_VERSION /* * 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); /* * makeup_legacy_design: create design using legacy setup.xml file */ TGalleryDesign * makeup_legacy_design (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__ */