summaryrefslogtreecommitdiff
path: root/src/items.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/items.c')
-rw-r--r--src/items.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/items.c b/src/items.c
index 06864dd..4012980 100644
--- a/src/items.c
+++ b/src/items.c
@@ -81,6 +81,7 @@ parse_album_xml (const gchar *filename)
int i;
gchar *s, *s2;
gchar *node_name;
+ gchar *base_dir;
TIndexItem *item;
TAtomFeedItem *feed_item;
TAlbum *index;
@@ -90,7 +91,6 @@ parse_album_xml (const gchar *filename)
return NULL;
index = g_malloc0 (sizeof (TAlbum));
- index->base_dir = g_path_get_dirname (filename);
/* Retrieve gallery type */
gallery_type = xml_file_get_node_attribute (xml, "/gallery", "type");
@@ -107,6 +107,8 @@ parse_album_xml (const gchar *filename)
}
g_free (gallery_type);
+ base_dir = g_path_get_dirname (filename);
+
/* Section General */
index->ID = xml_file_get_node_value (xml, "/gallery/general/ID/text()");
index->title = xml_file_get_node_value (xml, "/gallery/general/title/text()");
@@ -225,14 +227,14 @@ parse_album_xml (const gchar *filename)
/* Retrieve title and description from linked album if not defined here */
if (index->type == GALLERY_TYPE_INDEX &&
item->title == NULL && item->title_description == NULL) {
- s = g_strconcat (index->base_dir, "/", item->path, "/index.xml", NULL);
+ s = g_strconcat (base_dir, "/", item->path, "/index.xml", NULL);
get_album_titles (s, &item->title, &item->title_description, NULL);
g_free (s);
}
/* Retrieve thumbnail from linked album if not defined here */
if (index->type == GALLERY_TYPE_INDEX && item->thumbnail == NULL) {
- s = g_strconcat (index->base_dir, "/", item->path, "/index.xml", NULL);
+ s = g_strconcat (base_dir, "/", item->path, "/index.xml", NULL);
s2 = NULL;
get_album_titles (s, NULL, NULL, &s2);
if (s2) {
@@ -280,6 +282,8 @@ parse_album_xml (const gchar *filename)
}
xml_parser_free (xml);
+ g_free (base_dir);
+
return index;
}
@@ -295,7 +299,6 @@ free_album_data (TAlbum *album)
g_free (album->title);
g_free (album->desc);
g_free (album->footnote);
- g_free (album->base_dir);
g_free (album->border_style);
g_free (album->meta_author);
g_free (album->meta_description);
@@ -357,3 +360,18 @@ get_album_titles (const gchar *filename, gchar **title, gchar **description, gch
xml_parser_free (xml);
}
+
+/*
+ * free_path_info: free allocated pathinfo data
+ */
+void
+free_path_info (TPathInfo *path_info)
+{
+ if (path_info) {
+ g_free (path_info->source_root);
+ g_free (path_info->dest_root);
+ g_free (path_info->src_dir);
+ g_free (path_info->dest_dir);
+ g_free (path_info);
+ }
+}