aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2004-02-28 08:45:05 +0800
committerMarco Pesenti Gritti <marco@src.gnome.org>2004-02-28 08:45:05 +0800
commit4dad5fa5c5e4ce8c0f28d516d6a1781e8ecf9514 (patch)
treee6b005164f7049405386c8ac66a7da1d898bbcbf /lib
parent86636557589b2102a506aea689c3f06a646dbcfe (diff)
downloadgsoc2013-epiphany-4dad5fa5c5e4ce8c0f28d516d6a1781e8ecf9514.tar.gz
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')
-rwxr-xr-xlib/egg/egg-editable-toolbar.c6
-rwxr-xr-xlib/egg/egg-editable-toolbar.h1
-rw-r--r--lib/widgets/ephy-location-entry.c52
3 files changed, 59 insertions, 0 deletions
diff --git a/lib/egg/egg-editable-toolbar.c b/lib/egg/egg-editable-toolbar.c
index 461d58247..aa8e2d8cb 100755
--- a/lib/egg/egg-editable-toolbar.c
+++ b/lib/egg/egg-editable-toolbar.c
@@ -1088,6 +1088,12 @@ egg_editable_toolbar_new (GtkUIManager *merge,
NULL));
}
+gboolean
+egg_editable_toolbar_get_edit_mode (EggEditableToolbar *etoolbar)
+{
+ return etoolbar->priv->edit_mode;
+}
+
void
egg_editable_toolbar_set_edit_mode (EggEditableToolbar *etoolbar,
gboolean mode)
diff --git a/lib/egg/egg-editable-toolbar.h b/lib/egg/egg-editable-toolbar.h
index 3915878ff..c946472bd 100755
--- a/lib/egg/egg-editable-toolbar.h
+++ b/lib/egg/egg-editable-toolbar.h
@@ -62,6 +62,7 @@ GtkWidget *egg_editable_toolbar_new (GtkUIManager *merge,
EggToolbarsModel *model);
void egg_editable_toolbar_set_edit_mode (EggEditableToolbar *etoolbar,
gboolean mode);
+gboolean egg_editable_toolbar_get_edit_mode (EggEditableToolbar *etoolbar);
void egg_editable_toolbar_show (EggEditableToolbar *etoolbar,
const char *name);
void egg_editable_toolbar_hide (EggEditableToolbar *etoolbar,
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