Bug 772785 - Quit dialog should exit when all the images in the list...
... have been saved. No need to keep a list of 0 images when the creator requested a quit or close-all actions and manually went through the list to save all remaining images. Yet one can still cancel the quit/close-all action by hitting Esc (or Cancel button) during the last save, since it is an idle source action.
This commit is contained in:
@ -113,6 +113,7 @@ static gboolean quit_close_all_dialog_query_tooltip (GtkWidget *w
|
|||||||
gboolean keyboard_tip,
|
gboolean keyboard_tip,
|
||||||
GtkTooltip *tooltip,
|
GtkTooltip *tooltip,
|
||||||
QuitDialog *private);
|
QuitDialog *private);
|
||||||
|
static gboolean quit_close_all_idle (QuitDialog *private);
|
||||||
|
|
||||||
|
|
||||||
/* public functions */
|
/* public functions */
|
||||||
@ -285,6 +286,7 @@ quit_close_all_dialog_new (Gimp *gimp,
|
|||||||
static void
|
static void
|
||||||
quit_close_all_dialog_free (QuitDialog *private)
|
quit_close_all_dialog_free (QuitDialog *private)
|
||||||
{
|
{
|
||||||
|
g_idle_remove_by_data (private);
|
||||||
g_object_unref (private->images);
|
g_object_unref (private->images);
|
||||||
g_object_unref (private->context);
|
g_object_unref (private->context);
|
||||||
|
|
||||||
@ -365,6 +367,18 @@ quit_close_all_dialog_container_changed (GimpContainer *images,
|
|||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
gtk_widget_grab_default (private->ok_button);
|
gtk_widget_grab_default (private->ok_button);
|
||||||
|
|
||||||
|
/* When no image requires saving anymore, there is no harm in
|
||||||
|
* assuming completing the original quit or close-all action is
|
||||||
|
* the expected end-result.
|
||||||
|
* I don't immediately exit though because of some unfinished
|
||||||
|
* actions provoking warnings. Let's just close as soon as
|
||||||
|
* possible with an idle source.
|
||||||
|
* Also the idle source has another benefit: allowing to change
|
||||||
|
* one's mind and not exist after the last save, for instance by
|
||||||
|
* hitting Esc quickly while the last save is in progress.
|
||||||
|
*/
|
||||||
|
g_idle_add (quit_close_all_idle, private);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -590,3 +604,11 @@ quit_close_all_dialog_query_tooltip (GtkWidget *widget,
|
|||||||
|
|
||||||
return show_tip;
|
return show_tip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
quit_close_all_idle (QuitDialog *private)
|
||||||
|
{
|
||||||
|
gtk_dialog_response (private->dialog, GTK_RESPONSE_OK);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user