set a print job name.

2007-07-24  Sven Neumann  <sven@gimp.org>

	* plug-ins/print/print.c: set a print job name.


svn path=/trunk/; revision=22981
This commit is contained in:
Sven Neumann 2007-07-24 07:22:35 +00:00 committed by Sven Neumann
parent fefd674d40
commit 39e4997706
2 changed files with 47 additions and 19 deletions

View File

@ -1,3 +1,7 @@
2007-07-24 Sven Neumann <sven@gimp.org>
* plug-ins/print/print.c: set a print job name.
2007-07-24 Sven Neumann <sven@gimp.org>
* plug-ins/print/print.c: if we created an export image, delete

View File

@ -46,14 +46,15 @@ static gboolean print_image (gint32 image_ID,
gint32 drawable_ID,
gboolean interactive);
static void print_operation_set_name (GtkPrintOperation *operation,
gint image_ID);
static void begin_print (GtkPrintOperation *operation,
GtkPrintContext *context,
PrintData *data);
static void end_print (GtkPrintOperation *operation,
GtkPrintContext *context,
PrintData *data);
static void draw_page (GtkPrintOperation *print,
GtkPrintContext *context,
gint page_nr,
@ -154,7 +155,7 @@ print_image (gint32 image_ID,
gint32 drawable_ID,
gboolean interactive)
{
GtkPrintOperation *operation = gtk_print_operation_new ();
GtkPrintOperation *operation;
GError *error = NULL;
gint32 orig_image_ID = image_ID;
PrintData data;
@ -168,6 +169,10 @@ print_image (gint32 image_ID,
if (export == GIMP_EXPORT_CANCEL)
return FALSE;
operation = gtk_print_operation_new ();
print_operation_set_name (operation, orig_image_ID);
/* fill in the PrintData struct */
data.num_pages = 1;
data.drawable_id = drawable_ID;
@ -263,6 +268,25 @@ print_image (gint32 image_ID,
return TRUE;
}
static void
print_operation_set_name (GtkPrintOperation *operation,
gint image_ID)
{
gchar *filename;
gchar *basename;
gchar *jobname;
filename = gimp_image_get_filename (image_ID);
basename = filename ? g_filename_display_basename (filename) : _("Untitled");
jobname = g_strdup_printf ("%s - %s", g_get_application_name (), basename);
gtk_print_operation_set_job_name (operation, jobname);
g_free (jobname);
g_free (basename);
g_free (filename);
}
static void
begin_print (GtkPrintOperation *operation,
GtkPrintContext *context,