aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog19
-rw-r--r--mail/folder-browser-ui.c24
-rw-r--r--mail/folder-browser-ui.h3
-rw-r--r--mail/folder-browser.c28
-rw-r--r--mail/mail-callbacks.c8
-rw-r--r--mail/message-list.c3
6 files changed, 78 insertions, 7 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index b52aa923fe..becab93fa1 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,22 @@
+2002-03-04 Jeffrey Stedfast <fejj@ximian.com>
+
+ * folder-browser.c (my_folder_browser_init): Connect to the
+ focus-in/out events on the message-list so that we can disable the
+ EditInvertSelection and EditSelectThread menu items when the
+ message-list is not in focus.
+
+ * folder-browser-ui.c (folder_browser_ui_message_list_unfocus):
+ New function to de-sensitize some items if the message-list is not
+ in focus.
+ (folder_browser_ui_message_list_focus): New function to sensitize
+ some items if the message-list is not in focus.
+
+ * mail-callbacks.c (invert_selection): Only invert the selection
+ of the message-list if it is the widget in focus.
+
+ * message-list.c (message_list_select): Do not explicitly grab the
+ focus here.
+
2002-03-04 Ettore Perazzoli <ettore@ximian.com>
[Fix #19303.]
diff --git a/mail/folder-browser-ui.c b/mail/folder-browser-ui.c
index cd79be08ea..207d6344bd 100644
--- a/mail/folder-browser-ui.c
+++ b/mail/folder-browser-ui.c
@@ -144,7 +144,7 @@ static EPixmap message_pixcache [] = {
E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageMove", "buttons/move-message.png"),
E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageCopy", "buttons/copy-message.png"),
E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageDelete", "buttons/delete-message.png"),
-
+
E_PIXMAP ("/Toolbar/MailNextButtons/MailNext", "buttons/next-message.png"),
E_PIXMAP ("/Toolbar/MailNextButtons/MailPrevious", "buttons/previous-message.png"),
@@ -308,6 +308,28 @@ folder_browser_ui_discard_view_menus (FolderBrowser *fb)
fb->view_menus = NULL;
}
+void
+folder_browser_ui_message_list_focus (FolderBrowser *fb)
+{
+ g_assert (fb->uicomp != NULL);
+
+ bonobo_ui_component_set_prop (fb->uicomp, "/commands/EditInvertSelection",
+ "sensitive", "1", NULL);
+ bonobo_ui_component_set_prop (fb->uicomp, "/commands/EditSelectThread",
+ "sensitive", "1", NULL);
+}
+
+void
+folder_browser_ui_message_list_unfocus (FolderBrowser *fb)
+{
+ g_assert (fb->uicomp != NULL);
+
+ bonobo_ui_component_set_prop (fb->uicomp, "/commands/EditInvertSelection",
+ "sensitive", "0", NULL);
+ bonobo_ui_component_set_prop (fb->uicomp, "/commands/EditSelectThread",
+ "sensitive", "0", NULL);
+}
+
static void
folder_browser_setup_property_menu (FolderBrowser *fb,
BonoboUIComponent *uic)
diff --git a/mail/folder-browser-ui.h b/mail/folder-browser-ui.h
index 21c590e1a8..0d305cb277 100644
--- a/mail/folder-browser-ui.h
+++ b/mail/folder-browser-ui.h
@@ -29,4 +29,7 @@ void folder_browser_ui_setup_view_menus (FolderBrowser *fb);
/* Set the sensitivity of a single item */
void fbui_sensitise_item(FolderBrowser *fb, const char *item, int state);
+void folder_browser_ui_message_list_focus (FolderBrowser *fb);
+void folder_browser_ui_message_list_unfocus (FolderBrowser *fb);
+
#endif /* _FOLDER_BROWSER_UI_H */
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index daab5eed88..b025ba9291 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -2039,6 +2039,28 @@ on_message_selected (MessageList *ml, const char *uid, FolderBrowser *fb)
fb->loading_id = gtk_timeout_add (100, (GtkFunction)do_message_selected, fb);
}
+static gboolean
+on_message_list_focus_in (GtkWidget *widget, GdkEventFocus *event, gpointer user_data)
+{
+ FolderBrowser *fb = (FolderBrowser *) user_data;
+
+ printf ("got focus!\n");
+ folder_browser_ui_message_list_focus (fb);
+
+ return FALSE;
+}
+
+static gboolean
+on_message_list_focus_out (GtkWidget *widget, GdkEventFocus *event, gpointer user_data)
+{
+ FolderBrowser *fb = (FolderBrowser *) user_data;
+
+ printf ("got unfocus!\n");
+ folder_browser_ui_message_list_unfocus (fb);
+
+ return FALSE;
+}
+
static void
folder_browser_init (GtkObject *object)
{
@@ -2087,6 +2109,12 @@ my_folder_browser_init (GtkObject *object)
gtk_signal_connect (GTK_OBJECT (fb->message_list->tree),
"double_click", GTK_SIGNAL_FUNC (on_double_click), fb);
+ gtk_signal_connect (GTK_OBJECT (fb->message_list->tree), "focus_in_event",
+ GTK_SIGNAL_FUNC (on_message_list_focus_in), fb);
+
+ gtk_signal_connect (GTK_OBJECT (fb->message_list->tree), "focus_out_event",
+ GTK_SIGNAL_FUNC (on_message_list_focus_out), fb);
+
gtk_signal_connect (GTK_OBJECT (fb->message_list), "message_selected",
on_message_selected, fb);
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 87c7b3e506..4ffc4e4c78 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -1696,9 +1696,11 @@ invert_selection (BonoboUIComponent *uih, void *user_data, const char *path)
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- etsm = e_tree_get_selection_model (fb->message_list->tree);
-
- e_selection_model_invert_selection (etsm);
+ if (GTK_WIDGET_HAS_FOCUS (fb->message_list)) {
+ etsm = e_tree_get_selection_model (fb->message_list->tree);
+
+ e_selection_model_invert_selection (etsm);
+ }
}
/* flag all selected messages. Return number flagged */
diff --git a/mail/message-list.c b/mail/message-list.c
index b8eb9f9fc7..e9dd90fa9a 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -416,9 +416,6 @@ message_list_select (MessageList *message_list,
struct search_func_data data;
ETreeFindNextParams params = 0;
- if (!GTK_WIDGET_HAS_FOCUS (message_list))
- gtk_widget_grab_focus (GTK_WIDGET (message_list));
-
data.message_list = message_list;
data.flags = flags;
data.mask = mask;