app: use the GimpDisplay as progress object when exporting.

Since we now hide the file dialog when exporting, progression ends up
invisible, which is especially a problem with big files. Therefore use
the image display as a GimpProgress to show progression.
This commit is contained in:
Jehan 2021-01-30 10:44:36 +01:00
parent 5d5ad7ea73
commit 73a64a4ee8
4 changed files with 30 additions and 18 deletions

View File

@ -83,7 +83,8 @@ static GtkWidget * file_save_dialog_show (Gimp *gimp,
GimpDisplay *display);
static GtkWidget * file_export_dialog_show (Gimp *gimp,
GimpImage *image,
GtkWidget *parent);
GtkWidget *parent,
GimpDisplay *display);
static void file_save_dialog_response (GtkWidget *dialog,
gint response_id,
gpointer data);
@ -303,7 +304,7 @@ file_save_cmd_callback (GimpAction *action,
break;
case GIMP_SAVE_MODE_EXPORT_AS:
file_export_dialog_show (gimp, image, widget);
file_export_dialog_show (gimp, image, widget, display);
break;
case GIMP_SAVE_MODE_EXPORT:
@ -321,7 +322,7 @@ file_save_cmd_callback (GimpAction *action,
if (! file)
{
/* Behave as if Export As... was invoked */
file_export_dialog_show (gimp, image, widget);
file_export_dialog_show (gimp, image, widget, display);
break;
}
@ -687,7 +688,7 @@ file_save_dialog_response (GtkWidget *dialog,
other = file_export_dialog_show (GIMP_FILE_DIALOG (file_dialog)->image->gimp,
GIMP_FILE_DIALOG (file_dialog)->image,
GTK_WIDGET (parent));
GTK_WIDGET (parent), NULL);
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (other), folder);
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (other), basename);
@ -700,7 +701,8 @@ file_save_dialog_response (GtkWidget *dialog,
static GtkWidget *
file_export_dialog_show (Gimp *gimp,
GimpImage *image,
GtkWidget *parent)
GtkWidget *parent,
GimpDisplay *display)
{
GtkWidget *dialog;
@ -735,7 +737,8 @@ file_export_dialog_show (Gimp *gimp,
if (dialog)
{
gimp_export_dialog_set_image (GIMP_EXPORT_DIALOG (dialog), image);
gimp_export_dialog_set_image (GIMP_EXPORT_DIALOG (dialog), image,
GIMP_OBJECT (display));
gtk_window_present (GTK_WINDOW (dialog));
}

View File

@ -180,6 +180,7 @@ file_save_dialog_response (GtkWidget *dialog,
case CHECK_URI_OK:
{
GimpImage *image = file_dialog->image;
GimpProgress *progress = GIMP_PROGRESS (dialog);
GimpDisplay *display_to_close = NULL;
gboolean xcf_compression = FALSE;
gboolean is_save_dialog = GIMP_IS_SAVE_DIALOG (dialog);
@ -205,13 +206,16 @@ file_save_dialog_response (GtkWidget *dialog,
* file dialog is just blocking the view.
*/
if (GIMP_IS_EXPORT_DIALOG (dialog))
{
gtk_widget_hide (dialog);
progress = GIMP_PROGRESS (GIMP_EXPORT_DIALOG (dialog)->display);
}
g_signal_connect (dialog, "destroy",
G_CALLBACK (gtk_widget_destroyed),
&dialog);
if (file_save_dialog_save_image (GIMP_PROGRESS (dialog),
if (file_save_dialog_save_image (progress,
gimp,
image,
file,

View File

@ -85,7 +85,8 @@ gimp_export_dialog_new (Gimp *gimp)
void
gimp_export_dialog_set_image (GimpExportDialog *dialog,
GimpImage *image)
GimpImage *image,
GimpObject *display)
{
GimpFileDialog *file_dialog;
GFile *dir_file = NULL;
@ -99,6 +100,7 @@ gimp_export_dialog_set_image (GimpExportDialog *dialog,
file_dialog = GIMP_FILE_DIALOG (dialog);
file_dialog->image = image;
dialog->display = display;
gimp_file_dialog_set_file_proc (file_dialog, NULL);

View File

@ -38,6 +38,8 @@ typedef struct _GimpExportDialogClass GimpExportDialogClass;
struct _GimpExportDialog
{
GimpFileDialog parent_instance;
GimpObject *display;
};
struct _GimpExportDialogClass
@ -51,7 +53,8 @@ GType gimp_export_dialog_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_export_dialog_new (Gimp *gimp);
void gimp_export_dialog_set_image (GimpExportDialog *dialog,
GimpImage *image);
GimpImage *image,
GimpObject *display);
G_END_DECLS