From 4dad5fa5c5e4ce8c0f28d516d6a1781e8ecf9514 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Sat, 28 Feb 2004 00:45:05 +0000 Subject: Sucky but not intrusive hack to make dnd on the address entry work when MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2004-02-28 Marco Pesenti Gritti * lib/egg/egg-editable-toolbar.c: (egg_editable_toolbar_get_edit_mode): * lib/egg/egg-editable-toolbar.h: * lib/widgets/ephy-location-entry.c: (toolbar_is_editable), (entry_drag_motion_cb), (entry_drag_drop_cb), (ephy_location_entry_construct_contents): Sucky but not intrusive hack to make dnd on the address entry work when editing toolbar. A better solution will be found when the toolbar editor will get in gtk. Based on a patch from Søren Sandmann, bug 132467. --- lib/widgets/ephy-location-entry.c | 52 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'lib/widgets/ephy-location-entry.c') diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c index 1e14e217b..1db59118a 100644 --- a/lib/widgets/ephy-location-entry.c +++ b/lib/widgets/ephy-location-entry.c @@ -25,6 +25,7 @@ #include "ephy-location-entry.h" #include "ephy-marshal.h" #include "ephy-debug.h" +#include "egg-editable-toolbar.h" #include #include @@ -298,6 +299,52 @@ match_selected_cb (GtkEntryCompletion *completion, return TRUE; } +static gboolean +toolbar_is_editable (GtkWidget *widget) +{ + GtkWidget *etoolbar; + + etoolbar = gtk_widget_get_ancestor (widget, EGG_TYPE_EDITABLE_TOOLBAR); + + if (etoolbar) + { + return egg_editable_toolbar_get_edit_mode + (EGG_EDITABLE_TOOLBAR (etoolbar)); + } + + return FALSE; +} + +static gboolean +entry_drag_motion_cb (GtkWidget *widget, + GdkDragContext *context, + gint x, + gint y, + guint time) +{ + if (toolbar_is_editable (widget)) + { + g_signal_stop_emission_by_name (widget, "drag_motion"); + } + + return FALSE; +} + +static gboolean +entry_drag_drop_cb (GtkWidget *widget, + GdkDragContext *context, + gint x, + gint y, + guint time) +{ + if (toolbar_is_editable (widget)) + { + g_signal_stop_emission_by_name (widget, "drag_drop"); + } + + return FALSE; +} + static void ephy_location_entry_construct_contents (EphyLocationEntry *le) { @@ -306,6 +353,7 @@ ephy_location_entry_construct_contents (EphyLocationEntry *le) LOG ("EphyLocationEntry constructing contents %p", le) p->entry = gtk_entry_new (); + gtk_container_add (GTK_CONTAINER (le), p->entry); gtk_widget_show (p->entry); @@ -313,6 +361,10 @@ ephy_location_entry_construct_contents (EphyLocationEntry *le) G_CALLBACK (entry_button_press_cb), le); g_signal_connect (p->entry, "changed", G_CALLBACK (editable_changed_cb), le); + g_signal_connect (p->entry, "drag_motion", + G_CALLBACK (entry_drag_motion_cb), le); + g_signal_connect (p->entry, "drag_drop", + G_CALLBACK (entry_drag_drop_cb), le); } static void -- cgit v1.2.3