gtk_gs_init(GtkGS * gs)
{
gs->bpixmap = NULL;
- gs->use_bpixmap = TRUE;
gs->current_page = -2;
gs->disable_start = FALSE;
char *savelocale;
#endif
+ if (gs->pstarget == NULL)
+ return;
+
/* Do we have to check if the actual geometry changed? */
stop_interpreter(gs);
/* clear new pixmap (set to white) */
fill = gdk_gc_new(gs->pstarget);
if(fill) {
- //colormap = gtk_widget_get_colormap(GTK_WIDGET(gs));
- //gdk_color_alloc(colormap, &white);
gdk_gc_set_foreground(fill, &white);
- if(gs->use_bpixmap && gs->width > 0 && gs->height > 0) {
+ if(gs->width > 0 && gs->height > 0) {
if(gs->bpixmap) {
gdk_drawable_unref(gs->bpixmap);
gs->bpixmap = NULL;
return gs->gs_filename;
/* do the decompression */
- filename = ggv_quote_filename(gs->gs_filename);
+ filename = g_shell_quote(gs->gs_filename);
filename_unc = g_strconcat(g_get_tmp_dir(), "/ggvXXXXXX", NULL);
if((fd = mkstemp(filename_unc)) < 0) {
g_free(filename_unc);
return NULL;
}
close(fd);
- fname = ggv_quote_filename(filename);
+ fname = g_shell_quote(filename);
cmd = g_strdup_printf(gtk_gs_defaults_get_dsc_cmd(), filename_dsc, fname);
g_free(fname);
/* this command (sometimes?) prints error messages to stdout! */
return NULL;
}
close(tmpfd);
- fname = ggv_quote_filename(gs->gs_filename_unc ?
- gs->gs_filename_unc : gs->gs_filename);
+ fname = g_shell_quote (gs->gs_filename_unc ?
+ gs->gs_filename_unc : gs->gs_filename);
cmd = g_strdup_printf(gtk_gs_defaults_get_convert_pdf_cmd(), tmpn, fname);
g_free(fname);
if((system(cmd) == 0) && ggv_file_readable(tmpn)) {
ps_document_set_target (EvDocument *document,
GdkDrawable *target)
{
- GTK_GS (document)->pstarget = target;
+ GtkGS *gs = GTK_GS (document);
+
+ gs->pstarget = target;
+ gtk_gs_goto_page (gs, gs->current_page);
}
static void
int *width,
int *height)
{
+ GtkGS *gs = GTK_GS (document);
+
+ if (width) {
+ *width = gs->width;
+ }
+
+ if (height) {
+ *height = gs->height;
+ }
}
static void
GtkGS *gs = GTK_GS (document);
GdkGC *gc;
+ if (gs->pstarget == NULL ||
+ gs->bpixmap == NULL) {
+ return;
+ }
+
gc = gdk_gc_new (gs->pstarget);
gdk_draw_drawable (gs->pstarget, gc,
g_object_unref (gc);
}
-static void
-ps_document_begin_find (EvDocument *document,
- const char *search_string,
- gboolean case_sensitive)
-{
-}
-
-static void
-ps_document_end_find (EvDocument *document)
-{
-}
-
static void
ps_document_document_iface_init (EvDocumentIface *iface)
{
iface->set_page_offset = ps_document_set_page_offset;
iface->get_page_size = ps_document_get_page_size;
iface->render = ps_document_render;
- iface->begin_find = ps_document_begin_find;
- iface->end_find = ps_document_end_find;
}