-
- if (entry->visible)
- {
- pango_layout_set_text (layout, entry->text, entry->n_bytes);
- }
- else
- {
- GString *str = g_string_new (NULL);
- gunichar invisible_char;
- guint password_hint_timeout;
- GtkEntryPasswordHint *password_hint;
-
- g_object_get (gtk_widget_get_settings (widget),
- "gtk-entry-password-hint-timeout", &password_hint_timeout,
- NULL);
-
- if (entry->invisible_char != 0)
- invisible_char = entry->invisible_char;
- else
- invisible_char = ' '; /* just pick a char */
-
- password_hint = g_object_get_qdata (G_OBJECT (entry),
- quark_password_hint);
-
- if (password_hint && password_hint->password_hint_timeout_id)
- {
- g_source_remove (password_hint->password_hint_timeout_id);
- password_hint->password_hint_timeout_id = 0;
- }
-
- if (password_hint_timeout == 0 || password_hint == NULL ||
- (password_hint && password_hint->password_hint_length == 0))
- {
- append_char (str, invisible_char, entry->text_length);
- }
- else if (password_hint)
- {
- /* Draw hidden characters upto the inserted position,
- * then the real thing, pad up to full length
- */
- if (password_hint->password_hint_position > 1)
- append_char (str, invisible_char,
- password_hint->password_hint_position - 1);
-
- g_string_append_len (str, password_hint->password_hint,
- password_hint->password_hint_length);
-
- if (password_hint->password_hint_position < entry->text_length)
- append_char (str, invisible_char,
- entry->text_length -
- password_hint->password_hint_position);
-
- /* Now remove this last input character, don't need
- * it anymore
- */
- memset (password_hint->password_hint, 0, PASSWORD_HINT_MAX);
- password_hint->password_hint_length = 0;
-
- password_hint->password_hint_timeout_id =
- gdk_threads_add_timeout (password_hint_timeout,
- (GSourceFunc) gtk_entry_remove_password_hint,
- entry);
- }