Connect to the focus-in/out events on the message-list so that we can

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.

svn path=/trunk/; revision=15909
This commit is contained in:
Jeffrey Stedfast
2002-03-04 22:01:12 +00:00
committed by Jeffrey Stedfast
parent 944f73858b
commit c5f85f4f33
6 changed files with 78 additions and 7 deletions

View File

@ -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.]

View File

@ -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)

View File

@ -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 */

View File

@ -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);

View File

@ -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 */

View File

@ -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;