mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-10-05 21:02:42 +02:00
plug-ins: Allow for more specific print settings with portals
In the case the "create-custom-widget" signal is not emitted (typically when using the print portal), it is necessary to open a second dialog to fine-tune the print settings.
This commit is contained in:
@@ -202,6 +202,7 @@ print_page_layout_gui (PrintData *data,
|
||||
|
||||
gimp_help_connect (main_hbox, NULL, gimp_standard_help_func, help, NULL, NULL);
|
||||
|
||||
data->has_layout_gui = TRUE;
|
||||
return main_hbox;
|
||||
}
|
||||
|
||||
|
@@ -287,6 +287,7 @@ print_image (GimpImage *image,
|
||||
data.use_full_page = FALSE;
|
||||
data.draw_crop_marks = FALSE;
|
||||
data.operation = operation;
|
||||
data.has_layout_gui = FALSE;
|
||||
|
||||
gimp_image_get_resolution (image, &data.xres, &data.yres);
|
||||
|
||||
@@ -448,6 +449,26 @@ begin_print (GtkPrintOperation *operation,
|
||||
GtkPrintContext *context,
|
||||
PrintData *data)
|
||||
{
|
||||
if (! data->has_layout_gui)
|
||||
{
|
||||
GtkWidget *dialog, *layout_gui;
|
||||
layout_gui = print_page_layout_gui (data, PRINT_PROC_NAME);
|
||||
dialog = gtk_dialog_new_with_buttons (_("Image Settings"), NULL, 0,
|
||||
_("_Print"), GTK_RESPONSE_ACCEPT,
|
||||
_("_Cancel"), GTK_RESPONSE_REJECT, NULL);
|
||||
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
|
||||
layout_gui, TRUE, TRUE, 0);
|
||||
gtk_widget_show_all (dialog);
|
||||
if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_ACCEPT)
|
||||
{
|
||||
gtk_print_operation_cancel (operation);
|
||||
gtk_widget_destroy (dialog);
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
gtk_print_operation_set_use_full_page (operation, data->use_full_page);
|
||||
|
||||
gimp_progress_init (_("Printing"));
|
||||
|
@@ -53,4 +53,5 @@ typedef struct
|
||||
gboolean use_full_page;
|
||||
gboolean draw_crop_marks;
|
||||
GtkPrintOperation *operation;
|
||||
gboolean has_layout_gui;
|
||||
} PrintData;
|
||||
|
Reference in New Issue
Block a user