File: vexample.vala

package info (click to toggle)
keybinder 0.2.2-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,488 kB
  • ctags: 158
  • sloc: sh: 10,224; ansic: 520; makefile: 105; python: 10
file content (24 lines) | stat: -rw-r--r-- 662 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* vexample.vala
 * Created in 2010 by Ulrik Sverdrup <ulrik.sverdrup@gmail.com>
 *
 * This work is placed in the public domain.
 */

const string EXAMPLE_KEY = "<Ctrl>A";

public void callback (string keystring, void *udata) {
	string s = (string) udata;
	print("Handling key %s. User data: %p, %s\n", keystring, udata, s);
	print("Event time: %u\n", Keybinder.get_current_event_time());
	Keybinder.unbind(keystring, callback);
	Gtk.main_quit();
}

int main(string[] args) {
	Gtk.init(ref args);
	Keybinder.init();
	Keybinder.bind(EXAMPLE_KEY, callback, "user data");
	print("Press %s to activate keybinding and quit\n", EXAMPLE_KEY);
	Gtk.main();
	return 0;
}