Re: [PATCH] Fix behavior when "Save modified files?" window is closed



On 9 March 2010 17:00, Peter Tyser <ptyser gmail com> wrote:
> diff --git a/meld/meldapp.py b/meld/meldapp.py
> index 81e6991..1e0a786 100644
> --- a/meld/meldapp.py
> +++ b/meld/meldapp.py
> @@ -740,7 +740,8 @@ class MeldApp(gnomeglade.Component):
>
>     def try_remove_page(self, page):
>         "See if a page will allow itself to be removed"
> -        if page.on_delete_event() != gtk.RESPONSE_CANCEL:
> +        resp = page.on_delete_event()
> +        if resp != gtk.RESPONSE_CANCEL and resp != gtk.RESPONSE_DELETE_EVENT:
>             self.scheduler.remove_scheduler( page.scheduler )
>             i = self.notebook.page_num( page.widget )
>             assert(i>=0)

I think this fixes the wrong place. Really, melddoc.on_delete_event
(which is incorrectly named; it's not hooked to the delete signal at
all) shouldn't return anything other than yes/no. Since we're using
RESPONSE_OK and RESPONSE_CANCEL, a short-term fix might be to add
something like:
    elif response == gtk.RESPONSE_DELETE_EVENT:
        response = gtk.RESPONSE_CANCEL
near the end of filediff.on_delete_event.

cheers,
Kai


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