+2008-09-11 Alberto Garcia <agarcia@igalia.com>
+
+ * src/hildon-text-view.c:
+ Add sample code to the documentation.
+
+ * src/hildon-entry.h
+ * src/hildon-text-view.h:
+ Minor cosmetic changes.
+
+ * src/hildon-entry.c:
+ Add sample code to the documentation.
+ (hildon_entry_init, hildon_entry_refresh_contents):
+ Don't allow NULL values in the placeholder.
+
2008-09-10 Alberto Garcia <agarcia@igalia.com>
* doc/hildon-docs.sgml
* gtk_entry_get_text() and gtk_entry_set_text() must never be used to
* get/set the text in this widget. hildon_entry_get_text() and
* hildon_entry_set_text() must be used instead.
+ *
+ * <example>
+ * <title>Creating a HildonEntry with a placeholder</title>
+ * <programlisting>
+ * GtkWidget *
+ * create_entry (void)
+ * {
+ * GtkWidget *entry;
+ * <!-- -->
+ * entry = hildon_entry_new (HILDON_SIZE_AUTO);
+ * hildon_entry_set_placeholder (HILDON_ENTRY (entry), "First name");
+ * <!-- -->
+ * return entry;
+ * }
+ * </programlisting>
+ * </example>
*/
#include "hildon-entry.h"
/* 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) {
+ if (priv->placeholder[0] != '\0') {
gtk_widget_set_name (entry, placeholder_widget_name);
gtk_entry_set_text (GTK_ENTRY (entry), priv->placeholder);
}
{
HildonEntryPrivate *priv = HILDON_ENTRY_GET_PRIVATE (self);
- priv->placeholder = NULL;
+ priv->placeholder = g_strdup ("");
}
hildon_entry_set_text (HildonEntry *entry,
const gchar *text);
+const gchar *
+hildon_entry_get_text (HildonEntry *entry);
+
void
hildon_entry_set_placeholder (HildonEntry *entry,
const gchar *text);
-const gchar *
-hildon_entry_get_text (HildonEntry *entry);
-
G_END_DECLS
#endif /* __HILDON_ENTRY_H__ */
* never be used to get/set the buffer in this
* widget. hildon_text_view_get_buffer() and
* hildon_text_view_set_buffer() must be used instead.
+ *
+ * <example>
+ * <title>Creating a HildonTextView with a placeholder</title>
+ * <programlisting>
+ * GtkWidget *
+ * create_text_view (void)
+ * {
+ * GtkWidget *text_view;
+ * <!-- -->
+ * text_view = hildon_text_view_new ();
+ * hildon_text_view_set_placeholder (HILDON_TEXT_VIEW (text_view),
+ * "Type some text here");
+ * <!-- -->
+ * return text_view;
+ * }
+ * </programlisting>
+ * </example>
*/
#include "hildon-text-view.h"
void
hildon_text_view_set_placeholder (HildonTextView *text_view,
- const gchar *text);
+ const gchar *text);
G_END_DECLS