Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/backend/djvu
diff options
context:
space:
mode:
authorCarlos Garcia Campos <carlosgc@gnome.org>2007-07-26 14:53:17 (GMT)
committer Carlos Garcia Campos <carlosgc@src.gnome.org>2007-07-26 14:53:17 (GMT)
commite70119b293ab8a26bdea4a56407bb0f41f1e43aa (patch)
tree627b9853902c99806786543eb0155151925cfed6 /backend/djvu
parent0b6b9a984c7cfbf0e313a10f9bd09f77cb3be164 (diff)
Use capabilities to know which options should be offered by the print
2007-07-26 Carlos Garcia Campos <carlosgc@gnome.org> * backend/dvi/dvi-document.c: (dvi_document_file_exporter_begin), (dvi_document_file_exporter_do_page), (dvi_document_file_exporter_get_capabilities), (dvi_document_file_exporter_iface_init): * backend/ps/ps-document.c: (ps_document_file_exporter_begin), (ps_document_file_exporter_do_page), (ps_document_file_exporter_get_capabilities), (ps_document_file_exporter_iface_init): * backend/djvu/djvu-document.c: (djvu_document_file_exporter_begin), (djvu_document_file_exporter_end), (djvu_document_file_exporter_get_capabilities), (djvu_document_file_exporter_iface_init): * backend/tiff/tiff-document.c: (tiff_document_file_exporter_begin), (tiff_document_file_exporter_get_capabilities), (tiff_document_document_file_exporter_iface_init): * backend/pdf/ev-poppler.cc: (pdf_document_file_exporter_begin), (pdf_document_file_exporter_do_page), (pdf_document_file_exporter_get_capabilities), (pdf_document_file_exporter_iface_init): * libdocument/ev-file-exporter.[ch]: (ev_file_exporter_begin), (ev_file_exporter_get_capabilities): * shell/ev-print-job.c: (ev_print_job_use_print_dialog_settings), (idle_print_handler), (ev_print_job_print): * shell/ev-jobs.c: (ev_job_print_run): * shell/ev-window.c: (ev_window_print_send), (ev_window_print_range): Use capabilities to know which options should be offered by the print dialog depending on the document backend. svn path=/trunk/; revision=2580
Diffstat (limited to 'backend/djvu')
-rw-r--r--backend/djvu/djvu-document.c41
1 files changed, 19 insertions, 22 deletions
diff --git a/backend/djvu/djvu-document.c b/backend/djvu/djvu-document.c
index 88c6bc8..9b4ba82 100644
--- a/backend/djvu/djvu-document.c
+++ b/backend/djvu/djvu-document.c
@@ -441,30 +441,17 @@ djvu_document_document_thumbnails_iface_init (EvDocumentThumbnailsIface *iface)
}
/* EvFileExporterIface */
-static gboolean
-djvu_document_file_exporter_format_supported (EvFileExporter *exporter,
- EvFileExporterFormat format)
-{
- return (format == EV_FILE_FORMAT_PS); // only exporting to PS is implemented.
-}
-
static void
-djvu_document_file_exporter_begin (EvFileExporter *exporter,
- EvFileExporterFormat format,
- const char *filename, /* for storing the temp ps file */
- int first_page,
- int last_page,
- double width,
- double height,
- gboolean duplex)
+djvu_document_file_exporter_begin (EvFileExporter *exporter,
+ EvFileExporterContext *fc)
{
DjvuDocument *djvu_document = DJVU_DOCUMENT (exporter);
if (djvu_document->ps_filename)
g_free (djvu_document->ps_filename);
- djvu_document->ps_filename = g_strdup(filename);
+ djvu_document->ps_filename = g_strdup (fc->filename);
- g_string_assign(djvu_document->opts, "-page=");
+ g_string_assign (djvu_document->opts, "-page=");
}
static void
@@ -473,7 +460,7 @@ djvu_document_file_exporter_do_page (EvFileExporter *exporter,
{
DjvuDocument *djvu_document = DJVU_DOCUMENT (exporter);
- g_string_append_printf(djvu_document->opts, "%d,", (rc->page) + 1);
+ g_string_append_printf (djvu_document->opts, "%d,", (rc->page) + 1);
}
static void
@@ -484,29 +471,39 @@ djvu_document_file_exporter_end (EvFileExporter *exporter)
DjvuDocument *djvu_document = DJVU_DOCUMENT (exporter);
- FILE *fn = fopen(djvu_document->ps_filename, "w");
+ FILE *fn = fopen (djvu_document->ps_filename, "w");
if (fn == NULL) {
- g_warning(_("Cannot open file ā€œ%sā€."), djvu_document->ps_filename);
+ g_warning ("Cannot open file ā€œ%sā€.", djvu_document->ps_filename);
return;
}
d_optv[0] = djvu_document->opts->str;
ddjvu_job_t * job = ddjvu_document_print(djvu_document->d_document, fn, d_optc, d_optv);
- while (!ddjvu_job_done(job) ) {
+ while (!ddjvu_job_done(job)) {
djvu_handle_events (djvu_document, TRUE);
}
fclose(fn);
}
+static EvFileExporterCapabilities
+djvu_document_file_exporter_get_capabilities (EvFileExporter *exporter)
+{
+ return EV_FILE_EXPORTER_CAN_PAGE_SET |
+ EV_FILE_EXPORTER_CAN_COPIES |
+ EV_FILE_EXPORTER_CAN_COLLATE |
+ EV_FILE_EXPORTER_CAN_REVERSE |
+ EV_FILE_EXPORTER_CAN_GENERATE_PS;
+}
+
static void
djvu_document_file_exporter_iface_init (EvFileExporterIface *iface)
{
- iface->format_supported = djvu_document_file_exporter_format_supported;
iface->begin = djvu_document_file_exporter_begin;
iface->do_page = djvu_document_file_exporter_do_page;
iface->end = djvu_document_file_exporter_end;
+ iface->get_capabilities = djvu_document_file_exporter_get_capabilities;
}
static void