summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Nemerson <evan@coeus-group.com>2012-06-18 16:01:27 -0700
committerRichard Hughes <richard@hughsie.com>2012-06-26 12:14:30 +0100
commitaefd63d20e5297a8d901bcf7dcbcf22baa921b2f (patch)
treeba52663dedb710fb7aa50e72f774ab0ec7e79a40
parentd503abe84e878f3f4a6c3c6eba51272ba14e2b9e (diff)
downloadcolord-aefd63d20e5297a8d901bcf7dcbcf22baa921b2f.tar.gz
Add a Vala version of cd-gtk-demo.
Signed-off-by: Richard Hughes <richard@hughsie.com>
-rw-r--r--examples/cd-vala-gtk-demo.vala43
1 files changed, 43 insertions, 0 deletions
diff --git a/examples/cd-vala-gtk-demo.vala b/examples/cd-vala-gtk-demo.vala
new file mode 100644
index 0000000..067a511
--- /dev/null
+++ b/examples/cd-vala-gtk-demo.vala
@@ -0,0 +1,43 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011-2012 Richard Hughes <richard@hughsie.com>
+ * Copyright (C) 2012 Evan Nemerson <evan@coeus-group.com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+//valac -o cd-vala-gtk-demo cd-vala-gtk-demo --pkg colord-gtk --pkg colord --pkg gtk+-3.0
+
+private static int main (string[] args) {
+ Gtk.init (ref args);
+
+ var window = new Cd.Window ();
+ var dialog = new Gtk.MessageDialog (null, Gtk.DialogFlags.MODAL, Gtk.MessageType.INFO, Gtk.ButtonsType.OK, "Hello world");
+ dialog.map.connect ((dlg) => {
+ window.get_profile.begin (dlg, null, (obj, async_res) => {
+ try {
+ Cd.Profile profile = window.get_profile.end (async_res);
+ GLib.debug ("screen profile to use %s", profile.get_filename ());
+ } catch ( GLib.Error e ) {
+ GLib.warning ("failed to get output profile: %s", e.message);
+ }
+ });
+ });
+ dialog.run ();
+
+ return 0;
+}