示例#1
0
void
eom_detail_window_load(EomDetailWindow *self)
{
    gint i, j = 0, row = 0, col = 0;
    int total_qty = self->manga->total_qty;
    int rows;

    if (!total_qty)
        total_qty = self->manga->current_qty + 1;

    rows = (int)ceil(total_qty / COLUMNS);

    gtk_window_set_title(GTK_WINDOW(self), self->manga->name);
    gtk_container_foreach(GTK_CONTAINER(self->ctable), cb_destroy, NULL);
    gtk_table_resize(GTK_TABLE(self->ctable), rows, COLUMNS);
    gtk_container_foreach(GTK_CONTAINER(self->rtable), cb_destroy, NULL);
    gtk_table_resize(GTK_TABLE(self->rtable), rows, COLUMNS);

    for (i = 0; i < total_qty; i++) {
        GtkWidget *cbtn, *rbtn;
        gchar *txt;

        if (i > 0 && i % COLUMNS == 0) {
            row++;
            col = 0;
        }

        txt = g_strdup_printf("%d", i + 1);
        cbtn = create_volume_button(txt, GTK_TABLE(self->ctable), col,
                                    row);
        rbtn = create_volume_button(txt, GTK_TABLE(self->rtable), col,
                                    row);

        if (j < self->manga->vol_count
                && self->manga->volumes[j].number == i + 1) {
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cbtn), TRUE);

            if (self->manga->volumes[j].read)
                gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rbtn),
                                             TRUE);

            j++;
        }

        g_signal_connect(cbtn, "toggled", G_CALLBACK(on_volume_toggled),
                         (gpointer)self);
        g_signal_connect(rbtn, "toggled",
                         G_CALLBACK(on_volume_read_toggled),
                         (gpointer)self);

        g_free(txt);
        col++;
    }

    gtk_widget_show_all(self->volsbox);
}
示例#2
0
文件: volume.c 项目: tom2901/desktop
//MODLOADER
G_MODULE_EXPORT void plugin_call(GtkWidget *root)
{
  g_print("------------------------------\n-> SIDE Volume loading...\n------------------------------\n"); //notify the user...
  box = side_plugin_get_root_box(root);
  create_volume_button();
}
示例#3
0
文件: volume.c 项目: tom2901/desktop
gboolean redraw_volume_button(GtkWidget *widget, GdkEvent  *event, gpointer user_data)
{
  g_debug("captured destuction of volume button -> re-create");
  create_volume_button(); //draw it again!!
  return FALSE;
}