Re: [PATCH] Fix saving of multiple modified files on quit



On 22 April 2010 16:20, Peter Tyser <ptyser gmail com> wrote:
> Previously, file modifications could be lost when quitting meld
> when multiple diff panes were open and more than 1 of the panes
> had file modifications.  Quitting would prompt the user to
> Discard/Cancel/Save the changes in one of the modified panes.  Pressing
> "Discard Changes" would result in Meld quitting immediately without
> prompting the user if they wanted to save the other modified files.
>
> This issue only occurred if multiple diff panes were open, eg when using
> Meld to diff/modify multiple files in a version-controlled directory.
>
> Signed-off-by: Peter Tyser <ptyser gmail com>
> ---
>  meld/meldapp.py |   10 ++++++----
>  1 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/meld/meldapp.py b/meld/meldapp.py
> index 7de8ab3..0f5b6c6 100644
> --- a/meld/meldapp.py
> +++ b/meld/meldapp.py
> @@ -642,12 +642,14 @@ class MeldApp(gnomeglade.Component):
>             self.try_remove_page(page)
>
>     def on_menu_quit_activate(self, *extra):
> -        for c in self.notebook.get_children():
> -            response = c.get_data("pyobject").on_delete_event(appquit=1)
> +        # Delete pages from right-to-left.  This ensures that if a version
> +        # control page is open in the far left page, it will be deleted last.
> +        for c in reversed(self.notebook.get_children()):
> +            page = c.get_data("pyobject")
> +            self.notebook.set_current_page(self.notebook.page_num(page.widget))
> +            response = page.on_delete_event(appquit=1)
>             if response == gtk.RESPONSE_CANCEL:
>                 return gtk.RESPONSE_CANCEL
> -            elif response == gtk.RESPONSE_CLOSE:
> -                break
>         for c in self.notebook.get_children():
>             c.get_data("pyobject").on_quit_event()
>         gtk.main_quit()
> --
> 1.6.2-rc2.GIT

So this isn't quite right. It's certainly better than before, but it
exposes a problem with when we close tabs.

For example: have two panes open, both with modified files. Try to
quit Meld. For the first dialogue that appears, select "Discard
changes". For the second dialogue, select "Cancel". Both tabs stay
open.

I'd expect that as soon as discard/save is selected, the action is
taken and the tab is closed. However, what we actually do is delay
closing tabs until we're sure we can close all of them... this doesn't
seem ideal to me. Thoughts?

cheers,
Kai


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]