Show an "infinite" list when total is unknown

* src/eom-detail-window.c (eom_detail_window_load): If the currently
  selected manga's `total_qty' is `0', take, for viewing/editing
  purposes, the manga's `current_qty' + `1' instead.
  (on_volume_toggled): If the current manga's `total_qty' is `0'
  reload the screen after toggling a manga as collected.
This commit is contained in:
Tom Willemsen 2012-10-25 00:25:24 +02:00
parent 18d4d38e8d
commit 337a0ba2d2

View file

@ -36,13 +36,19 @@ void
eom_detail_window_load(EomDetailWindow *self)
{
gint i, j = 0, row = 0, col = 0;
int rows = (int)floor(self->manga->total_qty / COLUMNS);
int total_qty = self->manga->total_qty;
int rows;
if (!total_qty)
total_qty = self->manga->current_qty + 1;
rows = (int)floor(total_qty / COLUMNS);
gtk_window_set_title(GTK_WINDOW(self), self->manga->name);
gtk_table_resize(GTK_TABLE(self->ctable), rows, COLUMNS);
gtk_table_resize(GTK_TABLE(self->rtable), rows, COLUMNS);
for (i = 0; i < self->manga->total_qty; i++) {
for (i = 0; i < total_qty; i++) {
GtkWidget *cbtn, *rbtn;
gchar *txt;
@ -275,6 +281,9 @@ on_volume_toggled(GtkToggleButton *togglebutton, gpointer user_data)
}
self->manga->current_qty--;
}
if (!self->manga->total_qty)
eom_detail_window_load(self);
}
static void