aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Bordoley <bordoley@msu.edu>2003-04-22 01:37:31 +0800
committerDave Bordoley <Bordoley@src.gnome.org>2003-04-22 01:37:31 +0800
commit99b07178a3ae4596e074a2569ef28b2978415450 (patch)
tree019135dd1834162d3470a42be03ccb0f5dc2b9ee /src
parent1ccd53c473f0a9037af0fdffa9c9b302c22554dd (diff)
downloadgsoc2013-epiphany-99b07178a3ae4596e074a2569ef28b2978415450.tar
gsoc2013-epiphany-99b07178a3ae4596e074a2569ef28b2978415450.tar.gz
gsoc2013-epiphany-99b07178a3ae4596e074a2569ef28b2978415450.tar.bz2
gsoc2013-epiphany-99b07178a3ae4596e074a2569ef28b2978415450.tar.lz
gsoc2013-epiphany-99b07178a3ae4596e074a2569ef28b2978415450.tar.xz
gsoc2013-epiphany-99b07178a3ae4596e074a2569ef28b2978415450.tar.zst
gsoc2013-epiphany-99b07178a3ae4596e074a2569ef28b2978415450.zip
Use delete key to remove history items.
2003-04-21 David Bordoley <bordoley@msu.edu> * src/ephy-history-window.c: (key_pressed_cb), (ephy_history_window_construct): Use delete key to remove history items. * src/bookmarks/ephy-bookmarks-editor: (cmd_delete), (key_pressed_cb), (ephy_bookmarks_editor_construct): Call cmd_delete from key_press_cb for code reuse. Don't allow deletion of special topics with the keyboard delete.
Diffstat (limited to 'src')
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c25
-rw-r--r--src/ephy-history-window.c23
2 files changed, 42 insertions, 6 deletions
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index 3cac56784..aed373524 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -347,7 +347,20 @@ cmd_delete (EggAction *action,
}
else if (ephy_node_view_is_target (EPHY_NODE_VIEW (editor->priv->key_view)))
{
- ephy_node_view_remove (EPHY_NODE_VIEW (editor->priv->key_view));
+ EphyNodeViewPriority priority;
+ GList *selected;
+ EphyNode *node;
+
+ selected = ephy_node_view_get_selection (EPHY_NODE_VIEW (editor->priv->key_view));
+ node = EPHY_NODE (selected->data);
+ priority = ephy_node_get_property_int (node, EPHY_NODE_KEYWORD_PROP_PRIORITY);
+
+ if (priority == -1) priority = EPHY_NODE_VIEW_NORMAL_PRIORITY;
+
+ if (priority == EPHY_NODE_VIEW_NORMAL_PRIORITY)
+ {
+ ephy_node_view_remove (EPHY_NODE_VIEW (editor->priv->key_view));
+ }
}
}
@@ -763,15 +776,15 @@ bookmarks_filter (EphyBookmarksEditor *editor,
}
static gboolean
-key_pressed_cb (GtkWidget *widget,
+key_pressed_cb (EphyNodeView *view,
GdkEventKey *event,
- EphyNodeView *view)
+ EphyBookmarksEditor *editor)
{
switch (event->keyval)
{
case GDK_Delete:
case GDK_KP_Delete:
- ephy_node_view_remove (view);
+ cmd_delete (NULL, editor);
return TRUE;
default:
@@ -1069,7 +1082,7 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
g_signal_connect (G_OBJECT (key_view),
"key_press_event",
G_CALLBACK (key_pressed_cb),
- EPHY_NODE_VIEW (editor->priv->key_view));
+ editor);
g_signal_connect (G_OBJECT (key_view),
"node_selected",
G_CALLBACK (keyword_node_selected_cb),
@@ -1123,7 +1136,7 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
g_signal_connect (G_OBJECT (bm_view),
"key_press_event",
G_CALLBACK (key_pressed_cb),
- EPHY_NODE_VIEW (editor->priv->bm_view));
+ editor);
g_signal_connect (G_OBJECT (bm_view),
"node_activated",
G_CALLBACK (ephy_bookmarks_editor_node_activated_cb),
diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c
index 88de5b344..dcbaf2e89 100644
--- a/src/ephy-history-window.c
+++ b/src/ephy-history-window.c
@@ -614,6 +614,25 @@ pages_filter (EphyHistoryWindow *editor,
ephy_node_filter_done_changing (editor->priv->pages_filter);
}
+static gboolean
+key_pressed_cb (EphyNodeView *view,
+ GdkEventKey *event,
+ EphyHistoryWindow *editor)
+{
+ switch (event->keyval)
+ {
+ case GDK_Delete:
+ case GDK_KP_Delete:
+ cmd_delete (NULL, editor);
+ return TRUE;
+
+ default:
+ break;
+ }
+
+ return FALSE;
+}
+
static void
reset_search_entry (EphyHistoryWindow *editor)
{
@@ -914,6 +933,10 @@ ephy_history_window_construct (EphyHistoryWindow *editor)
"show_popup",
G_CALLBACK (ephy_history_window_show_popup_cb),
editor);
+ g_signal_connect (G_OBJECT (pages_view),
+ "key_press_event",
+ G_CALLBACK (key_pressed_cb),
+ editor);
ephy_state_add_window (GTK_WIDGET (editor),
"history_window",