mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-11 05:00:07 +00:00
Merge branch 'for-main' into 'main'
printoperation: Cosmetics See merge request GNOME/gtk!7938
This commit is contained in:
commit
745fceb1a1
@ -68,13 +68,13 @@ typedef struct _PrinterFinder PrinterFinder;
|
|||||||
|
|
||||||
static void printer_finder_free (PrinterFinder *finder);
|
static void printer_finder_free (PrinterFinder *finder);
|
||||||
static void find_printer (const char *printer,
|
static void find_printer (const char *printer,
|
||||||
GFunc func,
|
GFunc func,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
unix_start_page (GtkPrintOperation *op,
|
unix_start_page (GtkPrintOperation *op,
|
||||||
GtkPrintContext *print_context,
|
GtkPrintContext *print_context,
|
||||||
GtkPageSetup *page_setup)
|
GtkPageSetup *page_setup)
|
||||||
{
|
{
|
||||||
GtkPrintOperationUnix *op_unix;
|
GtkPrintOperationUnix *op_unix;
|
||||||
GtkPaperSize *paper_size;
|
GtkPaperSize *paper_size;
|
||||||
@ -130,7 +130,7 @@ unix_start_page (GtkPrintOperation *op,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
unix_end_page (GtkPrintOperation *op,
|
unix_end_page (GtkPrintOperation *op,
|
||||||
GtkPrintContext *print_context)
|
GtkPrintContext *print_context)
|
||||||
{
|
{
|
||||||
cairo_t *cr;
|
cairo_t *cr;
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ op_unix_free (GtkPrintOperationUnix *op_unix)
|
|||||||
{
|
{
|
||||||
if (op_unix->job_status_changed_tag > 0)
|
if (op_unix->job_status_changed_tag > 0)
|
||||||
g_signal_handler_disconnect (op_unix->job,
|
g_signal_handler_disconnect (op_unix->job,
|
||||||
op_unix->job_status_changed_tag);
|
op_unix->job_status_changed_tag);
|
||||||
g_object_unref (op_unix->job);
|
g_object_unref (op_unix->job);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,8 +158,8 @@ op_unix_free (GtkPrintOperationUnix *op_unix)
|
|||||||
|
|
||||||
static char *
|
static char *
|
||||||
shell_command_substitute_file (const char *cmd,
|
shell_command_substitute_file (const char *cmd,
|
||||||
const char *pdf_filename,
|
const char *pdf_filename,
|
||||||
const char *settings_filename,
|
const char *settings_filename,
|
||||||
gboolean *pdf_filename_replaced,
|
gboolean *pdf_filename_replaced,
|
||||||
gboolean *settings_filename_replaced)
|
gboolean *settings_filename_replaced)
|
||||||
{
|
{
|
||||||
@ -375,8 +375,8 @@ unix_finish_send (GtkPrintJob *job,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
unix_end_run (GtkPrintOperation *op,
|
unix_end_run (GtkPrintOperation *op,
|
||||||
gboolean wait,
|
gboolean wait,
|
||||||
gboolean cancelled)
|
gboolean cancelled)
|
||||||
{
|
{
|
||||||
GtkPrintOperationUnix *op_unix = op->priv->platform_data;
|
GtkPrintOperationUnix *op_unix = op->priv->platform_data;
|
||||||
|
|
||||||
@ -401,7 +401,7 @@ unix_end_run (GtkPrintOperation *op,
|
|||||||
{
|
{
|
||||||
g_object_ref (op);
|
g_object_ref (op);
|
||||||
if (!op_unix->data_sent)
|
if (!op_unix->data_sent)
|
||||||
g_main_loop_run (op_unix->loop);
|
g_main_loop_run (op_unix->loop);
|
||||||
g_main_loop_unref (op_unix->loop);
|
g_main_loop_unref (op_unix->loop);
|
||||||
op_unix->loop = NULL;
|
op_unix->loop = NULL;
|
||||||
g_object_unref (op);
|
g_object_unref (op);
|
||||||
@ -410,7 +410,7 @@ unix_end_run (GtkPrintOperation *op,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
job_status_changed_cb (GtkPrintJob *job,
|
job_status_changed_cb (GtkPrintJob *job,
|
||||||
GtkPrintOperation *op)
|
GtkPrintOperation *op)
|
||||||
{
|
{
|
||||||
_gtk_print_operation_set_status (op, gtk_print_job_get_status (job), NULL);
|
_gtk_print_operation_set_status (op, gtk_print_job_get_status (job), NULL);
|
||||||
}
|
}
|
||||||
@ -447,18 +447,18 @@ get_print_dialog (GtkPrintOperation *op,
|
|||||||
pd = gtk_print_unix_dialog_new (NULL, parent);
|
pd = gtk_print_unix_dialog_new (NULL, parent);
|
||||||
|
|
||||||
gtk_print_unix_dialog_set_manual_capabilities (GTK_PRINT_UNIX_DIALOG (pd),
|
gtk_print_unix_dialog_set_manual_capabilities (GTK_PRINT_UNIX_DIALOG (pd),
|
||||||
GTK_PRINT_CAPABILITY_PAGE_SET |
|
GTK_PRINT_CAPABILITY_PAGE_SET |
|
||||||
GTK_PRINT_CAPABILITY_COPIES |
|
GTK_PRINT_CAPABILITY_COPIES |
|
||||||
GTK_PRINT_CAPABILITY_COLLATE |
|
GTK_PRINT_CAPABILITY_COLLATE |
|
||||||
GTK_PRINT_CAPABILITY_REVERSE |
|
GTK_PRINT_CAPABILITY_REVERSE |
|
||||||
GTK_PRINT_CAPABILITY_SCALE |
|
GTK_PRINT_CAPABILITY_SCALE |
|
||||||
GTK_PRINT_CAPABILITY_PREVIEW |
|
GTK_PRINT_CAPABILITY_PREVIEW |
|
||||||
GTK_PRINT_CAPABILITY_NUMBER_UP |
|
GTK_PRINT_CAPABILITY_NUMBER_UP |
|
||||||
GTK_PRINT_CAPABILITY_NUMBER_UP_LAYOUT);
|
GTK_PRINT_CAPABILITY_NUMBER_UP_LAYOUT);
|
||||||
|
|
||||||
if (priv->print_settings)
|
if (priv->print_settings)
|
||||||
gtk_print_unix_dialog_set_settings (GTK_PRINT_UNIX_DIALOG (pd),
|
gtk_print_unix_dialog_set_settings (GTK_PRINT_UNIX_DIALOG (pd),
|
||||||
priv->print_settings);
|
priv->print_settings);
|
||||||
|
|
||||||
if (priv->default_page_setup)
|
if (priv->default_page_setup)
|
||||||
gtk_print_unix_dialog_set_page_setup (GTK_PRINT_UNIX_DIALOG (pd),
|
gtk_print_unix_dialog_set_page_setup (GTK_PRINT_UNIX_DIALOG (pd),
|
||||||
@ -477,23 +477,23 @@ get_print_dialog (GtkPrintOperation *op,
|
|||||||
priv->has_selection);
|
priv->has_selection);
|
||||||
|
|
||||||
g_signal_emit_by_name (op, "create-custom-widget",
|
g_signal_emit_by_name (op, "create-custom-widget",
|
||||||
&priv->custom_widget);
|
&priv->custom_widget);
|
||||||
|
|
||||||
if (priv->custom_widget)
|
if (priv->custom_widget)
|
||||||
{
|
{
|
||||||
custom_tab_label = priv->custom_tab_label;
|
custom_tab_label = priv->custom_tab_label;
|
||||||
|
|
||||||
if (custom_tab_label == NULL)
|
if (custom_tab_label == NULL)
|
||||||
{
|
{
|
||||||
custom_tab_label = g_get_application_name ();
|
custom_tab_label = g_get_application_name ();
|
||||||
if (custom_tab_label == NULL)
|
if (custom_tab_label == NULL)
|
||||||
custom_tab_label = _("Application");
|
custom_tab_label = _("Application");
|
||||||
}
|
}
|
||||||
|
|
||||||
label = gtk_label_new (custom_tab_label);
|
label = gtk_label_new (custom_tab_label);
|
||||||
|
|
||||||
gtk_print_unix_dialog_add_custom_tab (GTK_PRINT_UNIX_DIALOG (pd),
|
gtk_print_unix_dialog_add_custom_tab (GTK_PRINT_UNIX_DIALOG (pd),
|
||||||
priv->custom_widget, label);
|
priv->custom_widget, label);
|
||||||
|
|
||||||
g_signal_connect (pd, "notify::selected-printer", (GCallback) print_setup_changed_cb, op);
|
g_signal_connect (pd, "notify::selected-printer", (GCallback) print_setup_changed_cb, op);
|
||||||
g_signal_connect (pd, "notify::page-setup", (GCallback) print_setup_changed_cb, op);
|
g_signal_connect (pd, "notify::page-setup", (GCallback) print_setup_changed_cb, op);
|
||||||
@ -525,10 +525,10 @@ print_response_data_free (gpointer data)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
finish_print (PrintResponseData *rdata,
|
finish_print (PrintResponseData *rdata,
|
||||||
GtkPrinter *printer,
|
GtkPrinter *printer,
|
||||||
GtkPageSetup *page_setup,
|
GtkPageSetup *page_setup,
|
||||||
GtkPrintSettings *settings,
|
GtkPrintSettings *settings,
|
||||||
gboolean page_setup_set)
|
gboolean page_setup_set)
|
||||||
{
|
{
|
||||||
GtkPrintOperation *op = rdata->op;
|
GtkPrintOperation *op = rdata->op;
|
||||||
GtkPrintOperationPrivate *priv = op->priv;
|
GtkPrintOperationPrivate *priv = op->priv;
|
||||||
@ -542,18 +542,18 @@ finish_print (PrintResponseData *rdata,
|
|||||||
|
|
||||||
if (gtk_print_settings_get_number_up (settings) < 2)
|
if (gtk_print_settings_get_number_up (settings) < 2)
|
||||||
{
|
{
|
||||||
if (printer && (gtk_printer_get_hard_margins_for_paper_size (printer, gtk_page_setup_get_paper_size (page_setup), &top, &bottom, &left, &right) ||
|
if (printer && (gtk_printer_get_hard_margins_for_paper_size (printer, gtk_page_setup_get_paper_size (page_setup), &top, &bottom, &left, &right) ||
|
||||||
gtk_printer_get_hard_margins (printer, &top, &bottom, &left, &right)))
|
gtk_printer_get_hard_margins (printer, &top, &bottom, &left, &right)))
|
||||||
_gtk_print_context_set_hard_margins (priv->print_context, top, bottom, left, right);
|
_gtk_print_context_set_hard_margins (priv->print_context, top, bottom, left, right);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Pages do not have any unprintable area when printing n-up as each page on the
|
/* Pages do not have any unprintable area when printing n-up as each page on the
|
||||||
* sheet has been scaled down and translated to a position within the printable
|
* sheet has been scaled down and translated to a position within the printable
|
||||||
* area of the sheet.
|
* area of the sheet.
|
||||||
*/
|
*/
|
||||||
_gtk_print_context_set_hard_margins (priv->print_context, 0, 0, 0, 0);
|
_gtk_print_context_set_hard_margins (priv->print_context, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (page_setup != NULL &&
|
if (page_setup != NULL &&
|
||||||
(gtk_print_operation_get_default_page_setup (op) == NULL ||
|
(gtk_print_operation_get_default_page_setup (op) == NULL ||
|
||||||
@ -564,39 +564,39 @@ finish_print (PrintResponseData *rdata,
|
|||||||
|
|
||||||
if (!rdata->do_preview)
|
if (!rdata->do_preview)
|
||||||
{
|
{
|
||||||
GtkPrintOperationUnix *op_unix;
|
GtkPrintOperationUnix *op_unix;
|
||||||
cairo_t *cr;
|
cairo_t *cr;
|
||||||
|
|
||||||
op_unix = g_new0 (GtkPrintOperationUnix, 1);
|
op_unix = g_new0 (GtkPrintOperationUnix, 1);
|
||||||
priv->platform_data = op_unix;
|
priv->platform_data = op_unix;
|
||||||
priv->free_platform_data = (GDestroyNotify) op_unix_free;
|
priv->free_platform_data = (GDestroyNotify) op_unix_free;
|
||||||
op_unix->parent = rdata->parent;
|
op_unix->parent = rdata->parent;
|
||||||
|
|
||||||
priv->start_page = unix_start_page;
|
priv->start_page = unix_start_page;
|
||||||
priv->end_page = unix_end_page;
|
priv->end_page = unix_end_page;
|
||||||
priv->end_run = unix_end_run;
|
priv->end_run = unix_end_run;
|
||||||
|
|
||||||
job = gtk_print_job_new (priv->job_name, printer, settings, page_setup);
|
job = gtk_print_job_new (priv->job_name, printer, settings, page_setup);
|
||||||
op_unix->job = job;
|
op_unix->job = job;
|
||||||
gtk_print_job_set_track_print_status (job, priv->track_print_status);
|
gtk_print_job_set_track_print_status (job, priv->track_print_status);
|
||||||
|
|
||||||
op_unix->surface = gtk_print_job_get_surface (job, &priv->error);
|
op_unix->surface = gtk_print_job_get_surface (job, &priv->error);
|
||||||
if (op_unix->surface == NULL)
|
if (op_unix->surface == NULL)
|
||||||
{
|
{
|
||||||
rdata->result = GTK_PRINT_OPERATION_RESULT_ERROR;
|
rdata->result = GTK_PRINT_OPERATION_RESULT_ERROR;
|
||||||
rdata->do_print = FALSE;
|
rdata->do_print = FALSE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
cr = cairo_create (op_unix->surface);
|
cr = cairo_create (op_unix->surface);
|
||||||
gtk_print_context_set_cairo_context (priv->print_context, cr, 72, 72);
|
gtk_print_context_set_cairo_context (priv->print_context, cr, 72, 72);
|
||||||
cairo_destroy (cr);
|
cairo_destroy (cr);
|
||||||
|
|
||||||
_gtk_print_operation_set_status (op, gtk_print_job_get_status (job), NULL);
|
_gtk_print_operation_set_status (op, gtk_print_job_get_status (job), NULL);
|
||||||
|
|
||||||
op_unix->job_status_changed_tag =
|
op_unix->job_status_changed_tag =
|
||||||
g_signal_connect (job, "status-changed",
|
g_signal_connect (job, "status-changed",
|
||||||
G_CALLBACK (job_status_changed_cb), op);
|
G_CALLBACK (job_status_changed_cb), op);
|
||||||
|
|
||||||
priv->print_pages = gtk_print_job_get_pages (job);
|
priv->print_pages = gtk_print_job_get_pages (job);
|
||||||
priv->page_ranges = gtk_print_job_get_page_ranges (job, &priv->num_page_ranges);
|
priv->page_ranges = gtk_print_job_get_page_ranges (job, &priv->num_page_ranges);
|
||||||
@ -620,8 +620,8 @@ finish_print (PrintResponseData *rdata,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
handle_print_response (GtkWidget *dialog,
|
handle_print_response (GtkWidget *dialog,
|
||||||
int response,
|
int response,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GtkPrintUnixDialog *pd = GTK_PRINT_UNIX_DIALOG (dialog);
|
GtkPrintUnixDialog *pd = GTK_PRINT_UNIX_DIALOG (dialog);
|
||||||
PrintResponseData *rdata = data;
|
PrintResponseData *rdata = data;
|
||||||
@ -637,7 +637,7 @@ handle_print_response (GtkWidget *dialog,
|
|||||||
rdata->result = GTK_PRINT_OPERATION_RESULT_APPLY;
|
rdata->result = GTK_PRINT_OPERATION_RESULT_APPLY;
|
||||||
rdata->do_preview = FALSE;
|
rdata->do_preview = FALSE;
|
||||||
if (printer != NULL)
|
if (printer != NULL)
|
||||||
rdata->do_print = TRUE;
|
rdata->do_print = TRUE;
|
||||||
}
|
}
|
||||||
else if (response == GTK_RESPONSE_APPLY)
|
else if (response == GTK_RESPONSE_APPLY)
|
||||||
{
|
{
|
||||||
@ -676,7 +676,7 @@ handle_print_response (GtkWidget *dialog,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
found_printer (GtkPrinter *printer,
|
found_printer (GtkPrinter *printer,
|
||||||
PrintResponseData *rdata)
|
PrintResponseData *rdata)
|
||||||
{
|
{
|
||||||
GtkPrintOperation *op = rdata->op;
|
GtkPrintOperation *op = rdata->op;
|
||||||
GtkPrintOperationPrivate *priv = op->priv;
|
GtkPrintOperationPrivate *priv = op->priv;
|
||||||
@ -693,17 +693,17 @@ found_printer (GtkPrinter *printer,
|
|||||||
rdata->do_print = TRUE;
|
rdata->do_print = TRUE;
|
||||||
|
|
||||||
if (priv->print_settings)
|
if (priv->print_settings)
|
||||||
settings = gtk_print_settings_copy (priv->print_settings);
|
settings = gtk_print_settings_copy (priv->print_settings);
|
||||||
else
|
else
|
||||||
settings = gtk_print_settings_new ();
|
settings = gtk_print_settings_new ();
|
||||||
|
|
||||||
gtk_print_settings_set_printer (settings,
|
gtk_print_settings_set_printer (settings,
|
||||||
gtk_printer_get_name (printer));
|
gtk_printer_get_name (printer));
|
||||||
|
|
||||||
if (priv->default_page_setup)
|
if (priv->default_page_setup)
|
||||||
page_setup = gtk_page_setup_copy (priv->default_page_setup);
|
page_setup = gtk_page_setup_copy (priv->default_page_setup);
|
||||||
else
|
else
|
||||||
page_setup = gtk_page_setup_new ();
|
page_setup = gtk_page_setup_new ();
|
||||||
}
|
}
|
||||||
|
|
||||||
finish_print (rdata, printer, page_setup, settings, FALSE);
|
finish_print (rdata, printer, page_setup, settings, FALSE);
|
||||||
@ -741,7 +741,7 @@ gtk_print_operation_unix_run_dialog_async (GtkPrintOperation *op,
|
|||||||
gtk_window_set_modal (GTK_WINDOW (pd), TRUE);
|
gtk_window_set_modal (GTK_WINDOW (pd), TRUE);
|
||||||
|
|
||||||
g_signal_connect (pd, "response",
|
g_signal_connect (pd, "response",
|
||||||
G_CALLBACK (handle_print_response), rdata);
|
G_CALLBACK (handle_print_response), rdata);
|
||||||
|
|
||||||
gtk_window_present (GTK_WINDOW (pd));
|
gtk_window_present (GTK_WINDOW (pd));
|
||||||
}
|
}
|
||||||
@ -749,7 +749,7 @@ gtk_print_operation_unix_run_dialog_async (GtkPrintOperation *op,
|
|||||||
{
|
{
|
||||||
printer_name = NULL;
|
printer_name = NULL;
|
||||||
if (op->priv->print_settings)
|
if (op->priv->print_settings)
|
||||||
printer_name = gtk_print_settings_get_printer (op->priv->print_settings);
|
printer_name = gtk_print_settings_get_printer (op->priv->print_settings);
|
||||||
|
|
||||||
find_printer (printer_name, (GFunc) found_printer, rdata);
|
find_printer (printer_name, (GFunc) found_printer, rdata);
|
||||||
}
|
}
|
||||||
@ -769,12 +769,12 @@ write_preview (void *closure,
|
|||||||
written = write (fd, data, length);
|
written = write (fd, data, length);
|
||||||
|
|
||||||
if (written == -1)
|
if (written == -1)
|
||||||
{
|
{
|
||||||
if (errno == EAGAIN || errno == EINTR)
|
if (errno == EAGAIN || errno == EINTR)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
return CAIRO_STATUS_WRITE_ERROR;
|
return CAIRO_STATUS_WRITE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
data += written;
|
data += written;
|
||||||
length -= written;
|
length -= written;
|
||||||
@ -883,7 +883,7 @@ gtk_print_operation_unix_run_dialog (GtkPrintOperation *op,
|
|||||||
gtk_window_set_modal (GTK_WINDOW (pd), TRUE);
|
gtk_window_set_modal (GTK_WINDOW (pd), TRUE);
|
||||||
|
|
||||||
g_signal_connect (pd, "response",
|
g_signal_connect (pd, "response",
|
||||||
G_CALLBACK (handle_print_response), &rdata);
|
G_CALLBACK (handle_print_response), &rdata);
|
||||||
|
|
||||||
gtk_window_present (GTK_WINDOW (pd));
|
gtk_window_present (GTK_WINDOW (pd));
|
||||||
|
|
||||||
@ -896,11 +896,11 @@ gtk_print_operation_unix_run_dialog (GtkPrintOperation *op,
|
|||||||
{
|
{
|
||||||
printer_name = NULL;
|
printer_name = NULL;
|
||||||
if (op->priv->print_settings)
|
if (op->priv->print_settings)
|
||||||
printer_name = gtk_print_settings_get_printer (op->priv->print_settings);
|
printer_name = gtk_print_settings_get_printer (op->priv->print_settings);
|
||||||
|
|
||||||
rdata.loop = g_main_loop_new (NULL, FALSE);
|
rdata.loop = g_main_loop_new (NULL, FALSE);
|
||||||
find_printer (printer_name,
|
find_printer (printer_name,
|
||||||
(GFunc) found_printer, &rdata);
|
(GFunc) found_printer, &rdata);
|
||||||
|
|
||||||
g_main_loop_run (rdata.loop);
|
g_main_loop_run (rdata.loop);
|
||||||
g_main_loop_unref (rdata.loop);
|
g_main_loop_unref (rdata.loop);
|
||||||
@ -935,8 +935,8 @@ page_setup_data_free (gpointer data)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
handle_page_setup_response (GtkWidget *dialog,
|
handle_page_setup_response (GtkWidget *dialog,
|
||||||
int response,
|
int response,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GtkPageSetupUnixDialog *psd;
|
GtkPageSetupUnixDialog *psd;
|
||||||
PageSetupResponseData *rdata = data;
|
PageSetupResponseData *rdata = data;
|
||||||
@ -959,17 +959,17 @@ handle_page_setup_response (GtkWidget *dialog,
|
|||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
get_page_setup_dialog (GtkWindow *parent,
|
get_page_setup_dialog (GtkWindow *parent,
|
||||||
GtkPageSetup *page_setup,
|
GtkPageSetup *page_setup,
|
||||||
GtkPrintSettings *settings)
|
GtkPrintSettings *settings)
|
||||||
{
|
{
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
|
|
||||||
dialog = gtk_page_setup_unix_dialog_new (NULL, parent);
|
dialog = gtk_page_setup_unix_dialog_new (NULL, parent);
|
||||||
if (page_setup)
|
if (page_setup)
|
||||||
gtk_page_setup_unix_dialog_set_page_setup (GTK_PAGE_SETUP_UNIX_DIALOG (dialog),
|
gtk_page_setup_unix_dialog_set_page_setup (GTK_PAGE_SETUP_UNIX_DIALOG (dialog),
|
||||||
page_setup);
|
page_setup);
|
||||||
gtk_page_setup_unix_dialog_set_print_settings (GTK_PAGE_SETUP_UNIX_DIALOG (dialog),
|
gtk_page_setup_unix_dialog_set_print_settings (GTK_PAGE_SETUP_UNIX_DIALOG (dialog),
|
||||||
settings);
|
settings);
|
||||||
|
|
||||||
return dialog;
|
return dialog;
|
||||||
}
|
}
|
||||||
@ -993,8 +993,8 @@ get_page_setup_dialog (GtkWindow *parent,
|
|||||||
*/
|
*/
|
||||||
GtkPageSetup *
|
GtkPageSetup *
|
||||||
gtk_print_run_page_setup_dialog (GtkWindow *parent,
|
gtk_print_run_page_setup_dialog (GtkWindow *parent,
|
||||||
GtkPageSetup *page_setup,
|
GtkPageSetup *page_setup,
|
||||||
GtkPrintSettings *settings)
|
GtkPrintSettings *settings)
|
||||||
{
|
{
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
PageSetupResponseData rdata;
|
PageSetupResponseData rdata;
|
||||||
@ -1042,10 +1042,10 @@ gtk_print_run_page_setup_dialog (GtkWindow *parent,
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gtk_print_run_page_setup_dialog_async (GtkWindow *parent,
|
gtk_print_run_page_setup_dialog_async (GtkWindow *parent,
|
||||||
GtkPageSetup *page_setup,
|
GtkPageSetup *page_setup,
|
||||||
GtkPrintSettings *settings,
|
GtkPrintSettings *settings,
|
||||||
GtkPageSetupDoneFunc done_cb,
|
GtkPageSetupDoneFunc done_cb,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
PageSetupResponseData *rdata;
|
PageSetupResponseData *rdata;
|
||||||
@ -1061,7 +1061,7 @@ gtk_print_run_page_setup_dialog_async (GtkWindow *parent,
|
|||||||
rdata->loop = NULL;
|
rdata->loop = NULL;
|
||||||
|
|
||||||
g_signal_connect (dialog, "response",
|
g_signal_connect (dialog, "response",
|
||||||
G_CALLBACK (handle_page_setup_response), rdata);
|
G_CALLBACK (handle_page_setup_response), rdata);
|
||||||
|
|
||||||
gtk_window_present (GTK_WINDOW (dialog));
|
gtk_window_present (GTK_WINDOW (dialog));
|
||||||
}
|
}
|
||||||
@ -1113,7 +1113,7 @@ schedule_finder_callback (PrinterFinder *finder)
|
|||||||
static void
|
static void
|
||||||
printer_added_cb (GtkPrintBackend *backend,
|
printer_added_cb (GtkPrintBackend *backend,
|
||||||
GtkPrinter *printer,
|
GtkPrinter *printer,
|
||||||
PrinterFinder *finder)
|
PrinterFinder *finder)
|
||||||
{
|
{
|
||||||
if (finder->found_printer)
|
if (finder->found_printer)
|
||||||
return;
|
return;
|
||||||
@ -1129,11 +1129,11 @@ printer_added_cb (GtkPrintBackend *backend,
|
|||||||
finder->found_printer = TRUE;
|
finder->found_printer = TRUE;
|
||||||
}
|
}
|
||||||
else if (finder->default_printer == NULL &&
|
else if (finder->default_printer == NULL &&
|
||||||
gtk_printer_is_default (printer))
|
gtk_printer_is_default (printer))
|
||||||
{
|
{
|
||||||
finder->default_printer = g_object_ref (printer);
|
finder->default_printer = g_object_ref (printer);
|
||||||
if (finder->printer_name == NULL)
|
if (finder->printer_name == NULL)
|
||||||
finder->found_printer = TRUE;
|
finder->found_printer = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1147,7 +1147,7 @@ printer_added_cb (GtkPrintBackend *backend,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
printer_list_done_cb (GtkPrintBackend *backend,
|
printer_list_done_cb (GtkPrintBackend *backend,
|
||||||
PrinterFinder *finder)
|
PrinterFinder *finder)
|
||||||
{
|
{
|
||||||
finder->backends = g_list_remove (finder->backends, backend);
|
finder->backends = g_list_remove (finder->backends, backend);
|
||||||
|
|
||||||
@ -1166,7 +1166,7 @@ printer_list_done_cb (GtkPrintBackend *backend,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
find_printer_init (PrinterFinder *finder,
|
find_printer_init (PrinterFinder *finder,
|
||||||
GtkPrintBackend *backend)
|
GtkPrintBackend *backend)
|
||||||
{
|
{
|
||||||
GList *list;
|
GList *list;
|
||||||
GList *node;
|
GList *node;
|
||||||
@ -1180,7 +1180,7 @@ find_printer_init (PrinterFinder *finder,
|
|||||||
node = node->next;
|
node = node->next;
|
||||||
|
|
||||||
if (finder->found_printer)
|
if (finder->found_printer)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_list_free (list);
|
g_list_free (list);
|
||||||
@ -1192,11 +1192,11 @@ find_printer_init (PrinterFinder *finder,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_signal_connect (backend, "printer-added",
|
g_signal_connect (backend, "printer-added",
|
||||||
(GCallback) printer_added_cb,
|
(GCallback) printer_added_cb,
|
||||||
finder);
|
finder);
|
||||||
g_signal_connect (backend, "printer-list-done",
|
g_signal_connect (backend, "printer-list-done",
|
||||||
(GCallback) printer_list_done_cb,
|
(GCallback) printer_list_done_cb,
|
||||||
finder);
|
finder);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1233,8 +1233,8 @@ printer_finder_free (PrinterFinder *finder)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
find_printer (const char *printer,
|
find_printer (const char *printer,
|
||||||
GFunc func,
|
GFunc func,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GList *node, *next;
|
GList *node, *next;
|
||||||
PrinterFinder *finder;
|
PrinterFinder *finder;
|
||||||
@ -1264,9 +1264,9 @@ find_printer (const char *printer,
|
|||||||
|
|
||||||
GtkPrintOperationResult
|
GtkPrintOperationResult
|
||||||
_gtk_print_operation_platform_backend_run_dialog (GtkPrintOperation *op,
|
_gtk_print_operation_platform_backend_run_dialog (GtkPrintOperation *op,
|
||||||
gboolean show_dialog,
|
gboolean show_dialog,
|
||||||
GtkWindow *parent,
|
GtkWindow *parent,
|
||||||
gboolean *do_print)
|
gboolean *do_print)
|
||||||
{
|
{
|
||||||
if (gdk_should_use_portal ())
|
if (gdk_should_use_portal ())
|
||||||
return gtk_print_operation_portal_run_dialog (op, show_dialog, parent, do_print);
|
return gtk_print_operation_portal_run_dialog (op, show_dialog, parent, do_print);
|
||||||
@ -1276,9 +1276,9 @@ _gtk_print_operation_platform_backend_run_dialog (GtkPrintOperation *op,
|
|||||||
|
|
||||||
void
|
void
|
||||||
_gtk_print_operation_platform_backend_run_dialog_async (GtkPrintOperation *op,
|
_gtk_print_operation_platform_backend_run_dialog_async (GtkPrintOperation *op,
|
||||||
gboolean show_dialog,
|
gboolean show_dialog,
|
||||||
GtkWindow *parent,
|
GtkWindow *parent,
|
||||||
GtkPrintOperationPrintFunc print_cb)
|
GtkPrintOperationPrintFunc print_cb)
|
||||||
{
|
{
|
||||||
if (gdk_should_use_portal ())
|
if (gdk_should_use_portal ())
|
||||||
gtk_print_operation_portal_run_dialog_async (op, show_dialog, parent, print_cb);
|
gtk_print_operation_portal_run_dialog_async (op, show_dialog, parent, print_cb);
|
||||||
@ -1300,10 +1300,10 @@ _gtk_print_operation_platform_backend_launch_preview (GtkPrintOperation *op,
|
|||||||
|
|
||||||
cairo_surface_t *
|
cairo_surface_t *
|
||||||
_gtk_print_operation_platform_backend_create_preview_surface (GtkPrintOperation *op,
|
_gtk_print_operation_platform_backend_create_preview_surface (GtkPrintOperation *op,
|
||||||
GtkPageSetup *page_setup,
|
GtkPageSetup *page_setup,
|
||||||
double *dpi_x,
|
double *dpi_x,
|
||||||
double *dpi_y,
|
double *dpi_y,
|
||||||
char **target)
|
char **target)
|
||||||
{
|
{
|
||||||
#ifdef CAIRO_HAS_PDF_SURFACE
|
#ifdef CAIRO_HAS_PDF_SURFACE
|
||||||
return gtk_print_operation_unix_create_preview_surface (op, page_setup, dpi_x, dpi_y, target);
|
return gtk_print_operation_unix_create_preview_surface (op, page_setup, dpi_x, dpi_y, target);
|
||||||
@ -1314,24 +1314,24 @@ _gtk_print_operation_platform_backend_create_preview_surface (GtkPrintOperation
|
|||||||
|
|
||||||
void
|
void
|
||||||
_gtk_print_operation_platform_backend_resize_preview_surface (GtkPrintOperation *op,
|
_gtk_print_operation_platform_backend_resize_preview_surface (GtkPrintOperation *op,
|
||||||
GtkPageSetup *page_setup,
|
GtkPageSetup *page_setup,
|
||||||
cairo_surface_t *surface)
|
cairo_surface_t *surface)
|
||||||
{
|
{
|
||||||
gtk_print_operation_unix_resize_preview_surface (op, page_setup, surface);
|
gtk_print_operation_unix_resize_preview_surface (op, page_setup, surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_gtk_print_operation_platform_backend_preview_start_page (GtkPrintOperation *op,
|
_gtk_print_operation_platform_backend_preview_start_page (GtkPrintOperation *op,
|
||||||
cairo_surface_t *surface,
|
cairo_surface_t *surface,
|
||||||
cairo_t *cr)
|
cairo_t *cr)
|
||||||
{
|
{
|
||||||
gtk_print_operation_unix_preview_start_page (op, surface, cr);
|
gtk_print_operation_unix_preview_start_page (op, surface, cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_gtk_print_operation_platform_backend_preview_end_page (GtkPrintOperation *op,
|
_gtk_print_operation_platform_backend_preview_end_page (GtkPrintOperation *op,
|
||||||
cairo_surface_t *surface,
|
cairo_surface_t *surface,
|
||||||
cairo_t *cr)
|
cairo_t *cr)
|
||||||
{
|
{
|
||||||
gtk_print_operation_unix_preview_end_page (op, surface, cr);
|
gtk_print_operation_unix_preview_end_page (op, surface, cr);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user