[gthumb: 22/57] [webalbums] simplified the syntax, added caption iterator.



commit 1995e2e9dc4595ed24e40eb5130cb2d6a56df979
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sat Jun 12 23:24:23 2010 +0200

    [webalbums] simplified the syntax, added caption iterator.
    
    Use "<%" as prefix for the special tag instead of "<gthumb:".
    Added for_each_thumbnail_caption to iterate through the
    selected attributes.

 extensions/webalbums/albumtheme-private.c          |  209 ++++++-
 extensions/webalbums/albumtheme-private.h          |   69 ++-
 extensions/webalbums/albumtheme.l                  |  313 +++-------
 extensions/webalbums/albumtheme.y                  |  191 ++----
 .../data/albumthemes/ClassicClips/image.gthtml     |  152 +----
 .../data/albumthemes/ClassicClips/index.gthtml     |  164 +++---
 .../data/albumthemes/ClassicClips/layout.css       |   87 ++-
 .../data/albumthemes/ClassicClips/style.css        |    9 +-
 .../data/albumthemes/ClassicClips/thumbnail.gthtml |   96 +--
 .../webalbums/data/gthumb_webalbums.schemas.in     |   27 +-
 extensions/webalbums/data/ui/web-album-exporter.ui |  682 ++++++++++++++------
 extensions/webalbums/dlg-web-exporter.c            |   70 ++-
 extensions/webalbums/gth-web-exporter.c            |  488 ++++++++++-----
 extensions/webalbums/gth-web-exporter.h            |   15 +-
 extensions/webalbums/preferences.h                 |   10 +-
 gthumb/gth-metadata.c                              |    7 +
 gthumb/gth-metadata.h                              |    1 +
 17 files changed, 1493 insertions(+), 1097 deletions(-)
---
diff --git a/extensions/webalbums/albumtheme-private.c b/extensions/webalbums/albumtheme-private.c
index 743cae1..8a5636c 100644
--- a/extensions/webalbums/albumtheme-private.c
+++ b/extensions/webalbums/albumtheme-private.c
@@ -3,7 +3,7 @@
 /*
  *  GThumb
  *
- *  Copyright (C) 2003 Free Software Foundation, Inc.
+ *  Copyright (C) 2003, 2010 Free Software Foundation, Inc.
  *
  *  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
@@ -586,8 +586,8 @@ gth_condition_free (GthCondition *cond)
 
 
 void
-gth_condition_add_document  (GthCondition *cond,
-			     GList        *document)
+gth_condition_add_document (GthCondition *cond,
+			    GList        *document)
 {
 	if (cond->document != NULL)
 		gth_parsed_doc_free (cond->document);
@@ -595,6 +595,48 @@ gth_condition_add_document  (GthCondition *cond,
 }
 
 
+/* GthLoop */
+
+
+GthLoop *
+gth_loop_new (GthTagType  loop_type)
+{
+	GthLoop *loop;
+
+	loop = g_new0 (GthLoop, 1);
+	loop->type = loop_type;
+
+	return loop;
+}
+
+
+void
+gth_loop_free (GthLoop *loop)
+{
+	if (loop == NULL)
+		return;
+	gth_parsed_doc_free (loop->document);
+	g_free (loop);
+}
+
+
+GthTagType
+gth_loop_get_type (GthLoop *loop)
+{
+	return loop->type;
+}
+
+
+void
+gth_loop_add_document (GthLoop *loop,
+		       GList   *document)
+{
+	if (loop->document != NULL)
+		gth_parsed_doc_free (loop->document);
+	loop->document = document;
+}
+
+
 /* GthTag */
 
 
@@ -638,6 +680,19 @@ gth_tag_new_condition (GList *cond_list)
 }
 
 
+GthTag *
+gth_tag_new_loop (GthLoop *loop)
+{
+	GthTag *tag;
+
+	tag = g_new0 (GthTag, 1);
+	tag->type = loop->type;
+	tag->value.loop = loop;
+
+	return tag;
+}
+
+
 void
 gth_tag_add_document (GthTag *tag,
 		      GList  *document)
@@ -651,16 +706,19 @@ gth_tag_add_document (GthTag *tag,
 void
 gth_tag_free (GthTag *tag)
 {
-	if (tag->type == GTH_TAG_HTML)
+	if (tag->type == GTH_TAG_HTML) {
 		g_free (tag->value.html);
-
+	}
 	else if (tag->type == GTH_TAG_IF) {
 		g_list_foreach (tag->value.cond_list,
 				(GFunc) gth_condition_free,
 				NULL);
 		g_list_free (tag->value.cond_list);
-
-	} else {
+	}
+	else if (tag->type == GTH_TAG_FOR_EACH_THUMBNAIL_CAPTION) {
+		gth_loop_free (tag->value.loop);
+	}
+	else {
 		g_list_foreach (tag->value.arg_list,
 				(GFunc) gth_var_free,
 				NULL);
@@ -674,11 +732,140 @@ gth_tag_free (GthTag *tag)
 }
 
 
+GthTagType
+gth_tag_get_type_from_name (const char *tag_name)
+{
+	if (tag_name == NULL)
+		return GTH_TAG_INVALID;
+
+	if (g_str_equal (tag_name, "header"))
+		return GTH_TAG_HEADER;
+	else if (g_str_equal (tag_name, "footer"))
+		return GTH_TAG_FOOTER;
+	else if (g_str_equal (tag_name, "language"))
+		return GTH_TAG_LANGUAGE;
+	else if (g_str_equal (tag_name, "theme_link"))
+		return GTH_TAG_THEME_LINK;
+	else if (g_str_equal (tag_name, "image"))
+		return GTH_TAG_IMAGE;
+	else if (g_str_equal (tag_name, "image_link"))
+		return GTH_TAG_IMAGE_LINK;
+	else if (g_str_equal (tag_name, "image_idx"))
+		return GTH_TAG_IMAGE_IDX;
+	else if (g_str_equal (tag_name, "image_dim"))
+		return GTH_TAG_IMAGE_DIM;
+	else if (g_str_equal (tag_name, "images"))
+		return GTH_TAG_IMAGES;
+	else if (g_str_equal (tag_name, "file_name"))
+		return GTH_TAG_FILE_NAME;
+	else if (g_str_equal (tag_name, "file_path"))
+		return GTH_TAG_FILE_PATH;
+	else if (g_str_equal (tag_name, "file_size"))
+		return GTH_TAG_FILE_SIZE;
+	else if (g_str_equal (tag_name, "page_link"))
+		return GTH_TAG_PAGE_LINK;
+	else if (g_str_equal (tag_name, "page_idx"))
+		return GTH_TAG_PAGE_IDX;
+	else if (g_str_equal (tag_name, "page_link"))
+		return GTH_TAG_PAGE_LINK;
+	else if (g_str_equal (tag_name, "page_rows"))
+		return GTH_TAG_PAGE_ROWS;
+	else if (g_str_equal (tag_name, "page_cols"))
+		return GTH_TAG_PAGE_COLS;
+	else if (g_str_equal (tag_name, "pages"))
+		return GTH_TAG_PAGES;
+	else if (g_str_equal (tag_name, "thumbnails"))
+		return GTH_TAG_THUMBNAILS;
+	else if (g_str_equal (tag_name, "timestamp"))
+		return GTH_TAG_TIMESTAMP;
+	else if (g_str_equal (tag_name, "text"))
+		return GTH_TAG_TEXT;
+	else if (g_str_equal (tag_name, "html"))
+		return GTH_TAG_HTML;
+	else if (g_str_equal (tag_name, "set_var"))
+		return GTH_TAG_SET_VAR;
+	else if (g_str_equal (tag_name, "eval"))
+		return GTH_TAG_EVAL;
+	else if (g_str_equal (tag_name, "if"))
+		return GTH_TAG_IF;
+	else if (g_str_equal (tag_name, "for_each_thumbnail_caption"))
+		return GTH_TAG_FOR_EACH_THUMBNAIL_CAPTION;
+	else if (g_str_equal (tag_name, "item_attribute"))
+		return GTH_TAG_ITEM_ATTRIBUTE;
+
+	return GTH_TAG_INVALID;
+}
+
+
+const char *
+gth_tag_get_name_from_type (GthTagType tag_type)
+{
+	static char *tag_name[] = {
+		"header",
+		"footer",
+		"language",
+		"theme_link",
+		"image",
+		"image_link",
+		"image_idx",
+		"image_dim",
+		"images",
+		"filename",
+		"filepath",
+		"filesize",
+		"page_link",
+		"page_idx",
+		"page_rows",
+		"page_cols",
+		"pages",
+		"thumbnails",
+		"timestamp",
+		"text",
+		"html",
+		"set_var",
+		"eval",
+		"if",
+		"for_each_thumbnail_caption",
+		"item_attribute"
+	};
+
+	return tag_name[tag_type];
+}
+
+
+void
+gth_parsed_doc_print_tree (GList *document)
+{
+	GList *scan;
+
+	for (scan = document; scan; scan = scan->next) {
+		GthTag *tag = scan->data;
+
+		g_print ("<%s>\n", gth_tag_get_name_from_type (tag->type));
+
+		if ((tag->type != GTH_TAG_HTML) && (tag->type != GTH_TAG_IF)) {
+			GList *scan_arg;
+
+			for (scan_arg = tag->value.arg_list; scan_arg; scan_arg = scan_arg->next) {
+				GthVar *var = scan_arg->data;
+
+				g_print ("  %s = ", var->name);
+				if (var->type == GTH_VAR_STRING)
+					g_print ("%s\n", var->value.string);
+				else
+					gth_expr_print (var->value.expr);
+			}
+		}
+	}
+	g_print (".\n\n");
+}
+
+
 void
-gth_parsed_doc_free (GList *parsed_doc)
+gth_parsed_doc_free (GList *document)
 {
-	if (parsed_doc != NULL) {
-		g_list_foreach (parsed_doc, (GFunc) gth_tag_free, NULL);
-		g_list_free (parsed_doc);
+	if (document != NULL) {
+		g_list_foreach (document, (GFunc) gth_tag_free, NULL);
+		g_list_free (document);
 	}
 }
diff --git a/extensions/webalbums/albumtheme-private.h b/extensions/webalbums/albumtheme-private.h
index 4d89b7d..d989bf8 100644
--- a/extensions/webalbums/albumtheme-private.h
+++ b/extensions/webalbums/albumtheme-private.h
@@ -155,10 +155,10 @@ void           gth_condition_free          (GthCondition *cond);
 void           gth_condition_add_document  (GthCondition *cond,
 					    GList        *document);
 
-/* GthTag */
+/* GthLoop */
 
 typedef enum {
-	GTH_TAG_HEADER,
+	GTH_TAG_HEADER = 0,
 	GTH_TAG_FOOTER,
 	GTH_TAG_LANGUAGE,
 	GTH_TAG_THEME_LINK,
@@ -167,56 +167,65 @@ typedef enum {
 	GTH_TAG_IMAGE_IDX,
 	GTH_TAG_IMAGE_DIM,
 	GTH_TAG_IMAGES,
-	GTH_TAG_FILENAME,
-	GTH_TAG_FILEPATH,
-	GTH_TAG_FILESIZE,
-	GTH_TAG_COMMENT,
-	GTH_TAG_PLACE,
-	GTH_TAG_DATE_TIME,
+	GTH_TAG_FILE_NAME,
+	GTH_TAG_FILE_PATH,
+	GTH_TAG_FILE_SIZE,
 	GTH_TAG_PAGE_LINK,
 	GTH_TAG_PAGE_IDX,
 	GTH_TAG_PAGE_ROWS,
 	GTH_TAG_PAGE_COLS,
 	GTH_TAG_PAGES,
-	GTH_TAG_TABLE,
-	GTH_TAG_THUMBS,
-	GTH_TAG_DATE,
+	GTH_TAG_THUMBNAILS,
+	GTH_TAG_TIMESTAMP,
 	GTH_TAG_TEXT,
 	GTH_TAG_HTML,
 	GTH_TAG_SET_VAR,
 	GTH_TAG_EVAL,
 	GTH_TAG_IF,
-	GTH_TAG_EXIF_EXPOSURE_TIME,
-	GTH_TAG_EXIF_EXPOSURE_MODE,
-	GTH_TAG_EXIF_FLASH,
-	GTH_TAG_EXIF_SHUTTER_SPEED,
-	GTH_TAG_EXIF_APERTURE_VALUE,
-	GTH_TAG_EXIF_FOCAL_LENGTH,
-	GTH_TAG_EXIF_DATE_TIME,
-	GTH_TAG_EXIF_CAMERA_MODEL
+	GTH_TAG_FOR_EACH_THUMBNAIL_CAPTION,
+	GTH_TAG_ITEM_ATTRIBUTE,
+	GTH_TAG_INVALID
 } GthTagType;
 
 typedef struct {
+	GthTagType  type;
+	GList      *document; /* GthTag list */
+} GthLoop;
+
+GthLoop *   gth_loop_new           (GthTagType  loop_type);
+void        gth_loop_free          (GthLoop    *loop);
+GthTagType  gth_loop_get_type      (GthLoop    *loop);
+void        gth_loop_add_document  (GthLoop    *loop,
+				    GList      *document);
+
+/* GthTag */
+
+typedef struct {
 	GthTagType type;
 	union {
-		GList *arg_list;    /* GthVar list */
-		char  *html;        /* html */
-		GList *cond_list;   /* GthCondition list */
+		GList   *arg_list;    /* GthVar list */
+		char    *html;        /* html */
+		GList   *cond_list;   /* GthCondition list */
+		GthLoop *loop;        /* a loop tag */
 	} value;
 	GList *document; /* GthTag list */
 } GthTag;
 
-GthTag * gth_tag_new                 (GthTagType    type,
-				      GList        *arg_list);
-GthTag * gth_tag_new_html            (const char   *html);
-GthTag * gth_tag_new_condition       (GList        *cond_list);
-void     gth_tag_add_document        (GthTag       *tag,
-				      GList        *document);
-void     gth_tag_free                (GthTag       *tag);
+GthTag *     gth_tag_new                 (GthTagType  type,
+				          GList      *arg_list);
+GthTag *     gth_tag_new_html            (const char *html);
+GthTag *     gth_tag_new_condition       (GList      *cond_list);
+GthTag *     gth_tag_new_loop            (GthLoop    *loop);
+void         gth_tag_add_document        (GthTag     *tag,
+				          GList      *document);
+void         gth_tag_free                (GthTag     *tag);
+GthTagType   gth_tag_get_type_from_name  (const char *tag_name);
+const char * gth_tag_get_name_from_type  (GthTagType  tag_type);
 
 /* Utils */
 
 int      gth_albumtheme_yyparse      (void);
-void     gth_parsed_doc_free         (GList *parsed_doc);
+void     gth_parsed_doc_print_tree   (GList *document);
+void     gth_parsed_doc_free         (GList *document);
 
 #endif /* ALBUMTHEME_PRIVATE_H */
diff --git a/extensions/webalbums/albumtheme.l b/extensions/webalbums/albumtheme.l
index 3bd219d..cf3c70f 100644
--- a/extensions/webalbums/albumtheme.l
+++ b/extensions/webalbums/albumtheme.l
@@ -2,7 +2,7 @@
 /*
  *  GThumb
  *
- *  Copyright (C) 2003 Free Software Foundation, Inc.
+ *  Copyright (C) 2003, 2010 Free Software Foundation, Inc.
  *
  *  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
@@ -36,301 +36,142 @@ GFileInputStream *yy_istream;
 %option noinput nounput
 
 number           [0-9]+
-name             [a-zA-Z_][0-9a-zA-Z_:@]*
-string           ([^'\n]|\\')*
+attribute_name   [a-zA-Z_][a-zA-Z_0-9:\.-]*
+name             [a-zA-Z_][^'" \t\n]*
+quote_sign       ['"]
 
-%x TAG STAG STR SSTR
+%x FUNCTION ATTRIBUTES CONDITION QUOTE
 
 %%
 
-"<gthumb:header"		{ 
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_HEADER;
-					return HEADER;
-				}
-"<gthumb:footer"		{ 
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_FOOTER;
-					return FOOTER;
-				}
-"<gthumb:language"		{ 
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_LANGUAGE;
-					return LANGUAGE;
-				}
-"<gthumb:theme_link"		{ 
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_THEME_LINK;
-					return THEME_LINK;
-				}
-"<gthumb:image"			{ 
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_IMAGE;
-					return IMAGE;
-				}
-"<gthumb:image_link"		{ 
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_IMAGE_LINK;
-					return IMAGE_LINK;
-				}
-"<gthumb:image_idx"		{ 
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_IMAGE_IDX;
-					return IMAGE_IDX;
-				}
-"<gthumb:image_dim"		{ 
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_IMAGE_DIM;
-					return IMAGE_DIM;
-				}
-"<gthumb:images"		{ 
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_IMAGES;
-					return IMAGES;
-				}
-"<gthumb:file_name"		{ 
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_FILENAME;
-					return FILENAME;
-				}
-"<gthumb:file_path"		{ 
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_FILEPATH;
-					return FILEPATH;
-				}
-"<gthumb:file_size"		{ 
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_FILESIZE;
-					return FILESIZE;
-				}
-"<gthumb:comment"		{ 
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_COMMENT;
-					return COMMENT;
-				}
-"<gthumb:place"			{
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_PLACE;
-					return PLACE;
-				}
-"<gthumb:date_time"			{
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_DATE_TIME;
-					return DATE_TIME;
-				}
-"<gthumb:page_link"		{ 
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_PAGE_LINK;
-					return PAGE_LINK;
-				}
-"<gthumb:page_idx"		{ 
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_PAGE_IDX;
-					return PAGE_IDX;
-				}
-"<gthumb:page_rows"		{ 
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_PAGE_ROWS;
-					return PAGE_ROWS;
-				}
-"<gthumb:page_cols"		{ 
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_PAGE_COLS;
-					return PAGE_COLS;
-				}
-"<gthumb:pages"			{ 
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_PAGES;
-					return PAGES;
-				}
-"<gthumb:table"			{ 
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_TABLE;
-					return TABLE;
-				}
-"<gthumb:thumbs"			{ 
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_THUMBS;
-					return THUMBS;
-				}
-"<gthumb:date"			{ 
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_DATE;
-					return DATE;
-				}
-"<gthumb:text"			{ 
-					BEGIN (STAG);
-					yylval.ivalue = GTH_TAG_TEXT;
-					return TEXT;
-				}
-"</gthumb:text>"		{
-					BEGIN (INITIAL);
-					return TEXT_END;
-				}
-"<gthumb:exif:exposure_time"	{ 
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_EXIF_EXPOSURE_TIME;
-					return EXIF_EXPOSURE_TIME;
-				}
-"<gthumb:exif:exposure_mode"	{ 
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_EXIF_EXPOSURE_MODE;
-					return EXIF_EXPOSURE_MODE;
-				}
-"<gthumb:exif:flash"		{ 
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_EXIF_FLASH;
-					return EXIF_FLASH;
-				}
-"<gthumb:exif:shutter_speed"	{ 
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_EXIF_SHUTTER_SPEED;
-					return EXIF_SHUTTER_SPEED;
-				}
-"<gthumb:exif:aperture_value"	{ 
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_EXIF_APERTURE_VALUE;
-					return EXIF_APERTURE_VALUE;
-				}
-"<gthumb:exif:focal_length"	{ 
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_EXIF_FOCAL_LENGTH;
-					return EXIF_FOCAL_LENGTH;
-				}
-"<gthumb:exif:date_time"	{ 
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_EXIF_DATE_TIME;
-					return EXIF_DATE_TIME;
-				}
-"<gthumb:exif:camera_model"	{ 
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_EXIF_CAMERA_MODEL;
-					return EXIF_CAMERA_MODEL;
-				}
-"<gthumb:set_var"		{ 
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_SET_VAR;
-					return SET_VAR;
-				}
-"<gthumb:eval"			{
-					BEGIN (TAG);
-					yylval.ivalue = GTH_TAG_EVAL;
-					return EVAL;
-				}
-"<gthumb:if"			{ 
-					BEGIN (TAG);
+"<% if"                         {
+					BEGIN (CONDITION);
 					return IF;
 				}
-"<gthumb:else"			{ 
-					BEGIN (TAG);
-					return ELSE;
-				}
-"<gthumb:else_if"		{ 
-					BEGIN (TAG);
+"<% elsif"                      {
+					BEGIN (CONDITION);
 					return ELSE_IF;
 				}
-"<gthumb:end"			{ 
-					BEGIN (TAG);
+"<% else"                       {
+					BEGIN (ATTRIBUTES);
+					return ELSE;
+				}
+"<% end"                        {
+					BEGIN (ATTRIBUTES);
 					return END;
 				}
-<TAG>"'"			{
-					BEGIN (STR);
-					return '\'';
+"<% set_var"		 	{
+					BEGIN (ATTRIBUTES);
+					return SET_VAR;
+				}	
+"<% for_each_thumbnail_caption"	{
+					BEGIN (ATTRIBUTES);
+					yylval.ivalue = GTH_TAG_FOR_EACH_THUMBNAIL_CAPTION;
+					return FOR_EACH;
+				}
+"<%="                           {
+					BEGIN (FUNCTION);
+					return BEGIN_TAG;
+				}
+<FUNCTION>{attribute_name}	{
+					BEGIN (ATTRIBUTES);
+					yylval.text = g_strdup (yytext);
+					return FUNCTION_NAME;
 				}
-<STAG>"'"			{
-					BEGIN (SSTR);
-					return '\'';
+"<%text"                        {
+					BEGIN (ATTRIBUTES);
+					return BEGIN_TEXT_TAG;
 				}
-<STR,SSTR>{string}		{
-					yylval.text = g_strdup (yytext);
-					return STRING;
+"<%/text>"		        {
+					BEGIN (INITIAL);
+					return END_TEXT_TAG;
 				}
-<STR>"'"			{
-					BEGIN (TAG);
-					return '\'';
+<ATTRIBUTES>{quote_sign} 	{
+					BEGIN (QUOTE);
+					return '"';
 				}
-<SSTR>"'"			{
-					BEGIN (STAG);
-					return '\'';
+<QUOTE>{quote_sign}		{
+					BEGIN (ATTRIBUTES);
+					return '"';
 				}
-<TAG,STAG>{number}		{
+<ATTRIBUTES,QUOTE,CONDITION>"%>"	{
+					BEGIN (INITIAL);
+					return END_TAG;
+				}
+<ATTRIBUTES>{attribute_name}	{
+					yylval.text = g_strdup (yytext);
+					return ATTRIBUTE_NAME;
+				}
+<ATTRIBUTES>"="			{
+					return '=';
+				}
+<QUOTE,CONDITION>{number}	{
 					yylval.ivalue = atoi (yytext);
 					return NUMBER;
 				}
-<TAG,STAG>{name}		{
+<QUOTE,CONDITION>{name}		{
 					yylval.text = g_strdup (yytext);
-					return NAME;
+					return QUOTED_NAME;
 				}
-<TAG,STAG>"="			{
+<QUOTE,CONDITION>"="		{
 					return '=';
 				}
-<TAG,STAG>"<"			{
+<QUOTE,CONDITION>"<"		{
 					yylval.ivalue = GTH_OP_CMP_LT;
 					return COMPARE;
 				}
-<TAG>">"			{
+<QUOTE,CONDITION>">"		{
 					yylval.ivalue = GTH_OP_CMP_GT;
 					return COMPARE;
 				}
-<STAG>">"		        {
-					BEGIN (INITIAL);
-					return END_TAG;
-				}
-<TAG,STAG>"+"			{
+<QUOTE,CONDITION>"+"		{
 					return '+';
 				}
-<TAG,STAG>"-"			{
+<QUOTE,CONDITION>"-"		{
 					return '-';
 				}
-<TAG,STAG>"*"			{
+<QUOTE,CONDITION>"*"		{
 					return '*';
 				}
-<TAG,STAG>"/"			{
+<QUOTE,CONDITION>"/"		{
 					return '/';
 				}
-<TAG,STAG>"!"			{
+<QUOTE,CONDITION>"!"		{
 					return '!';
 				}
-<TAG,STAG>"("			{
+<QUOTE,CONDITION>"("		{
 					return '(';
 				}
-<TAG,STAG>")"			{
+<QUOTE,CONDITION>")"		{
 					return ')';
 				}
-<TAG,STAG>\"			{
-					return '"';
-				}
-<TAG,STAG>"&&"			{
+<QUOTE,CONDITION>"&&"		{
 					yylval.ivalue = GTH_OP_AND;
 					return BOOL_OP;
 				}
-<TAG,STAG>"||"			{
+<QUOTE,CONDITION>"||"		{
 					yylval.ivalue = GTH_OP_OR;
 					return BOOL_OP;
 				}
-<TAG,STAG>"=="			{
+<QUOTE,CONDITION>"=="		{
 					yylval.ivalue = GTH_OP_CMP_EQ;
 					return COMPARE;
 				}
-<TAG,STAG>"!="			{
+<QUOTE,CONDITION>"!="		{
 					yylval.ivalue = GTH_OP_CMP_NE;
 					return COMPARE;
 				}
-<TAG,STAG>"<="			{
+<QUOTE,CONDITION>"<="		{
 					yylval.ivalue = GTH_OP_CMP_LE;
 					return COMPARE;
 				}
-<TAG,STAG>">="			{
+<QUOTE,CONDITION>">="		{
 					yylval.ivalue = GTH_OP_CMP_GE;
 					return COMPARE;
 				}
-<TAG,STAG>[ \t\n]		{
+<ATTRIBUTES,QUOTE,CONDITION>[ \t\n]	{
 					/* Eat spaces inside tag. */
 				}
-<TAG>"/>"		        {
-					BEGIN (INITIAL);
-					return END_TAG;
-				}
 "<"				{
 					yylval.text = g_strdup (yytext);
 					return HTML;
@@ -340,7 +181,9 @@ string           ([^'\n]|\\')*
 					return HTML;
 				}
 <<EOF>>				{
-					return 0;
+					YY_FLUSH_BUFFER;
+					BEGIN(INITIAL);
+					yyterminate ();
 				}
 
 %%
diff --git a/extensions/webalbums/albumtheme.y b/extensions/webalbums/albumtheme.y
index 243e60d..da5308b 100644
--- a/extensions/webalbums/albumtheme.y
+++ b/extensions/webalbums/albumtheme.y
@@ -2,7 +2,7 @@
 /*
  *  GThumb
  *
- *  Copyright (C) 2003 Free Software Foundation, Inc.
+ *  Copyright (C) 2003, 2010 Free Software Foundation, Inc.
  *
  *  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
@@ -30,23 +30,25 @@ void  gth_albumtheme_yyerror (char *fmt, ...);
 int   gth_albumtheme_yywrap  (void);
 
 #define YY_NO_UNPUT
+#define YYERROR_VERBOSE 1
 
 %}
 
 %union {
 	char         *text;
 	int           ivalue;
-        GString      *string;
 	GthVar       *var;
 	GthTag       *tag;
 	GthExpr      *expr;
 	GList        *list;
 	GthCondition *cond;
+	GthLoop      *loop;
 }
 
-%nonassoc       IF ELSE ELSE_IF END
-%token          END_TAG
-%token <text>   NAME STRING
+%nonassoc       IF ELSE ELSE_IF END END_TEXT_TAG FOR_EACH_THUMBNAIL_CAPTION SET_VAR 
+%token          BEGIN_TAG END_TAG BEGIN_TEXT_TAG 
+%token <text>   QUOTED_NAME ATTRIBUTE_NAME FUNCTION_NAME
+%token <ivalue> FOR_EACH
 %token <ivalue> NUMBER
 %token <ivalue> HEADER FOOTER
 %token <ivalue> LANGUAGE
@@ -59,26 +61,15 @@ int   gth_albumtheme_yywrap  (void);
 %token <ivalue> FILENAME
 %token <ivalue> FILEPATH
 %token <ivalue> FILESIZE
-%token <ivalue> COMMENT
-%token <ivalue> PLACE
-%token <ivalue> DATE_TIME
 %token <ivalue> PAGE_LINK
 %token <ivalue> PAGE_IDX
 %token <ivalue> PAGE_ROWS
 %token <ivalue> PAGE_COLS
 %token <ivalue> PAGES
-%token <ivalue> TABLE
-%token <ivalue> THUMBS
+%token <ivalue> THUMBNAILS
 %token <ivalue> DATE
 %token <ivalue> TEXT TEXT_END
-%token <ivalue> EXIF_EXPOSURE_TIME
-%token <ivalue> EXIF_EXPOSURE_MODE
-%token <ivalue> EXIF_FLASH
-%token <ivalue> EXIF_SHUTTER_SPEED
-%token <ivalue> EXIF_APERTURE_VALUE
-%token <ivalue> EXIF_FOCAL_LENGTH
-%token <ivalue> EXIF_DATE_TIME
-%token <ivalue> EXIF_CAMERA_MODEL
+%token <text>   ITEM_ATTRIBUTE
 
 %token <ivalue> SET_VAR
 %token <ivalue> EVAL
@@ -88,18 +79,15 @@ int   gth_albumtheme_yywrap  (void);
 %type <list>   document
 %type <tag>    gthumb_tag
 %type <tag>    gthumb_text_tag
+%type <loop>   gthumb_loop
 %type <cond>   gthumb_if
 %type <cond>   gthumb_else_if
 %type <cond>   opt_else
 %type <list>   opt_if_list
-%type <ivalue> tag_name
-%type <list>   arg_list
-%type <var>    arg
+%type <ivalue> tag_type
+%type <list>   attribute_list
+%type <var>    attribute
 %type <expr>   expr
-%type <expr>   quoted_expr
-%type <string> constant_list
-%type <string> constant
-%type <string> constant1
 
 %left  <ivalue> BOOL_OP
 %left  <ivalue> COMPARE
@@ -110,7 +98,6 @@ int   gth_albumtheme_yywrap  (void);
 
 all		: document {
 			yy_parsed_doc = $1;
-
 			if (yy_parsed_doc == NULL)
 				YYABORT;
 			else
@@ -127,6 +114,14 @@ document	: HTML document {
 			$$ = g_list_prepend ($2, $1);
 		}
 
+		| gthumb_loop document gthumb_end document {
+			GthTag *tag;
+			
+			gth_loop_add_document ($1, $2);
+			tag = gth_tag_new_loop ($1);
+			$$ = g_list_prepend ($4, $1);
+		}
+
 		| gthumb_if document opt_if_list opt_else gthumb_end document {
 			GList  *cond_list;
 			GthTag *tag;
@@ -140,11 +135,15 @@ document	: HTML document {
 			$$ = g_list_prepend ($6, tag);
 		}
 
-		| gthumb_text_tag HTML TEXT_END document {
-			GthTag *tag = gth_tag_new_html ($2);
-			GList *child_doc = g_list_append (NULL, tag);
+		| gthumb_text_tag HTML END_TEXT_TAG document {
+			GthTag *tag;
+			GList  *child_doc;
+			
+			tag = gth_tag_new_html ($2);
+			child_doc = g_list_append (NULL, tag);
 			gth_tag_add_document ($1, child_doc);
 			$$ = g_list_prepend ($4, $1);
+			
 			g_free ($2);
 		}
 
@@ -159,10 +158,14 @@ document	: HTML document {
 		}
 		;
 
+gthumb_loop     : FOR_EACH END_TAG {
+			$$ = gth_loop_new ($1);
+		};
+
 gthumb_if	: IF expr END_TAG {
 			$$ = gth_condition_new ($2);
 		}
-		| IF '"' quoted_expr '"' END_TAG {
+		| IF '"' expr '"' END_TAG {
 			$$ = gth_condition_new ($3);
 		}
 		;
@@ -180,7 +183,7 @@ opt_if_list     : gthumb_else_if document opt_if_list {
 gthumb_else_if  : ELSE_IF expr END_TAG {
 			$$ = gth_condition_new ($2);
 		}
-		| ELSE_IF '"' quoted_expr '"' END_TAG {
+		| ELSE_IF '"' expr '"' END_TAG {
 			$$ = gth_condition_new ($3);
 		}
 		;
@@ -304,7 +307,7 @@ expr		: '(' expr ')' {
 			$$ = $2;
 		}
 
-		| NAME {
+		| QUOTED_NAME {
 			GthExpr *e = gth_expr_new ();
 			gth_expr_push_var (e, $1);
 			g_free ($1);
@@ -317,105 +320,31 @@ expr		: '(' expr ')' {
 			$$ = e;
 		}
 		;
-quoted_expr     : expr {
-			$$ = $1;
-		}
-		| STRING {
-			GthExpr *e = gth_expr_new ();
-			gth_expr_push_var(e, $1);
-			g_free($1);
-			$$ = e;
-		}
-		| constant1 constant constant_list {
-			GthExpr *e = gth_expr_new ();
-			g_string_append($1, $2->str);
-			g_string_free($2, TRUE);
-			if ($3 != NULL)
-			{
-				g_string_append($1, $3->str);
-				g_string_free($3, TRUE);
-			}
-			gth_expr_push_var(e, $1->str);
-			g_string_free($1, TRUE);
-			$$ = e;
-		}
-		;
-constant1       : NAME {
-			GString* s = g_string_new($1);
-			g_free($1);
-			$$ = s;
-		}
-		;
-constant        : NAME {
-			GString* s = g_string_new($1);
-			g_string_prepend_c(s, ' ');
-			g_free($1);
-			$$ = s;
-		}
-		| NUMBER {
-			GString* s = g_string_new("");
-			g_string_sprintf(s, " %i", $1);
-			$$ = s;
+
+gthumb_text_tag	: BEGIN_TEXT_TAG attribute_list END_TAG {
+			$$ = gth_tag_new (GTH_TAG_TEXT, $2);
 		}
 		;
-constant_list   : constant constant_list {
-			if ($2 != NULL)
-			{
-				g_string_append($1, $2->str);
-				g_string_free($2, TRUE);
-			}
-			$$ = $1;
-		}
-		| /* empty */ {
-			$$ = NULL;
+
+gthumb_tag 	: BEGIN_TAG tag_type attribute_list END_TAG {
+			$$ = gth_tag_new ($2, $3);
 		}
-		;
-gthumb_text_tag	: TEXT arg_list END_TAG {
-			$$ = gth_tag_new ($1, $2);
+		
+		| SET_VAR attribute_list END_TAG {
+			$$ = gth_tag_new (GTH_TAG_SET_VAR, $2);
 		}
 		;
 
-gthumb_tag 	: tag_name arg_list END_TAG {
-			$$ = gth_tag_new ($1, $2);
+tag_type	: FUNCTION_NAME {
+			$$ = gth_tag_get_type_from_name ($1);
+			if ($$ == GTH_TAG_INVALID) {
+				yyerror ("Unrecognized function: %s", $1);
+				YYERROR;
+			}
 		}
 		;
 
-tag_name	: HEADER              { $$ = $1; }
-		| FOOTER              { $$ = $1; }
-		| LANGUAGE            { $$ = $1; }
-		| THEME_LINK          { $$ = $1; }
-		| IMAGE               { $$ = $1; }
-		| IMAGE_LINK          { $$ = $1; }
-		| IMAGE_IDX           { $$ = $1; }
-		| IMAGE_DIM           { $$ = $1; }
-		| IMAGES              { $$ = $1; }
-		| FILENAME            { $$ = $1; }
-		| FILEPATH            { $$ = $1; }
-		| FILESIZE            { $$ = $1; }
-		| COMMENT             { $$ = $1; }
-		| PLACE               { $$ = $1; }
-		| DATE_TIME           { $$ = $1; }
-		| PAGE_LINK           { $$ = $1; }
-		| PAGE_IDX            { $$ = $1; }
-		| PAGE_ROWS           { $$ = $1; }
-		| PAGE_COLS           { $$ = $1; }
-		| PAGES               { $$ = $1; }
-		| TABLE               { $$ = $1; }
-		| THUMBS              { $$ = $1; }
-		| DATE                { $$ = $1; }
-		| EXIF_EXPOSURE_TIME  { $$ = $1; }
-		| EXIF_EXPOSURE_MODE  { $$ = $1; }
-		| EXIF_FLASH          { $$ = $1; }
-		| EXIF_SHUTTER_SPEED  { $$ = $1; }
-		| EXIF_APERTURE_VALUE { $$ = $1; }
-		| EXIF_FOCAL_LENGTH   { $$ = $1; }
-		| EXIF_DATE_TIME      { $$ = $1; }
-		| EXIF_CAMERA_MODEL   { $$ = $1; }
-		| SET_VAR             { $$ = $1; }
-		| EVAL                { $$ = $1; }
-		;
-
-arg_list	: arg arg_list {
+attribute_list	: attribute attribute_list {
 			$$ = g_list_prepend ($2, $1);
 		}
 
@@ -424,22 +353,12 @@ arg_list	: arg arg_list {
 		}
 		;
 
-arg		: NAME '=' expr {
-			$$ = gth_var_new_expression ($1, $3);
-			g_free ($1);
-		}
-
-		| NAME '=' '\'' quoted_expr '\'' {
-			$$ = gth_var_new_expression ($1, $4);
-			g_free($1);
-		}
-
-		| NAME '=' '"' quoted_expr '"' {
+attribute	: ATTRIBUTE_NAME '=' '"' expr '"' {
 			$$ = gth_var_new_expression ($1, $4);
-			g_free($1);
+			g_free ($1);
 		}
 
-		| NAME {
+		| ATTRIBUTE_NAME {
 		  	GthExpr *e = gth_expr_new ();
 			gth_expr_push_constant (e, 1);
 			$$ = gth_var_new_expression ($1, e);
@@ -448,9 +367,9 @@ arg		: NAME '=' expr {
 		;
 
 
-
 %%
 
+
 int
 gth_albumtheme_yywrap (void)
 {
diff --git a/extensions/webalbums/data/albumthemes/ClassicClips/image.gthtml b/extensions/webalbums/data/albumthemes/ClassicClips/image.gthtml
index 8d6d928..35bebf0 100644
--- a/extensions/webalbums/data/albumthemes/ClassicClips/image.gthtml
+++ b/extensions/webalbums/data/albumthemes/ClassicClips/image.gthtml
@@ -1,17 +1,17 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
   "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>
-<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="<gthumb:language/>">
+<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="<%= language %>">
 <head>
-<gthumb:if images > 1 />
-  <title><gthumb:header/> (<gthumb:image_idx/>/<gthumb:images/>)</title>
-<gthumb:else/>
-  <title><gthumb:header/></title>
-<gthumb:end/>
+<% if images > 1 %>
+  <title><%= header %> (<%= image_idx %>/<%= images %>)</title>
+<% else %>
+  <title><%= header %></title>
+<% end %>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   <meta name="Generator" content="gThumb Image Viewer" />
-  <link href="<gthumb:theme_link src='layout.css'/>" rel="stylesheet" type="text/css" />
-  <link href="<gthumb:theme_link src='style.css'/>" rel="stylesheet" type="text/css" />
+  <link href="<%= theme_link src="layout.css" %>" rel="stylesheet" type="text/css" />
+  <link href="<%= theme_link src="style.css" %>" rel="stylesheet" type="text/css" />
 </head>
 <body>
 
@@ -23,7 +23,7 @@
 <table class="title" summary="title bar">
 <tr>
   <td>
-  <span class="title"><gthumb:header/></span>
+  <span class="title"><%= header %></span>
   </td>
 </tr>
 </table>
@@ -37,37 +37,37 @@
 <table class="full_size" summary="navigation bar">
 <tr>
   <td class="button">
-    <a href="<gthumb:page_link idx_relative=0 image_idx/>">
-        <img src="<gthumb:theme_link src='back.png'/>" alt="Back" />
+    <a href="<%= page_link idx_relative="0" image_idx %>">
+        <img src="<%= theme_link src="back.png" %>" alt="Back" />
     </a>
   </td>
   <td>
     &nbsp;
   </td>
   <td class="button">
-<gthumb:if image_idx == 1 />
-    <img src="<gthumb:theme_link src='background.gif'/>" alt="void" />
-<gthumb:else/>
-    <a href="<gthumb:image_link idx_relative=-1/>">
-        <img src="<gthumb:theme_link src='prev.png'/>" alt="Previous" />
+<% if image_idx == 1  %>
+    <img src="<%= theme_link src="background.gif' %>" alt="void" />
+<% else %>
+    <a href="<%= image_link idx_relative="-1" %>">
+        <img src="<%= theme_link src="prev.png" %>" alt="Previous" />
     </a>
-<gthumb:end/>
+<% end %>
   </td>
   <td class="button">
-<gthumb:if images == 1 />
-    <img src="<gthumb:theme_link src='background.gif'/>" alt="void" />
-<gthumb:else/>
-    <span class="page_index"><gthumb:image_idx/> / <gthumb:images/></span>
-<gthumb:end/>
+<% if images == 1 %>
+    <img src="<%= theme_link src="background.gif" %>" alt="void" />
+<% else %>
+    <span class="page_index"><%= image_idx %> / <%= images %></span>
+<% end %>
   </td>
   <td class="button">
-<gthumb:if image_idx == images />
-    <img src="<gthumb:theme_link src='background.gif'/>" alt="void" />
-<gthumb:else/>
-    <a href="<gthumb:image_link idx_relative=+1/>">
-        <img src="<gthumb:theme_link src='next.png'/>" alt="Next" />
+<% if image_idx == images  %>
+    <img src="<%= theme_link src="background.gif" %>" alt="void" />
+<% else %>
+    <a href="<%= image_link idx_relative="+1" %>">
+        <img src="<%= theme_link src="next.png" %>" alt="Next" />
     </a>
-<gthumb:end/>
+<% end %>
   </td>
 </tr>
 </table>
@@ -77,101 +77,19 @@
 <tr>
 <td>
 
-<!-- Thumbnails and preview -->
+<!-- Preview -->
 <table class="row" summary="preview">
 <tr>
   <td>
-    <a href="<gthumb:file_name with_relative_path/>"><gthumb:image preview class="preview"/>
-    </a>
+    <% if copy_originals %>    
+    <a href="<%= file_name with_relative_path %>"><%= image preview class="preview" %></a>
+    <% else %>
+    <%= image preview class="preview" %>
+    <% end %>
   </td>
 </tr>
 </table>
 
-<!-- Comment and Exif data -->
-<div class="properties">
-<div class="preview_comment">
-  <span class="comment">
-    <gthumb:if comment_visibility_image/>
-      <gthumb:comment/> <br />
-    <gthumb:end/>
-    <gthumb:if place_visibility_image/>
-      <gthumb:place/> <br />
-    <gthumb:end/>
-    <gthumb:if date_time_visibility_image/>
-      <gthumb:date_time/>
-    <gthumb:end/>
-  </span><br />
-</div>
-<table summary="image properties">
-<gthumb:if file_name_visibility_image/>
-<tr>
-  <td><span class="property"><gthumb:text>Image</gthumb:text></span></td>
-  <td><span class="property_value file_name"><gthumb:file_name utf8="1" /></span></td>
-</tr>
-<gthumb:end/>
-<gthumb:if image_dim_visibility_image/>
-<tr>
-  <td><span class="property"><gthumb:text>Dimensions</gthumb:text></span></td>
-  <td><span class="property_value image_dim"><gthumb:image_dim/> pixels</span></td>
-</tr>
-<gthumb:end/>
-<gthumb:if file_size_visibility_image/>
-<tr>
-  <td><span class="property"><gthumb:text>Bytes</gthumb:text></span></td>
-  <td><span class="property_value file_size"><gthumb:file_size/></span></td>
-</tr>
-<gthumb:end/>
-<gthumb:if exif_date_time_visibility_image/>
-<tr>
-  <td><span class="property"><gthumb:text>Date</gthumb:text></span></td>
-  <td><span class="property_value date_time"><gthumb:exif:date_time/></span></td>
-</tr>
-<gthumb:end/>
-<gthumb:if exif_exposure_time_visibility_image/>
-<tr>
-  <td><span class="property"><gthumb:text>Exposure time</gthumb:text></span></td>
-  <td><span class="property_value exif"><gthumb:exif:exposure_time/></span></td>
-</tr>
-<gthumb:end/>
-<gthumb:if exif_exposure_mode_visibility_image/>
-<tr>
-  <td><span class="property"><gthumb:text>Exposure mode</gthumb:text></span></td>
-  <td><span class="property_value exif"><gthumb:exif:exposure_mode/></span></td>
-</tr>
-<gthumb:end/>
-<gthumb:if exif_flash_visibility_image/>
-<tr>
-  <td><span class="property"><gthumb:text>Flash</gthumb:text></span></td>
-  <td><span class="property_value exif"><gthumb:exif:flash/></span></td>
-</tr>
-<gthumb:end/>
-<gthumb:if exif_shutter_speed_visibility_image/>
-<tr>
-  <td><span class="property"><gthumb:text>Shutter speed</gthumb:text></span></td>
-  <td><span class="property_value exif"><gthumb:exif:shutter_speed/></span></td>
-</tr>
-<gthumb:end/>
-<gthumb:if exif_aperture_value_visibility_image/>
-<tr>
-  <td><span class="property"><gthumb:text>Aperture value</gthumb:text></span></td>
-  <td><span class="property_value exif"><gthumb:exif:aperture_value/></span></td>
-</tr>
-<gthumb:end/>
-<gthumb:if exif_focal_length_visibility_image/>
-<tr>
-  <td><span class="property"><gthumb:text>Focal length</gthumb:text></span></td>
-  <td><span class="property_value exif"><gthumb:exif:focal_length/></span></td>
-</tr>
-<gthumb:end/>
-<gthumb:if exif_camera_model_visibility_image/>
-<tr>
-  <td><span class="property"><gthumb:text>Camera model</gthumb:text></span></td>
-  <td><span class="property_value exif"><gthumb:exif:camera_model/></span></td>
-</tr>
-<gthumb:end/>
-</table>
-</div>
-
 </td>
 </tr>
 <tr>
@@ -181,7 +99,7 @@
 <table class="full_size" summary="copyright">
 <tr>
   <td>
-  <span class="copyright"><gthumb:footer/></span>
+  <span class="copyright"><%= footer %></span>
   </td>
 </tr>
 </table>
diff --git a/extensions/webalbums/data/albumthemes/ClassicClips/index.gthtml b/extensions/webalbums/data/albumthemes/ClassicClips/index.gthtml
index 2196660..db0c989 100644
--- a/extensions/webalbums/data/albumthemes/ClassicClips/index.gthtml
+++ b/extensions/webalbums/data/albumthemes/ClassicClips/index.gthtml
@@ -1,103 +1,101 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
   "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>
-<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="<gthumb:language/>">
+<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="<%= language %>">
 <head>
-<gthumb:if pages > 1 />
-  <title><gthumb:header/> (<gthumb:page_idx/>/<gthumb:pages/>)</title>
-<gthumb:else/>
-  <title><gthumb:header/></title>
-<gthumb:end/>
+<% if pages > 1 %>
+  <title><%= header %> (<%= page_idx %>/<%= pages %>)</title>
+<% else %>
+  <title><%= header %></title>
+<% end %>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   <meta name="Generator" content="gThumb Image Viewer" />
-  <link href="<gthumb:theme_link src='layout.css'/>" rel="stylesheet" type="text/css" />
-  <link href="<gthumb:theme_link src='style.css'/>" rel="stylesheet" type="text/css" />
+  <link href="<%= theme_link src="layout.css" %>" rel="stylesheet" type="text/css" />
+  <link href="<%= theme_link src="style.css" %>" rel="stylesheet" type="text/css" />
 </head>
-<gthumb:set_var thumbnail_width="159" thumbnail_height="120"/>
-<gthumb:set_var preview_width="450" preview_height="400"/>
+<% set_var thumbnail_width="159" thumbnail_height="120" %>
+<% set_var preview_width="650" preview_height="600" %>
 <body>
 
-<table class="full_size" summary="page body">
-<tr>
-<td class="title">
+  <table class="full_size" summary="page body">
+  <tr>
+    <td class="title">
 
-<!-- Title -->
-<table class="title" summary="title bar">
-<tr>
-  <td>
-  <span class="title"><gthumb:header/></span>
-  </td>
-</tr>
-</table>
+      <!-- Title -->
+      <table class="title" summary="title bar">
+      <tr>
+        <td>
+          <span class="title"><%= header %></span>
+        </td>
+      </tr>
+      </table>
 
-</td>
-</tr>
-<tr>
-<td class="nav_bar">
+    </td>
+  </tr>
+  <tr>
+    <td class="nav_bar">
 
-<!-- Navigation Bar -->
-<table class="full_size" summary="navigation bar">
-<tr>
-  <td>
-    &nbsp;
-  </td>
-  <td class="button">
-<gthumb:if page_idx == 1 />
-    <img src="<gthumb:theme_link src='background.gif'/>" alt="void" />
-<gthumb:else/>
-    <a href="<gthumb:page_link idx_relative=-1/>">
-        <img src="<gthumb:theme_link src='prev.png'/>" alt="Previous" />
-    </a>
-<gthumb:end/>
-  </td>
-  <td class="button">
-<gthumb:if pages == 1 />
-    <img src="<gthumb:theme_link src='background.gif'/>" alt="void" />
-<gthumb:else/>
-    <span class="page_index"><gthumb:page_idx/> / <gthumb:pages/></span>
-<gthumb:end/>
-  </td>
-  <td class="button">
-<gthumb:if page_idx == pages />
-    <img src="<gthumb:theme_link src='background.gif'/>" alt="void" />
-<gthumb:else/>
-    <a href="<gthumb:page_link idx_relative=+1/>">
-        <img src="<gthumb:theme_link src='next.png'/>" alt="Next" />
-    </a>
-<gthumb:end/>
-  </td>
-</tr>
-</table>
+      <!-- Navigation Bar -->
+      <table class="full_size" summary="navigation bar">
+      <tr>
+        <td>
+          &nbsp;
+        </td>
+        <td class="button">
+          <% if page_idx == 1 %>
+          <img src="<%= theme_link src="background.gif" %>" alt="void" />
+          <% else %>
+          <a href="<%= page_link idx_relative="-1" %>">
+            <img src="<%= theme_link src="prev.png" %>" alt="Previous" />
+          </a>
+          <% end %>
+        </td>
+        <td class="button">
+          <% if pages == 1 %>
+          <img src="<%= theme_link src="background.gif" %>" alt="void" />
+          <% else %>
+          <span class="page_index"><%= page_idx %> / <%= pages %></span>
+          <% end %>
+        </td>
+        <td class="button">
+          <% if page_idx == pages %>
+          <img src="<%= theme_link src="background.gif" %>" alt="void" />
+          <% else %>
+          <a href="<%= page_link idx_relative="+1" %>">
+            <img src="<%= theme_link src="next.png" %>" alt="Next" />
+          </a>
+          <% end %>
+        </td>
+      </tr>
+      </table>
 
-</td>
-</tr>
-<tr>
-<td>
+    </td>
+  </tr>
+  <tr>
+    <td>
 
-<!-- Photos -->
-<div class="thumbnails">
-<table summary="thumbnails">
-<gthumb:table/>
-</table>
-</div>
+      <!-- Photos -->
+      <div id="thumbnail-list">
+        <%= thumbnails %>
+      </div>
 
-</td>
-</tr>
-<tr>
-<td class="footer">
+    </td>
+  </tr>
+  <tr>
+    <td class="footer">
 
-<!-- Footer -->
-<table class="full_size" summary="copyright">
-<tr>
-  <td>
-  <span class="copyright"><gthumb:footer/></span>
-  </td>
-</tr>
-</table>
+      <!-- Footer -->
+      <table class="full_size" summary="copyright">
+      <tr>
+        <td>
+          <span class="copyright"><%= footer %></span>
+        </td>
+      </tr>
+      </table>
 
-</td>
-</tr>
-</table>
+    </td>
+  </tr>
+  </table>
 
 </body>
 </html>
diff --git a/extensions/webalbums/data/albumthemes/ClassicClips/layout.css b/extensions/webalbums/data/albumthemes/ClassicClips/layout.css
index 93083c5..856baec 100644
--- a/extensions/webalbums/data/albumthemes/ClassicClips/layout.css
+++ b/extensions/webalbums/data/albumthemes/ClassicClips/layout.css
@@ -1,4 +1,4 @@
-/* Gthumb "Classic" layout, v. 2005-02-25 */
+/* gthumb "ClassicClips" layout, v. 2010-06-11 */
 
 html, body {
 	height: 100%;
@@ -45,6 +45,7 @@ td.nav_bar {
 
 td.button {
 	width: 60px;
+	min-height: 60px;
 	white-space: nowrap;
 }
 
@@ -57,7 +58,6 @@ td.footer {
 	height: 3em;
 }
 
-
 /* image.gthtml */
 
 td.left_thumbnail {
@@ -87,56 +87,79 @@ div.properties table td {
 	padding: 0.2em 1em 0.2em 0em;
 }
 
+/* index */
 
+#thumbnail-grid {
+	margin: auto;
+}
 
-/* index.gthtml */
+#thumbnail-grid td.td_index,
+#thumbnail-grid td.td_empty_index {
+	xwidth: 215px;
+	xpadding: 8px 5px 8px 5px;
+	vertical-align: middle;
+}
 
-div.thumbnails table {
-	margin:auto;
+#thumbnail-grid td.td_empty_index {
+	height: 150px;
 }
 
-td.td_index {
-	width: 215px;
-	padding: 8px 5px 8px 5px;
-	vertical-align: top;
+/* thumbnails */
+
+#thumbnail-list div.thumbnail-caption-container {
+	float: left;
+	margin: 10px;
 }
 
+#thumbnail-list div.thumbnail-container {
+}
 
-/* thumbnail.gthtml */
+#thumbnail-list div.thumbnail-top {
+	background: url(top.png) no-repeat top left;
+	width: 205px;
+	height: 21px;
+}
 
-table.photo {
-	cursor: pointer;
+#thumbnail-list div.thumbnail-bottom {
+	clear: both;
+	background: url(bot.png) no-repeat bottom left;
+	width: 205px;
+	height: 26px;
 }
 
-td.photo {
-	background-color: white;
-	width: 162px;
-	height: 122px;
+#thumbnail-list div.thumbnail-center {
+	background: #fff;
+	overflow: hidden;
+	float: left;
 }
 
-img.photo_top {
-	border-style: none;
-	vertical-align: bottom;
+#thumbnail-list div.thumbnail-left {
+	background: url(left.png) no-repeat top left;
+	width: 205px;
+	height: 100%;
 }
 
-img.photo_bottom {
-	border-style: none;
-	vertical-align: top;
+#thumbnail-list div.thumbnail-right {
+	background: url(right.png) no-repeat top right;
+	width: 205px;
+	height: 100%;
 }
 
-img.photo_left {
-	border-style: none;
-	text-align: right;
-	vertical-align: top;
+#thumbnail-list div.thumbnail-image-container {
+	width: 205px;
+	height: 100%;
 }
 
-img.photo_right {
+#thumbnail-list a.thumbnail-image img {
+	display: block;
+	margin: 0 auto;
 	border-style: none;
-	text-align: left;
-	vertical-align: top;
+	padding: 0;
 }
 
-img.photo_center {
-	border-style: none;
-	vertical-align: top;
+#thumbnail-list div.caption-container {
+}
+
+#thumbnail-list div.property-row {
+	text-align: center;
 }
diff --git a/extensions/webalbums/data/albumthemes/ClassicClips/style.css b/extensions/webalbums/data/albumthemes/ClassicClips/style.css
index a5e8eee..413caad 100644
--- a/extensions/webalbums/data/albumthemes/ClassicClips/style.css
+++ b/extensions/webalbums/data/albumthemes/ClassicClips/style.css
@@ -1,4 +1,4 @@
-/* Gthumb "Classic" style, v. 2005-02-25 */
+/* gthumb "ClassicClips" style, v. 2010-06-11 */
 
 /* Common */
 
@@ -25,10 +25,8 @@ span.copyright {
 	font-size: small;
 }
 
-
 /* image.gthtml */
 
-
 img.preview {
 	border: solid 2px white;
 }
@@ -70,7 +68,6 @@ td.td_index span.image_dim {
 	font-weight: bold;
 }
 
-
 /* links */
 
 a:link { 
@@ -91,3 +88,7 @@ a:hover {
 	color: #FFD700;
 }
 
+.property-name {
+	font-weight: bold;
+	cursor: default;
+}
diff --git a/extensions/webalbums/data/albumthemes/ClassicClips/thumbnail.gthtml b/extensions/webalbums/data/albumthemes/ClassicClips/thumbnail.gthtml
index 6eb7c29..dfbf77f 100644
--- a/extensions/webalbums/data/albumthemes/ClassicClips/thumbnail.gthtml
+++ b/extensions/webalbums/data/albumthemes/ClassicClips/thumbnail.gthtml
@@ -1,71 +1,33 @@
-      <table class="photo" summary="photo">
-      <tr>
-        <td colspan="3"><img class="photo_top" src="<gthumb:theme_link src='top.png'/>" alt="Top" /></td>
-      </tr>
-      <tr>
-        <td><img class="photo_left" src="<gthumb:theme_link src='left.png'/>" alt="Left" /></td>
-        <td class="photo">
-          <a href="<gthumb:image_link/>">
-            <gthumb:image thumbnail class="photo_center" /></a>
-        </td>
-        <td><img class="photo_right" src="<gthumb:theme_link src='right.png'/>" alt="Right" /></td>
-      </tr>
-      <tr>
-        <td colspan="3"><img class="photo_bottom" src="<gthumb:theme_link src='bot.png'/>" alt="Bottom" /></td>
-      </tr>
-      </table>
+    <div class="thumbnail-caption-container">
 
-<span class="comment">
-  <gthumb:if comment_visibility_index/>
-    <gthumb:comment/> <br />
-  <gthumb:end/>
-  <gthumb:if place_visibility_index/>
-    <gthumb:place/> <br />
-  <gthumb:end/>
-  <gthumb:if date_time_visibility_index/>
-    <gthumb:date_time/>
-  <gthumb:end/>
-</span><br />
+      <div class="thumbnail-container">
+        <div class="thumbnail-top">
+        </div>
+        <div class="thumbnail-center">
+          <div class="thumbnail-left">
+            <div class="thumbnail-right">
+              <div class="thumbnail-image-container">
+                <a class="thumbnail-image" href="<%= image_link %>"><%= image thumbnail %></a>
+              </div>
+            </div>
+          </div>
+        </div>
+        <div class="thumbnail-bottom">
+        </div>
+      </div>
 
-<gthumb:if image_dim_visibility_index/>
-      <span class="property_value image_dim"><gthumb:image_dim/></span>
-<gthumb:if file_size_visibility_index/>
-      <span class="property_value file_size">(<gthumb:file_size/>)</span>
-<gthumb:end/>
-<gthumb:else/>
-<gthumb:if file_size_visibility_index/>
-      <span class="property_value file_size"><gthumb:file_size/></span>
-<gthumb:end/>
-<gthumb:end/>
-<gthumb:if image_dim_visibility_index || file_size_visibility_index/>
-      <br />
-<gthumb:end/>
+      <% for_each_thumbnail_caption %>
+        <% if first_item %>
+          <div class="caption-container">
+        <% end %>
 
-<gthumb:if file_name_visibility_index/>
-      <span class="property_value file_name"><gthumb:file_name utf8="1" /></span><br />
-<gthumb:end/>
+          <div class="property-row">
+            <span class="property-value" title="<%= item_attribute display_name %>"> <%= item_attribute value %> </span>
+          </div>
 
-<gthumb:if exif_date_time_visibility_index/>
-      <span class="property_value exif"><gthumb:exif:date_time/></span><br />
-<gthumb:end/>
-<gthumb:if exif_exposure_time_visibility_index/>
-      <span class="property_value exif"><gthumb:exif:exposure_time/></span><br />
-<gthumb:end/>
-<gthumb:if exif_exposure_mode_visibility_index/>
-      <span class="property_value exif"><gthumb:exif:exposure_mode/></span><br />
-<gthumb:end/>
-<gthumb:if exif_flash_visibility_index/>
-      <span class="property_value exif"><gthumb:exif:flash/></span><br />
-<gthumb:end/>
-<gthumb:if exif_shutter_speed_visibility_index/>
-      <span class="property_value exif"><gthumb:exif:shutter_speed/></span><br />
-<gthumb:end/>
-<gthumb:if exif_aperture_value_visibility_index/>
-      <span class="property_value exif"><gthumb:exif:aperture_value/></span><br />
-<gthumb:end/>
-<gthumb:if exif_focal_length_visibility_index/>
-      <span class="property_value exif"><gthumb:exif:focal_length/></span><br />
-<gthumb:end/>
-<gthumb:if exif_camera_model_visibility_index/>
-      <span class="property_value exif"><gthumb:exif:camera_model/></span>
-<gthumb:end/>
+        <% if last_item %>
+          </div>
+        <% end %>
+      <% end %>
+
+    </div> <!-- thumbnail-caption-container -->
diff --git a/extensions/webalbums/data/gthumb_webalbums.schemas.in b/extensions/webalbums/data/gthumb_webalbums.schemas.in
index 6c43d61..3dca356 100644
--- a/extensions/webalbums/data/gthumb_webalbums.schemas.in
+++ b/extensions/webalbums/data/gthumb_webalbums.schemas.in
@@ -171,11 +171,11 @@
       </schema>
 
       <schema>
-	<key>/schemas/apps/gthumb/ext/webalbums/columns</key>
-	<applyto>/apps/gthumb/ext/webalbums/columns</applyto>
+	<key>/schemas/apps/gthumb/ext/webalbums/images_per_index</key>
+	<applyto>/apps/gthumb/ext/webalbums/images_per_index</applyto>
 	<owner>gthumb</owner>
 	<type>int</type>
-	<default>4</default>
+	<default>16</default>
 	<locale name="C">
 	  <short></short>
 	  <long>
@@ -184,8 +184,21 @@
       </schema>
 
       <schema>
-	<key>/schemas/apps/gthumb/ext/webalbums/rows</key>
-	<applyto>/apps/gthumb/ext/webalbums/rows</applyto>
+        <key>/schemas/apps/gthumb/ext/webalbums/single_index</key>
+        <applyto>/apps/gthumb/ext/webalbums/single_index</applyto>
+        <owner>gthumb</owner>
+        <type>bool</type>
+        <default>false</default>
+        <locale name="C">
+          <short></short>
+          <long>
+          </long>
+        </locale>
+      </schema>
+
+      <schema>
+	<key>/schemas/apps/gthumb/ext/webalbums/columns</key>
+	<applyto>/apps/gthumb/ext/webalbums/columns</applyto>
 	<owner>gthumb</owner>
 	<type>int</type>
 	<default>4</default>
@@ -197,8 +210,8 @@
       </schema>
 
       <schema>
-        <key>/schemas/apps/gthumb/ext/webalbums/single_index</key>
-        <applyto>/apps/gthumb/ext/webalbums/single_index</applyto>
+        <key>/schemas/apps/gthumb/ext/webalbums/adapt_to_width</key>
+        <applyto>/apps/gthumb/ext/webalbums/adapt_to_width</applyto>
         <owner>gthumb</owner>
         <type>bool</type>
         <default>false</default>
diff --git a/extensions/webalbums/data/ui/web-album-exporter.ui b/extensions/webalbums/data/ui/web-album-exporter.ui
index 96e062e..9414203 100644
--- a/extensions/webalbums/data/ui/web-album-exporter.ui
+++ b/extensions/webalbums/data/ui/web-album-exporter.ui
@@ -71,8 +71,8 @@
                                 <child>
                                   <object class="GtkFileChooserButton" id="destination_filechooserbutton">
                                     <property name="visible">True</property>
-                                    <property name="local_only">False</property>
                                     <property name="action">select-folder</property>
+                                    <property name="local_only">False</property>
                                     <property name="title" translatable="yes">Choose destination folder</property>
                                   </object>
                                   <packing>
@@ -186,6 +186,83 @@
                   </packing>
                 </child>
                 <child>
+                  <object class="GtkFrame" id="frame6">
+                    <property name="visible">True</property>
+                    <property name="label_xalign">0</property>
+                    <property name="shadow_type">none</property>
+                    <child>
+                      <object class="GtkAlignment" id="alignment8">
+                        <property name="visible">True</property>
+                        <property name="top_padding">6</property>
+                        <property name="left_padding">12</property>
+                        <child>
+                          <object class="GtkScrolledWindow" id="scrolledwindow4">
+                            <property name="width_request">465</property>
+                            <property name="height_request">355</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="hscrollbar_policy">automatic</property>
+                            <property name="vscrollbar_policy">automatic</property>
+                            <property name="shadow_type">in</property>
+                            <child>
+                              <object class="GtkIconView" id="theme_iconview">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="selection_mode">browse</property>
+                                <property name="model">theme_liststore</property>
+                                <child>
+                                  <object class="GtkCellRendererPixbuf" id="cellrenderertext3">
+                                    <property name="follow_state">True</property>
+                                  </object>
+                                  <attributes>
+                                    <attribute name="pixbuf">2</attribute>
+                                  </attributes>
+                                </child>
+                                <child>
+                                  <object class="GtkCellRendererText" id="cellrenderertext4"/>
+                                  <attributes>
+                                    <attribute name="text">1</attribute>
+                                  </attributes>
+                                </child>
+                              </object>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                    <child type="label">
+                      <object class="GtkLabel" id="label13">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">Theme</property>
+                        <property name="use_markup">True</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                        </attributes>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+            </child>
+            <child type="tab">
+              <object class="GtkLabel" id="label3">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">General</property>
+              </object>
+              <packing>
+                <property name="tab_fill">False</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkVBox" id="vbox2">
+                <property name="visible">True</property>
+                <property name="border_width">6</property>
+                <property name="orientation">vertical</property>
+                <property name="spacing">12</property>
+                <child>
                   <object class="GtkFrame" id="frame3">
                     <property name="visible">True</property>
                     <property name="label_xalign">0</property>
@@ -198,154 +275,336 @@
                         <child>
                           <object class="GtkTable" id="table3">
                             <property name="visible">True</property>
-                            <property name="n_rows">3</property>
+                            <property name="n_rows">6</property>
                             <property name="n_columns">2</property>
                             <property name="column_spacing">6</property>
                             <property name="row_spacing">6</property>
                             <child>
-                              <object class="GtkCheckButton" id="single_index_checkbutton">
-                                <property name="label" translatable="yes">or _use a single index page</property>
+                              <object class="GtkLabel" id="label112">
                                 <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">False</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">S_ort:</property>
                                 <property name="use_underline">True</property>
-                                <property name="draw_indicator">True</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">2</property>
+                                <property name="bottom_attach">3</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkHBox" id="hbox62">
+                                <property name="visible">True</property>
+                                <property name="spacing">6</property>
+                                <child>
+                                  <object class="GtkComboBox" id="sort_combobox">
+                                    <property name="visible">True</property>
+                                    <property name="model">sort_liststore</property>
+                                    <child>
+                                      <object class="GtkCellRendererText" id="cellrenderertext2"/>
+                                      <attributes>
+                                        <attribute name="text">1</attribute>
+                                      </attributes>
+                                    </child>
+                                  </object>
+                                  <packing>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="reverse_order_checkbutton">
+                                    <property name="label" translatable="yes">Re_verse order</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">False</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="draw_indicator">True</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
                               </object>
                               <packing>
                                 <property name="left_attach">1</property>
                                 <property name="right_attach">2</property>
+                                <property name="top_attach">2</property>
+                                <property name="bottom_attach">3</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options">GTK_FILL</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="label18">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">Columns:</property>
+                              </object>
+                              <packing>
                                 <property name="top_attach">1</property>
                                 <property name="bottom_attach">2</property>
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkTable" id="columns_rows_table">
+                              <object class="GtkLabel" id="label86">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">_Header:</property>
+                                <property name="use_underline">True</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">3</property>
+                                <property name="bottom_attach">4</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkEntry" id="index_page_header_entry">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="invisible_char">&#x25CF;</property>
+                                <property name="activates_default">True</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">3</property>
+                                <property name="bottom_attach">4</property>
+                                <property name="y_options">GTK_FILL</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="label122">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">_Footer:</property>
+                                <property name="use_underline">True</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">4</property>
+                                <property name="bottom_attach">5</property>
+                                <property name="x_options">GTK_FILL</property>
+                                <property name="y_options"></property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkEntry" id="index_page_footer_entry">
                                 <property name="visible">True</property>
-                                <property name="n_rows">2</property>
+                                <property name="can_focus">True</property>
+                                <property name="invisible_char">&#x25CF;</property>
+                                <property name="activates_default">True</property>
+                                <property name="secondary_icon_stock">gtk-help</property>
+                                <property name="secondary_icon_activatable">True</property>
+                                <property name="secondary_icon_sensitive">True</property>
+                                <property name="secondary_icon_tooltip_text">Help</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">4</property>
+                                <property name="bottom_attach">5</property>
+                                <property name="y_options">GTK_FILL</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkTable" id="page_footer_help_table">
+                                <property name="n_rows">4</property>
                                 <property name="n_columns">2</property>
-                                <property name="column_spacing">6</property>
+                                <property name="column_spacing">12</property>
                                 <property name="row_spacing">6</property>
                                 <child>
-                                  <object class="GtkSpinButton" id="cols_spinbutton">
+                                  <object class="GtkLabel" id="label7">
                                     <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="invisible_char">&#x25CF;</property>
-                                    <property name="adjustment">cols_adjustment</property>
-                                    <property name="climb_rate">1</property>
+                                    <property name="xalign">0</property>
+                                    <property name="label" translatable="yes">%p</property>
+                                    <attributes>
+                                      <attribute name="size" value="8000"/>
+                                    </attributes>
                                   </object>
                                   <packing>
-                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="top_attach">1</property>
+                                    <property name="bottom_attach">2</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkLabel" id="label133">
+                                  <object class="GtkLabel" id="label8">
                                     <property name="visible">True</property>
                                     <property name="xalign">0</property>
-                                    <property name="label" translatable="yes">columns,</property>
+                                    <property name="label" translatable="yes">%P</property>
+                                    <attributes>
+                                      <attribute name="size" value="8000"/>
+                                    </attributes>
                                   </object>
                                   <packing>
-                                    <property name="left_attach">1</property>
-                                    <property name="right_attach">2</property>
-                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="top_attach">2</property>
+                                    <property name="bottom_attach">3</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkSpinButton" id="rows_spinbutton">
+                                  <object class="GtkLabel" id="label10">
                                     <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="invisible_char">&#x25CF;</property>
-                                    <property name="adjustment">rows_adjustment</property>
-                                    <property name="climb_rate">1</property>
+                                    <property name="xalign">0</property>
+                                    <property name="label" translatable="yes">The current page number</property>
+                                    <attributes>
+                                      <attribute name="size" value="8000"/>
+                                    </attributes>
                                   </object>
                                   <packing>
+                                    <property name="left_attach">1</property>
+                                    <property name="right_attach">2</property>
                                     <property name="top_attach">1</property>
                                     <property name="bottom_attach">2</property>
-                                    <property name="x_options">GTK_FILL</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkLabel" id="label132">
+                                  <object class="GtkLabel" id="label11">
                                     <property name="visible">True</property>
                                     <property name="xalign">0</property>
-                                    <property name="label" translatable="yes">rows per page</property>
+                                    <property name="label" translatable="yes">The total number of pages</property>
+                                    <attributes>
+                                      <attribute name="size" value="8000"/>
+                                    </attributes>
                                   </object>
                                   <packing>
                                     <property name="left_attach">1</property>
                                     <property name="right_attach">2</property>
-                                    <property name="top_attach">1</property>
-                                    <property name="bottom_attach">2</property>
-                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="top_attach">2</property>
+                                    <property name="bottom_attach">3</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkLabel" id="label14">
+                                    <property name="visible">True</property>
+                                    <property name="xalign">0</property>
+                                    <property name="label" translatable="yes">Special code</property>
+                                    <attributes>
+                                      <attribute name="weight" value="bold"/>
+                                      <attribute name="size" value="8000"/>
+                                    </attributes>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkLabel" id="label15">
+                                    <property name="visible">True</property>
+                                    <property name="xalign">0</property>
+                                    <property name="label" translatable="yes">Description</property>
+                                    <attributes>
+                                      <attribute name="weight" value="bold"/>
+                                      <attribute name="size" value="8000"/>
+                                    </attributes>
+                                  </object>
+                                  <packing>
+                                    <property name="left_attach">1</property>
+                                    <property name="right_attach">2</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkLabel" id="label16">
+                                    <property name="visible">True</property>
+                                    <property name="xalign">0</property>
+                                    <property name="label" translatable="yes" comments="translate only the text in the curly brackets">%D{ format }</property>
+                                    <attributes>
+                                      <attribute name="size" value="8000"/>
+                                    </attributes>
+                                  </object>
+                                  <packing>
+                                    <property name="top_attach">3</property>
+                                    <property name="bottom_attach">4</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkLabel" id="label17">
+                                    <property name="visible">True</property>
+                                    <property name="xalign">0</property>
+                                    <property name="label" translatable="yes">The current date</property>
+                                    <attributes>
+                                      <attribute name="size" value="8000"/>
+                                    </attributes>
+                                  </object>
+                                  <packing>
+                                    <property name="left_attach">1</property>
+                                    <property name="right_attach">2</property>
+                                    <property name="top_attach">3</property>
+                                    <property name="bottom_attach">4</property>
                                   </packing>
                                 </child>
                               </object>
                               <packing>
                                 <property name="left_attach">1</property>
                                 <property name="right_attach">2</property>
+                                <property name="top_attach">5</property>
+                                <property name="bottom_attach">6</property>
+                                <property name="y_options">GTK_FILL</property>
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkAlignment" id="alignment3">
+                              <object class="GtkHBox" id="hbox1">
                                 <property name="visible">True</property>
-                                <property name="top_padding">4</property>
+                                <property name="spacing">6</property>
                                 <child>
-                                  <object class="GtkLabel" id="label99">
+                                  <object class="GtkSpinButton" id="cols_spinbutton">
                                     <property name="visible">True</property>
-                                    <property name="xalign">0</property>
-                                    <property name="yalign">0</property>
-                                    <property name="label" translatable="yes">_Size:</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="invisible_char">&#x25CF;</property>
+                                    <property name="adjustment">cols_adjustment</property>
+                                    <property name="climb_rate">1</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="adapt_column_checkbutton">
+                                    <property name="label" translatable="yes">_Adapt to the window width </property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">False</property>
                                     <property name="use_underline">True</property>
+                                    <property name="draw_indicator">True</property>
                                   </object>
+                                  <packing>
+                                    <property name="position">1</property>
+                                  </packing>
                                 </child>
                               </object>
                               <packing>
-                                <property name="x_options">GTK_FILL</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkLabel" id="label112">
-                                <property name="visible">True</property>
-                                <property name="xalign">0</property>
-                                <property name="label" translatable="yes">S_ort:</property>
-                                <property name="use_underline">True</property>
-                              </object>
-                              <packing>
-                                <property name="top_attach">2</property>
-                                <property name="bottom_attach">3</property>
-                                <property name="x_options">GTK_FILL</property>
-                                <property name="y_options"></property>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">1</property>
+                                <property name="bottom_attach">2</property>
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkHBox" id="hbox62">
+                              <object class="GtkHBox" id="hbox3">
                                 <property name="visible">True</property>
                                 <property name="spacing">6</property>
                                 <child>
-                                  <object class="GtkComboBox" id="sort_combobox">
+                                  <object class="GtkSpinButton" id="images_per_index_spinbutton">
                                     <property name="visible">True</property>
-                                    <property name="model">sort_liststore</property>
-                                    <child>
-                                      <object class="GtkCellRendererText" id="cellrenderertext2"/>
-                                      <attributes>
-                                        <attribute name="text">1</attribute>
-                                      </attributes>
-                                    </child>
+                                    <property name="can_focus">True</property>
+                                    <property name="invisible_char">&#x25CF;</property>
+                                    <property name="adjustment">rows_adjustment</property>
+                                    <property name="climb_rate">1</property>
                                   </object>
                                   <packing>
+                                    <property name="expand">False</property>
                                     <property name="position">0</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkCheckButton" id="reverse_order_checkbutton">
-                                    <property name="label" translatable="yes">Re_verse order</property>
+                                  <object class="GtkCheckButton" id="single_index_checkbutton">
+                                    <property name="label" translatable="yes">All images on a single page</property>
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">False</property>
-                                    <property name="use_underline">True</property>
                                     <property name="draw_indicator">True</property>
                                   </object>
                                   <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">False</property>
                                     <property name="position">1</property>
                                   </packing>
                                 </child>
@@ -353,13 +612,18 @@
                               <packing>
                                 <property name="left_attach">1</property>
                                 <property name="right_attach">2</property>
-                                <property name="top_attach">2</property>
-                                <property name="bottom_attach">3</property>
-                                <property name="x_options">GTK_FILL</property>
-                                <property name="y_options">GTK_FILL</property>
                               </packing>
                             </child>
                             <child>
+                              <object class="GtkLabel" id="label28">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">Images per page:</property>
+                                <property name="use_underline">True</property>
+                                <property name="mnemonic_widget">images_per_index_spinbutton</property>
+                              </object>
+                            </child>
+                            <child>
                               <placeholder/>
                             </child>
                           </object>
@@ -369,7 +633,7 @@
                     <child type="label">
                       <object class="GtkLabel" id="label6">
                         <property name="visible">True</property>
-                        <property name="label" translatable="yes">Index Layout</property>
+                        <property name="label" translatable="yes">Index Page</property>
                         <property name="use_markup">True</property>
                         <attributes>
                           <attribute name="weight" value="bold"/>
@@ -379,7 +643,7 @@
                   </object>
                   <packing>
                     <property name="expand">False</property>
-                    <property name="position">1</property>
+                    <property name="position">0</property>
                   </packing>
                 </child>
                 <child>
@@ -398,23 +662,56 @@
                             <property name="orientation">vertical</property>
                             <property name="spacing">6</property>
                             <child>
-                              <object class="GtkTable" id="table2">
+                              <object class="GtkTable" id="table1">
                                 <property name="visible">True</property>
-                                <property name="n_rows">3</property>
+                                <property name="n_rows">4</property>
                                 <property name="n_columns">2</property>
                                 <property name="column_spacing">6</property>
                                 <property name="row_spacing">6</property>
                                 <child>
-                                  <object class="GtkTable" id="template_help_table">
+                                  <object class="GtkLabel" id="label19">
+                                    <property name="visible">True</property>
+                                    <property name="xalign">0</property>
+                                    <property name="label" translatable="yes">_Footer:</property>
+                                    <property name="use_underline">True</property>
+                                  </object>
+                                  <packing>
+                                    <property name="top_attach">2</property>
+                                    <property name="bottom_attach">3</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="y_options"></property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkEntry" id="image_page_footer_entry">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="invisible_char">&#x25CF;</property>
+                                    <property name="activates_default">True</property>
+                                    <property name="secondary_icon_stock">gtk-help</property>
+                                    <property name="secondary_icon_activatable">True</property>
+                                    <property name="secondary_icon_sensitive">True</property>
+                                    <property name="secondary_icon_tooltip_text">Help</property>
+                                  </object>
+                                  <packing>
+                                    <property name="left_attach">1</property>
+                                    <property name="right_attach">2</property>
+                                    <property name="top_attach">2</property>
+                                    <property name="bottom_attach">3</property>
+                                    <property name="y_options">GTK_FILL</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkTable" id="image_footer_help_table">
                                     <property name="n_rows">4</property>
                                     <property name="n_columns">2</property>
                                     <property name="column_spacing">12</property>
                                     <property name="row_spacing">6</property>
                                     <child>
-                                      <object class="GtkLabel" id="label7">
+                                      <object class="GtkLabel" id="label20">
                                         <property name="visible">True</property>
                                         <property name="xalign">0</property>
-                                        <property name="label" translatable="yes">%P</property>
+                                        <property name="label" translatable="yes">%i</property>
                                         <attributes>
                                           <attribute name="size" value="8000"/>
                                         </attributes>
@@ -425,10 +722,10 @@
                                       </packing>
                                     </child>
                                     <child>
-                                      <object class="GtkLabel" id="label8">
+                                      <object class="GtkLabel" id="label21">
                                         <property name="visible">True</property>
                                         <property name="xalign">0</property>
-                                        <property name="label" translatable="yes">%N</property>
+                                        <property name="label" translatable="yes">%I</property>
                                         <attributes>
                                           <attribute name="size" value="8000"/>
                                         </attributes>
@@ -439,10 +736,10 @@
                                       </packing>
                                     </child>
                                     <child>
-                                      <object class="GtkLabel" id="label10">
+                                      <object class="GtkLabel" id="label22">
                                         <property name="visible">True</property>
                                         <property name="xalign">0</property>
-                                        <property name="label" translatable="yes">The current page number</property>
+                                        <property name="label" translatable="yes">The current image number</property>
                                         <attributes>
                                           <attribute name="size" value="8000"/>
                                         </attributes>
@@ -455,10 +752,10 @@
                                       </packing>
                                     </child>
                                     <child>
-                                      <object class="GtkLabel" id="label11">
+                                      <object class="GtkLabel" id="label23">
                                         <property name="visible">True</property>
                                         <property name="xalign">0</property>
-                                        <property name="label" translatable="yes">The total number of pages</property>
+                                        <property name="label" translatable="yes">The total number of images</property>
                                         <attributes>
                                           <attribute name="size" value="8000"/>
                                         </attributes>
@@ -471,7 +768,7 @@
                                       </packing>
                                     </child>
                                     <child>
-                                      <object class="GtkLabel" id="label14">
+                                      <object class="GtkLabel" id="label24">
                                         <property name="visible">True</property>
                                         <property name="xalign">0</property>
                                         <property name="label" translatable="yes">Special code</property>
@@ -482,7 +779,7 @@
                                       </object>
                                     </child>
                                     <child>
-                                      <object class="GtkLabel" id="label15">
+                                      <object class="GtkLabel" id="label25">
                                         <property name="visible">True</property>
                                         <property name="xalign">0</property>
                                         <property name="label" translatable="yes">Description</property>
@@ -497,7 +794,7 @@
                                       </packing>
                                     </child>
                                     <child>
-                                      <object class="GtkLabel" id="label16">
+                                      <object class="GtkLabel" id="label26">
                                         <property name="visible">True</property>
                                         <property name="xalign">0</property>
                                         <property name="label" translatable="yes" comments="translate only the text in the curly brackets">%D{ format }</property>
@@ -511,7 +808,7 @@
                                       </packing>
                                     </child>
                                     <child>
-                                      <object class="GtkLabel" id="label17">
+                                      <object class="GtkLabel" id="label27">
                                         <property name="visible">True</property>
                                         <property name="xalign">0</property>
                                         <property name="label" translatable="yes">The current date</property>
@@ -530,35 +827,16 @@
                                   <packing>
                                     <property name="left_attach">1</property>
                                     <property name="right_attach">2</property>
-                                    <property name="top_attach">2</property>
-                                    <property name="bottom_attach">3</property>
+                                    <property name="top_attach">3</property>
+                                    <property name="bottom_attach">4</property>
                                     <property name="y_options">GTK_FILL</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkEntry" id="footer_entry">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="invisible_char">&#x25CF;</property>
-                                    <property name="activates_default">True</property>
-                                    <property name="secondary_icon_stock">gtk-help</property>
-                                    <property name="secondary_icon_activatable">True</property>
-                                    <property name="secondary_icon_sensitive">True</property>
-                                    <property name="secondary_icon_tooltip_text">Help</property>
-                                  </object>
-                                  <packing>
-                                    <property name="left_attach">1</property>
-                                    <property name="right_attach">2</property>
-                                    <property name="top_attach">1</property>
-                                    <property name="bottom_attach">2</property>
-                                    <property name="y_options">GTK_FILL</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkLabel" id="label122">
+                                  <object class="GtkLabel" id="label29">
                                     <property name="visible">True</property>
                                     <property name="xalign">0</property>
-                                    <property name="label" translatable="yes">_Footer:</property>
+                                    <property name="label" translatable="yes">_Header:</property>
                                     <property name="use_underline">True</property>
                                   </object>
                                   <packing>
@@ -569,7 +847,7 @@
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkEntry" id="header_entry">
+                                  <object class="GtkEntry" id="index_page_header_entry1">
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="invisible_char">&#x25CF;</property>
@@ -578,116 +856,110 @@
                                   <packing>
                                     <property name="left_attach">1</property>
                                     <property name="right_attach">2</property>
+                                    <property name="top_attach">1</property>
+                                    <property name="bottom_attach">2</property>
                                     <property name="y_options">GTK_FILL</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkLabel" id="label86">
+                                  <object class="GtkLabel" id="label30">
                                     <property name="visible">True</property>
                                     <property name="xalign">0</property>
-                                    <property name="label" translatable="yes">_Header:</property>
+                                    <property name="label" translatable="yes">_Max size:</property>
                                     <property name="use_underline">True</property>
+                                    <property name="mnemonic_widget">image_size_combobox</property>
                                   </object>
                                   <packing>
                                     <property name="x_options">GTK_FILL</property>
-                                    <property name="y_options"></property>
                                   </packing>
                                 </child>
                                 <child>
                                   <placeholder/>
                                 </child>
+                                <child>
+                                  <object class="GtkHBox" id="hbox4">
+                                    <property name="visible">True</property>
+                                    <child>
+                                      <object class="GtkComboBox" id="image_size_combobox">
+                                        <property name="visible">True</property>
+                                        <property name="model">size_liststore</property>
+                                        <child>
+                                          <object class="GtkCellRendererText" id="cellrenderertext5"/>
+                                          <attributes>
+                                            <attribute name="text">0</attribute>
+                                          </attributes>
+                                        </child>
+                                      </object>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="position">0</property>
+                                      </packing>
+                                    </child>
+                                  </object>
+                                  <packing>
+                                    <property name="left_attach">1</property>
+                                    <property name="right_attach">2</property>
+                                  </packing>
+                                </child>
                               </object>
                               <packing>
-                                <property name="expand">False</property>
                                 <property name="position">0</property>
                               </packing>
                             </child>
-                          </object>
-                        </child>
-                      </object>
-                    </child>
-                    <child type="label">
-                      <object class="GtkLabel" id="label2">
-                        <property name="visible">True</property>
-                        <property name="label" translatable="yes">Album</property>
-                        <property name="use_markup">True</property>
-                        <attributes>
-                          <attribute name="weight" value="bold"/>
-                        </attributes>
-                      </object>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="position">2</property>
-                  </packing>
-                </child>
-              </object>
-            </child>
-            <child type="tab">
-              <object class="GtkLabel" id="label3">
-                <property name="visible">True</property>
-                <property name="label" translatable="yes">General</property>
-              </object>
-              <packing>
-                <property name="tab_fill">False</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkVBox" id="vbox2">
-                <property name="visible">True</property>
-                <property name="border_width">6</property>
-                <property name="orientation">vertical</property>
-                <property name="spacing">12</property>
-                <child>
-                  <object class="GtkFrame" id="frame6">
-                    <property name="visible">True</property>
-                    <property name="label_xalign">0</property>
-                    <property name="shadow_type">none</property>
-                    <child>
-                      <object class="GtkAlignment" id="alignment8">
-                        <property name="visible">True</property>
-                        <property name="top_padding">6</property>
-                        <property name="left_padding">12</property>
-                        <child>
-                          <object class="GtkScrolledWindow" id="scrolledwindow4">
-                            <property name="width_request">200</property>
-                            <property name="height_request">150</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="hscrollbar_policy">automatic</property>
-                            <property name="vscrollbar_policy">automatic</property>
-                            <property name="shadow_type">in</property>
                             <child>
-                              <object class="GtkIconView" id="theme_iconview">
+                              <object class="GtkVBox" id="vbox6">
                                 <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="selection_mode">browse</property>
-                                <property name="model">theme_liststore</property>
+                                <property name="orientation">vertical</property>
+                                <property name="spacing">6</property>
                                 <child>
-                                  <object class="GtkCellRendererPixbuf" id="cellrenderertext3">
-                                    <property name="follow_state">True</property>
+                                  <object class="GtkCheckButton" id="checkbutton1">
+                                    <property name="label" translatable="yes">Thumbnails of the previous and next image</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">False</property>
+                                    <property name="draw_indicator">True</property>
                                   </object>
-                                  <attributes>
-                                    <attribute name="pixbuf">2</attribute>
-                                  </attributes>
+                                  <packing>
+                                    <property name="position">0</property>
+                                  </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkCellRendererText" id="cellrenderertext4"/>
-                                  <attributes>
-                                    <attribute name="text">1</attribute>
-                                  </attributes>
+                                  <object class="GtkCheckButton" id="checkbutton2">
+                                    <property name="label" translatable="yes">Image attributes</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">False</property>
+                                    <property name="draw_indicator">True</property>
+                                  </object>
+                                  <packing>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="checkbutton3">
+                                    <property name="label" translatable="yes">Image description</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">False</property>
+                                    <property name="draw_indicator">True</property>
+                                  </object>
+                                  <packing>
+                                    <property name="position">2</property>
+                                  </packing>
                                 </child>
                               </object>
+                              <packing>
+                                <property name="position">1</property>
+                              </packing>
                             </child>
                           </object>
                         </child>
                       </object>
                     </child>
                     <child type="label">
-                      <object class="GtkLabel" id="label13">
+                      <object class="GtkLabel" id="label2">
                         <property name="visible">True</property>
-                        <property name="label" translatable="yes">Theme</property>
+                        <property name="label" translatable="yes">Image Page</property>
                         <property name="use_markup">True</property>
                         <attributes>
                           <attribute name="weight" value="bold"/>
@@ -696,7 +968,8 @@
                     </child>
                   </object>
                   <packing>
-                    <property name="position">0</property>
+                    <property name="expand">False</property>
+                    <property name="position">1</property>
                   </packing>
                 </child>
               </object>
@@ -707,7 +980,7 @@
             <child type="tab">
               <object class="GtkLabel" id="label5">
                 <property name="visible">True</property>
-                <property name="label" translatable="yes">Theme</property>
+                <property name="label" translatable="yes">Layout</property>
               </object>
               <packing>
                 <property name="position">1</property>
@@ -721,9 +994,6 @@
                 <property name="orientation">vertical</property>
                 <property name="spacing">12</property>
                 <child>
-                  <placeholder/>
-                </child>
-                <child>
                   <object class="GtkFrame" id="frame4">
                     <property name="visible">True</property>
                     <property name="label_xalign">0</property>
@@ -760,12 +1030,11 @@
                     </child>
                   </object>
                   <packing>
-                    <property name="position">1</property>
+                    <property name="position">0</property>
                   </packing>
                 </child>
                 <child>
                   <object class="GtkFrame" id="frame5">
-                    <property name="visible">True</property>
                     <property name="label_xalign">0</property>
                     <property name="shadow_type">none</property>
                     <child>
@@ -800,7 +1069,7 @@
                     </child>
                   </object>
                   <packing>
-                    <property name="position">2</property>
+                    <property name="position">1</property>
                   </packing>
                 </child>
               </object>
@@ -811,7 +1080,7 @@
             <child type="tab">
               <object class="GtkLabel" id="label4">
                 <property name="visible">True</property>
-                <property name="label" translatable="yes">Customize</property>
+                <property name="label" translatable="yes">Caption</property>
               </object>
               <packing>
                 <property name="position">2</property>
@@ -914,4 +1183,25 @@
       <column type="GdkPixbuf"/>
     </columns>
   </object>
+  <object class="GtkListStore" id="layout_liststore">
+    <columns>
+      <!-- column-name name -->
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes">All images on  a single image</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Adapts to the window width</col>
+      </row>
+    </data>
+  </object>
+  <object class="GtkSizeGroup" id="sizegroup1">
+    <widgets>
+      <widget name="label19"/>
+      <widget name="label28"/>
+      <widget name="label122"/>
+    </widgets>
+  </object>
 </interface>
diff --git a/extensions/webalbums/dlg-web-exporter.c b/extensions/webalbums/dlg-web-exporter.c
index 3620bc9..e10aa88 100644
--- a/extensions/webalbums/dlg-web-exporter.c
+++ b/extensions/webalbums/dlg-web-exporter.c
@@ -92,8 +92,9 @@ ok_clicked_cb (GtkWidget  *widget,
 	char            *s_value;
 	GFile           *destination;
 	int              i_value;
-	const char      *header;
-	const char      *footer;
+	const char      *index_page_header;
+	const char      *index_page_footer;
+	const char      *image_page_footer;
 	char            *thumbnail_caption;
 	char            *image_caption;
 	GtkTreeIter      iter;
@@ -116,9 +117,10 @@ ok_clicked_cb (GtkWidget  *widget,
 	eel_gconf_set_integer (PREF_WEBALBUMS_RESIZE_WIDTH, resize_size[i_value].width);
 	eel_gconf_set_integer (PREF_WEBALBUMS_RESIZE_HEIGHT, resize_size[i_value].height);
 
-	eel_gconf_set_integer (PREF_WEBALBUMS_COLUMNS, gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (GET_WIDGET ("cols_spinbutton"))));
-	eel_gconf_set_integer (PREF_WEBALBUMS_ROWS, gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (GET_WIDGET ("rows_spinbutton"))));
+	eel_gconf_set_integer (PREF_WEBALBUMS_IMAGES_PER_INDEX, gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (GET_WIDGET ("images_per_index_spinbutton"))));
 	eel_gconf_set_boolean (PREF_WEBALBUMS_SINGLE_INDEX, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("single_index_checkbutton"))));
+	eel_gconf_set_integer (PREF_WEBALBUMS_COLUMNS, gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (GET_WIDGET ("cols_spinbutton"))));
+	eel_gconf_set_boolean (PREF_WEBALBUMS_ADAPT_TO_WIDTH, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("adapt_column_checkbutton"))));
 
 	if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (GET_WIDGET ("sort_combobox")), &iter)) {
 		GthFileDataSort *sort_type;
@@ -132,11 +134,14 @@ ok_clicked_cb (GtkWidget  *widget,
 
 	eel_gconf_set_boolean (PREF_WEBALBUMS_SORT_INVERSE, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("reverse_order_checkbutton"))));
 
-	header = gtk_entry_get_text (GTK_ENTRY (GET_WIDGET ("header_entry")));
-	eel_gconf_set_string (PREF_WEBALBUMS_HEADER, header);
+	index_page_header = gtk_entry_get_text (GTK_ENTRY (GET_WIDGET ("index_page_header_entry")));
+	eel_gconf_set_string (PREF_WEBALBUMS_INDEX_PAGE_HEADER, index_page_header);
 
-	footer = gtk_entry_get_text (GTK_ENTRY (GET_WIDGET ("footer_entry")));
-	eel_gconf_set_string (PREF_WEBALBUMS_FOOTER, footer);
+	index_page_footer = gtk_entry_get_text (GTK_ENTRY (GET_WIDGET ("index_page_footer_entry")));
+	eel_gconf_set_string (PREF_WEBALBUMS_INDEX_PAGE_FOOTER, index_page_footer);
+
+	image_page_footer = gtk_entry_get_text (GTK_ENTRY (GET_WIDGET ("image_page_footer_entry")));
+	eel_gconf_set_string (PREF_WEBALBUMS_IMAGE_PAGE_FOOTER, image_page_footer);
 
 	theme_name = NULL;
 	{
@@ -170,8 +175,9 @@ ok_clicked_cb (GtkWidget  *widget,
 
 	task = gth_web_exporter_new (data->browser, data->file_list);
 
-	gth_web_exporter_set_header (GTH_WEB_EXPORTER (task), header);
-	gth_web_exporter_set_footer (GTH_WEB_EXPORTER (task), footer);
+	gth_web_exporter_set_header (GTH_WEB_EXPORTER (task), index_page_header);
+	gth_web_exporter_set_index_page_footer (GTH_WEB_EXPORTER (task), index_page_footer);
+	gth_web_exporter_set_image_page_footer (GTH_WEB_EXPORTER (task), image_page_footer);
 	gth_web_exporter_set_style (GTH_WEB_EXPORTER (task), theme_name);
 	gth_web_exporter_set_destination (GTH_WEB_EXPORTER (task), destination);
 	gth_web_exporter_set_use_subfolders (GTH_WEB_EXPORTER (task), eel_gconf_get_boolean (PREF_WEBALBUMS_USE_SUBFOLDERS, TRUE));
@@ -188,10 +194,10 @@ ok_clicked_cb (GtkWidget  *widget,
 					 eel_gconf_get_boolean (PREF_WEBALBUMS_SORT_INVERSE, FALSE));
 	g_free (s_value);
 
-	gth_web_exporter_set_row_col (GTH_WEB_EXPORTER (task),
-				      eel_gconf_get_integer (PREF_WEBALBUMS_ROWS, 4),
-				      eel_gconf_get_integer (PREF_WEBALBUMS_COLUMNS, 4));
+	gth_web_exporter_set_images_per_index (GTH_WEB_EXPORTER (task), eel_gconf_get_integer (PREF_WEBALBUMS_IMAGES_PER_INDEX, 16));
 	gth_web_exporter_set_single_index (GTH_WEB_EXPORTER (task), eel_gconf_get_boolean (PREF_WEBALBUMS_SINGLE_INDEX, FALSE));
+	gth_web_exporter_set_columns (GTH_WEB_EXPORTER (task), eel_gconf_get_integer (PREF_WEBALBUMS_COLUMNS, 4));
+	gth_web_exporter_set_adapt_to_width (GTH_WEB_EXPORTER (task), eel_gconf_get_boolean (PREF_WEBALBUMS_ADAPT_TO_WIDTH, FALSE));
 	gth_web_exporter_set_thumbnail_caption (GTH_WEB_EXPORTER (task), thumbnail_caption);
 	gth_web_exporter_set_image_caption (GTH_WEB_EXPORTER (task), image_caption);
 
@@ -210,6 +216,8 @@ update_sensitivity (DialogData *data)
 {
 	gtk_widget_set_sensitive (GET_WIDGET ("resize_images_combobox"), gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("resize_images_checkbutton"))));
 	gtk_widget_set_sensitive (GET_WIDGET ("resize_images_hbox"), gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("copy_images_checkbutton"))));
+	gtk_widget_set_sensitive (GET_WIDGET ("images_per_index_spinbutton"), ! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("single_index_checkbutton"))));
+	gtk_widget_set_sensitive (GET_WIDGET ("cols_spinbutton"), ! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("adapt_column_checkbutton"))));
 }
 
 
@@ -222,7 +230,11 @@ footer_entry_icon_press_cb (GtkEntry             *entry,
 	DialogData *data = user_data;
 	GtkWidget  *help_box;
 
-	help_box = GET_WIDGET ("template_help_table");
+	if (GTK_WIDGET (entry) == GET_WIDGET ("index_page_footer_entry"))
+		help_box = GET_WIDGET ("page_footer_help_table");
+	else
+		help_box = GET_WIDGET ("image_footer_help_table");
+
 	if (GTK_WIDGET_VISIBLE (help_box))
 		gtk_widget_hide (help_box);
 	else
@@ -359,10 +371,10 @@ dlg_web_exporter (GthBrowser *browser,
 	gtk_widget_set_sensitive (GET_WIDGET ("resize_images_checkbutton"), eel_gconf_get_boolean (PREF_WEBALBUMS_COPY_IMAGES, FALSE));
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("resize_images_checkbutton")), eel_gconf_get_boolean (PREF_WEBALBUMS_RESIZE_IMAGES, FALSE));
 	gtk_widget_set_sensitive (GET_WIDGET ("resize_images_options_hbox"), eel_gconf_get_boolean (PREF_WEBALBUMS_RESIZE_IMAGES, FALSE));
-	gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("cols_spinbutton")), eel_gconf_get_integer (PREF_WEBALBUMS_COLUMNS, 4));
-	gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("rows_spinbutton")), eel_gconf_get_integer (PREF_WEBALBUMS_ROWS, 4));
+	gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("images_per_index_spinbutton")), eel_gconf_get_integer (PREF_WEBALBUMS_IMAGES_PER_INDEX, 16));
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("single_index_checkbutton")), eel_gconf_get_boolean (PREF_WEBALBUMS_SINGLE_INDEX, FALSE));
-	gtk_widget_set_sensitive (GET_WIDGET ("columns_rows_table"), ! eel_gconf_get_boolean (PREF_WEBALBUMS_SINGLE_INDEX, FALSE));
+	gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("cols_spinbutton")), eel_gconf_get_integer (PREF_WEBALBUMS_COLUMNS, 4));
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("adapt_column_checkbutton")), eel_gconf_get_boolean (PREF_WEBALBUMS_ADAPT_TO_WIDTH, FALSE));
 
 	active_index = 0;
 	for (i = 0; i < G_N_ELEMENTS (resize_size); i++) {
@@ -407,11 +419,15 @@ dlg_web_exporter (GthBrowser *browser,
 
 	g_free (default_sort_type);
 
-	gtk_entry_set_text (GTK_ENTRY (GET_WIDGET ("header_entry")),
+	gtk_entry_set_text (GTK_ENTRY (GET_WIDGET ("index_page_header_entry")),
 			    g_file_info_get_edit_name (gth_browser_get_location_data (browser)->info));
 
-	s_value = eel_gconf_get_string (PREF_WEBALBUMS_FOOTER, "");
-	gtk_entry_set_text (GTK_ENTRY (GET_WIDGET ("footer_entry")), s_value);
+	s_value = eel_gconf_get_string (PREF_WEBALBUMS_INDEX_PAGE_FOOTER, "");
+	gtk_entry_set_text (GTK_ENTRY (GET_WIDGET ("index_page_footer_entry")), s_value);
+	g_free (s_value);
+
+	s_value = eel_gconf_get_string (PREF_WEBALBUMS_IMAGE_PAGE_FOOTER, "");
+	gtk_entry_set_text (GTK_ENTRY (GET_WIDGET ("image_page_footer_entry")), s_value);
 	g_free (s_value);
 
 	caption = eel_gconf_get_string (PREF_WEBALBUMS_THUMBNAIL_CAPTION, "");
@@ -462,10 +478,22 @@ dlg_web_exporter (GthBrowser *browser,
 				  "clicked",
 				  G_CALLBACK (update_sensitivity),
 				  data);
-	g_signal_connect (GET_WIDGET ("footer_entry"),
+	g_signal_connect (GET_WIDGET ("index_page_footer_entry"),
+			  "icon-press",
+			  G_CALLBACK (footer_entry_icon_press_cb),
+			  data);
+	g_signal_connect (GET_WIDGET ("image_page_footer_entry"),
 			  "icon-press",
 			  G_CALLBACK (footer_entry_icon_press_cb),
 			  data);
+	g_signal_connect_swapped (GET_WIDGET ("single_index_checkbutton"),
+				  "toggled",
+				  G_CALLBACK (update_sensitivity),
+				  data);
+	g_signal_connect_swapped (GET_WIDGET ("adapt_column_checkbutton"),
+				  "toggled",
+				  G_CALLBACK (update_sensitivity),
+				  data);
 
 	/* Run dialog. */
 
diff --git a/extensions/webalbums/gth-web-exporter.c b/extensions/webalbums/gth-web-exporter.c
index a1d8c4c..f2bdec7 100644
--- a/extensions/webalbums/gth-web-exporter.c
+++ b/extensions/webalbums/gth-web-exporter.c
@@ -35,7 +35,7 @@
 #include "albumtheme-private.h"
 #include "preferences.h"
 
-#define DATE_FORMAT _("%d %B %Y, %H:%M")
+#define DATE_FORMAT ("%x, %X")
 #define DEFAULT_THUMB_SIZE 100
 #define DEFAULT_INDEX_FILE "index.html"
 #define SAVING_TIMEOUT 5
@@ -54,6 +54,13 @@
 
 
 typedef enum {
+	GTH_TEMPLATE_TYPE_INDEX,
+	GTH_TEMPLATE_TYPE_IMAGE,
+	GTH_TEMPLATE_TYPE_THUMBNAIL,
+	GTH_TEMPLATE_TYPE_FRAGMENT
+} GthTemplateType;
+
+typedef enum {
 	GTH_VISIBILITY_ALWAYS = 0,
 	GTH_VISIBILITY_INDEX,
 	GTH_VISIBILITY_IMAGE
@@ -97,57 +104,107 @@ typedef struct {
 } AlbumDirs;
 
 
+typedef struct {
+	int          ref;
+	gboolean     first_item;
+	gboolean     last_item;
+	int          item_index;
+	GthFileData *item;
+	char        *attribute;
+} LoopInfo;
+
+
 struct _GthWebExporterPrivate {
-	GthBrowser      *browser;
-	GList           *gfile_list;             /* GFile list */
+	GthBrowser        *browser;
+	GList             *gfile_list;             /* GFile list */
 
 	/* options */
 
-	char            *header;
-	char            *footer;
-	GFile           *style_dir;
-	GFile           *target_dir;             /* Save files in this location. */
-	gboolean         use_subfolders;
-	AlbumDirs        directories;
-	char            *index_file;
-	gboolean         copy_images;
-	gboolean         resize_images;
-	int              resize_max_width;
-	int              resize_max_height;
-	GthFileDataSort *sort_type;
-	gboolean         sort_inverse;
-	int              page_rows;              /* Number of rows and columns */
-	int              page_cols;		 /* each page must have. */
-	gboolean         single_index;
-	int              thumb_width;
-	int              thumb_height;
-	int              preview_max_width;
-	int              preview_max_height;
-	int              preview_min_width;
-	int              preview_min_height;
-	char            *image_caption;
-	char            *thumbnail_caption;
+	char              *header;
+	char              *index_page_footer;
+	char              *image_page_footer;
+	GFile             *style_dir;
+	GFile             *target_dir;             /* Save files in this location. */
+	gboolean           use_subfolders;
+	AlbumDirs          directories;
+	char              *index_file;
+	gboolean           copy_images;
+	gboolean           resize_images;
+	int                resize_max_width;
+	int                resize_max_height;
+	GthFileDataSort   *sort_type;
+	gboolean           sort_inverse;
+	int                images_per_index;
+	gboolean           single_index;
+	int                columns_per_page;
+	int                rows_per_page;
+	gboolean           adapt_to_width;
+	int                thumb_width;
+	int                thumb_height;
+	int                preview_max_width;
+	int                preview_max_height;
+	int                preview_min_width;
+	int                preview_min_height;
+	char              *image_caption;
+	char              *thumbnail_caption;
 
 	/* private date */
 
-	GList           *file_list;             /* ImageData list */
-	GFile           *tmp_dir;
-	GthImageLoader  *iloader;
-	GList           *current_file;          /* Next file to be loaded. */
-	int              n_images;              /* Used for the progress signal. */
-	int              n_pages;
-	int              image;
-	int              page;
-	GList           *index_template;
-	GList           *thumbnail_template;
-	GList           *image_template;
-	guint            saving_timeout;
-	ImageData       *eval_image;
-	GError          *error;
-	gboolean         interrupted;
+	GList             *file_list;             /* ImageData list */
+	GFile             *tmp_dir;
+	GthImageLoader    *iloader;
+	GList             *current_file;          /* Next file to be loaded. */
+	int                n_images;              /* Used for the progress signal. */
+	int                n_pages;
+	int                image;
+	int                page;
+	GList             *index_template;
+	GList             *thumbnail_template;
+	GList             *image_template;
+	guint              saving_timeout;
+	ImageData         *eval_image;
+	LoopInfo          *loop_info;
+	GError            *error;
+	gboolean           interrupted;
 };
 
 
+static LoopInfo *
+loop_info_new (void)
+{
+	LoopInfo *info;
+
+	info = g_new0 (LoopInfo, 1);
+	info->ref = 1;
+	info->first_item = FALSE;
+	info->last_item = FALSE;
+	info->item = NULL;
+	info->attribute = NULL;
+
+	return info;
+}
+
+
+G_GNUC_UNUSED
+static void
+loop_info_ref (LoopInfo *info)
+{
+	info->ref++;
+}
+
+
+static void
+loop_info_unref (LoopInfo *info)
+{
+	info->ref--;
+	if (info->ref > 0)
+		return;
+	g_object_unref (info->item);
+	g_free (info->attribute);
+	g_free (info);
+}
+
+
 static ImageData *
 image_data_new (GthFileData *file_data,
 		int          file_idx)
@@ -269,9 +326,9 @@ get_var_value (const char *var_name,
 	else if (strcmp (var_name, "page_idx") == 0)
 		return self->priv->page + 1;
 	else if (strcmp (var_name, "page_rows") == 0)
-		return self->priv->page_rows;
+		return self->priv->rows_per_page;
 	else if (strcmp (var_name, "page_cols") == 0)
-		return self->priv->page_cols;
+		return self->priv->columns_per_page;
 	else if (strcmp (var_name, "pages") == 0)
 		return self->priv->n_pages;
 	else if (strcmp (var_name, "preview_min_width") == 0)
@@ -298,6 +355,11 @@ get_var_value (const char *var_name,
 	else if (strcmp (var_name, "thumb_height") == 0)
 		RETURN_IMAGE_FIELD (self->priv->eval_image, thumb_height)
 
+	else if (g_str_equal (var_name, "first_item"))
+		return (self->priv->loop_info != NULL) ? self->priv->loop_info->first_item : FALSE;
+	else if (g_str_equal (var_name, "last_item"))
+		return (self->priv->loop_info != NULL) ? self->priv->loop_info->last_item : FALSE;
+
 	/* FIXME: use a generic function to get an attribute visibility */
 /*
 	else if (strcmp (var_name, "image_dim_visibility_index") == 0)
@@ -470,7 +532,7 @@ get_page_idx_from_image_idx (GthWebExporter *self,
 	if (self->priv->single_index)
 		return 0;
 	else
-		return image_idx / (self->priv->page_rows * self->priv->page_cols);
+		return image_idx / self->priv->images_per_index;
 }
 
 
@@ -566,6 +628,8 @@ write_markup_escape_locale_line (GFileOutputStream  *ostream,
 }
 
 
+/* FIXME */
+G_GNUC_UNUSED
 static char *
 get_image_attribute (GthWebExporter    *self,
 		     GthTag            *tag,
@@ -702,7 +766,7 @@ get_html_index_file (GthWebExporter *self,
 	if (page == 0)
 		filename = g_strdup (self->priv->index_file);
 	else
-		filename = g_strdup_printf ("page%03d.htpl", page + 1);
+		filename = g_strdup_printf ("page%03d.html", page + 1);
 	dir = get_html_index_dir (self, page, target_dir);
 	result = g_file_get_child (dir, filename);
 
@@ -786,20 +850,20 @@ get_preview_file (GthWebExporter *self,
 }
 
 
-static char*
+static char *
 get_current_date (void)
 {
-	time_t     t;
-	struct tm *tp;
-	char       s[100];
+	GTimeVal  timeval;
+	char     *s;
+	char     *u;
 
-	/* FIXME */
+	g_get_current_time (&timeval);
+	s = _g_time_val_strftime (&timeval, DATE_FORMAT);
+	u = g_locale_to_utf8 (s, -1, 0, 0, 0);
 
-	t = time (NULL);
-	tp = localtime (&t);
-	strftime (s, 99, DATE_FORMAT, tp);
+	g_free (s);
 
-	return g_locale_to_utf8 (s, -1, 0, 0, 0);
+	return u;
 }
 
 
@@ -849,8 +913,6 @@ get_current_language (void)
 }
 
 
-/* FIXME: add support for date formats */
-
 static gboolean
 header_footer_eval_cb (const GMatchInfo *match_info,
 		       GString          *result,
@@ -861,13 +923,19 @@ header_footer_eval_cb (const GMatchInfo *match_info,
 	char           *match;
 
 	match = g_match_info_fetch (match_info, 0);
-	if (strcmp (match, "%P") == 0) {
+	if (strcmp (match, "%p") == 0) {
 		r = g_strdup_printf ("%d", self->priv->page + 1);
 	}
-	else if (strcmp (match, "%N") == 0) {
+	else if (strcmp (match, "%P") == 0) {
 		r = g_strdup_printf ("%d", self->priv->n_pages);
 	}
-	if (strncmp (match, "%D", 2) == 0) {
+	else if (strcmp (match, "%i") == 0) {
+		r = g_strdup_printf ("%d", self->priv->image + 1);
+	}
+	else if (strcmp (match, "%I") == 0) {
+		r = g_strdup_printf ("%d", self->priv->n_images);
+	}
+	else if (strncmp (match, "%D", 2) == 0) {
 		GTimeVal   timeval;
 		GRegex    *re;
 		char     **a;
@@ -910,7 +978,7 @@ get_header_footer_text (GthWebExporter *self,
 	if (g_utf8_strchr (utf8_text,  -1, '%') == NULL)
 		return g_strdup (utf8_text);
 
-	re = g_regex_new ("%[PND](\\{[^}]+\\})?", 0, 0, NULL);
+	re = g_regex_new ("%[pPiID](\\{[^}]+\\})?", 0, 0, NULL);
 	new_text = g_regex_replace_eval (re, utf8_text, -1, 0, 0, header_footer_eval_cb, self, NULL);
 	g_regex_unref (re);
 
@@ -933,15 +1001,18 @@ get_attr_image_type_from_tag (GthWebExporter *self,
 
 
 static void
-gth_parsed_doc_print (GList               *document,
+gth_parsed_doc_print (GthWebExporter      *self,
+		      GList               *document,
+		      GthTemplateType      template_type,
+		      LoopInfo            *loop_info,
 		      GFile		  *relative_to,
-		      GthWebExporter      *self,
 		      GFileOutputStream   *ostream,
-		      gboolean             allow_table,
 		      GError             **error)
 {
 	GList *scan;
 
+	self->priv->loop_info = loop_info;
+
 	for (scan = document; scan; scan = scan->next) {
 		GthTag     *tag = scan->data;
 		ImageData  *idata;
@@ -977,8 +1048,12 @@ gth_parsed_doc_print (GList               *document,
 			break;
 
 		case GTH_TAG_FOOTER:
-			line = get_header_footer_text (self, self->priv->footer);
-			write_markup_escape_line (ostream, line, error);
+			if (template_type == GTH_TEMPLATE_TYPE_INDEX)
+				line = get_header_footer_text (self, self->priv->index_page_footer);
+			else if (template_type == GTH_TEMPLATE_TYPE_IMAGE)
+				line = get_header_footer_text (self, self->priv->image_page_footer);
+			if (line != NULL)
+				write_markup_escape_line (ostream, line, error);
 			break;
 
 		case GTH_TAG_LANGUAGE:
@@ -1098,7 +1173,7 @@ gth_parsed_doc_print (GList               *document,
 			write_line (ostream, line, error);
 			break;
 
-		case GTH_TAG_FILENAME:
+		case GTH_TAG_FILE_NAME:
 			idx = get_image_idx (tag, self);
 			idata = g_list_nth (self->priv->file_list, idx)->data;
 			self->priv->eval_image = idata;
@@ -1140,7 +1215,7 @@ gth_parsed_doc_print (GList               *document,
 			g_object_unref (file);
 			break;
 
-		case GTH_TAG_FILEPATH:
+		case GTH_TAG_FILE_PATH:
 			idx = get_image_idx (tag, self);
 			idata = g_list_nth (self->priv->file_list, idx)->data;
 			self->priv->eval_image = idata;
@@ -1183,13 +1258,14 @@ gth_parsed_doc_print (GList               *document,
 			g_object_unref (file);
 			break;
 
-		case GTH_TAG_FILESIZE:
+		case GTH_TAG_FILE_SIZE:
 			idx = get_image_idx (tag, self);
 			idata = g_list_nth (self->priv->file_list, idx)->data;
 			line = g_format_size_for_display (g_file_info_get_size (idata->file_data->info));
 			write_markup_escape_line (ostream, line, error);
 			break;
 
+			/* FIXME
 		case GTH_TAG_COMMENT:
 			line = get_image_attribute (self, tag, "general::title");
 			write_markup_escape_line (ostream, line, error);
@@ -1204,6 +1280,8 @@ gth_parsed_doc_print (GList               *document,
 			line = get_image_attribute (self, tag, "general::datetime");
 			write_markup_escape_line (ostream, line, error);
 			break;
+			*/
+
 			/* FIXME
 			idx = get_image_idx (tag, self);
 			idata = g_list_nth (self->priv->file_list, idx)->data;
@@ -1250,12 +1328,12 @@ gth_parsed_doc_print (GList               *document,
 			break;
 
 		case GTH_TAG_PAGE_ROWS:
-			line = g_strdup_printf ("%d", self->priv->page_rows);
+			line = g_strdup_printf ("%d", self->priv->rows_per_page);
 			write_line (ostream, line, error);
 			break;
 
 		case GTH_TAG_PAGE_COLS:
-			line = g_strdup_printf ("%d", self->priv->page_cols);
+			line = g_strdup_printf ("%d", self->priv->columns_per_page);
 			write_line (ostream, line, error);
 			break;
 
@@ -1264,59 +1342,57 @@ gth_parsed_doc_print (GList               *document,
 			write_line (ostream, line, error);
 			break;
 
-		case GTH_TAG_TABLE:
-			if (! allow_table)
+		case GTH_TAG_THUMBNAILS:
+			if (template_type != GTH_TEMPLATE_TYPE_INDEX)
 				break;
 
-			if (self->priv->single_index)
-				self->priv->page_rows = (self->priv->n_images + self->priv->page_cols - 1) / self->priv->page_cols;
-
-			/* this may not work correctly if single_index is set */
-			for (r = 0; r < self->priv->page_rows; r++) {
-				if (self->priv->image < self->priv->n_images)
-					write_line (ostream, "  <tr class=\"tr_index\">\n", error);
-				else
-					write_line (ostream, "  <tr class=\"tr_empty_index\">\n", error);
-				for (c = 0; c < self->priv->page_cols; c++) {
-					if (self->priv->image < self->priv->n_images) {
-						write_line (ostream, "    <td class=\"td_index\">\n", error);
-						gth_parsed_doc_print (self->priv->thumbnail_template,
-								      relative_to,
-								      self,
-								      ostream,
-								      FALSE,
-								      error);
-						write_line (ostream, "    </td>\n", error);
-						self->priv->image++;
-					}
-					else {
-						write_line (ostream, "    <td class=\"td_empty_index\">\n", error);
-						write_line (ostream, "    &nbsp;\n", error);
-						write_line (ostream, "    </td>\n", error);
-					}
+			if (self->priv->adapt_to_width) {
+				for (r = 0; r < (self->priv->single_index ? self->priv->n_images : self->priv->images_per_index); r++) {
+					if (self->priv->image >= self->priv->n_images)
+						break;
+					gth_parsed_doc_print (self,
+							      self->priv->thumbnail_template,
+							      GTH_TEMPLATE_TYPE_THUMBNAIL,
+							      loop_info,
+							      relative_to,
+							      ostream,
+							      error);
+					self->priv->image++;
 				}
-				write_line (ostream, "  </tr>\n", error);
 			}
-			break;
-
-		case GTH_TAG_THUMBS:
-			if (! allow_table)
-				break;
-
-			for (r = 0; r < (self->priv->single_index ? self->priv->n_images : self->priv->page_rows * self->priv->page_cols); r++) {
-				if (self->priv->image >= self->priv->n_images)
-					break;
-				gth_parsed_doc_print (self->priv->thumbnail_template,
-						      relative_to,
-						      self,
-						      ostream,
-						      FALSE,
-						      error);
-				self->priv->image++;
+			else {
+				write_line (ostream, "<table id=\"thumbnail-grid\">\n", error);
+				for (r = 0; r < self->priv->rows_per_page; r++) {
+					if (self->priv->image < self->priv->n_images)
+						write_line (ostream, "  <tr class=\"tr_index\">\n", error);
+					else
+						write_line (ostream, "  <tr class=\"tr_empty_index\">\n", error);
+					for (c = 0; c < self->priv->columns_per_page; c++) {
+						if (self->priv->image < self->priv->n_images) {
+							write_line (ostream, "    <td class=\"td_index\">\n", error);
+							gth_parsed_doc_print (self,
+									      self->priv->thumbnail_template,
+									      GTH_TEMPLATE_TYPE_THUMBNAIL,
+									      loop_info,
+									      relative_to,
+									      ostream,
+									      error);
+							write_line (ostream, "    </td>\n", error);
+							self->priv->image++;
+						}
+						else {
+							write_line (ostream, "    <td class=\"td_empty_index\">\n", error);
+							write_line (ostream, "    &nbsp;\n", error);
+							write_line (ostream, "    </td>\n", error);
+						}
+					}
+					write_line (ostream, "  </tr>\n", error);
+				}
+				write_line (ostream, "</table>\n", error);
 			}
 			break;
 
-		case GTH_TAG_DATE:
+		case GTH_TAG_TIMESTAMP: /* FIXME: add custom format support */
 			line = get_current_date ();
 			write_markup_escape_line (ostream, line, error);
 			break;
@@ -1432,17 +1508,77 @@ gth_parsed_doc_print (GList               *document,
 			for (scan = tag->value.cond_list; scan; scan = scan->next) {
 				GthCondition *cond = scan->data;
 				if (expression_value (self, cond->expr) != 0) {
-					gth_parsed_doc_print (cond->document,
+					gth_parsed_doc_print (self,
+							      cond->document,
+							      GTH_TEMPLATE_TYPE_FRAGMENT,
+							      loop_info,
 							      relative_to,
-							      self,
 							      ostream,
-							      FALSE,
 							      error);
 					break;
 				}
 			}
 			break;
 
+		case GTH_TAG_FOR_EACH_THUMBNAIL_CAPTION:
+			/* FIXME */
+			{
+				LoopInfo  *inner_loop_info;
+				char     **attributes;
+				int        i;
+
+				idx = MIN (self->priv->image, self->priv->n_images - 1);
+				idata = g_list_nth (self->priv->file_list, idx)->data;
+				self->priv->eval_image = idata;
+
+				inner_loop_info = loop_info_new ();
+				attributes = g_strsplit (self->priv->thumbnail_caption, ",", -1);
+				for (i = 0; attributes[i] != NULL; i++) {
+					inner_loop_info->first_item = (i == 0);
+					inner_loop_info->last_item = (attributes[i + 1] == NULL);
+					inner_loop_info->item_index = i;
+					inner_loop_info->item = g_object_ref (idata->file_data);
+					inner_loop_info->attribute = g_strdup (attributes[i]);
+
+					gth_parsed_doc_print (self,
+							      tag->value.loop->document,
+							      GTH_TEMPLATE_TYPE_FRAGMENT,
+							      inner_loop_info,
+							      relative_to,
+							      ostream,
+							      error);
+				}
+
+				g_strfreev (attributes);
+				loop_info_unref (inner_loop_info);
+			}
+			break;
+
+		case GTH_TAG_ITEM_ATTRIBUTE:
+			if ((loop_info != NULL) && (loop_info->item != NULL)) {
+				GthMetadataInfo *metadata_info;
+
+				metadata_info = gth_main_get_metadata_info (loop_info->attribute);
+				if (metadata_info != NULL) {
+					if (gth_tag_get_var (self, tag, "id") != 0) {
+						line = g_strdup (metadata_info->id);
+					}
+					else if (gth_tag_get_var (self, tag, "display_name") != 0) {
+						line = g_strdup (metadata_info->display_name);
+					}
+					else if (gth_tag_get_var (self, tag, "value") != 0) {
+						line = gth_file_data_get_attribute_as_string (loop_info->item, loop_info->attribute);
+					}
+					else if (gth_tag_get_var (self, tag, "index") != 0) {
+						line = g_strdup_printf ("%d", loop_info->item_index);
+					}
+				}
+
+				if (line != NULL)
+					write_markup_escape_line (ostream, line, error);
+			}
+			break;
+
 		case GTH_TAG_TEXT:
 			if ((tag->value.arg_list == NULL) && (tag->document != NULL)) {
 				GthTag *child = tag->document->data;
@@ -1464,21 +1600,23 @@ gth_parsed_doc_print (GList               *document,
 
 
 static void
-save_template (GthWebExporter  *self,
-	       GList           *document,
-	       GFile           *file,
-	       GFile           *relative_to,
-	       GError         **error)
+save_template (GthWebExporter   *self,
+	       GList            *document,
+	       GthTemplateType   template_type,
+	       GFile            *file,
+	       GFile            *relative_to,
+	       GError          **error)
 {
 	GFileOutputStream *ostream;
 
 	ostream = g_file_replace (file, NULL, FALSE, G_FILE_CREATE_NONE, NULL, error);
 	if (ostream != NULL) {
-		gth_parsed_doc_print (document,
+		gth_parsed_doc_print (self,
+				      document,
+				      template_type,
+				      NULL,
 				      relative_to,
-				      self,
 				      ostream,
-				      TRUE,
 				      error);
 		g_object_unref (ostream);
 	}
@@ -1810,7 +1948,7 @@ save_html_image (gpointer data)
 	image_data = self->priv->current_file->data;
 	file = get_html_image_file (self, image_data, self->priv->tmp_dir);
 	relative_to = get_html_image_dir (self, self->priv->target_dir);
-	save_template (self, self->priv->image_template, file, relative_to, &error);
+	save_template (self, self->priv->image_template, GTH_TEMPLATE_TYPE_IMAGE, file, relative_to, &error);
 
 	g_object_unref (file);
 	g_object_unref (relative_to);
@@ -1867,7 +2005,7 @@ save_html_index (gpointer data)
 
 	file = get_html_index_file (self, self->priv->page, self->priv->tmp_dir);
 	relative_to = get_html_index_dir (self, self->priv->page, self->priv->target_dir);
-	save_template (self, self->priv->index_template, file, relative_to, &error);
+	save_template (self, self->priv->index_template, GTH_TEMPLATE_TYPE_INDEX, file, relative_to, &error);
 
 	g_object_unref (file);
 	g_object_unref (relative_to);
@@ -2366,11 +2504,16 @@ parse_theme_files (GthWebExporter *self)
 	template = g_file_get_child (self->priv->style_dir, "index.gthtml");
 	self->priv->index_template = parse_template (template);
 	if (self->priv->index_template == NULL) {
-		GthTag *tag = gth_tag_new (GTH_TAG_TABLE, NULL);
+		GthTag *tag = gth_tag_new (GTH_TAG_THUMBNAILS, NULL);
 		self->priv->index_template = g_list_prepend (NULL, tag);
 	}
 	g_object_unref (template);
 
+	/*
+	g_print ("\n\nIndex: \n");
+	gth_parsed_doc_print_tree (self->priv->index_template);
+	*/
+
 	/* read and parse thumbnail.gthtml */
 
 	template = g_file_get_child (self->priv->style_dir, "thumbnail.gthtml");
@@ -2396,6 +2539,11 @@ parse_theme_files (GthWebExporter *self)
 	}
 	g_object_unref (template);
 
+	/*
+	g_print ("\n\nThumbnail: \n");
+	gth_parsed_doc_print_tree (self->priv->thumbnail_template);
+	*/
+
 	/* Read and parse image.gthtml */
 
 	template = g_file_get_child (self->priv->style_dir, "image.gthtml");
@@ -2421,6 +2569,11 @@ parse_theme_files (GthWebExporter *self)
 	}
 	g_object_unref (template);
 
+	/*
+	g_print ("\n\nImage: \n");
+	gth_parsed_doc_print_tree (self->priv->image_template);
+	*/
+
 	/* read index.html and set variables. */
 
 	for (scan = self->priv->index_template; scan; scan = scan->next) {
@@ -2515,12 +2668,17 @@ gth_web_exporter_exec (GthTask *task)
 
 	self->priv->n_images = g_list_length (self->priv->gfile_list);
 	if (! self->priv->single_index) {
-		self->priv->n_pages = self->priv->n_images / (self->priv->page_rows * self->priv->page_cols);
-		if (self->priv->n_images % (self->priv->page_rows * self->priv->page_cols) > 0)
+		self->priv->n_pages = self->priv->n_images / self->priv->images_per_index;
+		if (self->priv->n_images % self->priv->images_per_index > 0)
 			self->priv->n_pages++;
 	}
-	else
+	else {
 		self->priv->n_pages = 1;
+		self->priv->images_per_index = self->priv->n_images;
+	}
+	self->priv->rows_per_page = self->priv->images_per_index / self->priv->columns_per_page;
+	if (self->priv->images_per_index % self->priv->columns_per_page > 0)
+		self->priv->rows_per_page++;
 
 	/* get index file name and subdirs from gconf (hidden prefs) */
 
@@ -2628,7 +2786,8 @@ gth_web_exporter_finalize (GObject *object)
 
 	self = GTH_WEB_EXPORTER (object);
 	g_free (self->priv->header);
-	g_free (self->priv->footer);
+	g_free (self->priv->index_page_footer);
+	g_free (self->priv->image_page_footer);
 	_g_object_unref (self->priv->style_dir);
 	_g_object_unref (self->priv->target_dir);
 	_g_object_unref (self->priv->tmp_dir);
@@ -2675,7 +2834,8 @@ gth_web_exporter_init (GthWebExporter *self)
 {
 	self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GTH_TYPE_WEB_EXPORTER, GthWebExporterPrivate);
 	self->priv->header = NULL;
-	self->priv->footer = NULL;
+	self->priv->index_page_footer = NULL;
+	self->priv->image_page_footer = NULL;
 	self->priv->style_dir = NULL;
 	self->priv->target_dir = NULL;
 	self->priv->use_subfolders = TRUE;
@@ -2691,8 +2851,9 @@ gth_web_exporter_init (GthWebExporter *self)
 	self->priv->resize_max_height = 0;
 	self->priv->sort_type = NULL;
 	self->priv->sort_inverse = FALSE;
-	self->priv->page_rows = 0;
-	self->priv->page_cols = 0;
+	self->priv->images_per_index = 0;
+	self->priv->columns_per_page = 0;
+	self->priv->rows_per_page = 0;
 	self->priv->single_index = FALSE;
 	self->priv->thumb_width = DEFAULT_THUMB_SIZE;
 	self->priv->thumb_height = DEFAULT_THUMB_SIZE;
@@ -2772,13 +2933,24 @@ gth_web_exporter_set_header (GthWebExporter *self,
 
 
 void
-gth_web_exporter_set_footer (GthWebExporter *self,
-			     const char     *footer)
+gth_web_exporter_set_index_page_footer (GthWebExporter *self,
+					const char     *footer)
 {
 	g_return_if_fail (GTH_IS_WEB_EXPORTER (self));
 
-	g_free (self->priv->footer);
-	self->priv->footer = g_strdup (footer);
+	g_free (self->priv->index_page_footer);
+	self->priv->index_page_footer = g_strdup (footer);
+}
+
+
+void
+gth_web_exporter_set_image_page_footer (GthWebExporter *self,
+					const char     *footer)
+{
+	g_return_if_fail (GTH_IS_WEB_EXPORTER (self));
+
+	g_free (self->priv->image_page_footer);
+	self->priv->image_page_footer = g_strdup (footer);
 }
 
 
@@ -2857,24 +3029,42 @@ gth_web_exporter_set_sort_order (GthWebExporter  *self,
 
 
 void
-gth_web_exporter_set_row_col (GthWebExporter *self,
-			      int             rows,
-			      int             cols)
+gth_web_exporter_set_images_per_index (GthWebExporter *self,
+				       int             value)
 {
 	g_return_if_fail (GTH_IS_WEB_EXPORTER (self));
 
-	self->priv->page_rows = rows;
-	self->priv->page_cols = cols;
+	self->priv->images_per_index = value;
 }
 
 
 void
 gth_web_exporter_set_single_index (GthWebExporter *self,
-				   gboolean        single)
+				   gboolean        value)
+{
+	g_return_if_fail (GTH_IS_WEB_EXPORTER (self));
+
+	self->priv->single_index = value;
+}
+
+
+void
+gth_web_exporter_set_columns (GthWebExporter *self,
+			      int             cols)
+{
+	g_return_if_fail (GTH_IS_WEB_EXPORTER (self));
+
+	self->priv->columns_per_page = cols;
+}
+
+
+void
+gth_web_exporter_set_adapt_to_width (GthWebExporter *self,
+				     gboolean        value)
 {
 	g_return_if_fail (GTH_IS_WEB_EXPORTER (self));
 
-	self->priv->single_index = single;
+	self->priv->adapt_to_width = value;
 }
 
 
diff --git a/extensions/webalbums/gth-web-exporter.h b/extensions/webalbums/gth-web-exporter.h
index 272d540..45608c3 100644
--- a/extensions/webalbums/gth-web-exporter.h
+++ b/extensions/webalbums/gth-web-exporter.h
@@ -54,7 +54,9 @@ GthTask *  gth_web_exporter_new                   (GthBrowser       *browser,
 						   GList            *file_list); /* GFile list */
 void       gth_web_exporter_set_header            (GthWebExporter   *self,
 						   const char       *header);
-void       gth_web_exporter_set_footer            (GthWebExporter   *self,
+void       gth_web_exporter_set_index_page_footer (GthWebExporter   *self,
+						   const char       *footer);
+void       gth_web_exporter_set_image_page_footer (GthWebExporter   *self,
 						   const char       *footer);
 void       gth_web_exporter_set_style             (GthWebExporter   *self,
 						   const char       *style_name);
@@ -71,11 +73,14 @@ void       gth_web_exporter_set_resize_images     (GthWebExporter   *self,
 void       gth_web_exporter_set_sort_order        (GthWebExporter   *self,
 						   GthFileDataSort  *sort_type,
 						   gboolean          sort_inverse);
-void       gth_web_exporter_set_row_col           (GthWebExporter   *self,
-						   int               rows,
-						   int               cols);
+void       gth_web_exporter_set_images_per_index  (GthWebExporter   *self,
+						   int               value);
 void       gth_web_exporter_set_single_index      (GthWebExporter   *self,
-						   gboolean          copy);
+						   gboolean          single);
+void       gth_web_exporter_set_columns           (GthWebExporter   *self,
+						   int               cols);
+void       gth_web_exporter_set_adapt_to_width    (GthWebExporter   *self,
+						   gboolean          value);
 void       gth_web_exporter_set_thumb_size        (GthWebExporter   *self,
 						   int               width,
 						   int               height);
diff --git a/extensions/webalbums/preferences.h b/extensions/webalbums/preferences.h
index 47037fb..b347a8a 100644
--- a/extensions/webalbums/preferences.h
+++ b/extensions/webalbums/preferences.h
@@ -40,13 +40,15 @@ G_BEGIN_DECLS
 #define PREF_WEBALBUMS_RESIZE_IMAGES       "/apps/gthumb/ext/webalbums/resize_images"
 #define PREF_WEBALBUMS_RESIZE_WIDTH        "/apps/gthumb/ext/webalbums/resize_width"
 #define PREF_WEBALBUMS_RESIZE_HEIGHT       "/apps/gthumb/ext/webalbums/resize_height"
-#define PREF_WEBALBUMS_COLUMNS             "/apps/gthumb/ext/webalbums/columns"
-#define PREF_WEBALBUMS_ROWS                "/apps/gthumb/ext/webalbums/rows"
+#define PREF_WEBALBUMS_IMAGES_PER_INDEX    "/apps/gthumb/ext/webalbums/images_per_index"
 #define PREF_WEBALBUMS_SINGLE_INDEX        "/apps/gthumb/ext/webalbums/single_index"
+#define PREF_WEBALBUMS_COLUMNS             "/apps/gthumb/ext/webalbums/columns"
+#define PREF_WEBALBUMS_ADAPT_TO_WIDTH      "/apps/gthumb/ext/webalbums/adapt_to_width"
 #define PREF_WEBALBUMS_SORT_TYPE           "/apps/gthumb/ext/webalbums/sort_type"
 #define PREF_WEBALBUMS_SORT_INVERSE        "/apps/gthumb/ext/webalbums/sort_inverse"
-#define PREF_WEBALBUMS_HEADER              "/apps/gthumb/ext/webalbums/header"
-#define PREF_WEBALBUMS_FOOTER              "/apps/gthumb/ext/webalbums/footer"
+#define PREF_WEBALBUMS_INDEX_PAGE_HEADER   "/apps/gthumb/ext/webalbums/index_page_header"
+#define PREF_WEBALBUMS_INDEX_PAGE_FOOTER   "/apps/gthumb/ext/webalbums/index_page_footer"
+#define PREF_WEBALBUMS_IMAGE_PAGE_FOOTER   "/apps/gthumb/ext/webalbums/image_page_footer"
 #define PREF_WEBALBUMS_THEME               "/apps/gthumb/ext/webalbums/theme"
 #define PREF_WEBALBUMS_THUMBNAIL_CAPTION   "/apps/gthumb/ext/webalbums/thumbnail_caption"
 #define PREF_WEBALBUMS_IMAGE_CAPTION       "/apps/gthumb/ext/webalbums/image_caption"
diff --git a/gthumb/gth-metadata.c b/gthumb/gth-metadata.c
index 4666ee4..1720434 100644
--- a/gthumb/gth-metadata.c
+++ b/gthumb/gth-metadata.c
@@ -201,6 +201,13 @@ gth_metadata_new (void)
 
 
 const char *
+gth_metadata_get_id (GthMetadata *metadata)
+{
+	return metadata->priv->id;
+}
+
+
+const char *
 gth_metadata_get_raw (GthMetadata *metadata)
 {
 	return metadata->priv->raw;
diff --git a/gthumb/gth-metadata.h b/gthumb/gth-metadata.h
index 2234792..33e3d08 100644
--- a/gthumb/gth-metadata.h
+++ b/gthumb/gth-metadata.h
@@ -74,6 +74,7 @@ struct _GthMetadataClass {
 
 GType             gth_metadata_get_type        (void);
 GthMetadata *     gth_metadata_new             (void);
+const char *      gth_metadata_get_id          (GthMetadata     *metadata);
 const char *      gth_metadata_get_raw         (GthMetadata     *metadata);
 const char *      gth_metadata_get_formatted   (GthMetadata     *metadata);
 GthMetadataInfo * gth_metadata_info_dup        (GthMetadataInfo *info);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]