[evolution] Bug #268644 - unread mail shortcut collides with gtk tree search



commit 7c8e8174bc891b9208b7d500e768dc2ca8ed7b33
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jun 25 13:19:19 2009 +0200

    Bug #268644 - unread mail shortcut collides with gtk tree search

 mail/em-folder-tree.c |   14 +++++++++++++-
 mail/em-folder-tree.h |    1 +
 mail/mail-component.c |   20 ++++++++++++++++++++
 3 files changed, 34 insertions(+), 1 deletions(-)
---
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index 3114493..1702713 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -115,6 +115,7 @@ struct _EMFolderTreePrivate {
 enum {
 	FOLDER_ACTIVATED,  /* aka double-clicked or user hit enter */
 	FOLDER_SELECTED,
+	HIDDEN_KEY_EVENT,
 	LAST_SIGNAL
 };
 
@@ -239,6 +240,15 @@ em_folder_tree_class_init (EMFolderTreeClass *klass)
 			      G_TYPE_NONE, 2,
 			      G_TYPE_STRING,
 			      G_TYPE_STRING);
+
+	signals[HIDDEN_KEY_EVENT] =
+		g_signal_new ("hidden-key-event",
+			      G_OBJECT_CLASS_TYPE (object_class),
+			      G_SIGNAL_RUN_LAST,
+			      G_STRUCT_OFFSET (EMFolderTreeClass, hidden_key_event),
+			      NULL, NULL,
+			      g_cclosure_marshal_VOID__BOXED,
+			      G_TYPE_NONE, 1, GDK_TYPE_EVENT);
 }
 
 static gboolean
@@ -2285,7 +2295,9 @@ emft_tree_button_press (GtkTreeView *treeview, GdkEventButton *event, EMFolderTr
 static gboolean
 emft_tree_user_event (GtkTreeView *treeview, GdkEvent *e, EMFolderTree *emft)
 {
-	if (e && e->type == GDK_KEY_PRESS && e->key.keyval == GDK_space) {
+	if (e && e->type == GDK_KEY_PRESS && (e->key.keyval == GDK_space || e->key.keyval == '.' || e->key.keyval == ',' || e->key.keyval == '[' || e->key.keyval == ']')) {
+		g_signal_emit (emft, signals [HIDDEN_KEY_EVENT], 0, e);
+
 		return TRUE;
 	}
 	if (!emft->priv->do_multiselect)
diff --git a/mail/em-folder-tree.h b/mail/em-folder-tree.h
index ba02ff1..e8b6071 100644
--- a/mail/em-folder-tree.h
+++ b/mail/em-folder-tree.h
@@ -62,6 +62,7 @@ struct _EMFolderTreeClass {
 	/* signals */
 	void (* folder_activated) (EMFolderTree *emft, const gchar *full_name, const gchar *uri);
 	void (* folder_selected) (EMFolderTree *emft, const gchar *full_name, const gchar *uri, guint32 flags);
+	void (* hidden_key_event) (EMFolderTree *emft, GdkEvent *event);
 };
 
 GType em_folder_tree_get_type (void);
diff --git a/mail/mail-component.c b/mail/mail-component.c
index 4b788b3..c54a76a 100644
--- a/mail/mail-component.c
+++ b/mail/mail-component.c
@@ -414,6 +414,25 @@ folder_selected_cb (EMFolderTree *emft, const gchar *path, const gchar *uri, gui
 	}
 }
 
+static void
+tree_hidden_key_event_cb (EMFolderTree *emft, GdkEvent *event, EMFolderView *view)
+{
+	if (event && event->type == GDK_KEY_PRESS && view && view->list) {
+		switch (event->key.keyval) {
+		case '[':
+		case ',':
+			gtk_widget_grab_focus ((GtkWidget *) view->list);
+			message_list_select (view->list, MESSAGE_LIST_SELECT_PREVIOUS|MESSAGE_LIST_SELECT_WRAP, 0, CAMEL_MESSAGE_SEEN);
+			break;
+		case ']':
+		case '.':
+			gtk_widget_grab_focus ((GtkWidget *) view->list);
+			message_list_select (view->list, MESSAGE_LIST_SELECT_NEXT|MESSAGE_LIST_SELECT_WRAP, 0, CAMEL_MESSAGE_SEEN);
+			break;
+		}
+	}
+}
+
 static gint
 check_autosave(gpointer data)
 {
@@ -786,6 +805,7 @@ impl_createView (PortableServer_Servant servant,
 
 	g_signal_connect (component_view->view_control, "activate", G_CALLBACK (view_control_activate_cb), view_widget);
 	g_signal_connect (tree_widget, "folder-selected", G_CALLBACK (folder_selected_cb), view_widget);
+	g_signal_connect (tree_widget, "hidden-key-event", G_CALLBACK (tree_hidden_key_event_cb), view_widget);
 
 	g_signal_connect((EMFolderBrowser *)view_widget, "account_search_cleared", G_CALLBACK (enable_folder_tree), tree_widget);
 	g_signal_connect(((EMFolderBrowser *)view_widget), "account_search_activated", G_CALLBACK (disable_folder_tree), tree_widget);



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