aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJosé Aliste <jaliste@src.gnome.org>2011-06-28 02:30:54 +0800
committerXan Lopez <xlopez@igalia.com>2011-06-28 02:44:28 +0800
commit972de8b227165ed15f65c6401698501bdcd34565 (patch)
treecfa3f33268c5dc7c575c27842ceab4d1a81b816d /lib
parent7a692429542c2b0455b195991642c3139427e16b (diff)
downloadgsoc2013-epiphany-972de8b227165ed15f65c6401698501bdcd34565.tar
gsoc2013-epiphany-972de8b227165ed15f65c6401698501bdcd34565.tar.gz
gsoc2013-epiphany-972de8b227165ed15f65c6401698501bdcd34565.tar.bz2
gsoc2013-epiphany-972de8b227165ed15f65c6401698501bdcd34565.tar.lz
gsoc2013-epiphany-972de8b227165ed15f65c6401698501bdcd34565.tar.xz
gsoc2013-epiphany-972de8b227165ed15f65c6401698501bdcd34565.tar.zst
gsoc2013-epiphany-972de8b227165ed15f65c6401698501bdcd34565.zip
toolbareditor: Fix the removal of items by DnD.
If the 'window-dragging' property of GtkToolbar is set (as it is in adwaita) then the Toolbar starts the drag of the window on 'button-press' event. We prevent this by connecting a handler for 'button-press' which prevents the handler of the toolbar to be run while in edit mode. Fixes bug #647265
Diffstat (limited to 'lib')
-rw-r--r--lib/egg/egg-editable-toolbar.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/egg/egg-editable-toolbar.c b/lib/egg/egg-editable-toolbar.c
index a9028aa9f..a27b88ae7 100644
--- a/lib/egg/egg-editable-toolbar.c
+++ b/lib/egg/egg-editable-toolbar.c
@@ -377,6 +377,19 @@ popup_context_menu_cb (GtkWidget *toolbar,
}
static gboolean
+edit_mode_button_press_event_cb (GtkWidget *widget,
+ GdkEventButton *event,
+ EggEditableToolbar *etoolbar)
+{
+ if (event->button == 1)
+ {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static gboolean
button_press_event_cb (GtkWidget *widget,
GdkEventButton *event,
EggEditableToolbar *etoolbar)
@@ -423,6 +436,23 @@ configure_item_sensitivity (GtkToolItem *item, EggEditableToolbar *etoolbar)
}
static void
+configure_item_window_drag (GtkToolItem *item,
+ EggEditableToolbar *etoolbar)
+{
+ if (etoolbar->priv->edit_mode > 0)
+ {
+ g_signal_connect (item, "button-press-event",
+ G_CALLBACK (edit_mode_button_press_event_cb), NULL);
+ }
+ else
+ {
+ g_signal_handlers_disconnect_by_func (item,
+ G_CALLBACK (edit_mode_button_press_event_cb),
+ NULL);
+ }
+}
+
+static void
configure_item_cursor (GtkToolItem *item,
EggEditableToolbar *etoolbar)
{
@@ -1215,6 +1245,7 @@ item_added_cb (EggToolbarsModel *model,
connect_widget_signals (GTK_WIDGET (item), etoolbar);
configure_item_tooltip (item);
configure_item_cursor (item, etoolbar);
+ configure_item_window_drag (item, etoolbar);
configure_item_sensitivity (item, etoolbar);
dock = get_dock_nth (etoolbar, tpos);
@@ -1546,6 +1577,7 @@ set_edit_mode (EggEditableToolbar *etoolbar,
item = gtk_toolbar_get_nth_item (GTK_TOOLBAR (toolbar), l);
configure_item_cursor (item, etoolbar);
+ configure_item_window_drag (item, etoolbar);
configure_item_sensitivity (item, etoolbar);
}
}