ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #02562
[Branch ~indicator-applet-developers/indicator-me/trunk] Rev 114: Fix entry focus issue LP:#37639
Merge authors:
David Barth (dbarth)
Related merge proposals:
https://code.launchpad.net/~dbarth/indicator-me/fix-hint-on-missed-focus-changes/+merge/37639
proposed by: David Barth (dbarth)
review: Approve - Cody Russell (bratsche)
------------------------------------------------------------
revno: 114 [merge]
fixes bug(s): https://launchpad.net/bugs/37639
committer: David Barth <david.barth@xxxxxxxxxxxxx>
branch nick: indicator-me
timestamp: Fri 2010-10-15 16:03:09 +0200
message:
Fix entry focus issue LP:#37639
modified:
src/indicator-me.c
--
lp:indicator-me
https://code.launchpad.net/~indicator-applet-developers/indicator-me/trunk
Your team ayatana-commits is subscribed to branch lp:indicator-me.
To unsubscribe from this branch go to https://code.launchpad.net/~indicator-applet-developers/indicator-me/trunk/+edit-subscription
=== modified file 'src/indicator-me.c'
--- src/indicator-me.c 2010-09-22 10:45:47 +0000
+++ src/indicator-me.c 2010-10-05 16:53:21 +0000
@@ -298,6 +298,19 @@
gtk_widget_queue_draw (GTK_WIDGET (entry));
}
+/* unconditionnaly show the hint in the entry */
+static void
+entry_hint_show_hint (GtkEntry *entry)
+{
+ g_return_if_fail (GTK_IS_ENTRY (entry));
+
+ const gchar *hint = g_object_get_data (G_OBJECT (entry),
+ DBUSMENU_ENTRY_MENUITEM_PROP_HINT);
+ gtk_entry_set_text (entry, hint);
+ entry_set_style (entry, GTK_STATE_INSENSITIVE);
+ entry_hint_set_shown (GTK_WIDGET (entry), TRUE);
+}
+
static void
entry_maybe_show_hint (GtkEntry *entry)
{
@@ -322,9 +335,7 @@
} else {
g_debug ("%s, nothing in the entry or not focused, so setting the hint to: %s", __func__, hint);
- gtk_entry_set_text (entry, hint);
- entry_set_style (entry, GTK_STATE_INSENSITIVE);
- entry_hint_set_shown (GTK_WIDGET (entry), TRUE);
+ entry_hint_show_hint (entry);
}
}
@@ -375,11 +386,18 @@
static gboolean
entry_focus_out_cb (GtkWidget *widget, GdkEventFocus *event)
{
+ g_return_val_if_fail (GTK_IS_ENTRY (widget), FALSE);
+
GtkEntry *entry = GTK_ENTRY (widget);
g_debug ("%s", __func__);
- entry_maybe_show_hint (entry);
+ if (! entry_hint_is_shown (GTK_WIDGET (entry)))
+ if (gtk_entry_get_text_length (entry) == 0)
+ /* show the hint unconditionnaly, as the focus change
+ may not have propagated already and entry_maybe_show_hint
+ could get confused */
+ entry_hint_show_hint (entry);
return FALSE;
}