2021-11-01 14:38:15 +01:00
|
|
|
#include <gtk/gtk.h>
|
2021-11-01 20:02:05 +01:00
|
|
|
#include <adwaita.h>
|
2021-11-01 14:38:15 +01:00
|
|
|
|
|
|
|
#include <openmg/manga.h>
|
|
|
|
|
2021-11-04 00:00:00 +01:00
|
|
|
#include <openmg/backend/readmng.h>
|
|
|
|
|
2021-11-01 18:07:12 +01:00
|
|
|
#include <openmg/util/xml.h>
|
2021-11-06 01:36:07 +01:00
|
|
|
#include <openmg/util/gobject_utility_extensions.h>
|
2021-11-01 18:07:12 +01:00
|
|
|
|
2021-11-01 14:38:15 +01:00
|
|
|
#include <openmg/view/picture.h>
|
|
|
|
#include <openmg/view/detail_manga.h>
|
2021-11-06 01:36:07 +01:00
|
|
|
#include <openmg/view/list_view_chapter.h>
|
2021-11-01 14:38:15 +01:00
|
|
|
|
|
|
|
GtkBox *
|
|
|
|
create_detail_view (MgManga *manga) {
|
2021-11-04 00:00:00 +01:00
|
|
|
MgBackendReadmng *readmng = mg_backend_readmng_new ();
|
2021-11-06 01:36:07 +01:00
|
|
|
GtkWidget *scroll;
|
2021-11-01 14:38:15 +01:00
|
|
|
GtkBox *detail_view = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 0));
|
2021-11-04 00:00:00 +01:00
|
|
|
GtkBox *avatar_title_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
|
2021-11-01 18:07:12 +01:00
|
|
|
MgUtilXML *xml_util = mg_util_xml_new ();
|
2021-11-01 20:02:05 +01:00
|
|
|
GtkLabel *manga_title = NULL;
|
2021-11-04 00:00:00 +01:00
|
|
|
GtkLabel *manga_description = NULL;
|
2021-11-06 01:36:07 +01:00
|
|
|
GtkListView *chapter_list = NULL;
|
2021-11-01 14:38:15 +01:00
|
|
|
GtkPicture *manga_image = create_picture_from_url (
|
|
|
|
mg_manga_get_image_url(manga), 200);
|
2021-11-01 18:07:12 +01:00
|
|
|
char *title_text = mg_util_xml_get_title_text (
|
|
|
|
xml_util, mg_manga_get_title (manga));
|
2021-11-04 00:00:00 +01:00
|
|
|
char *description_text;
|
|
|
|
|
2021-11-06 01:36:07 +01:00
|
|
|
scroll = gtk_scrolled_window_new ();
|
2021-11-04 00:00:00 +01:00
|
|
|
|
2021-11-06 01:36:07 +01:00
|
|
|
mg_backend_readmng_retrieve_manga_details (readmng, manga);
|
|
|
|
chapter_list = create_list_view_chapters (manga);
|
2021-11-04 00:00:00 +01:00
|
|
|
description_text = mg_manga_get_description (manga);
|
|
|
|
|
2021-11-01 20:02:05 +01:00
|
|
|
manga_title = GTK_LABEL (gtk_label_new (title_text));
|
2021-11-04 00:00:00 +01:00
|
|
|
manga_description = GTK_LABEL (gtk_label_new (description_text));
|
|
|
|
|
2021-11-01 20:02:05 +01:00
|
|
|
gtk_label_set_wrap (manga_title, 1);
|
2021-11-04 00:00:00 +01:00
|
|
|
gtk_label_set_wrap (manga_description, 1);
|
|
|
|
|
2021-11-01 18:07:12 +01:00
|
|
|
gtk_label_set_use_markup (GTK_LABEL (manga_title), 1);
|
2021-11-04 00:00:00 +01:00
|
|
|
gtk_box_append (avatar_title_box, GTK_WIDGET (manga_image));
|
|
|
|
gtk_box_append (avatar_title_box, GTK_WIDGET (manga_title));
|
|
|
|
gtk_box_append (detail_view, GTK_WIDGET (avatar_title_box));
|
|
|
|
gtk_box_append (detail_view, GTK_WIDGET (manga_description));
|
2021-11-06 01:36:07 +01:00
|
|
|
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scroll), GTK_WIDGET (chapter_list));
|
|
|
|
g_object_set_property_int (G_OBJECT (scroll), "vexpand", 1);
|
|
|
|
gtk_box_append (detail_view, GTK_WIDGET (scroll));
|
2021-11-04 00:00:00 +01:00
|
|
|
|
2021-11-01 14:38:15 +01:00
|
|
|
return detail_view;
|
|
|
|
}
|