[Xfce4-commits] <midori:master> Handle drag on default text like focus in
Christian Dywan
noreply at xfce.org
Tue Jan 11 21:08:02 CET 2011
Updating branch refs/heads/master
to 39e915bbbfca574ff8449d75db198285dc34ff03 (commit)
from 8f489ca872bd369b8f46aad94f5c9e3db88aca75 (commit)
commit 39e915bbbfca574ff8449d75db198285dc34ff03
Author: Christian Dywan <christian at twotoasts.de>
Date: Tue Jan 11 20:53:56 2011 +0100
Handle drag on default text like focus in
Also only connect the signals once.
midori/sokoke.c | 21 +++++++++++++++++----
1 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/midori/sokoke.c b/midori/sokoke.c
index 055ebdd..4e4aa09 100644
--- a/midori/sokoke.c
+++ b/midori/sokoke.c
@@ -1102,6 +1102,17 @@ sokoke_on_entry_focus_out_event (GtkEntry* entry,
return FALSE;
}
+static void
+sokoke_on_entry_drag_data_received (GtkEntry* entry,
+ GdkDragContext* drag_context,
+ gint x,
+ gint y,
+ guint timestamp,
+ gpointer user_data)
+{
+ sokoke_on_entry_focus_in_event (entry, NULL, NULL);
+}
+
void
sokoke_entry_set_default_text (GtkEntry* entry,
const gchar* default_text)
@@ -1116,6 +1127,12 @@ sokoke_entry_set_default_text (GtkEntry* entry,
sokoke_widget_set_pango_font_style (GTK_WIDGET (entry),
PANGO_STYLE_ITALIC);
gtk_entry_set_text (entry, default_text);
+ g_signal_connect (entry, "drag-data-received",
+ G_CALLBACK (sokoke_on_entry_drag_data_received), NULL);
+ g_signal_connect (entry, "focus-in-event",
+ G_CALLBACK (sokoke_on_entry_focus_in_event), NULL);
+ g_signal_connect (entry, "focus-out-event",
+ G_CALLBACK (sokoke_on_entry_focus_out_event), NULL);
}
else if (!gtk_widget_has_focus (GTK_WIDGET (entry)))
{
@@ -1130,10 +1147,6 @@ sokoke_entry_set_default_text (GtkEntry* entry,
}
g_object_set_data (G_OBJECT (entry), "sokoke_default_text",
(gpointer)default_text);
- g_signal_connect (entry, "focus-in-event",
- G_CALLBACK (sokoke_on_entry_focus_in_event), NULL);
- g_signal_connect (entry, "focus-out-event",
- G_CALLBACK (sokoke_on_entry_focus_out_event), NULL);
}
gchar*
More information about the Xfce4-commits
mailing list