On 11/20/2011 07:29 AM, Richard Shann wrote:
Below is a self-contained test file for printing from the evince widget.
It uses the same code as print.c for the printing, and it works.
I have tried embedding it into Denemo and when I do this it does not
print. It seems that the draw_page signal is not emitted (that is, the
callback which libevince attaches is never called).
I have built a debug version of libevince, and verified that the handler
for draw_page is connected.
Something we are doing in Denemo must be causing this. It is all the
stranger since until now we were using the draw_page signal ourselves to
print from a .png loaded into the print preview window.
This test prints and runs fine when compiled with gtk-3 and libevince-3.
I use this to compile it:
gcc evince_test.c -o test `pkg-config --libs --cflags evince-view-3.0`
`pkg-config --libs --cflags gtk+-3.0`
I will glance over it and see if I notice anything also.
Jeremiah
If anyone has any idea how this signal might be getting lost I would
like to know.
Richard
#include<stdio.h>
#include<gtk/gtk.h>
#include<evince-view.h>
evince_print() {
GError *err = NULL;
GFile *file;
gchar *filename = "test.pdf";
file = g_file_new_for_commandline_arg (filename);
gchar *uri = g_file_get_uri (file);
g_object_unref (file);
EvDocument *doc = ev_document_factory_get_document (uri,&err);
if(err) {
g_warning ("Trying to read the pdf file %s gave an error: %s", uri,
err->message);
if(err)
g_error_free (err);
err = NULL;
} else {
EvPrintOperation *printop = ev_print_operation_new (doc);
ev_print_operation_run (printop, NULL);
}
}
int main(int argc, char **argv)
{
GtkWidget *main_vbox, *top;
gtk_init(&argc,&argv);
ev_init();
GtkWidget *printarea;
top = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(top), "Evince Print Test");
printarea = gtk_button_new_with_label("click me to print the file
test.pdf");
gtk_container_add (GTK_CONTAINER(top), (GtkWidget*)printarea);
g_signal_connect (G_OBJECT (printarea), "clicked",
G_CALLBACK (evince_print), NULL);
gtk_widget_show_all(top);
gtk_main();
return 0;
}
//////////////// end of source code
To build use something like
gcc testevince.c -o test -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include
-I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0
-I/usr/include/gio-unix-2.0/ -I/usr/include/pixman-1 -I/usr/include/freetype2
-I/usr/include/libpng12 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
-I/usr/include/libxml2 -pthread -I/usr/include/gtksourceview-2.0
-I/usr/include/libxml2 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include
-I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0
-I/usr/include/gio-unix-2.0/ -I/usr/include/pixman-1 -I/usr/include/freetype2
-I/usr/include/libpng12 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
-pthread -I/usr/include/librsvg-2 -I/usr/include/glib-2.0
-I/usr/lib/glib-2.0/include -I/usr/include/gtk-2.0 -I/usr/include/cairo
-I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
-I/usr/include/evince/2.30 -levview -levdocument
(a lot of that could be omitted I'm sure :)
_______________________________________________
Denemo-devel mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/denemo-devel
_______________________________________________
Denemo-devel mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/denemo-devel