diff options
author | Michael Terry <mterry@fastmail.fm> | 2004-01-04 05:07:11 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <marco@src.gnome.org> | 2004-01-04 05:07:11 +0800 |
commit | 1fe471d0ab202613f6802751f5604420e23727d1 (patch) | |
tree | e4c2b234d66a898ea408ee5198cee440122c6ed4 /src/ephy-window.c | |
parent | 1d32b8d181198a8afe42d5d105537afd08ccf0a5 (diff) | |
download | gsoc2013-epiphany-1fe471d0ab202613f6802751f5604420e23727d1.tar gsoc2013-epiphany-1fe471d0ab202613f6802751f5604420e23727d1.tar.gz gsoc2013-epiphany-1fe471d0ab202613f6802751f5604420e23727d1.tar.bz2 gsoc2013-epiphany-1fe471d0ab202613f6802751f5604420e23727d1.tar.lz gsoc2013-epiphany-1fe471d0ab202613f6802751f5604420e23727d1.tar.xz gsoc2013-epiphany-1fe471d0ab202613f6802751f5604420e23727d1.tar.zst gsoc2013-epiphany-1fe471d0ab202613f6802751f5604420e23727d1.zip |
Show copy text menu item also for links
2004-01-03 Michael Terry <mterry@fastmail.fm>
* data/ui/epiphany-ui.xml:
Show copy text menu item also for links
* src/ephy-window.c: (update_edit_actions_sensitivity),
(enable_edit_actions_sensitivity), (edit_menu_show_cb),
(edit_menu_hide_cb), (hide_embed_popup_cb), (show_embed_popup):
Show copy text menu item only when there is actually selected
text.
Diffstat (limited to 'src/ephy-window.c')
-rw-r--r-- | src/ephy-window.c | 72 |
1 files changed, 49 insertions, 23 deletions
diff --git a/src/ephy-window.c b/src/ephy-window.c index a7f1449c1..f5013d9c8 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -638,7 +638,7 @@ ephy_window_state_event_cb (GtkWidget *widget, GdkEventWindowState *event, EphyW static void -update_edit_actions_sensitivity (EphyWindow *window) +update_edit_actions_sensitivity (EphyWindow *window, gboolean hide) { GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (window)); GtkActionGroup *action_group; @@ -680,27 +680,19 @@ update_edit_actions_sensitivity (EphyWindow *window) action_group = window->priv->action_group; action = gtk_action_group_get_action (action_group, "EditCopy"); - g_object_set (action, "sensitive", can_copy, NULL); + g_object_set (action, "sensitive", can_copy, "visible", !hide || can_copy, NULL); action = gtk_action_group_get_action (action_group, "EditCut"); - g_object_set (action, "sensitive", can_cut, NULL); + g_object_set (action, "sensitive", can_cut, "visible", !hide || can_cut, NULL); action = gtk_action_group_get_action (action_group, "EditPaste"); - g_object_set (action, "sensitive", can_paste, NULL); + g_object_set (action, "sensitive", can_paste, "visible", !hide || can_paste, NULL); action = gtk_action_group_get_action (action_group, "EditUndo"); - g_object_set (action, "sensitive", can_undo, NULL); + g_object_set (action, "sensitive", can_undo, "visible", !hide || can_undo, NULL); action = gtk_action_group_get_action (action_group, "EditRedo"); - g_object_set (action, "sensitive", can_redo, NULL); + g_object_set (action, "sensitive", can_redo, "visible", !hide || can_redo, NULL); } static void -edit_menu_show_cb (GtkWidget *menu, - EphyWindow *window) -{ - update_edit_actions_sensitivity (window); -} - -static void -edit_menu_hide_cb (GtkWidget *menu, - EphyWindow *window) +enable_edit_actions_sensitivity (EphyWindow *window) { GtkActionGroup *action_group; GtkAction *action; @@ -708,13 +700,29 @@ edit_menu_hide_cb (GtkWidget *menu, action_group = window->priv->action_group; action = gtk_action_group_get_action (action_group, "EditCopy"); - g_object_set (action, "sensitive", TRUE, NULL); + g_object_set (action, "sensitive", TRUE, "visible", TRUE, NULL); action = gtk_action_group_get_action (action_group, "EditCut"); - g_object_set (action, "sensitive", TRUE, NULL); + g_object_set (action, "sensitive", TRUE, "visible", TRUE, NULL); + action = gtk_action_group_get_action (action_group, "EditPaste"); + g_object_set (action, "sensitive", TRUE, "visible", TRUE, NULL); action = gtk_action_group_get_action (action_group, "EditUndo"); - g_object_set (action, "sensitive", TRUE, NULL); + g_object_set (action, "sensitive", TRUE, "visible", TRUE, NULL); action = gtk_action_group_get_action (action_group, "EditRedo"); - g_object_set (action, "sensitive", TRUE, NULL); + g_object_set (action, "sensitive", TRUE, "visible", TRUE, NULL); +} + +static void +edit_menu_show_cb (GtkWidget *menu, + EphyWindow *window) +{ + update_edit_actions_sensitivity (window, FALSE); +} + +static void +edit_menu_hide_cb (GtkWidget *menu, + EphyWindow *window) +{ + enable_edit_actions_sensitivity (window); } static void @@ -1107,6 +1115,13 @@ popup_menu_at_coords (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, } static void +hide_embed_popup_cb (GtkWidget *popup, + EphyWindow *window) +{ + enable_edit_actions_sensitivity (window); +} + +static void show_embed_popup (EphyWindow *window, EphyTab *tab, EphyEmbedEvent *event) { GtkActionGroup *action_group; @@ -1117,6 +1132,7 @@ show_embed_popup (EphyWindow *window, EphyTab *tab, EphyEmbedEvent *event) gboolean framed, has_background; GtkWidget *widget; EphyEmbedEventType type; + gboolean showing_edit_actions = FALSE; /* Do not show the menu in print preview mode */ if (window->priv->is_ppview) @@ -1138,6 +1154,7 @@ show_embed_popup (EphyWindow *window, EphyTab *tab, EphyEmbedEvent *event) } else if (context & EMBED_CONTEXT_LINK) { + showing_edit_actions = TRUE; popup = "/EphyLinkPopup"; } else if (context & EMBED_CONTEXT_IMAGE) @@ -1147,29 +1164,38 @@ show_embed_popup (EphyWindow *window, EphyTab *tab, EphyEmbedEvent *event) #if MOZILLA_SNAPSHOT > 12 else if (context & EMBED_CONTEXT_INPUT) { - update_edit_actions_sensitivity (window); + showing_edit_actions = TRUE; popup = "/EphyInputPopup"; } #endif else { + showing_edit_actions = TRUE; popup = framed ? "/EphyFramedDocumentPopup" : "/EphyDocumentPopup"; } + widget = gtk_ui_manager_get_widget (GTK_UI_MANAGER (window->ui_merge), + popup); + g_return_if_fail (widget != NULL); + action_group = window->priv->popups_action_group; action = gtk_action_group_get_action (action_group, "SaveBackgroundAs"); g_object_set (action, "sensitive", has_background, "visible", has_background, NULL); - widget = gtk_ui_manager_get_widget (GTK_UI_MANAGER (window->ui_merge), - popup); - g_return_if_fail (widget != NULL); + if (showing_edit_actions) + { + update_edit_actions_sensitivity (window, TRUE); + } g_object_set_data_full (G_OBJECT (window), "context_event", g_object_ref (event), (GDestroyNotify)g_object_unref); + g_signal_connect (widget, "hide", + G_CALLBACK (hide_embed_popup_cb), window); + type = ephy_embed_event_get_event_type (event); if (type == EPHY_EMBED_EVENT_KEY) { |