I've made a patch to fix it, but it's kinda large,
involves moving drawing_prompt_to_save() from drawing.c to file.c

because changing drawing_prompt_to_save() to use file_save_as_dialog()
introduces 'gpaint_canvas' dependency to it's prototype in drawing.h,
including canvas.h wouldn't make sense (due to dependency loop).

So I justified by take it as a file-related function
and move it to file.c, changing it's name along the way.


Changes summary:
drawing.c: remove the drawing_prompt_to_save() function
drawing.h: remove drawing_prompt_to_save() prototype

file.c: change return type of file_save_as_dialog() from 'void' to 'int'
and change the code to return successfulness of saving,
'TRUE' if image was saved, 'FALSE' if otherwise (user cancel or write error).

file.c: add file_prompt_to_save() [formerly drawing_prompt_to_save()
from drawing.c]
with argument type changed from 'gpaint_drawing' to 'gpaint_canvas',
return type changed from 'gboolean' to 'int'
and changed the code to call file_save_as_dialog() in case of untitled drawing,
instead of directly invoking drawing_save().

file.h: change return type of file_save_as_dialog() from 'void' to 'int'
file.h: add a prototype of file_prompt_to_save()

main.c: add '#include "file.h"'
main.c: change all of 'drawing_prompt_to_save(canvas->drawing)'
        to 'file_prompt_to_save(canvas)'

menu.c: change all of 'drawing_prompt_to_save(canvas->drawing)'
        to 'file_prompt_to_save(canvas)'


Regards,
Nachanon

Attachment: use_saveas_at_exit.diff
Description: Binary data

Reply via email to