[gnome-devel-docs] Vala samples: Message Dialog example.



commit e6220e8c3b0b56c6d48517466637f98926372801
Author: Ryan Lortie <desrt desrt ca>
Date:   Thu Apr 12 00:43:41 2012 -0400

    Vala samples: Message Dialog example.

 platform-demos/C/samples/messagedialog.vala |   29 +++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/platform-demos/C/samples/messagedialog.vala b/platform-demos/C/samples/messagedialog.vala
new file mode 100644
index 0000000..368aadf
--- /dev/null
+++ b/platform-demos/C/samples/messagedialog.vala
@@ -0,0 +1,29 @@
+void dialog_response (int response_id) {
+	switch (response_id) {
+		case Gtk.ResponseType.OK:
+			print ("*boom*\n");
+			break;
+		case Gtk.ResponseType.CANCEL:
+			print ("good choice\n");
+			break;
+		case Gtk.ResponseType.DELETE_EVENT:
+			print ("dialog closed or cancelled\n");
+			break;
+	}
+
+	Gtk.main_quit ();
+}
+
+int main (string[] args) {
+
+	Gtk.init (ref args);
+
+	var messagedialog = new Gtk.MessageDialog (null, Gtk.DialogFlags.MODAL, Gtk.MessageType.INFO, Gtk.ButtonsType.OK_CANCEL, "This action will cause the universe to stop existing.");
+	messagedialog.response.connect (dialog_response);
+
+ 	messagedialog.show ();
+
+	Gtk.main ();
+
+	return 0;
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]