aboutsummaryrefslogtreecommitdiff
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
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.
-rw-r--r--bindings/Makefile.am7
-rw-r--r--bindings/vala/Makefile.am32
-rw-r--r--bindings/vala/examples/Makefile.am14
-rw-r--r--bindings/vala/examples/indicator-example.vala45
-rw-r--r--configure.ac9
-rw-r--r--src/AppIndicator-0.1.metadata2
-rw-r--r--src/Makefile.am29
7 files changed, 111 insertions, 27 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..c4627f5
--- /dev/null
+++ b/bindings/vala/Makefile.am
@@ -0,0 +1,32 @@
+SUBDIRS = . examples
+
+
+#########################
+# VAPI Files
+#########################
+
+if HAVE_INTROSPECTION
+
+if USE_GTK3
+GTKVAPI = gtk+-3.0
+else
+GTKVAPI = gtk+-2.0
+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 $(vapiprefix).deps
+ $(VALA_API_GEN) --library=$(vapiprefix) \
+ --pkg $(GTKVAPI) \
+ $<
+
+
+CLEANFILES = $(vapi_DATA)
+
+endif
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;
+ }
+}
diff --git a/configure.ac b/configure.ac
index 6f78786..f689003 100644
--- a/configure.ac
+++ b/configure.ac
@@ -96,6 +96,13 @@ AM_CONDITIONAL(INTROSPECTION_TEN, [test "x$introspection_ten" = "xyes"])
AC_PATH_PROG([VALA_API_GEN], [vapigen])
###########################
+# Vala Compiler support
+###########################
+
+AM_PROG_VALAC([0.11.0])
+AM_CONDITIONAL(HAVE_VALAC, [test "x$VALAC" != "x"])
+
+###########################
# Check for Mono support
###########################
@@ -205,6 +212,8 @@ bindings/mono/appindicator-sharp-0.1.pc
bindings/mono/examples/Makefile
bindings/mono/examples/indicator-example
bindings/python/Makefile
+bindings/vala/Makefile
+bindings/vala/examples/Makefile
tests/Makefile
example/Makefile
docs/Makefile
diff --git a/src/AppIndicator-0.1.metadata b/src/AppIndicator-0.1.metadata
index e4d068e..5790ddb 100644
--- a/src/AppIndicator-0.1.metadata
+++ b/src/AppIndicator-0.1.metadata
@@ -1 +1,3 @@
AppIndicator name="AppIndicator"
+Indicator.priv hidden="1"
+IndicatorPrivate hidden="1"
diff --git a/src/Makefile.am b/src/Makefile.am
index b9ee3e1..b9696c5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,12 +2,10 @@ if USE_GTK3
VER=3
lib_LTLIBRARIES = libappindicator3.la
GTKGIR = Gtk-3.0
-GTKVAPI = gtk+-3.0
else
VER=
lib_LTLIBRARIES = libappindicator.la
GTKGIR = Gtk-2.0
-GTKVAPI = gtk+-2.0
endif
CLEANFILES =
@@ -45,7 +43,8 @@ glib_enum_headers = $(addprefix $(srcdir)/, $(libappindicator_headers))
DISTCLEANFILES += app-indicator-enum-types.c
-libappindicatorincludedir=$(includedir)/libappindicator-0.1/libappindicator
+libappindicatorincludefolder=libappindicator
+libappindicatorincludedir=$(includedir)/libappindicator-0.1/$(libappindicatorincludefolder)
libappindicator_headers = \
app-indicator.h
@@ -133,13 +132,13 @@ INTROSPECTION_GIRS =
if INTROSPECTION_TEN
INTROSPECTION_SCANNER_ARGS = \
--add-include-path=$(srcdir) \
- $(addprefix --c-include=src/, $(introspection_sources)) \
+ $(addprefix --c-include=$(libappindicatorincludefolder)/, $(libappindicator_headers)) \
--symbol-prefix=app \
--identifier-prefix=App
else
INTROSPECTION_SCANNER_ARGS = \
--add-include-path=$(srcdir) \
- $(addprefix --c-include=src/, $(introspection_sources))
+ $(addprefix --c-include=$(libappindicatorincludefolder)/, $(libappindicator_headers))
endif
INTROSPECTION_COMPILER_ARGS = --includedir=$(builddir)
@@ -174,23 +173,3 @@ typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
CLEANFILES += $(gir_DATA) $(typelib_DATA)
endif
-
-#########################
-# VAPI Files
-#########################
-
-if HAVE_INTROSPECTION
-
-vapidir = $(datadir)/vala/vapi
-vapi_DATA = AppIndicator$(VER)-0.1.vapi
-
-AppIndicator$(VER)-0.1.vapi: AppIndicator$(VER)-0.1.gir Makefile.am
- $(VALA_API_GEN) --library=AppIndicator$(VER)-0.1 \
- --pkg $(GTKVAPI) \
- --vapidir=$(top_builddir)/src \
- $<
-
-CLEANFILES += $(vapi_DATA)
-
-endif
-