2008-07-31 Alberto Garcia <agarcia@igalia.com>
[hildon] / examples / hildon-dialog-example.c
index f34eda0..10376eb 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2008 Nokia Corporation, all rights reserved.
  *
- * Author: Victor Jaquez <vjaquez@igalia.com>
+ * Author: Karl Lattimer <karl.lattimer@nokia.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -28,11 +28,13 @@ int
 main                                            (int argc,
                                                  char **args)
 {
-    HildonDialog *d;
-    GtkWidget *label;
+    HildonDialog *d, *d2;
+    GtkWidget *label, *label2;
 
     gtk_init (&argc, &args);
 
+    /* First dialog, using hildon_dialog_new() */
+
     d = HILDON_DIALOG (hildon_dialog_new ());
     label = gtk_label_new ("Hello, world!");
 
@@ -44,5 +46,24 @@ main                                            (int argc,
 
     gtk_dialog_run (GTK_DIALOG (d));
 
+    /* Second dialog, using hildon_dialog_new_with_buttons() */
+
+    d2 = HILDON_DIALOG (hildon_dialog_new_with_buttons ("Hi again!",
+                                                        GTK_WINDOW (d),
+                                                        GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                        GTK_STOCK_OK,
+                                                        GTK_RESPONSE_ACCEPT,
+                                                        GTK_STOCK_CANCEL,
+                                                        GTK_RESPONSE_REJECT,
+                                                        NULL));
+
+    label2 = gtk_label_new ("Hello, again!");
+
+    gtk_container_add (GTK_CONTAINER (GTK_DIALOG(d2)->vbox), label2);
+
+    gtk_widget_show_all (GTK_WIDGET (d2));
+
+    gtk_dialog_run (GTK_DIALOG (d2));
+
     return 0;
 }