From 7564180aa406fe0c5fa561fdbdb1f3566ca1487a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Rameau?= Date: Sun, 9 Oct 2005 19:49:00 +0000 Subject: Eliminate the *Popup/*ImagePopup popup variants. Add image context to all MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2005-10-09 Jean-François Rameau * data/ui/epiphany-ui.xml: * src/ephy-window.c: (show_embed_popup), (update_image_actions_visibility): Eliminate the *Popup/*ImagePopup popup variants. Add image context to all popups it can show up. Display image context dynamically. --- src/ephy-window.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/ephy-window.c b/src/ephy-window.c index 3dfdb4c39..c1d2fa02e 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -852,6 +852,24 @@ ephy_window_delete_event (GtkWidget *widget, return FALSE; } +static void +update_image_actions_visibility (EphyWindow *window, gboolean show) +{ + GtkAction *action; + GtkActionGroup *action_group; + + action_group = window->priv->popups_action_group; + + action = gtk_action_group_get_action (action_group, "OpenImage"); + gtk_action_set_visible (action, show); + action = gtk_action_group_get_action (action_group, "SaveImageAs"); + gtk_action_set_visible (action, show); + action = gtk_action_group_get_action (action_group, "SetImageAsBackground"); + gtk_action_set_visible (action, show); + action = gtk_action_group_get_action (action_group, "CopyImageLocation"); + gtk_action_set_visible (action, show); +} + static void update_edit_actions_sensitivity (EphyWindow *window, gboolean hide) { @@ -1775,30 +1793,16 @@ show_embed_popup (EphyWindow *window, LOG ("show_embed_popup context %x", context); - if ((context & EPHY_EMBED_CONTEXT_EMAIL_LINK) && - (context & EPHY_EMBED_CONTEXT_IMAGE)) - { - popup = "/EphyImageEmailLinkPopup"; - } - else if (context & EPHY_EMBED_CONTEXT_EMAIL_LINK) + if (context & EPHY_EMBED_CONTEXT_EMAIL_LINK) { popup = "/EphyEmailLinkPopup"; update_edit_actions_sensitivity (window, TRUE); } - else if ((context & EPHY_EMBED_CONTEXT_LINK) && - (context & EPHY_EMBED_CONTEXT_IMAGE)) - { - popup = "/EphyImageLinkPopup"; - } else if (context & EPHY_EMBED_CONTEXT_LINK) { popup = "/EphyLinkPopup"; update_edit_actions_sensitivity (window, TRUE); } - else if (context & EPHY_EMBED_CONTEXT_IMAGE) - { - popup = "/EphyImagePopup"; - } else if (context & EPHY_EMBED_CONTEXT_INPUT) { popup = "/EphyInputPopup"; @@ -1830,6 +1834,8 @@ show_embed_popup (EphyWindow *window, action = gtk_action_group_get_action (action_group, "OpenLinkInNewTab"); ephy_action_change_sensitivity_flags (action, SENS_FLAG_CONTEXT, !can_open_in_new); + update_image_actions_visibility (window, context & EPHY_EMBED_CONTEXT_IMAGE); + _ephy_window_set_context_event (window, event); g_signal_connect (widget, "deactivate", -- cgit v1.2.3