- gboolean entry_has_focus;
-
- entry_has_focus = GTK_WIDGET_HAS_FOCUS (entry);
-
- if (priv->showing_placeholder) {
- if (entry_has_focus) {
- /* Remove the placeholder when the widget obtains focus */
- hildon_helper_set_logical_color (entry, GTK_RC_TEXT, GTK_STATE_NORMAL, "ReversedTextColor");
- priv->showing_placeholder = FALSE;
- gtk_entry_set_text (GTK_ENTRY (entry), "");
- } else {
- /* Update the placeholder (it may have been changed) */
- gtk_entry_set_text (GTK_ENTRY (entry), priv->placeholder);
- }
- } else {
- /* Show the placeholder when the widget is empty and has no focus */
- const gchar *text = gtk_entry_get_text (GTK_ENTRY (entry));
- if (text[0] == '\0' && !entry_has_focus) {
- if (priv->placeholder[0] != '\0') {
- hildon_helper_set_logical_color (entry, GTK_RC_TEXT, GTK_STATE_NORMAL, "ReversedSecondaryTextColor");
- priv->showing_placeholder = TRUE;
- gtk_entry_set_text (GTK_ENTRY (entry), priv->placeholder);
- }
- }
- }
+
+ priv->showing_placeholder = TRUE;
+ gtk_entry_set_text (GTK_ENTRY (entry), priv->placeholder);
+ hildon_helper_set_logical_color (GTK_WIDGET (entry),
+ GTK_RC_TEXT, GTK_STATE_NORMAL, "ReversedSecondaryTextColor");
+}
+
+static void
+hildon_entry_hide_placeholder (HildonEntry *entry, const gchar *text)
+{
+ HildonEntryPrivate *priv = HILDON_ENTRY (entry)->priv;
+
+ priv->showing_placeholder = FALSE;
+ gtk_entry_set_text (GTK_ENTRY (entry), text);
+ hildon_helper_set_logical_color (GTK_WIDGET (entry),
+ GTK_RC_TEXT, GTK_STATE_NORMAL, "ReversedTextColor");