aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Bordoley <bordoley@msu.edu>2003-03-29 00:06:33 +0800
committerDave Bordoley <Bordoley@src.gnome.org>2003-03-29 00:06:33 +0800
commitd15bb064a753c1087301d830f6ebf036290f26d7 (patch)
treee4695096c31aa1ec7581af362a2997876ac45f6c /src
parent7f45e7613d25995f69daf640bebc05399b557f91 (diff)
downloadgsoc2013-epiphany-d15bb064a753c1087301d830f6ebf036290f26d7.tar
gsoc2013-epiphany-d15bb064a753c1087301d830f6ebf036290f26d7.tar.gz
gsoc2013-epiphany-d15bb064a753c1087301d830f6ebf036290f26d7.tar.bz2
gsoc2013-epiphany-d15bb064a753c1087301d830f6ebf036290f26d7.tar.lz
gsoc2013-epiphany-d15bb064a753c1087301d830f6ebf036290f26d7.tar.xz
gsoc2013-epiphany-d15bb064a753c1087301d830f6ebf036290f26d7.tar.zst
gsoc2013-epiphany-d15bb064a753c1087301d830f6ebf036290f26d7.zip
Use the same key_press callback for both the topics and bm's view.
2003-03-27 David Bordoley <bordoley@msu.edu> * src/bookmarks/ephy-bookmarks-editor.c: (key_pressed_cb), (ephy_bookmarks_editor_construct): Use the same key_press callback for both the topics and bm's view. s/bookmarks/title in the bm tree. Remove an unused enum. * src/bookmarks/ephy-topics-selector.c: (topic_key_pressed), (ephy_topics_build_ui): Use space, return and enter to toggle topics in the selector.
Diffstat (limited to 'src')
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c40
-rw-r--r--src/bookmarks/ephy-topics-selector.c35
2 files changed, 45 insertions, 30 deletions
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index 39587c4e6..9bfbd3c14 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -96,12 +96,6 @@ enum
PROP_BOOKMARKS
};
-enum
-{
- RESPONSE_REMOVE,
- RESPONSE_GO
-};
-
static GtkTargetEntry topic_drag_types [] =
{
{ EPHY_DND_TOPIC_TYPE, 0, 0 }
@@ -481,21 +475,6 @@ ephy_bookmarks_editor_show_popup_cb (GtkWidget *view,
}
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 +506,15 @@ bookmarks_filter (EphyBookmarksEditor *editor,
}
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 +699,8 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
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),
@@ -747,15 +727,15 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
ephy_node_view_set_hinted (bm_view, TRUE);
ephy_node_view_enable_drag_source (bm_view, NULL, 0, EPHY_NODE_BMK_PROP_LOCATION);
ephy_node_view_add_icon_column (bm_view, EPHY_TREE_MODEL_NODE_COL_ICON);
- ephy_node_view_add_column (bm_view, _("Bookmarks"),
+ ephy_node_view_add_column (bm_view, _("Title"),
EPHY_TREE_MODEL_NODE_COL_BOOKMARK, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (bm_view), TRUE, TRUE, 0);
gtk_widget_show (GTK_WIDGET (bm_view));
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),
diff --git a/src/bookmarks/ephy-topics-selector.c b/src/bookmarks/ephy-topics-selector.c
index 97023550c..40f6a89b6 100644
--- a/src/bookmarks/ephy-topics-selector.c
+++ b/src/bookmarks/ephy-topics-selector.c
@@ -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 *editor)
("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);