aboutsummaryrefslogtreecommitdiff
path: root/bindings/vala/examples
diff options
context:
space:
mode:
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2011-02-03 16:22:06 +0100
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2011-02-03 16:22:06 +0100
commit7f49d7c2602ccb2ef01c64067e2abcc6b5715200 (patch)
tree48fe2d080655bb443e07795c26e7791eed034a72 /bindings/vala/examples
parent19c543fd42571ef3e011db21a6d93e93d7da4483 (diff)
downloadlibayatana-appindicator-7f49d7c2602ccb2ef01c64067e2abcc6b5715200.tar.gz
libayatana-appindicator-7f49d7c2602ccb2ef01c64067e2abcc6b5715200.tar.bz2
libayatana-appindicator-7f49d7c2602ccb2ef01c64067e2abcc6b5715200.zip
Adding vala bindings and example
Adding proper support for vala bindings, fixing the include path Now they are built in the bindings subfolder and they include a *.deps file. and I've also added a small example.
Diffstat (limited to 'bindings/vala/examples')
-rw-r--r--bindings/vala/examples/Makefile.am14
-rw-r--r--bindings/vala/examples/indicator-example.vala45
2 files changed, 59 insertions, 0 deletions
diff --git a/bindings/vala/examples/Makefile.am b/bindings/vala/examples/Makefile.am
new file mode 100644
index 0000000..6c3bd3c
--- /dev/null
+++ b/bindings/vala/examples/Makefile.am
@@ -0,0 +1,14 @@
+
+TESTS = indicator-example
+VALAFILES = indicator-example.vala
+CLEANFILES = $(TESTS) *.c
+EXTRA_DIST = $(VALAFILES)
+
+VALAFLAGS = --pkg appindicator-0.1 --vapidir=$(top_builddir)/bindings/vala --save-temps
+
+if HAVE_VALAC
+$(TESTS): $(VALAFILES) Makefile.am
+ $(VALAC) $(VALAFLAGS) $(srcdir)/$(VALAFILES)
+
+all: $(TESTS)
+endif
diff --git a/bindings/vala/examples/indicator-example.vala b/bindings/vala/examples/indicator-example.vala
new file mode 100644
index 0000000..908913a
--- /dev/null
+++ b/bindings/vala/examples/indicator-example.vala
@@ -0,0 +1,45 @@
+using Gtk;
+using AppIndicator;
+
+public class IndicatorExample {
+ public static int main(string[] args) {
+ Gtk.init(ref args);
+
+ var win = new Window();
+ win.title = "Indicator Test";
+ win.resize(200, 200);
+ win.destroy.connect(Gtk.main_quit);
+
+ var label = new Label("Hello, world!");
+ win.add(label);
+
+ var indicator = new Indicator(win.title, "indicator-messages",
+ IndicatorCategory.APPLICATION_STATUS);
+
+ indicator.set_status(IndicatorStatus.ACTIVE);
+ indicator.set_attention_icon("indicator-messages-new");
+
+ var menu = new Menu();
+ var item = new MenuItem.with_label("Foo");
+ item.activate.connect(() => {
+ indicator.set_status(IndicatorStatus.ATTENTION);
+ });
+ item.show();
+ menu.append(item);
+
+
+ item = new MenuItem.with_label("Bar");
+ item.show();
+ item.activate.connect(() => {
+ indicator.set_status(IndicatorStatus.ATTENTION);
+ });
+ menu.append(item);
+
+ indicator.set_menu(menu);
+
+ win.show_all();
+
+ Gtk.main();
+ return 0;
+ }
+}