forked from sergiotarxz/mangareader
Cleaning up.
This commit is contained in:
parent
d2ecdddf44
commit
de496ad246
47
main.c
47
main.c
@ -15,7 +15,7 @@ GtkBox *
|
|||||||
create_manga_container ();
|
create_manga_container ();
|
||||||
GtkListBox *
|
GtkListBox *
|
||||||
create_list_box (GtkBox *box);
|
create_list_box (GtkBox *box);
|
||||||
void
|
void
|
||||||
g_object_set_property_int(GObject *object, char *property_key, int value);
|
g_object_set_property_int(GObject *object, char *property_key, int value);
|
||||||
static void
|
static void
|
||||||
setup_list_view_mangas(GtkSignalListItemFactory *factory,
|
setup_list_view_mangas(GtkSignalListItemFactory *factory,
|
||||||
@ -34,12 +34,12 @@ activate (AdwApplication *app,
|
|||||||
create_headerbar (box);
|
create_headerbar (box);
|
||||||
|
|
||||||
GListStore *mangas;
|
GListStore *mangas;
|
||||||
|
|
||||||
MgBackendReadmng *readmng = mg_backend_readmng_new ();
|
MgBackendReadmng *readmng = mg_backend_readmng_new ();
|
||||||
mangas = mg_backend_readmng_get_featured_manga (readmng);
|
mangas = mg_backend_readmng_get_featured_manga (readmng);
|
||||||
GtkSingleSelection *selection = gtk_single_selection_new (G_LIST_MODEL (mangas));
|
GtkSingleSelection *selection = gtk_single_selection_new (G_LIST_MODEL (mangas));
|
||||||
GtkListItemFactory *factory = gtk_signal_list_item_factory_new ();
|
GtkListItemFactory *factory = gtk_signal_list_item_factory_new ();
|
||||||
g_signal_connect (G_OBJECT (factory), "bind",
|
g_signal_connect (G_OBJECT (factory), "bind",
|
||||||
G_CALLBACK (setup_list_view_mangas),
|
G_CALLBACK (setup_list_view_mangas),
|
||||||
NULL);
|
NULL);
|
||||||
GtkWidget *list_view = gtk_list_view_new (GTK_SELECTION_MODEL (selection),
|
GtkWidget *list_view = gtk_list_view_new (GTK_SELECTION_MODEL (selection),
|
||||||
@ -75,7 +75,7 @@ setup_list_view_mangas(GtkSignalListItemFactory *factory,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
error = NULL;
|
error = NULL;
|
||||||
g_output_stream_write (g_io_stream_get_output_stream (G_IO_STREAM (iostream)),
|
g_output_stream_write (g_io_stream_get_output_stream (G_IO_STREAM (iostream)),
|
||||||
downloaded_image, size_downloaded_image, NULL, &error);
|
downloaded_image, size_downloaded_image, NULL, &error);
|
||||||
if (error) {
|
if (error) {
|
||||||
fprintf (stderr, "Unable to write file: %s\n", error->message);
|
fprintf (stderr, "Unable to write file: %s\n", error->message);
|
||||||
@ -89,43 +89,6 @@ setup_list_view_mangas(GtkSignalListItemFactory *factory,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fill_list_of_mangas (GtkListBox *list) {
|
|
||||||
// for (int i = 0; i<len_mangas; i++) {
|
|
||||||
// GtkWidget *picture;
|
|
||||||
// GFileIOStream *iostream;
|
|
||||||
// GFile *tmp_image;
|
|
||||||
// GError *error = NULL;
|
|
||||||
//
|
|
||||||
// size_t size_downloaded_image = 0;
|
|
||||||
// char *downloaded_image;
|
|
||||||
//
|
|
||||||
// manga = mangas[i];
|
|
||||||
//
|
|
||||||
// downloaded_image = get_request (mg_manga_get_image_url(manga), &size_downloaded_image);
|
|
||||||
// tmp_image = g_file_new_tmp ("mangareadertmpfileXXXXXX",
|
|
||||||
// &iostream,
|
|
||||||
// &error
|
|
||||||
// );
|
|
||||||
// if (error) {
|
|
||||||
// fprintf (stderr, "Unable to read file: %s\n", error->message);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// error = NULL;
|
|
||||||
// g_output_stream_write (g_io_stream_get_output_stream (G_IO_STREAM (iostream)),
|
|
||||||
// downloaded_image, size_downloaded_image, NULL, &error);
|
|
||||||
// if (error) {
|
|
||||||
// fprintf (stderr, "Unable to write file: %s\n", error->message);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// picture = gtk_picture_new_for_file (tmp_image);
|
|
||||||
// g_object_set_property_int (G_OBJECT(picture), "height-request", 200);
|
|
||||||
// row = gtk_list_box_row_new ();
|
|
||||||
// gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), picture);
|
|
||||||
// gtk_list_box_append (list, row);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
g_object_set_property_int(GObject *object, char *property_key, int value) {
|
g_object_set_property_int(GObject *object, char *property_key, int value) {
|
||||||
GValue property = G_VALUE_INIT;
|
GValue property = G_VALUE_INIT;
|
||||||
g_value_init (&property, G_TYPE_INT);
|
g_value_init (&property, G_TYPE_INT);
|
||||||
@ -148,7 +111,7 @@ create_main_box (AdwApplicationWindow *window) {
|
|||||||
GTK_ORIENTATION_VERTICAL,
|
GTK_ORIENTATION_VERTICAL,
|
||||||
10);
|
10);
|
||||||
adw_application_window_set_content(
|
adw_application_window_set_content(
|
||||||
window,
|
window,
|
||||||
box);
|
box);
|
||||||
return GTK_BOX (box);
|
return GTK_BOX (box);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user