diff options
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | data/ui/epiphany-ui.xml | 2 | ||||
-rw-r--r-- | src/ephy-window.c | 72 |
3 files changed, 65 insertions, 24 deletions
@@ -1,6 +1,19 @@ +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. + 2004-01-03 Robert Sedak <robert.sedak@sk.htnet.hr> - * configure.in: Added "hr" in ALL_LINGUAS. + * configure.in: Added "hr" in ALL_LINGUAS. 2004-01-02 Taneem Ahmed <taneem@bengalinux.org> diff --git a/data/ui/epiphany-ui.xml b/data/ui/epiphany-ui.xml index 6fd3f4ee1..12c0dbbe4 100644 --- a/data/ui/epiphany-ui.xml +++ b/data/ui/epiphany-ui.xml @@ -128,6 +128,8 @@ <menuitem name="OpenLinkInNewWindowLP" action="OpenLinkInNewWindow"/> <menuitem name="OpenLinkInNewTabLP" action="OpenLinkInNewTab"/> <separator name="LPSep1"/> + <menuitem name="EditCopyLP" action="EditCopy"/> + <separator name="LPSep2"/> <menuitem name="DownloadLinkLP" action="DownloadLink"/> <menuitem name="BookmarkLinkLP" action="BookmarkLink"/> <menuitem name="CopyLinkAddressLP" action="CopyLinkAddress"/> 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) { |