aboutsummaryrefslogtreecommitdiff
path: root/bindings
diff options
context:
space:
mode:
authorLuke Yelavich <luke.yelavich@canonical.com>2011-02-11 07:47:26 +1100
committerLuke Yelavich <luke.yelavich@canonical.com>2011-02-11 07:47:26 +1100
commitb63c137778bbec1fb010f095e08750817744fced (patch)
tree960f8b383fdc012dcaeb689c58484f1009eae1ec /bindings
parentfffab2e1e8d991a41cc591ceaca77c8a40f31f33 (diff)
parent409fc00a5a2f60dad3c1adb62d82c896cdfb2a2a (diff)
downloadlibayatana-appindicator-b63c137778bbec1fb010f095e08750817744fced.tar.gz
libayatana-appindicator-b63c137778bbec1fb010f095e08750817744fced.tar.bz2
libayatana-appindicator-b63c137778bbec1fb010f095e08750817744fced.zip
Merge from trunk
Diffstat (limited to 'bindings')
-rw-r--r--bindings/Makefile.am7
-rw-r--r--bindings/vala/Makefile.am36
-rw-r--r--bindings/vala/examples/Makefile.am13
-rw-r--r--bindings/vala/examples/indicator-example.vala64
4 files changed, 118 insertions, 2 deletions
diff --git a/bindings/Makefile.am b/bindings/Makefile.am
index f74dec5..8e621e4 100644
--- a/bindings/Makefile.am
+++ b/bindings/Makefile.am
@@ -1,7 +1,10 @@
if USE_GTK3
-SUBDIRS = mono
+SUBDIRS = \
+ mono \
+ vala
else
SUBDIRS = \
mono \
- python
+ python \
+ vala
endif
diff --git a/bindings/vala/Makefile.am b/bindings/vala/Makefile.am
new file mode 100644
index 0000000..f80b48c
--- /dev/null
+++ b/bindings/vala/Makefile.am
@@ -0,0 +1,36 @@
+if HAVE_INTROSPECTION
+if HAVE_VAPIGEN
+
+SUBDIRS = . examples
+
+#########################
+# VAPI Files
+#########################
+
+if USE_GTK3
+GTKVAPI = gtk+-3.0
+VER=3
+else
+GTKVAPI = gtk+-2.0
+VER=
+endif
+
+vapidir = $(datadir)/vala/vapi
+vapiprefix = appindicator$(VER)-0.1
+vapi_DATA = $(vapiprefix).vapi $(vapiprefix).deps
+DEPS = $(GTKVAPI)
+
+$(vapiprefix).deps:
+ echo $(DEPS) > $@
+
+$(vapiprefix).vapi: $(top_builddir)/src/AppIndicator$(VER)-0.1.gir \
+ $(top_builddir)/src/AppIndicator$(VER)-0.1.metadata \
+ $(vapiprefix).deps
+ $(VALA_API_GEN) --library=$(vapiprefix) --girdir=$(srcdir)/src \
+ $<
+
+
+CLEANFILES = $(vapi_DATA)
+
+endif
+endif
diff --git a/bindings/vala/examples/Makefile.am b/bindings/vala/examples/Makefile.am
new file mode 100644
index 0000000..32a695b
--- /dev/null
+++ b/bindings/vala/examples/Makefile.am
@@ -0,0 +1,13 @@
+
+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
+indicator-example: $(VALAFILES) Makefile.am
+ $(VALAC) $(VALAFLAGS) $(srcdir)/$(VALAFILES)
+
+check: indicator-example
+endif
diff --git a/bindings/vala/examples/indicator-example.vala b/bindings/vala/examples/indicator-example.vala
new file mode 100644
index 0000000..621c962
--- /dev/null
+++ b/bindings/vala/examples/indicator-example.vala
@@ -0,0 +1,64 @@
+/*
+ * 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
+ * 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 <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Marco Trevisan (TreviƱo) <mail@3v1n0.net>
+ */
+
+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;
+ }
+}