summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@users.sourceforge.net>2011-06-04 18:36:44 +0200
committerTomas Bzatek <tbzatek@users.sourceforge.net>2011-06-04 18:36:44 +0200
commita894e2f163153553e5ac32a1f2600315971e13c4 (patch)
tree15ba6c75994ea02e55ccc969596fe4dd896ff007
parent02c5b4315a9aaf64b945428288453134f90b75cc (diff)
downloadcataract-a894e2f163153553e5ac32a1f2600315971e13c4.tar.xz
Port border style to the new defines system
This change allows greater flexibility for separate themes.
-rw-r--r--sample/src/setup.xml2
-rw-r--r--src/generators.c7
-rw-r--r--src/setup.c2
-rw-r--r--src/setup.h1
-rw-r--r--templates/default.xml8
-rw-r--r--templates/template_picture.html2
6 files changed, 9 insertions, 13 deletions
diff --git a/sample/src/setup.xml b/sample/src/setup.xml
index 63f9caf..8ccde39 100644
--- a/sample/src/setup.xml
+++ b/sample/src/setup.xml
@@ -11,8 +11,6 @@
</design>
<images>
- <!-- preview image border style - use your custom CSS style to display frame around image -->
- <border style="border_single" />
<!-- preload next image (allowed values: "yes", "no") default = yes -->
<preload value="yes" />
diff --git a/src/generators.c b/src/generators.c
index 1623ad5..c27b2e5 100644
--- a/src/generators.c
+++ b/src/generators.c
@@ -812,11 +812,8 @@ write_html_image (TGallerySetup *setup,
s1 = item->border_style;
if (s1 == NULL)
s1 = parent_items->border_style;
- if (s1 == NULL)
- s1 = setup->border_style;
- if (s1 == NULL)
- s1 = "border_single";
- replace_table_add_key (replace_table, "IMG_BORDER_STYLE", s1);
+ if (s1)
+ g_hash_table_replace (defines, g_strdup ("BORDER_STYLE"), g_strdup (s1));
/* Next/Previous links */
if (next_item) {
diff --git a/src/setup.c b/src/setup.c
index 3a2a66d..2d7fbac 100644
--- a/src/setup.c
+++ b/src/setup.c
@@ -91,7 +91,6 @@ parse_setup_xml (const gchar *filename)
setup->supplemental_files_use_common_root = xml_file_get_node_attribute_boolean (xml, "/gallery_setup/design/supplemental_files_use_common_root", "value", FALSE);
/* images section */
- setup->border_style = xml_file_get_node_attribute (xml, "/gallery_setup/images/border", "style");
setup->preload = xml_file_get_node_attribute_boolean (xml, "/gallery_setup/images/preload", "value", TRUE);
setup->use_iptc_exif = xml_file_get_node_attribute_boolean (xml, "/gallery_setup/images/use_iptc_exif", "value", FALSE);
setup->erase_exif_thumbnail = xml_file_get_node_attribute_boolean (xml, "/gallery_setup/images/erase_embed_thumbnail", "value", FALSE);
@@ -371,7 +370,6 @@ free_setup_data (TGallerySetup *setup)
if (setup) {
g_free (setup->setup_xml_path);
g_free (setup->design_setup_file);
- g_free (setup->border_style);
g_free (setup->meta_author);
g_free (setup->meta_author_email);
g_free (setup->meta_description);
diff --git a/src/setup.h b/src/setup.h
index a96a73f..75cbef7 100644
--- a/src/setup.h
+++ b/src/setup.h
@@ -53,7 +53,6 @@ typedef struct {
gboolean supplemental_files_use_common_root;
/* images section */
- gchar *border_style;
gboolean preload;
gboolean use_iptc_exif;
gboolean erase_exif_thumbnail;
diff --git a/templates/default.xml b/templates/default.xml
index 2a2fd8b..83a1c1a 100644
--- a/templates/default.xml
+++ b/templates/default.xml
@@ -93,8 +93,12 @@
act as block conditionals (combo "ifdef(DEFINE_NAME)" and "endif(DEFINE_NAME)")
or as a value constant (specify "value(DEFINE_NAME)" to retrieve the value).
For "ifdef" negation, use "ifndef" or "else". -->
- <define name="BORDER" value="single" />
- <define name="I_AM_HERE" />
+ <!-- Some defines are added during runtime and take priority over custom defines
+ here. This way you can define default values here which would get eventually
+ overriden by the generator. -->
+
+ <!-- image border style, overriden by <border style> tags from the album source file -->
+ <define name="BORDER_STYLE" value="border_single" />
</theme>
<!-- Here you can define another theme, with different templates etc.
diff --git a/templates/template_picture.html b/templates/template_picture.html
index 413d348..d9b72b2 100644
--- a/templates/template_picture.html
+++ b/templates/template_picture.html
@@ -33,7 +33,7 @@
<!-- ## Image -->
<div class="img_preview">
- <a href="$(LINK_NEXT)"><img src="$(IMG_SRC)" width="$(IMG_SIZE_W)" height="$(IMG_SIZE_H)" alt="" id="$(IMG_BORDER_STYLE)" /></a>
+ <a href="$(LINK_NEXT)"><img src="$(IMG_SRC)" width="$(IMG_SIZE_W)" height="$(IMG_SIZE_H)" alt="" id="$(value(BORDER_STYLE))" /></a>
<!-- $(BEGIN_IMG_FULLSIZE_LINK) -->
<div class="img_preview_full">
<a href="$(IMG_SRC_FULL)">See original size (<!-- $(IMG_SIZE_ORIG_W) -->x<!-- $(IMG_SIZE_ORIG_H) -->)</a>