aboutsummaryrefslogtreecommitdiffstats
path: root/src/bookmarks/ephy-bookmarks-editor.c
diff options
context:
space:
mode:
authorDavid Bordoley <bordoley@msu.edu>2003-04-20 01:20:45 +0800
committerDave Bordoley <Bordoley@src.gnome.org>2003-04-20 01:20:45 +0800
commitb2c6abf1424cde68177727eabb25f9789cfdc33c (patch)
treeebe680da5b9c1130b87caf2ae72d7635c01534c4 /src/bookmarks/ephy-bookmarks-editor.c
parent18bb6d0b335066b06f5e95d5ab27ac5a490e90b7 (diff)
downloadgsoc2013-epiphany-b2c6abf1424cde68177727eabb25f9789cfdc33c.tar
gsoc2013-epiphany-b2c6abf1424cde68177727eabb25f9789cfdc33c.tar.gz
gsoc2013-epiphany-b2c6abf1424cde68177727eabb25f9789cfdc33c.tar.bz2
gsoc2013-epiphany-b2c6abf1424cde68177727eabb25f9789cfdc33c.tar.lz
gsoc2013-epiphany-b2c6abf1424cde68177727eabb25f9789cfdc33c.tar.xz
gsoc2013-epiphany-b2c6abf1424cde68177727eabb25f9789cfdc33c.tar.zst
gsoc2013-epiphany-b2c6abf1424cde68177727eabb25f9789cfdc33c.zip
Add copy to the bookmark context menu.
2003-04-19 David Bordoley <bordoley@msu.edu> * data/ui/epiphany-bookmark-editor-ui.xml.in: Add copy to the bookmark context menu. * data/ui/epiphany-history-window-ui.xml.in: Add an edit menu. Add copy to history item context menu. * src/ephy-history-window.c: (cmd_cut), (cmd_copy), (cmd_paste), (cmd_select_all), (ephy_history_window_update_menu), (ephy_history_window_construct): Add edit menu actions. Update the edit menu when activated. Support copying the location of a history item and change the label to "Copy Location". * src/bookmarks/ephy-bookmarks-editor.c: (cmd_copy), (ephy_bookmarks_editor_update_menu): Support copying the location of a bookmark and change the label to "Copy Location".
Diffstat (limited to 'src/bookmarks/ephy-bookmarks-editor.c')
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c51
1 files changed, 40 insertions, 11 deletions
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index d8887eaa7..8c49eb991 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -333,6 +333,23 @@ cmd_copy (EggAction *action,
{
gtk_editable_copy_clipboard (GTK_EDITABLE (widget));
}
+
+ else if (ephy_node_view_is_target (EPHY_NODE_VIEW (editor->priv->bm_view)))
+ {
+ GList *selection;
+
+ selection = ephy_node_view_get_selection (EPHY_NODE_VIEW (editor->priv->bm_view));
+
+ if (g_list_length (selection) == 1)
+ {
+ const char *tmp;
+ EphyNode *node = EPHY_NODE (selection->data);
+ tmp = ephy_node_get_property_string (node, EPHY_NODE_BMK_PROP_LOCATION);
+ gtk_clipboard_set_text (gtk_clipboard_get (GDK_SELECTION_CLIPBOARD), tmp, -1);
+ }
+
+ g_free (selection);
+ }
}
static void
@@ -487,7 +504,7 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor)
{
gboolean open_in_window, open_in_tab,
rename, delete, properties;
- const gchar *open_in_window_label, *open_in_tab_label;
+ const gchar *open_in_window_label, *open_in_tab_label, *copy_label;
gboolean bmk_focus, key_focus;
gboolean key_selection, bmk_selection;
gboolean key_normal = FALSE;
@@ -502,34 +519,36 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor)
(EPHY_NODE_VIEW (editor->priv->bm_view));
key_focus = ephy_node_view_is_target
(EPHY_NODE_VIEW (editor->priv->key_view));
-
focus_widget = gtk_window_get_focus (GTK_WINDOW (editor));
+ bmk_selection = ephy_node_view_has_selection
+ (EPHY_NODE_VIEW (editor->priv->bm_view),
+ &bmk_multiple_selection);
+ key_selection = ephy_node_view_has_selection
+ (EPHY_NODE_VIEW (editor->priv->key_view), NULL);
if (GTK_IS_EDITABLE (focus_widget))
{
gboolean has_selection;
+ gboolean clipboard_contains_text;
has_selection = gtk_editable_get_selection_bounds
(GTK_EDITABLE (focus_widget), NULL, NULL);
+ clipboard_contains_text = gtk_clipboard_wait_is_text_available
+ (gtk_clipboard_get (GDK_SELECTION_CLIPBOARD));
- select_all = paste = TRUE;
cut = has_selection;
copy = has_selection;
+ paste = clipboard_contains_text;
+ select_all = TRUE;
}
else
{
- select_all = bmk_focus;
cut = FALSE;
- copy = FALSE;
+ copy = (bmk_focus && !bmk_multiple_selection && bmk_selection);
paste = FALSE;
+ select_all = bmk_focus;
}
- bmk_selection = ephy_node_view_has_selection
- (EPHY_NODE_VIEW (editor->priv->bm_view),
- &bmk_multiple_selection);
- key_selection = ephy_node_view_has_selection
- (EPHY_NODE_VIEW (editor->priv->key_view), NULL);
-
selected = ephy_node_view_get_selection (EPHY_NODE_VIEW (editor->priv->key_view));
if (key_focus && selected)
{
@@ -554,6 +573,15 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor)
open_in_tab_label = _("Open in New _Tab");
}
+ if (bmk_focus)
+ {
+ copy_label = _("_Copy Location");
+ }
+ else
+ {
+ copy_label = _("_Copy");
+ }
+
open_in_window = (bmk_focus && bmk_selection);
open_in_tab = (bmk_focus && bmk_selection);
rename = (bmk_focus && bmk_selection && !bmk_multiple_selection) ||
@@ -579,6 +607,7 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor)
g_object_set (action, "sensitive", cut, NULL);
action = egg_action_group_get_action (action_group, "Copy");
g_object_set (action, "sensitive", copy, NULL);
+ g_object_set (action, "label", copy_label, NULL);
action = egg_action_group_get_action (action_group, "Paste");
g_object_set (action, "sensitive", paste, NULL);
action = egg_action_group_get_action (action_group, "SelectAll");