1 #include "description_chunks.h"
2 
parse_fb2_title_info(APP * app,xmlNode * parent_node,GtkTextIter * text_buff_end)3 int parse_fb2_title_info(APP* app, xmlNode* parent_node, GtkTextIter* text_buff_end)
4 {
5 	g_return_val_if_fail(parent_node	!= NULL, EXIT_FAILURE);
6 	g_return_val_if_fail(text_buff_end	!= NULL, EXIT_FAILURE);
7 
8 	xmlNode* node				= parent_node->children;
9 	if(node != NULL)
10 	{
11 		GtkTextBuffer* text_buff	= app->text_buff;
12 
13 		gtk_text_buffer_insert(text_buff, text_buff_end, "\n\n\n\n", -1);
14 
15 		while(node != NULL)
16 		{
17 			if(node->type == XML_ELEMENT_NODE)
18 			{
19 				if(strcmp((char*)node->name, "coverpage") == 0)
20 				{
21 					parse_fb2_coverpage(app, node, text_buff_end);
22 					break;
23 				}
24 			}
25 			node = node->next;
26 		}
27 
28 		node = parent_node->children;
29 
30 		while(node != NULL)
31 		{
32 			if(node->type == XML_ELEMENT_NODE)
33 			{
34 				if(strcmp((char*)node->name, "book-title") == 0)
35 					parse_fb2_book_title(app, node, text_buff_end);
36 				else if(strcmp((char*)node->name, "annotation") == 0)
37 					parse_fb2_annotation(app, node, text_buff_end);
38 			}
39 			node = node->next;
40 		}
41 
42 		gtk_text_buffer_insert(text_buff, text_buff_end, "\n\n\n\n", -1);
43 	}
44 	else
45 		g_log(NULL, G_LOG_LEVEL_WARNING, "No content in <title-info> tag");
46 
47 
48 	return EXIT_SUCCESS;
49 }
50