[Epiphany] [patch]bookmark key nav patch
- From: Dave Bordoley <bordoley pilot msu edu>
- To: epiphany mozdev org
- Subject: [Epiphany] [patch]bookmark key nav patch
- Date: Thu, 27 Mar 2003 10:33:26 -0500
Lets you add/remove keywords in the new bookmark/properties windows
using space, return or kp_enter.
Use the same callback for for key_press events for both views in the
bme. Also lets you delete topics/bms using kp_delete as well.
ok to commit?
dave
ps. I'm going to attach this patch to the dave's megapatch bug.
Index: src/bookmarks/ephy-bookmarks-editor.c
===================================================================
RCS file: /cvs/gnome/epiphany/src/bookmarks/ephy-bookmarks-editor.c,v
retrieving revision 1.31
diff -u -p -r1.31 ephy-bookmarks-editor.c
--- src/bookmarks/ephy-bookmarks-editor.c 27 Mar 2003 13:39:33 -0000 1.31
+++ src/bookmarks/ephy-bookmarks-editor.c 27 Mar 2003 15:19:10 -0000
@@ -481,21 +481,6 @@ ephy_bookmarks_editor_show_popup_cb (Gtk
}
static void
-ephy_bookmarks_editor_key_pressed_cb (GtkWidget *view,
- GdkEventKey *event,
- EphyBookmarksEditor *editor)
-{
- switch (event->keyval)
- {
- case GDK_Delete:
- ephy_node_view_remove (editor->priv->bm_view);
- break;
- default:
- break;
- }
-}
-
-static void
ephy_bookmarks_editor_node_activated_cb (GtkWidget *view,
EphyNode *node,
EphyBookmarksEditor *editor)
@@ -527,14 +512,15 @@ bookmarks_filter (EphyBookmarksEditor *e
}
static void
-keyword_node_key_pressed_cb (GtkWidget *view,
- GdkEventKey *event,
- EphyBookmarksEditor *editor)
+key_pressed_cb (GtkWidget *widget,
+ GdkEventKey *event,
+ EphyNodeView *view)
{
switch (event->keyval)
{
case GDK_Delete:
- ephy_node_view_remove (editor->priv->key_view);
+ case GDK_KP_Delete:
+ ephy_node_view_remove (view);
break;
default:
@@ -719,8 +705,8 @@ ephy_bookmarks_editor_construct (EphyBoo
editor->priv->key_view = key_view;
g_signal_connect (G_OBJECT (key_view),
"key_press_event",
- G_CALLBACK (keyword_node_key_pressed_cb),
- editor);
+ G_CALLBACK (key_pressed_cb),
+ editor->priv->key_view);
g_signal_connect (G_OBJECT (key_view),
"node_selected",
G_CALLBACK (keyword_node_selected_cb),
@@ -754,8 +740,8 @@ ephy_bookmarks_editor_construct (EphyBoo
editor->priv->bm_view = bm_view;
g_signal_connect (G_OBJECT (bm_view),
"key_press_event",
- G_CALLBACK (ephy_bookmarks_editor_key_pressed_cb),
- editor);
+ G_CALLBACK (key_pressed_cb),
+ editor->priv->bm_view);
g_signal_connect (G_OBJECT (bm_view),
"node_activated",
G_CALLBACK (ephy_bookmarks_editor_node_activated_cb),
Index: src/bookmarks/ephy-topics-selector.c
===================================================================
RCS file: /cvs/gnome/epiphany/src/bookmarks/ephy-topics-selector.c,v
retrieving revision 1.6
diff -u -p -r1.6 ephy-topics-selector.c
--- src/bookmarks/ephy-topics-selector.c 27 Mar 2003 13:39:33 -0000 1.6
+++ src/bookmarks/ephy-topics-selector.c 27 Mar 2003 15:19:12 -0000
@@ -330,6 +330,39 @@ topic_clicked (GtkTreeView *tree_view,
return FALSE;
}
+static gboolean
+topic_key_pressed (GtkTreeView *tree_view,
+ GdkEventKey *event,
+ EphyTopicsSelector *selector)
+{
+ GtkTreeSelection *sel = NULL;
+ GtkTreeIter iter;
+ GtkTreePath *path = NULL;
+ gchar *path_str;
+
+ switch (event->keyval)
+ {
+ case GDK_space:
+ case GDK_Return:
+ case GDK_KP_Enter:
+ sel = gtk_tree_view_get_selection (tree_view);
+
+ if (gtk_tree_selection_get_selected (sel, NULL, &iter))
+ {
+ path = gtk_tree_model_get_path (selector->priv->model, &iter);
+ path_str = gtk_tree_path_to_string (path);
+ topic_toggled (NULL, path_str, selector);
+ g_free(path_str);
+ }
+ return TRUE;
+
+ default:
+ break;
+ }
+
+ return FALSE;
+}
+
static void
ephy_topics_build_ui (EphyTopicsSelector *editor)
{
@@ -358,6 +391,8 @@ ephy_topics_build_ui (EphyTopicsSelector
("Description", renderer, "text", COL_TOPIC, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
+ g_signal_connect (G_OBJECT (treeview), "key_press_event",
+ G_CALLBACK (topic_key_pressed), editor);
g_signal_connect (G_OBJECT (treeview), "button_press_event",
G_CALLBACK (topic_clicked), editor);
fill_model (editor);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]