[gimp/gimp-2-8] Bug 685557 - fix closing and saving a new image.
- From: Jehan PagÃs <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-8] Bug 685557 - fix closing and saving a new image.
- Date: Tue, 27 Nov 2012 15:18:49 +0000 (UTC)
commit c6b81f2f4e43308054c3b8b6f5ff2bc1af5bf9d9
Author: Jehan <jehan girinstud io>
Date: Sun Nov 25 23:13:35 2012 +0900
Bug 685557 - fix closing and saving a new image.
Current implementation had 2 issues, fixed by this commit:
1/ after the file save dialog is closed, the image would not close.
2/ if you switched the visible tab before saving the new image, it
would save and close the visible tab, instead of the expected one.
app/actions/file-commands.c | 15 +++++++++------
app/dialogs/file-save-dialog.c | 27 +++++++--------------------
app/widgets/gimpfiledialog.c | 4 +++-
app/widgets/gimpfiledialog.h | 4 +++-
4 files changed, 22 insertions(+), 28 deletions(-)
---
diff --git a/app/actions/file-commands.c b/app/actions/file-commands.c
index 94a23a0..eec3ab6 100644
--- a/app/actions/file-commands.c
+++ b/app/actions/file-commands.c
@@ -76,7 +76,8 @@ static void file_save_dialog_show (Gimp *gimp,
GtkWidget *parent,
const gchar *title,
gboolean save_a_copy,
- gboolean close_after_saving);
+ gboolean close_after_saving,
+ GimpDisplay *display);
static void file_export_dialog_show (Gimp *gimp,
GimpImage *image,
GtkWidget *parent);
@@ -270,13 +271,13 @@ file_save_cmd_callback (GtkAction *action,
case GIMP_SAVE_MODE_SAVE_AS:
file_save_dialog_show (gimp, image, widget,
_("Save Image"), FALSE,
- save_mode == GIMP_SAVE_MODE_SAVE_AND_CLOSE);
+ save_mode == GIMP_SAVE_MODE_SAVE_AND_CLOSE, display);
break;
case GIMP_SAVE_MODE_SAVE_A_COPY:
file_save_dialog_show (gimp, image, widget,
_("Save a Copy of the Image"), TRUE,
- FALSE);
+ FALSE, display);
break;
case GIMP_SAVE_MODE_EXPORT:
@@ -535,7 +536,8 @@ file_save_dialog_show (Gimp *gimp,
GtkWidget *parent,
const gchar *title,
gboolean save_a_copy,
- gboolean close_after_saving)
+ gboolean close_after_saving,
+ GimpDisplay *display)
{
GtkWidget *dialog;
@@ -569,7 +571,7 @@ file_save_dialog_show (Gimp *gimp,
gimp_file_dialog_set_save_image (GIMP_FILE_DIALOG (dialog),
gimp, image, save_a_copy, FALSE,
- close_after_saving);
+ close_after_saving, GIMP_OBJECT (display));
gtk_window_present (GTK_WINDOW (dialog));
}
@@ -621,7 +623,8 @@ file_export_dialog_show (Gimp *gimp,
image,
FALSE,
TRUE,
- FALSE);
+ FALSE,
+ NULL);
gtk_window_present (GTK_WINDOW (dialog));
}
diff --git a/app/dialogs/file-save-dialog.c b/app/dialogs/file-save-dialog.c
index 69edc86..762b00b 100644
--- a/app/dialogs/file-save-dialog.c
+++ b/app/dialogs/file-save-dialog.c
@@ -215,28 +215,15 @@ file_save_dialog_response (GtkWidget *save_dialog,
/* make sure the menus are updated with the keys we've just set */
gimp_image_flush (dialog->image);
- /* Handle close-after-saing */
- if (dialog)
+ /* Handle close-after-saving */
+ if (dialog->close_after_saving && dialog->display_to_close)
{
- GtkWindow *parent;
-
- parent = gtk_window_get_transient_for (GTK_WINDOW (dialog));
-
- if (dialog->close_after_saving)
- {
- if (GIMP_IS_DISPLAY_SHELL (parent))
- {
- GimpDisplay *display;
-
- display = GIMP_DISPLAY_SHELL (parent)->display;
-
- if (! gimp_image_is_dirty (gimp_display_get_image (display)))
- gimp_display_close (display);
- }
- }
-
- gtk_widget_destroy (save_dialog);
+ GimpDisplay *display = GIMP_DISPLAY (dialog->display_to_close);
+ if (display && ! gimp_image_is_dirty (gimp_display_get_image (display)))
+ gimp_display_close (display);
}
+
+ gtk_widget_destroy (save_dialog);
}
g_free (uri);
diff --git a/app/widgets/gimpfiledialog.c b/app/widgets/gimpfiledialog.c
index 861e118..95c8c41 100644
--- a/app/widgets/gimpfiledialog.c
+++ b/app/widgets/gimpfiledialog.c
@@ -486,7 +486,8 @@ gimp_file_dialog_set_save_image (GimpFileDialog *dialog,
GimpImage *image,
gboolean save_a_copy,
gboolean export,
- gboolean close_after_saving)
+ gboolean close_after_saving,
+ GimpObject *display)
{
const gchar *dir_uri = NULL;
const gchar *name_uri = NULL;
@@ -504,6 +505,7 @@ gimp_file_dialog_set_save_image (GimpFileDialog *dialog,
dialog->save_a_copy = save_a_copy;
dialog->export = export;
dialog->close_after_saving = close_after_saving;
+ dialog->display_to_close = display;
gimp_file_dialog_set_file_proc (dialog, NULL);
diff --git a/app/widgets/gimpfiledialog.h b/app/widgets/gimpfiledialog.h
index cf4b054..77bc2ca 100644
--- a/app/widgets/gimpfiledialog.h
+++ b/app/widgets/gimpfiledialog.h
@@ -45,6 +45,7 @@ struct _GimpFileDialog
gboolean save_a_copy;
gboolean export;
gboolean close_after_saving;
+ GimpObject *display_to_close;
GtkWidget *thumb_box;
GtkWidget *proc_expander;
@@ -87,7 +88,8 @@ void gimp_file_dialog_set_save_image (GimpFileDialog *dialog,
GimpImage *image,
gboolean save_a_copy,
gboolean export,
- gboolean close_after_saving);
+ gboolean close_after_saving,
+ GimpObject *display);
GimpFileDialogState * gimp_file_dialog_get_state (GimpFileDialog *dialog);
void gimp_file_dialog_set_state (GimpFileDialog *dialog,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]