From 42508f7a3ba2e050ddec599740a525d62926bace Mon Sep 17 00:00:00 2001 From: Not Zed Date: Mon, 17 Mar 2003 22:44:58 +0000 Subject: use a hack to find out if the message-list was focussed before we 2003-03-12 Not Zed * mail-callbacks.c (expunge_folder): use a hack to find out if the message-list was focussed before we desensitise it. (expunged_folder): If the message-list was focussed before, re-grab the focus. For bug #29564. svn path=/trunk/; revision=20325 --- mail/ChangeLog | 7 +++++++ mail/folder-browser.h | 3 ++- mail/mail-callbacks.c | 19 +++++++++++++++++-- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 1c2fad5e4b..11c8791472 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,10 @@ +2003-03-12 Not Zed + + * mail-callbacks.c (expunge_folder): use a hack to find out if the + message-list was focussed before we desensitise it. + (expunged_folder): If the message-list was focussed before, + re-grab the focus. For bug #29564. + 2003-03-17 Ettore Perazzoli * mail-signature-editor.c (mail_signature_editor): Give the editor diff --git a/mail/folder-browser.h b/mail/folder-browser.h index 24dd8db0bf..d538003301 100644 --- a/mail/folder-browser.h +++ b/mail/folder-browser.h @@ -63,7 +63,8 @@ struct _FolderBrowser { /* a folder we are expunging, dont use other than to compare the pointer value */ CamelFolder *expunging; - + int expunge_mlfocussed; /* true if the ml was focussed before we expunged */ + MessageList *message_list; MailDisplay *mail_display; GtkWidget *vpaned; diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index 6a961e5ef6..3b8267221c 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -2669,6 +2669,12 @@ expunged_folder (CamelFolder *f, void *data) fb->expunging = NULL; gtk_widget_set_sensitive (GTK_WIDGET (fb->message_list), TRUE); + + /* FIXME: we should check that the focus hasn't changed in the + * mean time, otherwise we steal the focus unecessarily. + * Check :get_toplevel()->focus_widget? */ + if (fb->expunge_mlfocussed) + gtk_widget_grab_focus((GtkWidget *)fb->message_list); } static gboolean @@ -2702,8 +2708,17 @@ expunge_folder (BonoboUIComponent *uih, void *user_data, const char *path) if (fb->folder && (fb->expunging == NULL || fb->folder != fb->expunging) && confirm_expunge (fb)) { CamelMessageInfo *info; - - /* hide the deleted messages so user can't click on them while we expunge */ + GtkWindow *top; + GtkWidget *focus; + + /* disable the message list so user can't click on them while we expunge */ + + /* nasty hack to find out if some widget inside the message list is focussed ... */ + top = gtk_widget_get_toplevel((GtkWidget *)fb->message_list); + focus = top?top->focus_widget:NULL; + while (focus && focus != (GtkWidget *)fb->message_list) + focus = focus->parent; + fb->expunge_mlfocussed = focus == (GtkWidget *)fb->message_list; gtk_widget_set_sensitive (GTK_WIDGET (fb->message_list), FALSE); /* Only blank the mail display if the message being -- cgit v1.2.3