static void notify_load_status_cb (WebKitWebView *view, GParamSpec *pspec, gpointer user_data) { WebKitLoadStatus status; g_object_get (view, "load-status", &status, NULL); if (status == WEBKIT_LOAD_FINISHED) { if (!webpagevals.error) { webpagevals.pixbuf = gtk_offscreen_window_get_pixbuf (GTK_OFFSCREEN_WINDOW (user_data)); } gtk_main_quit (); } }
/* We should probably experiment some more with this. * Right now the rendered icon is pretty good for most * themes. However, the icon is slightly large for themes * with large toolbar icons. */ static GdkPixbuf * new_pixbuf_from_widget (GtkWidget *widget) { GtkWidget *window; GdkPixbuf *pixbuf; gint icon_height; GdkScreen *screen; screen = gtk_widget_get_screen (widget); if (!gtk_icon_size_lookup_for_settings (gtk_settings_get_for_screen (screen), GTK_ICON_SIZE_LARGE_TOOLBAR, NULL, &icon_height)) { icon_height = DEFAULT_ICON_HEIGHT; } window = gtk_offscreen_window_new (); /* Set the width to -1 as we want the separator to be as thin as possible. */ gtk_widget_set_size_request (widget, -1, icon_height); gtk_container_add (GTK_CONTAINER (window), widget); gtk_widget_show_all (window); /* Process the waiting events to have the widget actually drawn */ gdk_window_process_updates (gtk_widget_get_window (window), TRUE); pixbuf = gtk_offscreen_window_get_pixbuf (GTK_OFFSCREEN_WINDOW (window)); gtk_widget_destroy (window); return pixbuf; }
JNIEXPORT jlong JNICALL Java_org_gnome_gtk_GtkOffscreenWindow_gtk_1offscreen_1window_1get_1pixbuf ( JNIEnv* env, jclass cls, jlong _self ) { GdkPixbuf* result; jlong _result; GtkOffscreenWindow* self; // convert parameter self self = (GtkOffscreenWindow*) _self; // call function result = gtk_offscreen_window_get_pixbuf(self); // cleanup parameter self // translate return value to JNI type _result = (jlong) result; // cleanup return value if (result != NULL) { bindings_java_memory_cleanup((GObject*)result, FALSE); } // and finally return _result; }