aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog12
-rw-r--r--mail/folder-browser.c82
-rw-r--r--mail/message-list.c3
3 files changed, 63 insertions, 34 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 1bb358058f..4771486a02 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,15 @@
+2001-05-07 Dan Winship <danw@ximian.com>
+
+ * folder-browser.c (my_folder_browser_init): Connect to
+ key_press_event on the GtkHTML widget.
+ (etree_key): Only handle space/backspace here, pass the rest off
+ to on_key_press.
+ (on_key_press): Handle Delete/N/P/Menu in either MessageList or
+ MailDisplay.
+
+ * message-list.c (message_list_select): Grab focus if we don't
+ have it.
+
2001-05-03 Dan Winship <danw@ximian.com>
* message-list.c: #include <camel/camel-file-utils.h>
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index c2d224d6ad..c070dd2072 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -15,11 +15,12 @@
#include <ctype.h>
#include <gdk/gdkkeysyms.h>
-#include <gal/util/e-util.h>
-#include <gal/widgets/e-unicode.h>
#include <gal/e-paned/e-vpaned.h>
-#include <gal/widgets/e-popup-menu.h>
+#include <gal/e-table/e-table.h>
+#include <gal/util/e-util.h>
#include <gal/widgets/e-gui-utils.h>
+#include <gal/widgets/e-popup-menu.h>
+#include <gal/widgets/e-unicode.h>
#include "filter/vfolder-rule.h"
#include "filter/vfolder-context.h"
@@ -821,38 +822,20 @@ display_menu:
return TRUE;
}
-static int
-etree_key (ETree *tree, int row, ETreePath path, int col, GdkEvent *ev, FolderBrowser *fb)
+static gint
+on_key_press (GtkWidget *widget, GdkEventKey *key, gpointer data)
{
- if ((ev->key.state & GDK_CONTROL_MASK) != 0)
- return FALSE;
-
- switch (ev->key.keyval) {
- case GDK_space:
- case GDK_BackSpace:
- {
- GtkAdjustment *vadj;
- gfloat page_size;
+ FolderBrowser *fb = data;
+ ETreePath *path;
+ int row;
- vadj = e_scroll_frame_get_vadjustment (fb->mail_display->scroll);
- page_size = vadj->page_size - vadj->step_increment;
+ if (key->state & GDK_CONTROL_MASK)
+ return FALSE;
- if (ev->key.keyval == GDK_BackSpace) {
- if (vadj->value > vadj->lower + page_size)
- vadj->value -= page_size;
- else
- vadj->value = vadj->lower;
- } else {
- if (vadj->value < vadj->upper - vadj->page_size - page_size)
- vadj->value += page_size;
- else
- vadj->value = vadj->upper - vadj->page_size;
- }
+ path = e_tree_get_cursor (fb->message_list->tree);
+ row = e_tree_row_of_node (fb->message_list->tree, path);
- gtk_adjustment_value_changed (vadj);
- return TRUE;
- }
-
+ switch (key->keyval) {
case GDK_Delete:
case GDK_KP_Delete:
delete_msg (NULL, fb);
@@ -876,14 +859,42 @@ etree_key (ETree *tree, int row, ETreePath path, int col, GdkEvent *ev, FolderBr
return TRUE;
case GDK_Menu:
- on_right_click (tree, row, path, col, ev, fb);
+ on_right_click (fb->message_list->tree, row, path, 2,
+ (GdkEvent *)key, fb);
return TRUE;
+ }
+
+ return FALSE;
+}
+
+static int
+etree_key (ETree *tree, int row, ETreePath path, int col, GdkEvent *ev, FolderBrowser *fb)
+{
+ GtkAdjustment *vadj;
+ gfloat page_size;
- default:
+ if ((ev->key.state & GDK_CONTROL_MASK) != 0)
return FALSE;
+ if (ev->key.keyval != GDK_space && ev->key.keyval != GDK_BackSpace)
+ return on_key_press ((GtkWidget *)tree, (GdkEventKey *)ev, fb);
+
+ vadj = e_scroll_frame_get_vadjustment (fb->mail_display->scroll);
+ page_size = vadj->page_size - vadj->step_increment;
+
+ if (ev->key.keyval == GDK_BackSpace) {
+ if (vadj->value > vadj->lower + page_size)
+ vadj->value -= page_size;
+ else
+ vadj->value = vadj->lower;
+ } else {
+ if (vadj->value < vadj->upper - vadj->page_size - page_size)
+ vadj->value += page_size;
+ else
+ vadj->value = vadj->upper - vadj->page_size;
}
- return FALSE;
+ gtk_adjustment_value_changed (vadj);
+ return TRUE;
}
static void
@@ -1085,6 +1096,9 @@ my_folder_browser_init (GtkObject *object)
GTK_POLICY_NEVER,
GTK_POLICY_ALWAYS);
+ gtk_signal_connect (GTK_OBJECT (fb->mail_display->html),
+ "key_press_event", GTK_SIGNAL_FUNC (on_key_press), fb);
+
gtk_signal_connect (GTK_OBJECT (fb->message_list->tree),
"key_press", GTK_SIGNAL_FUNC (etree_key), fb);
diff --git a/mail/message-list.c b/mail/message-list.c
index b5921b7412..1c241efd1b 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -381,6 +381,9 @@ message_list_select (MessageList *message_list, int base_row,
int vrow, last;
ETree *et = message_list->tree;
+ if (!GTK_WIDGET_HAS_FOCUS (message_list))
+ gtk_widget_grab_focus (GTK_WIDGET (message_list));
+
switch (direction) {
case MESSAGE_LIST_SELECT_PREVIOUS:
last = -1;