summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sample/src/apple-red.pngbin0 -> 3100 bytes
-rw-r--r--sample/src/setup.xml5
-rw-r--r--src/generators.c28
-rw-r--r--src/setup.c7
-rw-r--r--src/setup.h3
-rw-r--r--templates/template-album.tmpl2
-rw-r--r--templates/template-index.tmpl2
-rw-r--r--templates/template-view_photo.tmpl2
8 files changed, 46 insertions, 3 deletions
diff --git a/sample/src/apple-red.png b/sample/src/apple-red.png
new file mode 100644
index 0000000..f1bf9dd
--- /dev/null
+++ b/sample/src/apple-red.png
Binary files differ
diff --git a/sample/src/setup.xml b/sample/src/setup.xml
index 84cc639..12bef08 100644
--- a/sample/src/setup.xml
+++ b/sample/src/setup.xml
@@ -69,6 +69,11 @@
<!-- usual format: "Copyright, John Smith, 19xx. All rights reserved." -->
<add_copyright>This is custom copyright string added to every picture.
And the second line.</add_copyright>
+
+ <!-- favicon support, the "type" attribute is optional, -->
+ <!-- please alter it to the right icon MIME type -->
+ <!-- http://www.w3.org/2005/10/howto-favicon -->
+ <favicon type="image/png">apple-red.png</favicon>
</meta>
<navigation>
diff --git a/src/generators.c b/src/generators.c
index e07a880..992370a 100644
--- a/src/generators.c
+++ b/src/generators.c
@@ -356,6 +356,14 @@ write_html_album (TGallerySetup *setup,
g_free (s1);
s1 = s2;
}
+ if (setup->favicon_file && strlen (setup->favicon_file) > 0) {
+ if (setup->favicon_type)
+ s2 = g_strdup_printf ("%s\t<link rel=\"icon\" type=\"%s\" href=\"%s\" />\n", s1, setup->favicon_type, setup->favicon_file);
+ else
+ s2 = g_strdup_printf ("%s\t<link rel=\"icon\" href=\"%s\" />\n", s1, setup->favicon_file);
+ g_free (s1);
+ s1 = s2;
+ }
replace_table_add_key (global_replace_table, "CGG_META_TAGS", s1);
g_free (s1);
@@ -805,6 +813,14 @@ write_html_image (TGallerySetup *setup,
g_free (s1);
s1 = s2;
}
+ if (setup->favicon_file && strlen (setup->favicon_file) > 0) {
+ if (setup->favicon_type)
+ s2 = g_strdup_printf ("%s\t<link rel=\"icon\" type=\"%s\" href=\"%s\" />\n", s1, setup->favicon_type, setup->favicon_file);
+ else
+ s2 = g_strdup_printf ("%s\t<link rel=\"icon\" href=\"%s\" />\n", s1, setup->favicon_file);
+ g_free (s1);
+ s1 = s2;
+ }
replace_table_add_key (replace_table, "CGG_META_TAGS", s1);
g_free (s1);
@@ -950,6 +966,18 @@ build_tree (TGallerySetup *setup,
g_free (s2);
if (setup->verbose) printf (" done.\n");
+ if (setup->favicon_file && strlen (setup->favicon_file) > 0) {
+ if (setup->verbose) printf ("Writing '%s' ...", setup->favicon_file);
+ s3 = g_path_get_dirname (setup->setup_xml_path);
+ s1 = g_strconcat (s3, "/", setup->favicon_file, NULL);
+ s2 = g_strconcat (dst_dir, "/", setup->favicon_file, NULL);
+ copy_file (s1, s2);
+ g_free (s1);
+ g_free (s2);
+ g_free (s3);
+ if (setup->verbose) printf (" done.\n");
+ }
+
/* Prepare target thumbnail directory */
thumb_dir = g_strconcat (dst_dir, "/", THUMBNAIL_DIR, NULL);
diff --git a/src/setup.c b/src/setup.c
index 1481be6..31bd5ca 100644
--- a/src/setup.c
+++ b/src/setup.c
@@ -131,6 +131,9 @@ parse_setup_xml (const char *filename, TGallerySetup *setup)
setup->nofullsize = xml_file_get_node_present (xml, "/gallery_setup/images/nofullsize");
+ setup->favicon_file = xml_file_get_node_value (xml, "/gallery_setup/meta/favicon/text()");
+ setup->favicon_type = xml_file_get_node_attribute (xml, "/gallery_setup/meta/favicon", "type");
+
xml_parser_close (xml);
#ifdef __DEBUG_ALL__
@@ -256,6 +259,10 @@ free_setup_data (TGallerySetup *setup)
free (setup->site_title);
if (setup->add_copyright)
free (setup->add_copyright);
+ if (setup->favicon_file)
+ free (setup->favicon_file);
+ if (setup->favicon_type)
+ free (setup->favicon_type);
free (setup);
setup = NULL;
}
diff --git a/src/setup.h b/src/setup.h
index 111e9b1..cba4278 100644
--- a/src/setup.h
+++ b/src/setup.h
@@ -73,6 +73,9 @@ typedef struct {
char *site_title;
char *add_copyright;
gboolean use_inpage_links;
+
+ char *favicon_file;
+ char *favicon_type;
} TGallerySetup;
diff --git a/templates/template-album.tmpl b/templates/template-album.tmpl
index 75d55e5..616d6af 100644
--- a/templates/template-album.tmpl
+++ b/templates/template-album.tmpl
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
+<head profile="http://www.w3.org/2005/10/profile">
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>$(PAGE_TITLE)</title>
<!-- $(CGG_META_TAGS) -->
diff --git a/templates/template-index.tmpl b/templates/template-index.tmpl
index edb583a..089e487 100644
--- a/templates/template-index.tmpl
+++ b/templates/template-index.tmpl
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
+<head profile="http://www.w3.org/2005/10/profile">
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>$(PAGE_TITLE)</title>
<!-- $(CGG_META_TAGS) -->
diff --git a/templates/template-view_photo.tmpl b/templates/template-view_photo.tmpl
index 70c1dab..7c84919 100644
--- a/templates/template-view_photo.tmpl
+++ b/templates/template-view_photo.tmpl
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
+<head profile="http://www.w3.org/2005/10/profile">
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>$(PAGE_TITLE)</title>
<!-- $(CGG_META_TAGS) -->