[evince/gnome-3-0] toolbar-editor: Fix dragging items out of the toolbar.
- From: Jose Aliste <jaliste src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince/gnome-3-0] toolbar-editor: Fix dragging items out of the toolbar.
- Date: Mon, 27 Jun 2011 15:37:15 +0000 (UTC)
commit c48141968a2b374fe7a666feaf2635a82a528dac
Author: Josà Aliste <jaliste src gnome org>
Date: Sun Jun 26 12:36:11 2011 -0400
toolbar-editor: Fix dragging items out of the toolbar.
When 'window-dragging' is True, GtkToolbar starts a drag
in the 'button-press-event'. By connecting a callback to 'button-press-event'
after setting gtk_drag_source_set that return TRUE we prevent
GtkToolbar handler to be called.
cut-n-paste/toolbar-editor/egg-editable-toolbar.c | 31 +++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/cut-n-paste/toolbar-editor/egg-editable-toolbar.c b/cut-n-paste/toolbar-editor/egg-editable-toolbar.c
index 7772959..4679c6a 100644
--- a/cut-n-paste/toolbar-editor/egg-editable-toolbar.c
+++ b/cut-n-paste/toolbar-editor/egg-editable-toolbar.c
@@ -373,6 +373,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)
@@ -418,6 +431,22 @@ configure_item_sensitivity (GtkToolItem *item, EggEditableToolbar *etoolbar)
}
+static void toolbar_disable_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)
@@ -1184,6 +1213,7 @@ item_added_cb (EggToolbarsModel *model,
connect_widget_signals (GTK_WIDGET (item), etoolbar);
configure_item_tooltip (item);
configure_item_cursor (item, etoolbar);
+ toolbar_disable_window_drag (item, etoolbar);
configure_item_sensitivity (item, etoolbar);
dock = get_dock_nth (etoolbar, tpos);
@@ -1504,6 +1534,7 @@ set_edit_mode (EggEditableToolbar *etoolbar,
item = gtk_toolbar_get_nth_item (GTK_TOOLBAR (toolbar), l);
configure_item_cursor (item, etoolbar);
+ toolbar_disable_window_drag (item, etoolbar);
configure_item_sensitivity (item, etoolbar);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]