2008-08-11 Alberto Garcia <agarcia@igalia.com>
authorAlberto Garcia <agarcia@igalia.com>
Mon, 11 Aug 2008 10:02:29 +0000 (10:02 +0000)
committerAlberto Garcia <agarcia@igalia.com>
Mon, 11 Aug 2008 10:02:29 +0000 (10:02 +0000)
* examples/hildon-date-editor-example.c (main): Updated date
editor example.

* examples/hildon-note-example.c (on_confirmation_clicked):
Updated confirmation note example.

* src/hildon-date-editor.c
* src/hildon-note.c: Updated sample programs in documentation.
Fixes: NB#87437

ChangeLog
examples/hildon-date-editor-example.c
examples/hildon-note-example.c
src/hildon-date-editor.c
src/hildon-note.c

index 393b835..1848ce0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2008-08-11  Alberto Garcia  <agarcia@igalia.com>
+
+       * examples/hildon-date-editor-example.c (main): Updated date
+       editor example.
+
+       * examples/hildon-note-example.c (on_confirmation_clicked):
+       Updated confirmation note example.
+
+       * src/hildon-date-editor.c
+       * src/hildon-note.c: Updated sample programs in documentation.
+       Fixes: NB#87437
+
 2008-08-08  Claudio Saavedra  <csaavedra@igalia.com>
 
        * src/hildon-date-button.h:
index 44731b1..5e795f4 100644 (file)
@@ -41,18 +41,25 @@ on_error (GtkWidget *widget, HildonDateTimeError error_type)
 int
 main (int argc, char **args)
 {
+    guint y, m, d;
+
     gtk_init (&argc, &args);
     
     GtkDialog *dialog = GTK_DIALOG (gtk_dialog_new ());
     HildonDateEditor *date_editor = HILDON_DATE_EDITOR (hildon_date_editor_new ());
 
-    gtk_box_pack_start (GTK_BOX (dialog->vbox), GTK_WIDGET (date_editor), FALSE, FALSE, 0);
+    gtk_box_pack_start (GTK_BOX (dialog->vbox), gtk_label_new ("Choose a date"), FALSE, FALSE, 10);
+    gtk_box_pack_start (GTK_BOX (dialog->vbox), GTK_WIDGET (date_editor), FALSE, FALSE, 10);
     gtk_dialog_add_button (dialog, "Close", GTK_RESPONSE_CANCEL);
 
     g_signal_connect (G_OBJECT (date_editor), "date_error", G_CALLBACK (on_error), NULL);
         
     gtk_widget_show_all (GTK_WIDGET (dialog));
     gtk_dialog_run (dialog);
+
+    hildon_date_editor_get_date (date_editor, &y, &m, &d);
+
+    g_debug ("Date: %u-%u-%u", y, m, d);
     
     return 0;
 }
index d9749eb..d47a445 100644 (file)
@@ -45,12 +45,18 @@ on_information_clicked                          (GtkWidget *widget)
 static gboolean
 on_confirmation_clicked                         (GtkWidget *widget)
 {
+    gint i;
     HildonNote* note = HILDON_NOTE (hildon_note_new_confirmation (NULL, 
             "Do you want to confirm?!"));
 
-    gtk_dialog_run (GTK_DIALOG (note));
+    i = gtk_dialog_run (GTK_DIALOG (note));
     gtk_object_destroy (GTK_OBJECT (note));
     
+    if (i == GTK_RESPONSE_OK)
+        g_debug ("Button 'OK' pressed");
+    else
+        g_debug ("Button 'Cancel' pressed");
+
     return TRUE;
 }
 
index 54f424c..77e6e71 100644 (file)
  *
  * <example>
  * <programlisting>
- * gint y, m, d;
+ * guint y, m, d;
+ * GtkDialog *dialog;
+ * GtkWidget *date_editor;
  * <!-- -->
+ * dialog = GTK_DIALOG (gtk_dialog_new ());
  * date_editor = hildon_date_editor_new ();
  * <!-- -->
- * hildon_date_editor_get_date(date_editor, &amp;y, &amp;m, &amp;d);
+ * gtk_box_pack_start (GTK_BOX (dialog->vbox), gtk_label_new ("Choose a date"), FALSE, FALSE, 10);
+ * gtk_box_pack_start (GTK_BOX (dialog->vbox), date_editor, FALSE, FALSE, 10);
+ * gtk_dialog_add_button (dialog, "Close", GTK_RESPONSE_CANCEL);
+ * <!-- -->
+ * gtk_widget_show_all (GTK_WIDGET (dialog));
+ * gtk_dialog_run (dialog);
+ * <!-- -->
+ * hildon_date_editor_get_date (HILDON_DATE_EDITOR (date_editor), &amp;y, &amp;m, &amp;d);
+ * g_debug ("Date: %u-%u-%u", y, m, d);
  * <!-- -->
  * </programlisting>
  * </example>
index 45b1a6e..1d7df3f 100644 (file)
  * <title>HildonNote example</title>
  * <programlisting>
  * <!-- -->
- * hildon_note_new_confirmation (window, "Confirmation message...");
+ * gboolean
+ * show_confirmation_note (GtkWindow *parent)
+ * {
+ *   gint retcode;
+ *   GtkWidget *note;
+ *   note = hildon_note_new_confirmation (parent, "Confirmation message...");
  * <!-- -->
- * i = gtk_dialog_run (GTK_DIALOG (note));
- * gtk_widget_destroy (GTK_WIDGET (note));
+ *   retcode = gtk_dialog_run (GTK_DIALOG (note));
+ *   gtk_widget_destroy (note);
  * <!-- -->
- * if (i == GTK_RESPONSE_OK)
- *      gtk_infoprint (window, "User pressed 'OK' button'");
- * else
- *      gtk_infoprint (window, "User pressed 'Cancel' button" );
+ *   if (retcode == GTK_RESPONSE_OK) {
+ *        g_debug ("User pressed 'OK' button'");
+ *        return TRUE;
+ *   } else {
+ *        g_debug ("User pressed 'Cancel' button");
+ *        return FALSE;
+ *   }
+ * }
  * </programlisting>
  * </example>
  */