]> www.fi.muni.cz Git - evince.git/blobdiff - backend/comics/comics-document.c
Fixed wrong translation.
[evince.git] / backend / comics / comics-document.c
index e0fdd31ef781b0223b05afa746cbf11001efede9..092d8c2b3876b5caf3f5690727672978d114327e 100644 (file)
@@ -72,7 +72,7 @@ comics_regex_quote (const char *s)
 {
     char *ret, *d;
 
 {
     char *ret, *d;
 
-    d = ret = g_malloc (strlen (s) * 2 + 3);
+    d = ret = g_malloc (strlen (s) * 4 + 3);
     
     *d++ = '\'';
 
     
     *d++ = '\'';
 
@@ -85,7 +85,9 @@ comics_regex_quote (const char *s)
        case '*':
        case '\\':
        case '\'':
        case '*':
        case '\\':
        case '\'':
+           *d++ = '\'';
            *d++ = '\\';
            *d++ = '\\';
+           *d++ = '\'';
            break;
        }
        *d = *s;
            break;
        }
        *d = *s;
@@ -266,7 +268,7 @@ get_page_size_area_prepared_cb (GdkPixbufLoader *loader,
 }
 
 static GdkPixbuf *
 }
 
 static GdkPixbuf *
-comics_document_render_pixbuf (EvDocument  *document,
+comics_document_render_pixbuf (EvDocument      *document,
                               EvRenderContext *rc)
 {
        GdkPixbufLoader *loader;
                               EvRenderContext *rc)
 {
        GdkPixbufLoader *loader;
@@ -307,9 +309,24 @@ comics_document_render_pixbuf (EvDocument  *document,
                                                   360 - rc->rotation);
        g_spawn_close_pid (child_pid);
        g_object_unref (loader);
                                                   360 - rc->rotation);
        g_spawn_close_pid (child_pid);
        g_object_unref (loader);
+
        return rotated_pixbuf;
 }
 
        return rotated_pixbuf;
 }
 
+static cairo_surface_t *
+comics_document_render (EvDocument      *document,
+                       EvRenderContext *rc)
+{
+       GdkPixbuf       *pixbuf;
+       cairo_surface_t *surface;
+
+       pixbuf = comics_document_render_pixbuf (document, rc);
+       surface = ev_document_misc_surface_from_pixbuf (pixbuf);
+       g_object_unref (pixbuf);
+       
+       return surface;
+}
+
 static void
 render_pixbuf_size_prepared_cb (GdkPixbufLoader *loader,
                                gint             width,
 static void
 render_pixbuf_size_prepared_cb (GdkPixbufLoader *loader,
                                gint             width,
@@ -317,8 +334,8 @@ render_pixbuf_size_prepared_cb (GdkPixbufLoader *loader,
                                gpointer         data)
 {
        double *scale = data;
                                gpointer         data)
 {
        double *scale = data;
-       int w = width  * (*scale);
-       int h = height * (*scale);
+       int w = (width  * (*scale) + 0.5);
+       int h = (height * (*scale) + 0.5);
 
        gdk_pixbuf_loader_set_size (loader, w, h);
 }
 
        gdk_pixbuf_loader_set_size (loader, w, h);
 }
@@ -369,11 +386,11 @@ comics_document_document_iface_init (EvDocumentIface *iface)
 {
        iface->load = comics_document_load;
        iface->save = comics_document_save;
 {
        iface->load = comics_document_load;
        iface->save = comics_document_save;
-       iface->can_get_text  = comics_document_can_get_text;
-       iface->get_n_pages   = comics_document_get_n_pages;
+       iface->can_get_text = comics_document_can_get_text;
+       iface->get_n_pages = comics_document_get_n_pages;
        iface->get_page_size = comics_document_get_page_size;
        iface->get_page_size = comics_document_get_page_size;
-       iface->render_pixbuf = comics_document_render_pixbuf;
-       iface->get_info      = comics_document_get_info;
+       iface->render = comics_document_render;
+       iface->get_info = comics_document_get_info;
 }
 
 static void
 }
 
 static void
@@ -461,6 +478,7 @@ extract_argv (EvDocument *document, gint page)
        ComicsDocument *comics_document = COMICS_DOCUMENT (document);
        char **argv;
        char *command_line, *quoted_archive, *quoted_filename;
        ComicsDocument *comics_document = COMICS_DOCUMENT (document);
        char **argv;
        char *command_line, *quoted_archive, *quoted_filename;
+       GError *err = NULL;
 
        quoted_archive = g_shell_quote (comics_document->archive);
        if (comics_document->regex_arg) {
 
        quoted_archive = g_shell_quote (comics_document->archive);
        if (comics_document->regex_arg) {
@@ -475,8 +493,14 @@ extract_argv (EvDocument *document, gint page)
                                        comics_document->extract_command,
                                        quoted_archive,
                                        quoted_filename);
                                        comics_document->extract_command,
                                        quoted_archive,
                                        quoted_filename);
-       g_shell_parse_argv (command_line, NULL, &argv, NULL);
 
 
+       g_shell_parse_argv (command_line, NULL, &argv, &err);
+       
+       if (err) {
+               g_warning ("Error %s", err->message);
+               return NULL;
+       }
+       
        g_free (command_line);
        g_free (quoted_archive);
        g_free (quoted_filename);
        g_free (command_line);
        g_free (quoted_archive);
        g_free (quoted_filename);