From 923c421b3cbb2d6b55f40595034a12c19fef7c1b Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Sat, 17 Sep 2016 12:07:40 +0200 Subject: Drop legacy nofullsize and album width/height/quality tags This drops the legacy functionality that doesn't really fit into the new flexible design concept and makes code unnecessarily complicated. Most of these overrides affected only the "preview" image size anyway. This also makes the attribute mandatory as it's being the only source of metadata (unless overriden or supplied externally). This unfortunately breaks the so-far 100% album XML files compatibility. --- src/items.c | 40 ++++++++-------------------------------- 1 file changed, 8 insertions(+), 32 deletions(-) (limited to 'src/items.c') diff --git a/src/items.c b/src/items.c index acd4373..27ab57e 100644 --- a/src/items.c +++ b/src/items.c @@ -163,12 +163,6 @@ parse_album_xml (TGallerySetup *setup, const gchar *filename, TPathInfo *path_in g_free (s); } - prop_xml_attr_long (index->properties, PROP_QUALITY, xml, "/gallery/general/images", "quality"); - prop_xml_attr_long (index->properties, PROP_LANDSCAPE_W, xml, "/gallery/general/images", "landscape_w"); - prop_xml_attr_long (index->properties, PROP_LANDSCAPE_H, xml, "/gallery/general/images", "landscape_h"); - prop_xml_attr_long (index->properties, PROP_PORTRAIT_W, xml, "/gallery/general/images", "portrait_w"); - prop_xml_attr_long (index->properties, PROP_PORTRAIT_H, xml, "/gallery/general/images", "portrait_h"); - prop_xml_attr (index->properties, PROP_BORDER_STYLE, xml, "/gallery/general/border", "style"); index->meta_author = xml_file_get_node_value (xml, "/gallery/general/meta/author/text()"); index->meta_description = xml_file_get_node_value (xml, "/gallery/general/meta/description/text()"); @@ -201,9 +195,6 @@ parse_album_xml (TGallerySetup *setup, const gchar *filename, TPathInfo *path_in } - index->nofullsize = xml_file_get_node_present (xml, "/gallery/general/nofullsize"); - index->fullsize = xml_file_get_node_present (xml, "/gallery/general/fullsize"); - /* News records */ if (news_feed) { count = xml_file_node_get_children_count (xml, "/gallery/general/news"); @@ -270,9 +261,6 @@ parse_album_xml (TGallerySetup *setup, const gchar *filename, TPathInfo *path_in item->path = xml_file_get_node_attribute (xml, s, "path"); else item->path = xml_file_get_node_attribute (xml, s, "src"); - prop_xml_attr_long (item->properties, PROP_QUALITY, xml, s, "quality"); - prop_xml_attr_long (item->properties, PROP_WIDTH, xml, s, "width"); - prop_xml_attr_long (item->properties, PROP_HEIGHT, xml, s, "height"); prop_xml_attr (item->properties, PROP_BORDER_STYLE, xml, s, "border"); /* custom image size attributes */ @@ -296,19 +284,15 @@ parse_album_xml (TGallerySetup *setup, const gchar *filename, TPathInfo *path_in item->title_description = xml_file_get_node_value (xml, s); g_free (s); - if (index->type == GALLERY_TYPE_INDEX) { - s = g_strdup_printf ("/gallery/items/*[%d]/thumbnail", i + 1); + s = g_strdup_printf ("/gallery/items/*[%d]/thumbnail", i + 1); + if (index->type == GALLERY_TYPE_INDEX) item->thumbnail = xml_file_get_node_attribute (xml, s, "src"); - g_free (s); - } - - s = g_strdup_printf ("/gallery/items/*[%d]/nofullsize", i + 1); - item->force_nofullsize = (xml_file_get_node_present (xml, s) || item->path == NULL); - g_free (s); - - s = g_strdup_printf ("/gallery/items/*[%d]/fullsize", i + 1); - item->force_fullsize = xml_file_get_node_present (xml, s); + s2 = xml_file_get_node_attribute (xml, s, "crop"); g_free (s); + if (s2 != NULL) { + properties_table_add_int (item->properties, PROP_THUMB_CROP_HINT, parse_thumbnail_crop_hint (s2)); + g_free (s2); + } s = g_strdup_printf ("/gallery/items/*[%d]/hidden", i + 1); item->hidden = (xml_file_get_node_present (xml, s)); @@ -365,15 +349,7 @@ parse_album_xml (TGallerySetup *setup, const gchar *filename, TPathInfo *path_in } g_free (s); - s = g_strdup_printf ("/gallery/items/*[%d]/thumbnail", i + 1); - s2 = xml_file_get_node_attribute (xml, s, "crop"); - g_free (s); - if (s2 != NULL) { - properties_table_add_int (item->properties, PROP_THUMB_CROP_HINT, parse_thumbnail_crop_hint (s2)); - g_free (s2); - } - - if (item->path || item->image_sizes) { + if (item->path) { g_ptr_array_add (index->items, item); } else { log_error ("%s: No image src specified (title = '%s'), skipping!\n", filename, item->title); -- cgit v1.2.3