mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-19 01:10:08 +00:00
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:
parent
5d5ad7ea73
commit
73a64a4ee8
4 changed files with 30 additions and 18 deletions
|
@ -83,7 +83,8 @@ static GtkWidget * file_save_dialog_show (Gimp *gimp,
|
||||||
GimpDisplay *display);
|
GimpDisplay *display);
|
||||||
static GtkWidget * file_export_dialog_show (Gimp *gimp,
|
static GtkWidget * file_export_dialog_show (Gimp *gimp,
|
||||||
GimpImage *image,
|
GimpImage *image,
|
||||||
GtkWidget *parent);
|
GtkWidget *parent,
|
||||||
|
GimpDisplay *display);
|
||||||
static void file_save_dialog_response (GtkWidget *dialog,
|
static void file_save_dialog_response (GtkWidget *dialog,
|
||||||
gint response_id,
|
gint response_id,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
@ -303,7 +304,7 @@ file_save_cmd_callback (GimpAction *action,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_SAVE_MODE_EXPORT_AS:
|
case GIMP_SAVE_MODE_EXPORT_AS:
|
||||||
file_export_dialog_show (gimp, image, widget);
|
file_export_dialog_show (gimp, image, widget, display);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_SAVE_MODE_EXPORT:
|
case GIMP_SAVE_MODE_EXPORT:
|
||||||
|
@ -321,7 +322,7 @@ file_save_cmd_callback (GimpAction *action,
|
||||||
if (! file)
|
if (! file)
|
||||||
{
|
{
|
||||||
/* Behave as if Export As... was invoked */
|
/* Behave as if Export As... was invoked */
|
||||||
file_export_dialog_show (gimp, image, widget);
|
file_export_dialog_show (gimp, image, widget, display);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -687,7 +688,7 @@ file_save_dialog_response (GtkWidget *dialog,
|
||||||
|
|
||||||
other = file_export_dialog_show (GIMP_FILE_DIALOG (file_dialog)->image->gimp,
|
other = file_export_dialog_show (GIMP_FILE_DIALOG (file_dialog)->image->gimp,
|
||||||
GIMP_FILE_DIALOG (file_dialog)->image,
|
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_folder (GTK_FILE_CHOOSER (other), folder);
|
||||||
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (other), basename);
|
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (other), basename);
|
||||||
|
@ -698,9 +699,10 @@ file_save_dialog_response (GtkWidget *dialog,
|
||||||
}
|
}
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
file_export_dialog_show (Gimp *gimp,
|
file_export_dialog_show (Gimp *gimp,
|
||||||
GimpImage *image,
|
GimpImage *image,
|
||||||
GtkWidget *parent)
|
GtkWidget *parent,
|
||||||
|
GimpDisplay *display)
|
||||||
{
|
{
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
|
|
||||||
|
@ -735,7 +737,8 @@ file_export_dialog_show (Gimp *gimp,
|
||||||
|
|
||||||
if (dialog)
|
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));
|
gtk_window_present (GTK_WINDOW (dialog));
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,12 +179,13 @@ file_save_dialog_response (GtkWidget *dialog,
|
||||||
|
|
||||||
case CHECK_URI_OK:
|
case CHECK_URI_OK:
|
||||||
{
|
{
|
||||||
GimpImage *image = file_dialog->image;
|
GimpImage *image = file_dialog->image;
|
||||||
GimpDisplay *display_to_close = NULL;
|
GimpProgress *progress = GIMP_PROGRESS (dialog);
|
||||||
gboolean xcf_compression = FALSE;
|
GimpDisplay *display_to_close = NULL;
|
||||||
gboolean is_save_dialog = GIMP_IS_SAVE_DIALOG (dialog);
|
gboolean xcf_compression = FALSE;
|
||||||
gboolean close_after_saving = FALSE;
|
gboolean is_save_dialog = GIMP_IS_SAVE_DIALOG (dialog);
|
||||||
gboolean save_a_copy = FALSE;
|
gboolean close_after_saving = FALSE;
|
||||||
|
gboolean save_a_copy = FALSE;
|
||||||
|
|
||||||
if (is_save_dialog)
|
if (is_save_dialog)
|
||||||
{
|
{
|
||||||
|
@ -205,13 +206,16 @@ file_save_dialog_response (GtkWidget *dialog,
|
||||||
* file dialog is just blocking the view.
|
* file dialog is just blocking the view.
|
||||||
*/
|
*/
|
||||||
if (GIMP_IS_EXPORT_DIALOG (dialog))
|
if (GIMP_IS_EXPORT_DIALOG (dialog))
|
||||||
gtk_widget_hide (dialog);
|
{
|
||||||
|
gtk_widget_hide (dialog);
|
||||||
|
progress = GIMP_PROGRESS (GIMP_EXPORT_DIALOG (dialog)->display);
|
||||||
|
}
|
||||||
|
|
||||||
g_signal_connect (dialog, "destroy",
|
g_signal_connect (dialog, "destroy",
|
||||||
G_CALLBACK (gtk_widget_destroyed),
|
G_CALLBACK (gtk_widget_destroyed),
|
||||||
&dialog);
|
&dialog);
|
||||||
|
|
||||||
if (file_save_dialog_save_image (GIMP_PROGRESS (dialog),
|
if (file_save_dialog_save_image (progress,
|
||||||
gimp,
|
gimp,
|
||||||
image,
|
image,
|
||||||
file,
|
file,
|
||||||
|
|
|
@ -85,7 +85,8 @@ gimp_export_dialog_new (Gimp *gimp)
|
||||||
|
|
||||||
void
|
void
|
||||||
gimp_export_dialog_set_image (GimpExportDialog *dialog,
|
gimp_export_dialog_set_image (GimpExportDialog *dialog,
|
||||||
GimpImage *image)
|
GimpImage *image,
|
||||||
|
GimpObject *display)
|
||||||
{
|
{
|
||||||
GimpFileDialog *file_dialog;
|
GimpFileDialog *file_dialog;
|
||||||
GFile *dir_file = NULL;
|
GFile *dir_file = NULL;
|
||||||
|
@ -99,6 +100,7 @@ gimp_export_dialog_set_image (GimpExportDialog *dialog,
|
||||||
file_dialog = GIMP_FILE_DIALOG (dialog);
|
file_dialog = GIMP_FILE_DIALOG (dialog);
|
||||||
|
|
||||||
file_dialog->image = image;
|
file_dialog->image = image;
|
||||||
|
dialog->display = display;
|
||||||
|
|
||||||
gimp_file_dialog_set_file_proc (file_dialog, NULL);
|
gimp_file_dialog_set_file_proc (file_dialog, NULL);
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,8 @@ typedef struct _GimpExportDialogClass GimpExportDialogClass;
|
||||||
struct _GimpExportDialog
|
struct _GimpExportDialog
|
||||||
{
|
{
|
||||||
GimpFileDialog parent_instance;
|
GimpFileDialog parent_instance;
|
||||||
|
|
||||||
|
GimpObject *display;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GimpExportDialogClass
|
struct _GimpExportDialogClass
|
||||||
|
@ -51,7 +53,8 @@ GType gimp_export_dialog_get_type (void) G_GNUC_CONST;
|
||||||
GtkWidget * gimp_export_dialog_new (Gimp *gimp);
|
GtkWidget * gimp_export_dialog_new (Gimp *gimp);
|
||||||
|
|
||||||
void gimp_export_dialog_set_image (GimpExportDialog *dialog,
|
void gimp_export_dialog_set_image (GimpExportDialog *dialog,
|
||||||
GimpImage *image);
|
GimpImage *image,
|
||||||
|
GimpObject *display);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue