aboutsummaryrefslogtreecommitdiffstats
path: root/src/bookmarks/ephy-bookmarks-editor.c
diff options
context:
space:
mode:
authorDavid Bordoley <bordoley@msu.edu>2003-03-27 21:39:33 +0800
committerDave Bordoley <Bordoley@src.gnome.org>2003-03-27 21:39:33 +0800
commitd5be47a8e46ac8a35e41f296a95bb5ddcf7365e8 (patch)
tree397fc387ec6374fd9641709fdc9947de1ccf3621 /src/bookmarks/ephy-bookmarks-editor.c
parent1ee9df3c80f558d2e05c7204ef8d682bba938886 (diff)
downloadgsoc2013-epiphany-d5be47a8e46ac8a35e41f296a95bb5ddcf7365e8.tar.gz
gsoc2013-epiphany-d5be47a8e46ac8a35e41f296a95bb5ddcf7365e8.tar.zst
gsoc2013-epiphany-d5be47a8e46ac8a35e41f296a95bb5ddcf7365e8.zip
Reorganize the menus a bit. Unifiy topic/bookmarks rename/delete items.
2003-03-27 David Bordoley <bordoley@msu.edu> * data/ui/epiphany-bookmark-editor-ui.xml.in: * src/bookmarks/ephy-bookmarks-editor.c: (cmd_rename), (cmd_delete), (cmd_cut), (cmd_copy), (cmd_paste), (cmd_select_all), (keyword_node_key_pressed_cb), (keyword_node_show_popup_cb), (ephy_bookmarks_editor_construct): Reorganize the menus a bit. Unifiy topic/bookmarks rename/delete items. Add text editting menu items to the edit menu. Add a topic context menu. * src/bookmarks/ephy-node-view.[c-h]: (ephy_node_view_select_all), (ephy_node_view_has_focus): New functions. * src/bookmarks/ephy-topics-selector.c: (set_sort_column_id), (topic_clicked), (ephy_topics_build_ui): Sort topics case insensitively. Add/remove topics using a single click.
Diffstat (limited to 'src/bookmarks/ephy-bookmarks-editor.c')
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c182
1 files changed, 136 insertions, 46 deletions
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index fdbba76c9..39587c4e6 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -58,19 +58,23 @@ static void cmd_open_bookmarks_in_tabs (EggAction *action,
EphyBookmarksEditor *editor);
static void cmd_open_bookmarks_in_browser (EggAction *action,
EphyBookmarksEditor *editor);
-static void cmd_remove_bookmarks (EggAction *action,
+static void cmd_delete (EggAction *action,
EphyBookmarksEditor *editor);
static void cmd_bookmark_properties (EggAction *action,
EphyBookmarksEditor *editor);
static void cmd_add_topic (EggAction *action,
EphyBookmarksEditor *editor);
-static void cmd_remove_topic (EggAction *action,
+static void cmd_rename (EggAction *action,
EphyBookmarksEditor *editor);
-static void cmd_rename_bookmark (EggAction *action,
+static void cmd_close (EggAction *action,
EphyBookmarksEditor *editor);
-static void cmd_rename_topic (EggAction *action,
+static void cmd_cut (EggAction *action,
EphyBookmarksEditor *editor);
-static void cmd_close (EggAction *action,
+static void cmd_copy (EggAction *action,
+ EphyBookmarksEditor *editor);
+static void cmd_paste (EggAction *action,
+ EphyBookmarksEditor *editor);
+static void cmd_select_all (EggAction *action,
EphyBookmarksEditor *editor);
struct EphyBookmarksEditorPrivate
@@ -121,17 +125,23 @@ static EggActionGroupEntry ephy_bookmark_popup_entries [] = {
{ "OpenInTab", N_("Open In New _Tab"), NULL, "<shift><control>O",
NULL, G_CALLBACK (cmd_open_bookmarks_in_tabs), NULL },
- { "RenameBookmark", N_("_Rename Bookmark"), NULL, NULL,
- NULL, G_CALLBACK (cmd_rename_bookmark), NULL },
+ { "Cut", N_("Cu_t"), GTK_STOCK_CUT, "<control>X",
+ NULL, G_CALLBACK (cmd_cut), NULL },
+
+ { "Copy", N_("_Copy"), GTK_STOCK_COPY, "<control>C",
+ NULL, G_CALLBACK (cmd_copy), NULL },
+
+ { "Paste", N_("_Paste"), GTK_STOCK_PASTE, "<control>V",
+ NULL, G_CALLBACK (cmd_paste), NULL },
- { "RenameTopic", N_("R_ename Topic"), NULL, NULL,
- NULL, G_CALLBACK (cmd_rename_topic), NULL },
+ { "SelectAll", N_("Select _All"), NULL, "<control>A",
+ NULL, G_CALLBACK (cmd_select_all), NULL },
- { "RemoveBookmark", N_("_Delete Bookmark"), GTK_STOCK_DELETE, NULL,
- NULL, G_CALLBACK (cmd_remove_bookmarks), NULL },
+ { "Rename", N_("_Rename"), NULL, "F2",
+ NULL, G_CALLBACK (cmd_rename), NULL },
- { "RemoveTopic", N_("D_elete Topic"), NULL, NULL,
- NULL, G_CALLBACK (cmd_remove_topic), NULL },
+ { "Delete", N_("_Delete"), GTK_STOCK_DELETE, NULL,
+ NULL, G_CALLBACK (cmd_delete), NULL },
{ "Properties", N_("_Properties"), GTK_STOCK_PROPERTIES, "<alt>Return",
NULL, G_CALLBACK (cmd_bookmark_properties), NULL },
@@ -154,21 +164,6 @@ cmd_add_topic (EggAction *action,
}
static void
-cmd_remove_topic (EggAction *action,
- EphyBookmarksEditor *editor)
-{
- GList *selection;
-
- selection = ephy_node_view_get_selection (editor->priv->key_view);
- if (selection)
- {
- EphyNode *node = EPHY_NODE (selection->data);
- ephy_bookmarks_remove_keyword (editor->priv->bookmarks, node);
- g_list_free (selection);
- }
-}
-
-static void
cmd_close (EggAction *action,
EphyBookmarksEditor *editor)
{
@@ -176,17 +171,17 @@ cmd_close (EggAction *action,
}
static void
-cmd_rename_topic (EggAction *action,
- EphyBookmarksEditor *editor)
-{
- ephy_node_view_edit (editor->priv->key_view);
-}
-
-static void
-cmd_rename_bookmark (EggAction *action,
- EphyBookmarksEditor *editor)
-{
- ephy_node_view_edit (editor->priv->bm_view);
+cmd_rename (EggAction *action,
+ EphyBookmarksEditor *editor)
+{
+ if (ephy_node_view_has_focus (editor->priv->bm_view))
+ {
+ ephy_node_view_edit (editor->priv->bm_view);
+ }
+ else if (ephy_node_view_has_focus (editor->priv->key_view))
+ {
+ ephy_node_view_edit (editor->priv->key_view);
+ }
}
static GtkWidget *
@@ -261,10 +256,17 @@ cmd_open_bookmarks_in_browser (EggAction *action,
}
static void
-cmd_remove_bookmarks (EggAction *action,
- EphyBookmarksEditor *editor)
+cmd_delete (EggAction *action,
+ EphyBookmarksEditor *editor)
{
- ephy_node_view_remove (editor->priv->bm_view);
+ if (ephy_node_view_has_focus (editor->priv->bm_view))
+ {
+ ephy_node_view_remove (editor->priv->bm_view);
+ }
+ else if (ephy_node_view_has_focus (editor->priv->key_view))
+ {
+ ephy_node_view_remove (editor->priv->key_view);
+ }
}
static void
@@ -290,6 +292,59 @@ cmd_bookmark_properties (EggAction *action,
}
}
+static void
+cmd_cut (EggAction *action,
+ EphyBookmarksEditor *editor)
+{
+ GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (editor));
+
+ if (GTK_IS_EDITABLE (widget))
+ {
+ gtk_editable_cut_clipboard (GTK_EDITABLE (widget));
+ }
+}
+
+static void
+cmd_copy (EggAction *action,
+ EphyBookmarksEditor *editor)
+{
+ GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (editor));
+
+ if (GTK_IS_EDITABLE (widget))
+ {
+ gtk_editable_copy_clipboard (GTK_EDITABLE (widget));
+ }
+}
+
+static void
+cmd_paste (EggAction *action,
+ EphyBookmarksEditor *editor)
+{
+ GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (editor));
+
+ if (GTK_IS_EDITABLE (widget))
+ {
+ gtk_editable_paste_clipboard (GTK_EDITABLE (widget));
+ }
+}
+
+static void
+cmd_select_all (EggAction *action,
+ EphyBookmarksEditor *editor)
+{
+ GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (editor));
+
+ if (GTK_IS_EDITABLE (widget))
+ {
+ gtk_editable_select_region (GTK_EDITABLE (widget), 0, -1);
+ }
+ else if (ephy_node_view_has_focus (editor->priv->bm_view))
+ {
+ ephy_node_view_select_all (editor->priv->bm_view);
+ }
+}
+
+
GType
ephy_bookmarks_editor_get_type (void)
{
@@ -418,12 +473,12 @@ ephy_bookmarks_editor_show_popup_cb (GtkWidget *view,
EphyBookmarksEditor *editor)
{
GtkWidget *widget;
-
+
widget = egg_menu_merge_get_widget (editor->priv->ui_merge,
"/popups/EphyBookmarkEditorPopup");
gtk_menu_popup (GTK_MENU (widget), NULL, NULL, NULL, NULL, 2,
gtk_get_current_event_time ());
-}
+}
static void
ephy_bookmarks_editor_key_pressed_cb (GtkWidget *view,
@@ -472,6 +527,22 @@ bookmarks_filter (EphyBookmarksEditor *editor,
}
static void
+keyword_node_key_pressed_cb (GtkWidget *view,
+ GdkEventKey *event,
+ EphyBookmarksEditor *editor)
+{
+ switch (event->keyval)
+ {
+ case GDK_Delete:
+ ephy_node_view_remove (editor->priv->key_view);
+ break;
+
+ default:
+ break;
+ }
+}
+
+static void
keyword_node_selected_cb (EphyNodeView *view,
EphyNode *node,
EphyBookmarksEditor *editor)
@@ -490,6 +561,17 @@ keyword_node_selected_cb (EphyNodeView *view,
}
static void
+keyword_node_show_popup_cb (GtkWidget *view, EphyBookmarksEditor *editor)
+{
+ GtkWidget *widget;
+
+ widget = egg_menu_merge_get_widget (editor->priv->ui_merge,
+ "/popups/EphyBookmarkKeywordPopup");
+ gtk_menu_popup (GTK_MENU (widget), NULL, NULL, NULL, NULL, 2,
+ gtk_get_current_event_time ());
+}
+
+static void
search_entry_changed_cb (GtkWidget *entry, EphyBookmarksEditor *editor)
{
char *search_text;
@@ -617,7 +699,7 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
gtk_container_add (GTK_CONTAINER (editor->priv->menu_dock), hbox);
gtk_widget_show (hbox);
-
+
g_assert (editor->priv->bookmarks);
node = ephy_bookmarks_get_keywords (editor->priv->bookmarks);
@@ -636,10 +718,18 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
gtk_widget_show (GTK_WIDGET (key_view));
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_signal_connect (G_OBJECT (key_view),
"node_selected",
G_CALLBACK (keyword_node_selected_cb),
editor);
-
+ g_signal_connect (G_OBJECT (key_view),
+ "show_popup",
+ G_CALLBACK (keyword_node_show_popup_cb),
+ editor);
+
vbox = gtk_vbox_new (FALSE, 6);
gtk_box_pack_start (GTK_BOX (hbox),
vbox, TRUE, TRUE, 0);