From 7f49d7c2602ccb2ef01c64067e2abcc6b5715200 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 3 Feb 2011 16:22:06 +0100 Subject: 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. --- bindings/vala/examples/Makefile.am | 14 +++++++++ bindings/vala/examples/indicator-example.vala | 45 +++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 bindings/vala/examples/Makefile.am create mode 100644 bindings/vala/examples/indicator-example.vala (limited to 'bindings/vala/examples') 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; + } +} -- cgit v1.2.3 From bcbd870a2f3c304aa81133aa4635ee913c9af779 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 3 Feb 2011 17:26:35 +0100 Subject: Vala example: adding copyright message. --- bindings/vala/examples/indicator-example.vala | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'bindings/vala/examples') diff --git a/bindings/vala/examples/indicator-example.vala b/bindings/vala/examples/indicator-example.vala index 908913a..40226df 100644 --- a/bindings/vala/examples/indicator-example.vala +++ b/bindings/vala/examples/indicator-example.vala @@ -1,3 +1,22 @@ +/* + * Copyright 2009 Canonical Ltd. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3, as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranties of + * MERCHANTABILITY, SATISFACTORY QUALITY, 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, see . + * + * Authors: + * Marco Trevisan (TreviƱo) + */ + using Gtk; using AppIndicator; -- cgit v1.2.3 From 99ffe8877703c2d4e7ffe0bacb2a0cc0afd70d71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 3 Feb 2011 17:30:27 +0100 Subject: Vala example: indentation fixes --- bindings/vala/examples/indicator-example.vala | 52 +++++++++++++-------------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'bindings/vala/examples') diff --git a/bindings/vala/examples/indicator-example.vala b/bindings/vala/examples/indicator-example.vala index 40226df..60f62ea 100644 --- a/bindings/vala/examples/indicator-example.vala +++ b/bindings/vala/examples/indicator-example.vala @@ -21,44 +21,44 @@ using Gtk; using AppIndicator; public class IndicatorExample { - public static int main(string[] args) { + 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 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 label = new Label("Hello, world!"); + win.add(label); - var indicator = new Indicator(win.title, "indicator-messages", - IndicatorCategory.APPLICATION_STATUS); + var indicator = new Indicator(win.title, "indicator-messages", + IndicatorCategory.APPLICATION_STATUS); indicator.set_status(IndicatorStatus.ACTIVE); - indicator.set_attention_icon("indicator-messages-new"); + 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); + 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); + item = new MenuItem.with_label("Bar"); + item.show(); + item.activate.connect(() => { + indicator.set_status(IndicatorStatus.ATTENTION); + }); + menu.append(item); - indicator.set_menu(menu); + indicator.set_menu(menu); - win.show_all(); + win.show_all(); Gtk.main(); return 0; - } + } } -- cgit v1.2.3 From 2fea2064d1da2d2653009ba5f553829e67fc0d34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 3 Feb 2011 17:59:57 +0100 Subject: Vala example, changed copyright year --- bindings/vala/examples/indicator-example.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bindings/vala/examples') diff --git a/bindings/vala/examples/indicator-example.vala b/bindings/vala/examples/indicator-example.vala index 60f62ea..c91dfae 100644 --- a/bindings/vala/examples/indicator-example.vala +++ b/bindings/vala/examples/indicator-example.vala @@ -1,5 +1,5 @@ /* - * Copyright 2009 Canonical Ltd. + * Copyright 2011 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published -- cgit v1.2.3 From 692281a6d91151306cc8cac72c22d451c17438a1 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 3 Feb 2011 12:37:57 -0600 Subject: Changing the build to be the check instead of running it as we might not be interactive. --- bindings/vala/examples/Makefile.am | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'bindings/vala/examples') diff --git a/bindings/vala/examples/Makefile.am b/bindings/vala/examples/Makefile.am index 6c3bd3c..32a695b 100644 --- a/bindings/vala/examples/Makefile.am +++ b/bindings/vala/examples/Makefile.am @@ -1,5 +1,4 @@ -TESTS = indicator-example VALAFILES = indicator-example.vala CLEANFILES = $(TESTS) *.c EXTRA_DIST = $(VALAFILES) @@ -7,8 +6,8 @@ EXTRA_DIST = $(VALAFILES) VALAFLAGS = --pkg appindicator-0.1 --vapidir=$(top_builddir)/bindings/vala --save-temps if HAVE_VALAC -$(TESTS): $(VALAFILES) Makefile.am +indicator-example: $(VALAFILES) Makefile.am $(VALAC) $(VALAFLAGS) $(srcdir)/$(VALAFILES) -all: $(TESTS) +check: indicator-example endif -- cgit v1.2.3 From 6cc0ff8c6f108324dd2310569b870b8586930712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Fri, 4 Feb 2011 01:33:35 +0100 Subject: Vala bindings: add metadata as build dependencies, support for gtk3 --- bindings/vala/examples/indicator-example.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bindings/vala/examples') diff --git a/bindings/vala/examples/indicator-example.vala b/bindings/vala/examples/indicator-example.vala index c91dfae..621c962 100644 --- a/bindings/vala/examples/indicator-example.vala +++ b/bindings/vala/examples/indicator-example.vala @@ -23,7 +23,7 @@ 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); -- cgit v1.2.3