aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSrinivasa Ragavan <sragavan@src.gnome.org>2007-06-17 02:11:44 +0800
committerSrinivasa Ragavan <sragavan@src.gnome.org>2007-06-17 02:11:44 +0800
commit2c3588dfb263049299224e52a38f264369c84b7b (patch)
tree6d732344db5d4c31558495b3a0c5fbd5f09a1dc1
parent1a09e6737e6a74c8786042445bdf71882ef85bcb (diff)
downloadgsoc2013-evolution-2c3588dfb263049299224e52a38f264369c84b7b.tar.gz
gsoc2013-evolution-2c3588dfb263049299224e52a38f264369c84b7b.tar.zst
gsoc2013-evolution-2c3588dfb263049299224e52a38f264369c84b7b.zip
** Add support for the Magic Space Bar.
svn path=/trunk/; revision=33682
-rw-r--r--mail/ChangeLog10
-rw-r--r--mail/em-folder-browser.c39
-rw-r--r--mail/em-folder-tree.c47
-rw-r--r--mail/em-folder-tree.h1
4 files changed, 95 insertions, 2 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 0206b32815..35d41a507c 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,13 @@
+2007-06-16 Srinivasa Ragavan <sragavan@novell.com>
+
+ ** Add support for the Magic Space Bar.
+
+ * em-folder-browser.c: (html_scroll), (emfb_init),
+ (emfb_list_key_press):
+ * em-folder-tree.c: (emft_tree_user_event),
+ (em_folder_tree_select_next_path):
+ * em-folder-tree.h:
+
2007-06-15 Matthew Barnes <mbarnes@redhat.com>
* mail-send-recv.c:
diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c
index ab50741f8e..f560e150d6 100644
--- a/mail/em-folder-browser.c
+++ b/mail/em-folder-browser.c
@@ -412,6 +412,25 @@ emfb_realize (GtkWidget *widget)
}
static void
+html_scroll (GtkHTML *html,
+ GtkOrientation orientation,
+ GtkScrollType scroll_type,
+ gfloat position,
+ EMFolderBrowser *emfb)
+
+{
+ if (html->binding_handled || orientation != GTK_ORIENTATION_VERTICAL)
+ return;
+
+ if (scroll_type == GTK_SCROLL_PAGE_FORWARD) {
+ gtk_widget_grab_focus ((GtkWidget *)((EMFolderView *) emfb)->list);
+ message_list_select(((EMFolderView *) emfb)->list, MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN);
+ } else if (scroll_type == GTK_SCROLL_PAGE_BACKWARD) {
+ gtk_widget_grab_focus ((GtkWidget *)((EMFolderView *) emfb)->list);
+ message_list_select(((EMFolderView *) emfb)->list, MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN);
+ }
+}
+static void
emfb_init(GObject *o)
{
EMFolderBrowser *emfb = (EMFolderBrowser *)o;
@@ -423,6 +442,8 @@ emfb_init(GObject *o)
emfb->view.preview_active = TRUE;
emfb->view.list_active = TRUE;
+ g_signal_connect_after (((EMFormatHTML *)(emfb->view.preview))->html, "scroll", G_CALLBACK (html_scroll), emfb);
+
g_slist_foreach (emfb->view.ui_files, free_one_ui_file, NULL);
g_slist_free(emfb->view.ui_files);
@@ -1170,20 +1191,34 @@ emfb_search_search_cleared(ESearchBar *esb)
static int
emfb_list_key_press(ETree *tree, int row, ETreePath path, int col, GdkEvent *ev, EMFolderBrowser *emfb)
{
+ gboolean state, folder_choose = TRUE;
if ((ev->key.state & GDK_CONTROL_MASK) != 0)
return FALSE;
switch (ev->key.keyval) {
case GDK_space:
- em_utils_adjustment_page(gtk_scrolled_window_get_vadjustment((GtkScrolledWindow *)emfb->priv->scroll), TRUE);
+ state = gtk_html_command(((EMFormatHTML *)((EMFolderView *) emfb)->preview)->html, "scroll-forward");
+ if (!state)
+ folder_choose = message_list_select(((EMFolderView *) emfb)->list, MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN);
+
+ //em_utils_adjustment_page(gtk_scrolled_window_get_vadjustment((GtkScrolledWindow *)emfb->priv->scroll), TRUE);
break;
case GDK_BackSpace:
- em_utils_adjustment_page(gtk_scrolled_window_get_vadjustment((GtkScrolledWindow *)emfb->priv->scroll), FALSE);
+ state = gtk_html_command(((EMFormatHTML *)((EMFolderView *) emfb)->preview)->html, "scroll-backward");
+ if (!state)
+ folder_choose = message_list_select(((EMFolderView *) emfb)->list, MESSAGE_LIST_SELECT_PREVIOUS, 0, CAMEL_MESSAGE_SEEN);
+
+ //em_utils_adjustment_page(gtk_scrolled_window_get_vadjustment((GtkScrolledWindow *)emfb->priv->scroll), FALSE);
break;
default:
return FALSE;
}
+ if (!folder_choose) {
+ EMFolderTree *emft = g_object_get_data((GObject*)emfb, "foldertree");
+ em_folder_tree_select_next_path (emft);
+ gtk_widget_grab_focus ((GtkWidget *)((EMFolderView *) emfb)->list);
+ }
return TRUE;
}
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index a4c0d8c81d..93666128df 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -38,6 +38,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <gdk/gdkkeysyms.h>
#include <glib/gi18n.h>
#include <camel/camel-session.h>
@@ -2275,6 +2276,9 @@ emft_tree_button_press (GtkTreeView *treeview, GdkEventButton *event, EMFolderTr
static gboolean
emft_tree_user_event (GtkTreeView *treeview, GdkEvent *e, EMFolderTree *emft)
{
+ if (e->type == GDK_KEY_PRESS && e->key.keyval == GDK_space) {
+ return TRUE;
+ }
if (!emft->priv->do_multiselect)
emft_clear_selected_list(emft);
@@ -2314,6 +2318,49 @@ em_folder_tree_set_selected (EMFolderTree *emft, const char *uri)
g_list_free(l);
}
+void
+em_folder_tree_select_next_path (EMFolderTree *emft)
+{
+ GtkTreeSelection *selection;
+ GtkTreeModel *model;
+ GtkTreeIter iter, parent, child;
+ GtkTreePath *path = NULL;
+ struct _EMFolderTreePrivate *priv = emft->priv;
+
+ g_return_if_fail (EM_IS_FOLDER_TREE (emft));
+
+ selection = gtk_tree_view_get_selection(emft->priv->treeview);
+ if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
+ if (gtk_tree_model_iter_has_child (model, &iter)) {
+ gtk_tree_model_iter_children (model, &child, &iter);
+ path = gtk_tree_model_get_path (model, &child);
+ } else {
+ while (1) {
+ gboolean has_parent = gtk_tree_model_iter_parent (model, &parent, &iter);
+ if (gtk_tree_model_iter_next (model, &iter)) {
+ path = gtk_tree_model_get_path (model, &iter);
+ break;
+ } else {
+ if (has_parent)
+ iter = parent;
+ else
+ break;
+ }
+ }
+ }
+ }
+ if (path) {
+ gtk_tree_selection_select_path(selection, path);
+ if (!priv->cursor_set) {
+ gtk_tree_view_set_cursor (priv->treeview, path, NULL, FALSE);
+ priv->cursor_set = TRUE;
+ }
+ gtk_tree_view_scroll_to_cell (priv->treeview, path, NULL, TRUE, 0.5f, 0.0f);
+ }
+ return;
+}
+
+
char *
em_folder_tree_get_selected_uri (EMFolderTree *emft)
{
diff --git a/mail/em-folder-tree.h b/mail/em-folder-tree.h
index dd3cc94b10..c8bf089089 100644
--- a/mail/em-folder-tree.h
+++ b/mail/em-folder-tree.h
@@ -83,6 +83,7 @@ GList *em_folder_tree_get_selected_uris (EMFolderTree *emft);
GList *em_folder_tree_get_selected_paths (EMFolderTree *emft);
void em_folder_tree_set_selected (EMFolderTree *emft, const char *uri);
+void em_folder_tree_select_next_path (EMFolderTree *emft);
char *em_folder_tree_get_selected_uri (EMFolderTree *emft);
char *em_folder_tree_get_selected_path (EMFolderTree *emft);
CamelFolder *em_folder_tree_get_selected_folder (EMFolderTree *emft);