summaryrefslogtreecommitdiff
path: root/src/job-manager.c
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@users.sourceforge.net>2015-01-04 19:58:05 +0100
committerTomas Bzatek <tbzatek@users.sourceforge.net>2015-01-04 19:58:05 +0100
commit1f9e7dee25dfd002b6b1ab4636faa9a24f74d09f (patch)
treefb8343fddb4e6931cd361f78b30b292532a03dfa /src/job-manager.c
parent6f6d8002d318d502ca1f645f95a4c018871c70b3 (diff)
downloadcataract-1f9e7dee25dfd002b6b1ab4636faa9a24f74d09f.tar.xz
generators: Use single function for all templates
This commit makes use of a common function for all template parsing and page writing. The behaviour is controlled by the "item" argument passed in. This allows us to have a single code that generates code for list of items as well as for a single item. In the future, this can be used for e.g. combining thumbnails and large images on the same page. Other than that this commit also brings several other changes: - further clarification of theming setup XML file - <protected_thumbnail> tag has been moved out of the <album> structure into the <index> structure where it functionally belongs. Only whole albums can be protected and the substitute thumbnail is displayed on index pages. - position marker format has been broken out to a constant - added few more FIXMEs to mark places that will change soon - some template variables have been renamed
Diffstat (limited to 'src/job-manager.c')
-rw-r--r--src/job-manager.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/job-manager.c b/src/job-manager.c
index 1bf9c5c..3f13b93 100644
--- a/src/job-manager.c
+++ b/src/job-manager.c
@@ -51,7 +51,6 @@ typedef struct {
TIndexItem *item;
gboolean gen_done;
int index; /* processed image index */
- int real_index; /* absolute index in the list */
} TJobItem;
@@ -143,9 +142,9 @@ thread_func (gpointer data)
/* Two-pass check whether images need to be updated. First check does no I/O except of stat() calls. */
needs_update = job->force_update;
if (! needs_update)
- needs_update = generate_image (job->setup, job->items, item, job_item->real_index, job->path_info, TRUE);
+ needs_update = generate_image (job->setup, job->items, item, job->path_info, TRUE);
if (needs_update)
- generate_image (job->setup, job->items, item, job_item->real_index, job->path_info, FALSE);
+ generate_image (job->setup, job->items, item, job->path_info, FALSE);
if (needs_update && job->setup->verbose) {
G_LOCK (items_print);
@@ -161,7 +160,7 @@ thread_func (gpointer data)
s1 = g_build_filename (job->path_info->templates_root, theme->picture_template, NULL);
s2 = g_strdup_printf (theme->picture_filename, imgname);
s3 = g_build_filename (job->path_info->dest_dir, s2, NULL);
- write_html_image (job->setup, job->path_info, theme, s1, s3, item, job->items);
+ write_html_page (job->setup, job->path_info, theme, s1, s3, job->items, item);
g_free (s1);
g_free (s2);
g_free (s3);
@@ -357,7 +356,6 @@ build_tree (TGallerySetup *setup,
job_item->item = item;
job_item->gen_done = FALSE;
job_item->index = job->total_items;
- job_item->real_index = i;
job_items = g_list_append (job_items, job_item);
}
}
@@ -416,7 +414,7 @@ build_tree (TGallerySetup *setup,
printf (" Writing %s\n", s2);
s3 = g_build_filename (path_info->templates_root, s1, NULL);
s4 = g_build_filename (path_info->dest_dir, s2, NULL);
- if (! write_html_album (setup, path_info, theme, s3, s4, items))
+ if (! write_html_page (setup, path_info, theme, s3, s4, items, NULL))
log_error ("error generating target index file\n");
g_free (s3);
g_free (s4);