aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--data/ui/epiphany-ui.xml4
-rw-r--r--embed/mozilla/EventContext.cpp31
-rw-r--r--src/ephy-lockdown.c2
-rw-r--r--src/ephy-window.c22
-rw-r--r--src/popup-commands.c8
-rw-r--r--src/popup-commands.h3
7 files changed, 28 insertions, 54 deletions
diff --git a/ChangeLog b/ChangeLog
index 24de8a8bc..2dd057702 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2005-09-26 Jean-François Rameau <jframeau@cvs.gnome.org>
+
+ * src/ephy-lockdown.c: (update_window):
+ * src/ephy-window.c: (update_popups_tooltips), (show_embed_popup):
+ * src/popup-commands.c:
+ * src/popup-commands.h:
+ * embed/mozilla/EventContext.cpp: (GetEventContext):
+ * data/ui/epiphany-ui.xml:
+
+ Unify background image and image code (contex menu, conext event).
+ Fix bug 154887.
+
2005-09-26 Christian Persch <chpe@cvs.gnome.org>
* embed/mozilla/Makefile.am:
diff --git a/data/ui/epiphany-ui.xml b/data/ui/epiphany-ui.xml
index 2dc30a7ea..7eb2693d8 100644
--- a/data/ui/epiphany-ui.xml
+++ b/data/ui/epiphany-ui.xml
@@ -112,7 +112,6 @@
<menuitem name="EditCopyDP" action="EditCopy"/>
<separator name="DPSep2"/>
<menuitem name="SavePageAsDP" action="FileSaveAs"/>
- <menuitem name="SaveBackgroundAsDP" action="SaveBackgroundAs"/>
<menuitem name="BookmarkPageDP" action="ContextBookmarkPage"/>
</popup>
@@ -124,7 +123,6 @@
<menuitem name="EditCopyFSDP" action="EditCopy"/>
<separator />
<menuitem name="SavePageAsFSDP" action="FileSaveAs"/>
- <menuitem name="SaveBackgroundAsFSDP" action="SaveBackgroundAs"/>
<menuitem name="BookmarkPageFSDP" action="ContextBookmarkPage"/>
<separator />
<menuitem name="ViewToolbarFSDP" action="ViewToolbar"/>
@@ -138,7 +136,6 @@
<menuitem name="EditCopyFDP" action="EditCopy"/>
<separator />
<menuitem name="SavePageAsFDP" action="FileSaveAs"/>
- <menuitem name="SaveBackgroundAsFDP" action="SaveBackgroundAs"/>
<menuitem name="BookmarkPageFDP" action="ContextBookmarkPage"/>
<separator />
<menuitem name="OpenFrameFDP" action="OpenFrame"/>
@@ -152,7 +149,6 @@
<menuitem name="EditCopyFSFDP" action="EditCopy"/>
<separator />
<menuitem name="SavePageAsFSFDP" action="FileSaveAs"/>
- <menuitem name="SaveBackgroundAsFSFDP" action="SaveBackgroundAs"/>
<menuitem name="BookmarkPageFSFDP" action="ContextBookmarkPage"/>
<separator />
<menuitem name="OpenFrameFSFDP" action="OpenFrame"/>
diff --git a/embed/mozilla/EventContext.cpp b/embed/mozilla/EventContext.cpp
index 855cd06a5..cb202d7b8 100644
--- a/embed/mozilla/EventContext.cpp
+++ b/embed/mozilla/EventContext.cpp
@@ -266,7 +266,7 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget,
rv = node->GetNodeType(&type);
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
- PRBool has_background = PR_FALSE;
+ PRBool has_image = PR_FALSE;
nsCOMPtr<nsIDOMHTMLElement> element = do_QueryInterface(node);
if ((nsIDOMNode::ELEMENT_NODE == type) && element)
@@ -280,8 +280,6 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget,
if (g_ascii_strcasecmp (tag.get(), "img") == 0)
{
- info->context |= EPHY_EMBED_CONTEXT_IMAGE;
-
nsEmbedString img;
nsCOMPtr <nsIDOMHTMLImageElement> image =
do_QueryInterface(node, &rv);
@@ -289,7 +287,10 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget,
rv = image->GetSrc (img);
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
+
SetStringProperty ("image", img);
+ info->context |= EPHY_EMBED_CONTEXT_IMAGE;
+ has_image = PR_TRUE;
}
else if (g_ascii_strcasecmp (tag.get(), "area") == 0)
{
@@ -343,9 +344,9 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget,
rv = img->GetSrc (imgSrc);
if (NS_FAILED(rv)) continue;
- info->context |= EPHY_EMBED_CONTEXT_IMAGE;
-
SetStringProperty ("image", imgSrc);
+ info->context |= EPHY_EMBED_CONTEXT_IMAGE;
+ has_image = PR_TRUE;
break;
}
@@ -374,8 +375,6 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget,
// MIME types are always lower case
if (g_str_has_prefix (cValue.get(), "image/"))
{
- info->context |= EPHY_EMBED_CONTEXT_IMAGE;
-
nsEmbedString img;
rv = object->GetData (img);
@@ -386,6 +385,8 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget,
if (NS_FAILED (rv)) return NS_ERROR_FAILURE;
SetStringProperty ("image", cImg.get());
+ info->context |= EPHY_EMBED_CONTEXT_IMAGE;
+ has_image = PR_TRUE;
}
else
{
@@ -415,10 +416,9 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget,
if (NS_FAILED (rv))
return NS_ERROR_FAILURE;
- SetStringProperty ("background_image",
- bgimg.get());
-
- has_background = PR_TRUE;
+ SetStringProperty ("image", bgimg.get());
+ info->context |= EPHY_EMBED_CONTEXT_IMAGE;
+ has_image = PR_TRUE;
}
}
}
@@ -587,7 +587,7 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget,
info->context |= EPHY_EMBED_CONTEXT_INPUT;
}
- if (!has_background)
+ if (!has_image)
{
nsEmbedString cssurl;
rv = GetCSSBackground (node, cssurl);
@@ -598,10 +598,9 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget,
rv = ResolveBaseURL (cssurl, bgimg);
if (NS_FAILED (rv))
return NS_ERROR_FAILURE;
- SetStringProperty ("background_image",
- bgimg.get());
-
- has_background = PR_TRUE;
+ SetStringProperty ("image", bgimg.get());
+ info->context |= EPHY_EMBED_CONTEXT_IMAGE;
+ has_image = PR_TRUE;
}
}
}
diff --git a/src/ephy-lockdown.c b/src/ephy-lockdown.c
index a2397c9df..1d2a9def7 100644
--- a/src/ephy-lockdown.c
+++ b/src/ephy-lockdown.c
@@ -198,8 +198,6 @@ update_window (EphyWindow *window,
ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled);
action = gtk_action_group_get_action (popups_action_group, "DownloadLinkAs");
ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled);
- action = gtk_action_group_get_action (popups_action_group, "SaveBackgroundAs");
- ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled);
action = gtk_action_group_get_action (popups_action_group, "SaveImageAs");
ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled);
writable = eel_gconf_key_is_writable (CONF_DESKTOP_BG_PICTURE);
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 5283818fa..acc8db5ac 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -311,8 +311,6 @@ static const GtkToggleActionEntry ephy_menu_toggle_entries [] =
static const GtkActionEntry ephy_popups_entries [] = {
/* Document */
- { "SaveBackgroundAs", NULL, N_("_Save Background As..."), NULL,
- NULL, G_CALLBACK (popup_cmd_save_background_as) },
{ "ContextBookmarkPage", STOCK_ADD_BOOKMARK, N_("Add Boo_kmark..."), "<control>D",
N_("Add a bookmark for the current page"),
G_CALLBACK (window_cmd_file_bookmark_page) },
@@ -1622,8 +1620,6 @@ static void
embed_popup_deactivate_cb (GtkWidget *popup,
EphyWindow *window)
{
- EphyWindowPrivate *priv = window->priv;
-
LOG ("Deactivating popup menu");
enable_edit_actions_sensitivity (window);
@@ -1659,18 +1655,6 @@ update_popups_tooltips (EphyWindow *window, EphyEmbedEvent *event)
GtkAction *action;
char *tooltip, *name;
- if (ephy_embed_event_has_property (event, "background_image"))
- {
- ephy_embed_event_get_property (event, "background_image", &value);
-
- action = gtk_action_group_get_action (group, "SaveBackgroundAs");
- name = get_name_from_address_value (value);
- tooltip = g_strdup_printf (_("Save background image '%s'"), name);
- g_object_set (action, "tooltip", tooltip, NULL);
- g_free (name);
- g_free (tooltip);
- }
-
context = ephy_embed_event_get_context (event);
if (context & EPHY_EMBED_CONTEXT_IMAGE)
@@ -1755,7 +1739,7 @@ show_embed_popup (EphyWindow *window,
EphyEmbedEventContext context;
const char *popup;
const GValue *value;
- gboolean framed, has_background, can_open_in_new;
+ gboolean framed, can_open_in_new;
GtkWidget *widget;
guint button;
@@ -1768,7 +1752,6 @@ show_embed_popup (EphyWindow *window,
ephy_embed_event_get_property (event, "framed_page", &value);
framed = g_value_get_int (value);
- has_background = ephy_embed_event_has_property (event, "background_image");
can_open_in_new = ephy_embed_event_has_property (event, "link-has-web-scheme");
context = ephy_embed_event_get_context (event);
@@ -1823,9 +1806,6 @@ show_embed_popup (EphyWindow *window,
g_return_if_fail (widget != NULL);
action_group = window->priv->popups_action_group;
- action = gtk_action_group_get_action (action_group, "SaveBackgroundAs");
- ephy_action_change_sensitivity_flags (action, SENS_FLAG_CONTEXT, !has_background);
- gtk_action_set_visible (action, has_background);
action = gtk_action_group_get_action (action_group, "OpenLinkInNewWindow");
gtk_action_set_sensitive (action, can_open_in_new);
diff --git a/src/popup-commands.c b/src/popup-commands.c
index bd76c3825..fe688ea7d 100644
--- a/src/popup-commands.c
+++ b/src/popup-commands.c
@@ -340,14 +340,6 @@ popup_cmd_copy_image_location (GtkAction *action,
}
void
-popup_cmd_save_background_as (GtkAction *action,
- EphyWindow *window)
-{
- save_property_url (action, _("Save Background As"),
- window, TRUE, "background_image");
-}
-
-void
popup_cmd_open_frame (GtkAction *action,
EphyWindow *window)
{
diff --git a/src/popup-commands.h b/src/popup-commands.h
index 543967da9..e8d15ecc0 100644
--- a/src/popup-commands.h
+++ b/src/popup-commands.h
@@ -55,9 +55,6 @@ void popup_cmd_set_image_as_background (GtkAction *action,
void popup_cmd_copy_image_location (GtkAction *action,
EphyWindow *window);
-void popup_cmd_save_background_as (GtkAction *action,
- EphyWindow *window);
-
void popup_cmd_open_frame (GtkAction *action,
EphyWindow *window);