aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-link-action.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ephy-link-action.c')
-rw-r--r--src/ephy-link-action.c67
1 files changed, 19 insertions, 48 deletions
diff --git a/src/ephy-link-action.c b/src/ephy-link-action.c
index da627f451..f5be71675 100644
--- a/src/ephy-link-action.c
+++ b/src/ephy-link-action.c
@@ -32,17 +32,23 @@
#include <gtk/gtkmenuitem.h>
#include <gtk/gtkmenutoolbutton.h>
-#define EPHY_LINK_ACTION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_LINK_ACTION, EphyLinkActionPrivate))
+static GObjectClass *parent_class = NULL;
-struct _EphyLinkActionPrivate
+static gboolean
+proxy_button_press_event_cb (GtkButton *button,
+ GdkEventButton *event,
+ EphyLinkAction *action)
{
- gboolean ignore_next_middle_click;
-};
+ if (event->button == 2)
+ {
+ gtk_button_pressed(button);
+ }
-static GObjectClass *parent_class = NULL;
+ return FALSE;
+}
static gboolean
-proxy_button_release_event_cb (GtkWidget *widget,
+proxy_button_release_event_cb (GtkButton *button,
GdkEventButton *event,
EphyLinkAction *action)
{
@@ -53,37 +59,12 @@ proxy_button_release_event_cb (GtkWidget *widget,
*/
if (event->button == 2)
{
- if (!action->priv->ignore_next_middle_click)
- {
- gtk_action_activate (GTK_ACTION (action));
- }
- action->priv->ignore_next_middle_click = FALSE;
+ gtk_button_released(button);
}
return FALSE;
}
-static void
-proxy_drag_begin_cb (GtkWidget *widget,
- GdkDragContext *context,
- EphyLinkAction *action)
-{
- GdkEventMotion *event;
- GdkEvent *base_event = gtk_get_current_event ();
-
- g_return_if_fail (base_event != NULL);
- g_return_if_fail (base_event->type == GDK_MOTION_NOTIFY);
-
- event = (GdkEventMotion *) base_event;
-
- if (event->state & GDK_BUTTON2_MASK)
- {
- action->priv->ignore_next_middle_click = TRUE;
- }
-
- gdk_event_free(base_event);
-}
-
static GtkWidget *
get_event_widget (GtkWidget *proxy)
{
@@ -137,12 +118,12 @@ ephy_link_action_connect_proxy (GtkAction *action, GtkWidget *proxy)
widget = get_event_widget(proxy);
if (widget)
{
+ g_signal_connect (widget, "button-press-event",
+ G_CALLBACK (proxy_button_press_event_cb),
+ action);
g_signal_connect (widget, "button-release-event",
G_CALLBACK (proxy_button_release_event_cb),
action);
- g_signal_connect (widget, "drag-begin",
- G_CALLBACK (proxy_drag_begin_cb),
- action);
}
GTK_ACTION_CLASS (parent_class)->connect_proxy (action, proxy);
@@ -159,10 +140,10 @@ ephy_link_action_disconnect_proxy (GtkAction *action, GtkWidget *proxy)
if (widget)
{
g_signal_handlers_disconnect_by_func (widget,
- G_CALLBACK (proxy_button_release_event_cb),
+ G_CALLBACK (proxy_button_press_event_cb),
action);
g_signal_handlers_disconnect_by_func (widget,
- G_CALLBACK (proxy_drag_begin_cb),
+ G_CALLBACK (proxy_button_release_event_cb),
action);
}
@@ -172,22 +153,12 @@ ephy_link_action_disconnect_proxy (GtkAction *action, GtkWidget *proxy)
static void
ephy_link_action_class_init (EphyLinkActionClass *class)
{
- GObjectClass *object_class = G_OBJECT_CLASS (class);
GtkActionClass *action_class = GTK_ACTION_CLASS (class);
parent_class = g_type_class_peek_parent (class);
action_class->connect_proxy = ephy_link_action_connect_proxy;
action_class->disconnect_proxy = ephy_link_action_disconnect_proxy;
-
- g_type_class_add_private (object_class, sizeof (EphyLinkActionPrivate));
-}
-
-static void
-ephy_link_action_init (EphyLinkAction *action)
-{
- action->priv = EPHY_LINK_ACTION_GET_PRIVATE (action);
- action->priv->ignore_next_middle_click = FALSE;
}
GType
@@ -207,7 +178,7 @@ ephy_link_action_get_type (void)
NULL, /* class_data */
sizeof (EphyLinkAction),
0, /* n_preallocs */
- (GInstanceInitFunc) ephy_link_action_init
+ NULL /* instance_init */
};
static const GInterfaceInfo link_info =
{