aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ephy-window.c')
-rw-r--r--src/ephy-window.c45
1 files changed, 20 insertions, 25 deletions
diff --git a/src/ephy-window.c b/src/ephy-window.c
index d614f4730..91b163ed1 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -35,6 +35,7 @@
#include "eel-gconf-extensions.h"
#include "ephy-prefs.h"
#include "ephy-embed-prefs.h"
+#include "ephy-embed-utils.h"
#include "ephy-zoom.h"
#include "ephy-debug.h"
#include "ephy-file-helpers.h"
@@ -2271,37 +2272,32 @@ show_embed_popup (EphyWindow *window,
}
}
-#if 0
static gboolean
save_property_url (EphyEmbed *embed,
- EphyEmbedEvent *event,
- const char *property,
- const char *key)
+ GdkEventButton *gdk_event,
+ WebKitHitTestResult *hit_test_result,
+ const char *property)
{
const char *location;
- const GValue *value;
- EphyEmbedPersist *persist;
-
- value = ephy_embed_event_get_property (event, property);
- location = g_value_get_string (value);
+ GValue value = { 0, };
+ EphyEmbedEvent *event = ephy_embed_event_new (gdk_event, hit_test_result);
+ gboolean retval;
- if (!ephy_embed_utils_address_has_web_scheme (location)) return FALSE;
+ ephy_embed_event_get_property (event, property, &value);
+ location = g_value_get_string (&value);
- persist = EPHY_EMBED_PERSIST
- (g_object_new (EPHY_TYPE_EMBED_PERSIST, NULL));
+ LOG ("Location: %s", location);
- ephy_embed_persist_set_embed (persist, embed);
- ephy_embed_persist_set_flags (persist, 0);
- ephy_embed_persist_set_persist_key (persist, key);
- ephy_embed_persist_set_source (persist, location);
+ retval = ephy_embed_utils_address_has_web_scheme (location);
- ephy_embed_persist_save (persist);
+ if (retval)
+ ephy_embed_auto_download_url (embed, location);
- g_object_unref (G_OBJECT(persist));
+ g_value_unset (&value);
+ g_object_unref (event);
- return TRUE;
+ return retval;
}
-#endif
typedef struct
{
@@ -2354,7 +2350,6 @@ ephy_window_dom_mouse_click_cb (WebKitWebView *view,
modifier = event->state;
g_object_get (hit_test_result, "context", &context, NULL);
- g_object_unref (hit_test_result);
LOG ("ephy_window_dom_mouse_click_cb: button %d, context %d, modifier %d (%d:%d)",
button, context, modifier, (int)event->x, (int)event->y);
@@ -2376,20 +2371,19 @@ ephy_window_dom_mouse_click_cb (WebKitWebView *view,
|| (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE));
is_input = (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE) != 0;
-#if 0
/* shift+click saves the link target */
if (is_link && is_left_click && with_shift)
{
- handled = save_property_url (embed, event, "link", CONF_STATE_SAVE_DIR);
+ handled = save_property_url (EPHY_GET_EMBED_FROM_EPHY_WEB_VIEW (view), event, hit_test_result, "link-uri");
}
/* shift+click saves the non-link image
* Note: pressing enter to submit a form synthesizes a mouse click event
*/
else if (is_image && is_left_click && with_shift && !is_input)
{
- handled = save_property_url (embed, event, "image", CONF_STATE_SAVE_IMAGE_DIR);
+ handled = save_property_url (EPHY_GET_EMBED_FROM_EPHY_WEB_VIEW (view), event, hit_test_result, "image-uri");
}
-#endif
+
/* middle click opens the selection url */
if (is_middle_clickable && is_middle_click && middle_click_opens)
{
@@ -2423,6 +2417,7 @@ ephy_window_dom_mouse_click_cb (WebKitWebView *view,
handled = FALSE;
}
+ g_object_unref (hit_test_result);
return handled;
}