Debian Codegraph @

examples/cd-vala-gtk-demo.vala

raw
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
2 *
3 * Copyright (C) 2011-2012 Richard Hughes <[email protected]>
4 * Copyright (C) 2012 Evan Nemerson <[email protected]>
5 *
6 * Licensed under the GNU General Public License Version 2
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22
23 //valac -o cd-vala-gtk-demo cd-vala-gtk-demo --pkg colord-gtk --pkg colord --pkg gtk+-3.0
24
25 private static int main (string[] args) {
26 Gtk.init (ref args);
27
28 var window = new Cd.Window ();
29 var dialog = new Gtk.MessageDialog (null, Gtk.DialogFlags.MODAL, Gtk.MessageType.INFO, Gtk.ButtonsType.OK, "Hello world");
30 dialog.map.connect ((dlg) => {
31 window.get_profile.begin (dlg, null, (obj, async_res) => {
32 try {
33 Cd.Profile profile = window.get_profile.end (async_res);
34 GLib.debug ("screen profile to use %s", profile.get_filename ());
35 } catch ( GLib.Error e ) {
36 GLib.warning ("failed to get output profile: %s", e.message);
37 }
38 });
39 });
40 dialog.run ();
41
42 return 0;
43 }