[gnome-devel-docs] Vala samples: MessageDialog example mallard page
- From: Tiffany Antopolski <antopolski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-devel-docs] Vala samples: MessageDialog example mallard page
- Date: Thu, 12 Apr 2012 05:05:05 +0000 (UTC)
commit 3ae3ebfa727e8dd21d50c0f5c05bdc26c9948459
Author: Tiffany Antopolski <tiffany antopolski gmail com>
Date: Thu Apr 12 01:02:48 2012 -0400
Vala samples: MessageDialog example mallard page
platform-demos/C/media/messagedialog.png | Bin 0 -> 11072 bytes
platform-demos/C/messagedialog.vala.page | 59 +++++++++++++++++++++++++++
platform-demos/C/samples/messagedialog.vala | 3 +-
3 files changed, 61 insertions(+), 1 deletions(-)
---
diff --git a/platform-demos/C/media/messagedialog.png b/platform-demos/C/media/messagedialog.png
new file mode 100644
index 0000000..826a713
Binary files /dev/null and b/platform-demos/C/media/messagedialog.png differ
diff --git a/platform-demos/C/messagedialog.vala.page b/platform-demos/C/messagedialog.vala.page
new file mode 100644
index 0000000..5397cd4
--- /dev/null
+++ b/platform-demos/C/messagedialog.vala.page
@@ -0,0 +1,59 @@
+<page xmlns="http://projectmallard.org/1.0/"
+ type="guide" style="task"
+ id="messagedialog.vala">
+ <info>
+ <link type="guide" xref="beginner.vala#windows"/>
+ <revision version="0.1" date="2012-04-07" status="stub"/>
+
+ <credit type="author copyright">
+ <name>Tiffany Antopolski</name>
+ <email>tiffany antopolski gmail com</email>
+ <years>2012</years>
+ </credit>
+
+ <desc>A message window</desc>
+ </info>
+
+ <title>MessageDialog</title>
+ <media type="image" mime="image/png" src="media/messagedialog.png"/>
+ <p>A modal message dialog which can cause the world to explode.</p>
+
+ <code mime="text/x-vala" style="numbered"><![CDATA[
+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;
+}
+]]></code>
+<p>
+ In this sample we used the following:
+</p>
+<list>
+ <item><p><link href="">thing1</link></p></item>
+</list>
+</page>
diff --git a/platform-demos/C/samples/messagedialog.vala b/platform-demos/C/samples/messagedialog.vala
index 368aadf..564de8b 100644
--- a/platform-demos/C/samples/messagedialog.vala
+++ b/platform-demos/C/samples/messagedialog.vala
@@ -18,7 +18,8 @@ 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.");
+ var messagedialog = new Gtk.MessageDialog (null, Gtk.DialogFlags.MODAL, Gtk.MessageType.WARNING, Gtk.ButtonsType.OK_CANCEL, "This action will cause the universe to stop existing.");
+
messagedialog.response.connect (dialog_response);
messagedialog.show ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]