2008-09-11 Alberto Garcia <agarcia@igalia.com>
authorAlberto Garcia <agarcia@igalia.com>
Thu, 11 Sep 2008 11:49:02 +0000 (11:49 +0000)
committerAlberto Garcia <agarcia@igalia.com>
Thu, 11 Sep 2008 11:49:02 +0000 (11:49 +0000)
* 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.

ChangeLog
src/hildon-entry.c
src/hildon-entry.h
src/hildon-text-view.c
src/hildon-text-view.h

index bb7fb28..0949ea5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+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
index 7925e43..4aa9185 100644 (file)
  * 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"
@@ -74,7 +90,7 @@ hildon_entry_refresh_contents                   (GtkWidget *entry)
         /* 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);
             }
@@ -229,5 +245,5 @@ hildon_entry_init                               (HildonEntry *self)
 {
     HildonEntryPrivate *priv = HILDON_ENTRY_GET_PRIVATE (self);
 
-    priv->placeholder = NULL;
+    priv->placeholder = g_strdup ("");
 }
index 9de2bb6..14b9686 100644 (file)
@@ -67,13 +67,13 @@ void
 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__ */
index 55534ab..d39ce3b 100644 (file)
  * 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"
index 7075204..87b78a6 100644 (file)
@@ -72,7 +72,7 @@ hildon_text_view_get_buffer                     (HildonTextView *text_view);
 
 void
 hildon_text_view_set_placeholder                (HildonTextView *text_view,
-                                                 const gchar *text);
+                                                 const gchar    *text);
 
 G_END_DECLS