static void window_create(IMAGE *img)
{
    /* Create a gtk window */
    img->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title(GTK_WINDOW(img->window), "gs");
#if !GTK_CHECK_VERSION(3, 0, 0)
    img->vbox = gtk_vbox_new(FALSE, 0);
#else
    img->vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
    gtk_box_set_homogeneous(img->vbox, FALSE);
#endif
    gtk_container_add(GTK_CONTAINER(img->window), img->vbox);
    gtk_widget_show(img->vbox);

    img->darea = gtk_drawing_area_new();
    gtk_widget_show(img->darea);
    img->scroll = gtk_scrolled_window_new(NULL, NULL);
    gtk_widget_show(img->scroll);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(img->scroll),
        GTK_POLICY_ALWAYS, GTK_POLICY_ALWAYS);
    gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(img->scroll),
        img->darea);
    gtk_box_pack_start(GTK_BOX(img->vbox), img->scroll, TRUE, TRUE, 0);
#if !GTK_CHECK_VERSION(3, 0, 0)
    g_signal_connect(G_OBJECT (img->darea), "expose-event",
#else
    g_signal_connect(G_OBJECT (img->darea), "draw",
#endif
                        G_CALLBACK (window_draw), img);
    g_signal_connect(G_OBJECT (img->window), "destroy",
                        G_CALLBACK (window_destroy), img);
    g_signal_connect(G_OBJECT (img->window), "delete-event",
                        G_CALLBACK (gtk_widget_hide_on_delete), NULL);
    /* do not show img->window until we know the image size */
}
static void window_create(IMAGE *img)
{
     
    img->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title(GTK_WINDOW(img->window), "gs");
#if !GTK_CHECK_VERSION(3, 0, 0)
    img->vbox = gtk_vbox_new(FALSE, 0);
#else
    img->vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
    gtk_box_set_homogeneous(img->vbox, FALSE);
#endif
    gtk_container_add(GTK_CONTAINER(img->window), img->vbox);
    gtk_widget_show(img->vbox);

    img->darea = gtk_drawing_area_new();
    gtk_widget_show(img->darea);
    img->scroll = gtk_scrolled_window_new(NULL, NULL);
    gtk_widget_show(img->scroll);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(img->scroll),
        GTK_POLICY_ALWAYS, GTK_POLICY_ALWAYS);
    gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(img->scroll),
        img->darea);
    gtk_box_pack_start(GTK_BOX(img->vbox), img->scroll, TRUE, TRUE, 0);
#if !GTK_CHECK_VERSION(3, 0, 0)
    g_signal_connect(G_OBJECT (img->darea), "expose-event",
#else
    g_signal_connect(G_OBJECT (img->darea), "draw",
#endif
                        G_CALLBACK (window_draw), img);
    g_signal_connect(G_OBJECT (img->window), "destroy",
                        G_CALLBACK (window_destroy), img);
    g_signal_connect(G_OBJECT (img->window), "delete-event",
                        G_CALLBACK (gtk_widget_hide_on_delete), NULL);
     
}