summaryrefslogtreecommitdiff
path: root/src/job-manager.c
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@users.sourceforge.net>2015-01-25 18:23:03 +0100
committerTomas Bzatek <tbzatek@users.sourceforge.net>2015-01-25 18:23:03 +0100
commit6fffe1a21d5acaa544f7796241e13ff37e75349f (patch)
tree83e0cf3237f11742a89fbc925ac327595b930068 /src/job-manager.c
parent7779510229bb478f591cc67c0cb0e2fbb84fdb98 (diff)
downloadcataract-6fffe1a21d5acaa544f7796241e13ff37e75349f.tar.xz
theming: Make custom image size handling fully flexible
This commit brings full flexibility of custom image size definition and usage. When a custom image size is defined, it automatically maps to the album <item> tag arguments. Alternatively, this automatic name matching can be overriden by <size tagname="..."> theme setup tags. This allows us to supply image of different sizes that can be also used in templates. Legacy behaviour of "fullsize" and "preview" image size fallback is retained (though not recommended in new theming setups).
Diffstat (limited to 'src/job-manager.c')
-rw-r--r--src/job-manager.c48
1 files changed, 25 insertions, 23 deletions
diff --git a/src/job-manager.c b/src/job-manager.c
index 3f13b93..28e81ff 100644
--- a/src/job-manager.c
+++ b/src/job-manager.c
@@ -138,35 +138,37 @@ thread_func (gpointer data)
/* actually do some work */
if (item != NULL && job_item != NULL) {
- imgname = GET_ITEM_TARGET_FILENAME (item);
/* 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->path_info, TRUE);
- if (needs_update)
+
+ if (needs_update) {
+ imgname = get_item_target_filename (item);
+ if (job->setup->verbose) {
+ G_LOCK (items_print);
+ g_print (" [%d/%d] Processing item \"%s\"\n", job_item->index, job->total_items, imgname);
+ G_UNLOCK (items_print);
+ }
+
generate_image (job->setup, job->items, item, job->path_info, FALSE);
-
- if (needs_update && job->setup->verbose) {
- G_LOCK (items_print);
- g_print (" [%d/%d] Processing item \"%s\"\n", job_item->index, job->total_items, imgname);
- G_UNLOCK (items_print);
- }
- if (needs_update && job->items->type == GALLERY_TYPE_ALBUM)
- for (l = g_list_first (job->setup->design->themes); l; l = g_list_next (l)) {
- theme = l->data;
- /* Do not generate particular image pages when theme doesn't define it */
- if (theme->enabled && theme->picture_template && theme->picture_filename) {
- 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_page (job->setup, job->path_info, theme, s1, s3, job->items, item);
- g_free (s1);
- g_free (s2);
- g_free (s3);
+ if (job->items->type == GALLERY_TYPE_ALBUM)
+ for (l = g_list_first (job->setup->design->themes); l; l = g_list_next (l)) {
+ theme = l->data;
+ /* Do not generate particular image pages when theme doesn't define it */
+ if (theme->enabled && theme->picture_template && theme->picture_filename) {
+ 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_page (job->setup, job->path_info, theme, s1, s3, job->items, item);
+ g_free (s1);
+ g_free (s2);
+ g_free (s3);
+ }
}
- }
- g_free (imgname);
+ g_free (imgname);
+ }
}
} while (item != NULL);
@@ -232,7 +234,7 @@ build_tree (TGallerySetup *setup,
}
/* Read the index file and fill items array */
- items = parse_album_xml (idx_file, path_info);
+ items = parse_album_xml (setup, idx_file, path_info);
if (! items) {
log_error ("error reading index file '%s'\n", idx_file);
g_free (idx_file);