summaryrefslogtreecommitdiff
path: root/src/setup.c
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@users.sourceforge.net>2015-01-04 19:58:05 +0100
committerTomas Bzatek <tbzatek@users.sourceforge.net>2015-01-04 19:58:05 +0100
commit1f9e7dee25dfd002b6b1ab4636faa9a24f74d09f (patch)
treefb8343fddb4e6931cd361f78b30b292532a03dfa /src/setup.c
parent6f6d8002d318d502ca1f645f95a4c018871c70b3 (diff)
downloadcataract-1f9e7dee25dfd002b6b1ab4636faa9a24f74d09f.tar.xz
generators: Use single function for all templates
This commit makes use of a common function for all template parsing and page writing. The behaviour is controlled by the "item" argument passed in. This allows us to have a single code that generates code for list of items as well as for a single item. In the future, this can be used for e.g. combining thumbnails and large images on the same page. Other than that this commit also brings several other changes: - further clarification of theming setup XML file - <protected_thumbnail> tag has been moved out of the <album> structure into the <index> structure where it functionally belongs. Only whole albums can be protected and the substitute thumbnail is displayed on index pages. - position marker format has been broken out to a constant - added few more FIXMEs to mark places that will change soon - some template variables have been renamed
Diffstat (limited to 'src/setup.c')
-rw-r--r--src/setup.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/setup.c b/src/setup.c
index 637a1b3..d945021 100644
--- a/src/setup.c
+++ b/src/setup.c
@@ -248,6 +248,9 @@ parse_design_setup_xml (const gchar *filename)
s = g_strdup_printf ("/design_setup/theme[%d]/index/thumbnail_size/text()", i + 1);
theme->index_thumb_size = xml_file_get_node_value (xml, s);
g_free (s);
+ s = g_strdup_printf ("/design_setup/theme[%d]/index/protected_thumbnail/text()", i + 1);
+ theme->index_protected_thumbnail = xml_file_get_node_value (xml, s);
+ g_free (s);
s = g_strdup_printf ("/design_setup/theme[%d]/album/template/text()", i + 1);
theme->album_template = xml_file_get_node_value (xml, s);
@@ -261,9 +264,6 @@ parse_design_setup_xml (const gchar *filename)
s = g_strdup_printf ("/design_setup/theme[%d]/album/thumbnail_size/text()", i + 1);
theme->album_thumb_size = xml_file_get_node_value (xml, s);
g_free (s);
- s = g_strdup_printf ("/design_setup/theme[%d]/album/protected_thumbnail/text()", i + 1);
- theme->album_protected_thumbnail = xml_file_get_node_value (xml, s);
- g_free (s);
s = g_strdup_printf ("/design_setup/theme[%d]/picture/template/text()", i + 1);
theme->picture_template = xml_file_get_node_value (xml, s);
@@ -363,6 +363,7 @@ makeup_legacy_design (const gchar *filename)
}
theme->index_filename = xml_file_get_node_value_with_default (xml, "/gallery_setup/templates/index_file/text()", DEFAULT_INDEX_FILENAME);
theme->index_thumb_size = g_strdup (image_sizes[0]);
+ theme->index_protected_thumbnail = NULL;
theme->album_template = xml_file_get_node_value (xml, "/gallery_setup/templates/album/text()");
if (g_strcmp0 (theme->album_template, "template-album.tmpl") == 0) {
@@ -372,7 +373,6 @@ makeup_legacy_design (const gchar *filename)
theme->album_filename = xml_file_get_node_value_with_default (xml, "/gallery_setup/templates/index_file/text()", DEFAULT_INDEX_FILENAME);
theme->album_image_size = g_strdup (image_sizes[1]);
theme->album_thumb_size = g_strdup (image_sizes[0]);
- theme->album_protected_thumbnail = NULL;
theme->picture_template = xml_file_get_node_value (xml, "/gallery_setup/templates/photo/text()");
if (g_strcmp0 (theme->picture_template, "template-view_photo.tmpl") == 0) {
@@ -578,11 +578,11 @@ free_design_theme_data (TGalleryDesignTheme *theme)
g_free (theme->index_template);
g_free (theme->index_filename);
g_free (theme->index_thumb_size);
+ g_free (theme->index_protected_thumbnail);
g_free (theme->album_template);
g_free (theme->album_filename);
g_free (theme->album_image_size);
g_free (theme->album_thumb_size);
- g_free (theme->album_protected_thumbnail);
g_free (theme->picture_template);
g_free (theme->picture_filename);
g_free (theme->picture_image_size);