[epiphany-extensions] Fix some extensions to work with the new WebKitHitTestResult
- From: Xan Lopez <xan src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [epiphany-extensions] Fix some extensions to work with the new WebKitHitTestResult
- Date: Tue, 22 Sep 2009 10:28:33 +0000 (UTC)
commit 2ec26ba89d23a8ff5e84139fffafb3e763ec3668
Author: Xan Lopez <xan gnome org>
Date: Tue Sep 22 13:28:23 2009 +0300
Fix some extensions to work with the new WebKitHitTestResult
I've blacklisted sidebar and gestures, which need a bit of major
surgery to come back to life.
Bug #594486 is fixed with this.
configure.ac | 4 +-
extensions/actions/ephy-actions-extension.c | 43 +++++++++++--------
.../push-scroller/ephy-push-scroller-extension.c | 22 ++++++----
3 files changed, 40 insertions(+), 29 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index b634136..6348370 100644
--- a/configure.ac
+++ b/configure.ac
@@ -172,8 +172,8 @@ AM_CONDITIONAL([HAVE_OPENSP],[test "x$enable_opensp" = "xyes"])
AC_MSG_CHECKING([which extensions to build])
ALL_EXTENSIONS="actions adblock auto-reload auto-scroller certificates error-viewer extensions-manager-ui gestures greasemonkey java-console livehttpheaders page-info permissions push-scroller rss sample select-stylesheet sidebar smart-bookmarks soup-fly tab-groups tab-states"
-USEFUL_EXTENSIONS="actions adblock auto-reload auto-scroller certificates error-viewer extensions-manager-ui gestures java-console page-info push-scroller select-stylesheet sidebar smart-bookmarks soup-fly tab-groups tab-states"
-DEFAULT_EXTENSIONS="actions adblock auto-scroller certificates error-viewer extensions-manager-ui gestures java-console page-info push-scroller select-stylesheet sidebar smart-bookmarks soup-fly tab-groups tab-states greasemonkey"
+USEFUL_EXTENSIONS="actions adblock auto-reload auto-scroller certificates error-viewer extensions-manager-ui java-console page-info push-scroller select-stylesheet smart-bookmarks soup-fly tab-groups tab-states"
+DEFAULT_EXTENSIONS="actions adblock auto-scroller certificates error-viewer extensions-manager-ui java-console page-info push-scroller select-stylesheet smart-bookmarks soup-fly tab-groups tab-states greasemonkey"
MOZILLA_ALL_EXTENSIONS="error-viewer java-console livehttpheaders page-info select-stylesheet smart-bookmarks"
diff --git a/extensions/actions/ephy-actions-extension.c b/extensions/actions/ephy-actions-extension.c
index b141e13..5517e6f 100644
--- a/extensions/actions/ephy-actions-extension.c
+++ b/extensions/actions/ephy-actions-extension.c
@@ -8,7 +8,7 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
@@ -64,9 +64,9 @@ typedef struct
typedef struct
{
EphyNode *node;
- gboolean apply_to_image;
+ gboolean apply_to_image;
gboolean apply_to_page;
- EphyEmbedEventContext context;
+ guint context;
} ActionData;
enum
@@ -369,7 +369,7 @@ ephy_actions_extension_add_action (EphyWindow *window,
action_data->node = action;
action_data->apply_to_page = apply_to_page;
action_data->apply_to_image = apply_to_image;
- action_data->context = EPHY_EMBED_CONTEXT_NONE;
+ action_data->context = WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT;
if (callback)
{
@@ -453,7 +453,7 @@ ephy_actions_extension_run_action_on_embed_property (GtkAction *action,
const char *property_name)
{
EphyEmbedEvent *event;
- const GValue *value;
+ GValue value = { 0, };
g_return_if_fail (GTK_IS_ACTION (action));
g_return_if_fail (EPHY_IS_WINDOW (window));
@@ -462,16 +462,17 @@ ephy_actions_extension_run_action_on_embed_property (GtkAction *action,
event = ephy_window_get_context_event (window);
g_return_if_fail (event != NULL);
- value = ephy_embed_event_get_property (event, property_name);
+ ephy_embed_event_get_property (event, property_name, &value);
ephy_actions_extension_run_action (action, window,
- g_value_get_string (value));
+ g_value_get_string (&value));
+ g_value_unset (&value);
}
static void
ephy_actions_extension_document_popup_cb (GtkAction *action,
EphyWindow *window)
{
- EphyEmbedEventContext context;
+ guint context;
EphyEmbed *embed;
char *url;
ActionData *action_data;
@@ -481,18 +482,18 @@ ephy_actions_extension_document_popup_cb (GtkAction *action,
context = action_data->context;
- if (context & EPHY_EMBED_CONTEXT_IMAGE)
+ if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE)
{
ephy_actions_extension_run_action_on_embed_property (action,
window,
- "image");
+ "image-uri");
return;
}
- if (context & EPHY_EMBED_CONTEXT_LINK)
+ if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK)
{
ephy_actions_extension_run_action_on_embed_property (action,
window,
- "link");
+ "link-uri");
return;
}
@@ -750,17 +751,23 @@ ephy_actions_extension_get_actions (EphyActionsExtension *extension)
static gboolean
ephy_actions_extension_context_menu_cb (EphyEmbed *embed,
- EphyEmbedEvent *event,
+ GdkEventButton *event,
EphyWindow *window)
{
- EphyEmbedEventContext context;
+ guint context;
GList *actions, *l;
WindowData *data;
+ WebKitHitTestResult *hit_test;
+
+ if (event->button != 3)
+ return FALSE;
data = g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY);
g_return_val_if_fail (data != NULL, FALSE);
- context = ephy_embed_event_get_context (event);
+ hit_test = webkit_web_view_get_hit_test_result (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed), event);
+ g_object_get (hit_test, "context", &context, NULL);
+ g_object_unref (hit_test);
actions = gtk_action_group_list_actions (data->user_action_group);
for (l = actions; l != NULL; l = l->next)
@@ -773,12 +780,12 @@ ephy_actions_extension_context_menu_cb (EphyEmbed *embed,
action_data->context = context;
- if (context & EPHY_EMBED_CONTEXT_IMAGE)
+ if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE)
{
gtk_action_set_visible (action, action_data->apply_to_image);
continue;
}
- if (context & EPHY_EMBED_CONTEXT_DOCUMENT)
+ if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT)
{
gtk_action_set_visible (action, action_data->apply_to_page);
continue;
@@ -798,7 +805,7 @@ ephy_actions_extension_attach_tab (EphyExtension *extension,
{
g_return_if_fail (EPHY_IS_EMBED (embed));
- g_signal_connect (embed, "ge_context_menu",
+ g_signal_connect (embed, "button-press-event",
G_CALLBACK (ephy_actions_extension_context_menu_cb), window);
}
diff --git a/extensions/push-scroller/ephy-push-scroller-extension.c b/extensions/push-scroller/ephy-push-scroller-extension.c
index d87b653..4843381 100644
--- a/extensions/push-scroller/ephy-push-scroller-extension.c
+++ b/extensions/push-scroller/ephy-push-scroller-extension.c
@@ -57,20 +57,23 @@ ensure_push_scroller (EphyWindow *window)
static gboolean
dom_mouse_down_cb (EphyWebView *view,
- EphyEmbedEvent *event,
+ GdkEventButton *event,
EphyWindow *window)
{
EphyPushScroller *scroller;
EphyEmbed *embed;
- EphyEmbedEventContext context;
+ guint context;
guint button, x, y;
+ WebKitHitTestResult *hit_test;
- embed = gtk_widget_get_parent (GTK_WIDGET (view));
- button = ephy_embed_event_get_button (event);
- context = ephy_embed_event_get_context (event);
+ embed = EPHY_EMBED (gtk_widget_get_parent (GTK_WIDGET (view)));
+ button = event->button;
+ hit_test = webkit_web_view_get_hit_test_result (WEBKIT_WEB_VIEW (view), event);
+ g_object_get (hit_test, "context", &context, NULL);
+ g_object_unref (hit_test);
- if (button != 2 || (context & EPHY_EMBED_CONTEXT_INPUT) ||
- (context & EPHY_EMBED_CONTEXT_LINK))
+ if (button != 2 || (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE) ||
+ (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK))
{
return FALSE;
}
@@ -78,7 +81,8 @@ dom_mouse_down_cb (EphyWebView *view,
scroller = ensure_push_scroller (window);
g_return_val_if_fail (scroller != NULL, FALSE);
- ephy_embed_event_get_coords (event, &x, &y);
+ x = (guint)event->x;
+ y = (guint)event->y;
ephy_push_scroller_start (scroller, embed, x, y);
return TRUE;
@@ -101,7 +105,7 @@ impl_attach_tab (EphyExtension *ext,
g_return_if_fail (embed != NULL);
g_signal_connect_object (EPHY_GET_EPHY_WEB_VIEW_FROM_EMBED (embed),
- "ge-dom-mouse-down",
+ "button-press-event",
G_CALLBACK (dom_mouse_down_cb), window, 0);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]