changeset 1152:58b5374355ab

Added print jobname parameter to dw_print_new(). If parameter is NULL a dummy name will be used.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 12 Sep 2011 19:26:49 +0000
parents 641aa6941b2a
children f219ae018dd3
files dw.h dwtest.c gtk/dw.c gtk3/dw.c mac/dw.m os2/dw.c template/dw.c win/dw.c
diffstat 8 files changed, 20 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/dw.h	Mon Sep 12 02:22:48 2011 +0000
+++ b/dw.h	Mon Sep 12 19:26:49 2011 +0000
@@ -1690,7 +1690,7 @@
 HWND API dw_calendar_new(unsigned long id);
 void API dw_calendar_set_date( HWND window, unsigned int year, unsigned int month, unsigned int day );
 void API dw_calendar_get_date( HWND window, unsigned int *year, unsigned int *month, unsigned int *day );
-HPRINT API dw_print_new(unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata);
+HPRINT API dw_print_new(char *jobname, unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata);
 int API dw_print_run(HPRINT print, unsigned long flags);
 void API dw_print_cancel(HPRINT print);
 
--- a/dwtest.c	Mon Sep 12 02:22:48 2011 +0000
+++ b/dwtest.c	Mon Sep 12 19:26:49 2011 +0000
@@ -387,7 +387,7 @@
 
 int DWSIGNAL print_callback(HWND window, void *data)
 {
-   HPRINT print = dw_print_new(0, 1, DW_SIGNAL_FUNC(draw_page), NULL);
+   HPRINT print = dw_print_new("DWTest Job", 0, 1, DW_SIGNAL_FUNC(draw_page), NULL);
    dw_print_run(print, 0);
    return FALSE;
 }
--- a/gtk/dw.c	Mon Sep 12 02:22:48 2011 +0000
+++ b/gtk/dw.c	Mon Sep 12 19:26:49 2011 +0000
@@ -11705,6 +11705,7 @@
 /*
  * Creates a new print object.
  * Parameters:
+ *       jobname: Name of the print job to show in the queue.
  *       flags: Flags to initially configure the print object.
  *       pages: Number of pages to print.
  *       drawfunc: The pointer to the function to be used as the callback.
@@ -11712,7 +11713,7 @@
  * Returns:
  *       A handle to the print object or NULL on failure.
  */
-HPRINT API dw_print_new(unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata)
+HPRINT API dw_print_new(char *jobname, unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata)
 {
    return NULL;
 }
--- a/gtk3/dw.c	Mon Sep 12 02:22:48 2011 +0000
+++ b/gtk3/dw.c	Mon Sep 12 19:26:49 2011 +0000
@@ -10248,6 +10248,7 @@
 /*
  * Creates a new print object.
  * Parameters:
+ *       jobname: Name of the print job to show in the queue.
  *       flags: Flags to initially configure the print object.
  *       pages: Number of pages to print.
  *       drawfunc: The pointer to the function to be used as the callback.
@@ -10255,7 +10256,7 @@
  * Returns:
  *       A handle to the print object or NULL on failure.
  */
-HPRINT API dw_print_new(unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata)
+HPRINT API dw_print_new(char *jobname, unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata)
 {
    GtkPrintOperation *op;
    int _locked_by_me = FALSE;
@@ -10267,6 +10268,7 @@
    if((op = gtk_print_operation_new()))
    {
       gtk_print_operation_set_n_pages(op, pages);
+      gtk_print_operation_set_job_name(op, jobname ? jobname : "Dynamic Windows Print Job");
       g_object_set_data(G_OBJECT(op), "_dw_drawfunc", drawfunc);
       g_object_set_data(G_OBJECT(op), "_dw_drawdata", drawdata);
       g_signal_connect(op, "draw_page", G_CALLBACK(_dw_draw_page), NULL);
--- a/mac/dw.m	Mon Sep 12 02:22:48 2011 +0000
+++ b/mac/dw.m	Mon Sep 12 19:26:49 2011 +0000
@@ -9307,6 +9307,7 @@
 /*
  * Creates a new print object.
  * Parameters:
+ *       jobname: Name of the print job to show in the queue.
  *       flags: Flags to initially configure the print object.
  *       pages: Number of pages to print.
  *       drawfunc: The pointer to the function to be used as the callback.
@@ -9314,7 +9315,7 @@
  * Returns:
  *       A handle to the print object or NULL on failure.
  */
-HPRINT API dw_print_new(unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata)
+HPRINT API dw_print_new(char *jobname, unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata)
 {
     DWPrint *print;
     NSPrintPanel *panel;
@@ -9326,6 +9327,9 @@
         return NULL;
     }
     
+    if(!jobname)
+        jobname = "Dynamic Windows Print Job";
+    
     print->drawfunc = drawfunc;
     print->drawdata = drawdata;
     print->flags = flags;
@@ -9336,6 +9340,7 @@
     PMSetPageRange(settings, 1, pages);
     PMSetFirstPage(settings, 1, true);
     PMSetLastPage(settings, pages, true);
+    PMPrintSettingsSetJobName(settings, (CFStringRef)[NSString stringWithUTF8String:jobname]);
     [pi updateFromPMPrintSettings];
     
     /* Create and show the print panel */
--- a/os2/dw.c	Mon Sep 12 02:22:48 2011 +0000
+++ b/os2/dw.c	Mon Sep 12 19:26:49 2011 +0000
@@ -10065,6 +10065,7 @@
 /*
  * Creates a new print object.
  * Parameters:
+ *       jobname: Name of the print job to show in the queue.
  *       flags: Flags to initially configure the print object.
  *       pages: Number of pages to print.
  *       drawfunc: The pointer to the function to be used as the callback.
@@ -10072,7 +10073,7 @@
  * Returns:
  *       A handle to the print object or NULL on failure.
  */
-HPRINT API dw_print_new(unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata)
+HPRINT API dw_print_new(char *jobname, unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata)
 {
    return NULL;
 }
--- a/template/dw.c	Mon Sep 12 02:22:48 2011 +0000
+++ b/template/dw.c	Mon Sep 12 19:26:49 2011 +0000
@@ -3399,6 +3399,7 @@
 /*
  * Creates a new print object.
  * Parameters:
+ *       jobname: Name of the print job to show in the queue.
  *       flags: Flags to initially configure the print object.
  *       pages: Number of pages to print.
  *       drawfunc: The pointer to the function to be used as the callback.
@@ -3406,7 +3407,7 @@
  * Returns:
  *       A handle to the print object or NULL on failure.
  */
-HPRINT API dw_print_new(unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata)
+HPRINT API dw_print_new(char *jobname, unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata)
 {
    return NULL;
 }
--- a/win/dw.c	Mon Sep 12 02:22:48 2011 +0000
+++ b/win/dw.c	Mon Sep 12 19:26:49 2011 +0000
@@ -10035,6 +10035,7 @@
 /*
  * Creates a new print object.
  * Parameters:
+ *       jobname: Name of the print job to show in the queue.
  *       flags: Flags to initially configure the print object.
  *       pages: Number of pages to print.
  *       drawfunc: The pointer to the function to be used as the callback.
@@ -10042,7 +10043,7 @@
  * Returns:
  *       A handle to the print object or NULL on failure.
  */
-HPRINT API dw_print_new(unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata)
+HPRINT API dw_print_new(char *jobname, unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata)
 {
     DWPrint *print;
     
@@ -10067,7 +10068,7 @@
     }
 
     print->di.cbSize = sizeof(DOCINFO);
-    print->di.lpszDocName = "Dynamic Windows Print Job";
+    print->di.lpszDocName = jobname ? jobname : "Dynamic Windows Print Job";
     return print;
 }