diff options
author | Marco Pesenti Gritti <marco@gnome.org> | 2004-02-28 08:45:05 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <marco@src.gnome.org> | 2004-02-28 08:45:05 +0800 |
commit | 4dad5fa5c5e4ce8c0f28d516d6a1781e8ecf9514 (patch) | |
tree | e6b005164f7049405386c8ac66a7da1d898bbcbf /lib/widgets/ephy-location-entry.c | |
parent | 86636557589b2102a506aea689c3f06a646dbcfe (diff) | |
download | gsoc2013-epiphany-4dad5fa5c5e4ce8c0f28d516d6a1781e8ecf9514.tar gsoc2013-epiphany-4dad5fa5c5e4ce8c0f28d516d6a1781e8ecf9514.tar.gz gsoc2013-epiphany-4dad5fa5c5e4ce8c0f28d516d6a1781e8ecf9514.tar.bz2 gsoc2013-epiphany-4dad5fa5c5e4ce8c0f28d516d6a1781e8ecf9514.tar.lz gsoc2013-epiphany-4dad5fa5c5e4ce8c0f28d516d6a1781e8ecf9514.tar.xz gsoc2013-epiphany-4dad5fa5c5e4ce8c0f28d516d6a1781e8ecf9514.tar.zst gsoc2013-epiphany-4dad5fa5c5e4ce8c0f28d516d6a1781e8ecf9514.zip |
Sucky but not intrusive hack to make dnd on the address entry work when
2004-02-28 Marco Pesenti Gritti <marco@gnome.org>
* 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.
Diffstat (limited to 'lib/widgets/ephy-location-entry.c')
-rw-r--r-- | lib/widgets/ephy-location-entry.c | 52 |
1 files changed, 52 insertions, 0 deletions
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 <gtk/gtktoolbar.h> #include <gtk/gtkentry.h> @@ -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 |