+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:
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;
}
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;
}
*
* <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, &y, &m, &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), &y, &m, &d);
+ * g_debug ("Date: %u-%u-%u", y, m, d);
* <!-- -->
* </programlisting>
* </example>
* <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>
*/