aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am1
-rw-r--r--bindings/Makefile.am2
-rw-r--r--bindings/mono/Makefile.am57
-rw-r--r--bindings/mono/TestIndicator.cs82
-rw-r--r--bindings/mono/app-indicator.sources.xml12
-rw-r--r--bindings/mono/appindicator-sharp-0.1.pc.in12
-rw-r--r--bindings/mono/appindicator-sharp.dll.config.in7
-rw-r--r--bindings/mono/examples/IndicatorExample.cs36
-rw-r--r--bindings/mono/examples/Makefile.am12
-rwxr-xr-xbindings/mono/examples/indicator-example.in2
-rw-r--r--bindings/mono/libappindicator-api.metadata17
-rw-r--r--configure.ac62
-rw-r--r--debian/changelog7
13 files changed, 307 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am
index d05078e..a9b445c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,6 @@
SUBDIRS = data \
src \
+ bindings \
example \
tests \
docs
diff --git a/bindings/Makefile.am b/bindings/Makefile.am
new file mode 100644
index 0000000..bee9b1d
--- /dev/null
+++ b/bindings/Makefile.am
@@ -0,0 +1,2 @@
+SUBDIRS = \
+ mono
diff --git a/bindings/mono/Makefile.am b/bindings/mono/Makefile.am
new file mode 100644
index 0000000..b03cde8
--- /dev/null
+++ b/bindings/mono/Makefile.am
@@ -0,0 +1,57 @@
+SUBDIRS = . examples
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = appindicator-sharp-0.1.pc
+
+TEST = AppIndicator.Test.dll
+
+API = libappindicator-api.xml
+RAW_API = libappindicator-api.raw
+METADATA = libappindicator-api.metadata
+ASSEMBLY_NAME = appindicator-sharp
+ASSEMBLY = appindicator-sharp.dll
+TARGET = $(ASSEMBLY) $(ASSEMBLY).config
+assemblydir = $(libdir)/appindicator-sharp
+assembly_DATA = $(TARGET)
+CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb generated-stamp generated/*.cs $(API) $(RAW_API) $(TEST)
+DISTCLEANFILES = $(ASSEMBLY).config
+EXTRA_DIST = \
+ $(RAW_API) \
+ $(METADATA) \
+ appindicator-sharp-0.1.pc.in \
+ appindicator-sharp.dll.config.in \
+ app-indicator.sources.xml \
+ $(TEST_SOURCES)
+
+TEST_SOURCES = TestIndicator.cs
+
+references = $(GTK_SHARP_LIBS)
+test_references = $(GTK_SHARP_LIBS) $(NUNIT_LIBS) -r:$(ASSEMBLY)
+
+$(RAW_API): app-indicator.sources.xml
+ $(GAPI_PARSER) app-indicator.sources.xml
+
+$(API): $(METADATA) $(RAW_API)
+ cp $(srcdir)/$(RAW_API) $(API)
+ chmod u+w $(API)
+ @if test -n '$(METADATA)'; then \
+ echo "$(GAPI_FIXUP) --api=$(API) --metadata=$(srcdir)/$(METADATA)"; \
+ $(GAPI_FIXUP) --api=$(API) --metadata=$(srcdir)/$(METADATA); \
+ fi
+
+api_includes = $(GTK_SHARP_CFLAGS)
+
+generated-stamp: $(API)
+ rm -f generated/* && \
+ $(GAPI_CODEGEN) --generate $(API) $(api_includes) \
+ --outdir=generated --assembly-name=$(ASSEMBLY_NAME) \
+ && touch generated-stamp
+
+$(ASSEMBLY): generated-stamp
+ @rm -f $(ASSEMBLY).mdb
+ $(CSC) $(CSFLAGS) -nowarn:0169,0612,0618 -unsafe -out:$(ASSEMBLY) -target:library $(references) $(builddir)/$(GENERATED_SOURCES)
+
+$(TEST): $(ASSEMBLY) $(TEST_SOURCES)
+ $(CSC) -out:$(TEST) -target:library $(test_references) $(srcdir)/$(TEST_SOURCES)
+
+all: $(TEST)
diff --git a/bindings/mono/TestIndicator.cs b/bindings/mono/TestIndicator.cs
new file mode 100644
index 0000000..3127342
--- /dev/null
+++ b/bindings/mono/TestIndicator.cs
@@ -0,0 +1,82 @@
+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Cody Russell <cody.russell@canonical.com>
+ */
+
+using System;
+using GLib;
+using Gtk;
+using AppIndicator;
+
+using NUnit.Framework;
+
+namespace Ayatana.AppIndicator.Test
+{
+ [TestFixture]
+ public class IndicatorTest
+ {
+ ApplicationIndicator indicator;
+
+ private void Update ()
+ {
+ while (MainContext.Pending ())
+ MainContext.Iteration(true);
+ }
+
+ [SetUp]
+ public void Init ()
+ {
+ Application.Init ();
+
+ Console.WriteLine ("Init()");
+
+ indicator = new ApplicationIndicator ("my-id", "my-name", Category.ApplicationStatus);
+
+ Console.WriteLine ("Created indicator");
+
+ Update();
+ }
+
+ [Test]
+ public void TestProperties ()
+ {
+ Console.WriteLine ("TestProperties()");
+
+ Assert.AreNotSame (indicator, null);
+
+ Assert.AreEqual (indicator.IconName, "my-name");
+ Assert.AreEqual (indicator.ID, "my-id");
+ Assert.AreEqual (indicator.Status, Category.ApplicationStatus);
+
+ Console.WriteLine ("End..");
+ }
+
+ [Test]
+ public void TestSetProperties ()
+ {
+ Console.WriteLine ("TestSetProperties");
+
+ indicator.Status = Status.Attention;
+ indicator.AttentionIconName = "my-attention-name";
+
+ Assert.AreEqual (indicator.Status, Status.Attention);
+ Assert.AreEqual (indicator.AttentionIconName, "my-attention-name");
+
+ Console.WriteLine ("End..");
+ }
+ }
+} \ No newline at end of file
diff --git a/bindings/mono/app-indicator.sources.xml b/bindings/mono/app-indicator.sources.xml
new file mode 100644
index 0000000..8ee8758
--- /dev/null
+++ b/bindings/mono/app-indicator.sources.xml
@@ -0,0 +1,12 @@
+<gapi-parser-input>
+ <api filename="libappindicator-api.raw">
+ <library name="libappindicator.so">
+ <namespace name="AppIndicator">
+ <directory path="../../src/libappindicator">
+ <exclude>app-indicator-enum-types.h.in</exclude>
+ <exclude>app-indicator-enum-types.c.in</exclude>
+ </directory>
+ </namespace>
+ </library>
+ </api>
+</gapi-parser-input>
diff --git a/bindings/mono/appindicator-sharp-0.1.pc.in b/bindings/mono/appindicator-sharp-0.1.pc.in
new file mode 100644
index 0000000..16872ae
--- /dev/null
+++ b/bindings/mono/appindicator-sharp-0.1.pc.in
@@ -0,0 +1,12 @@
+prefix=${pcfiledir}/../..
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+assemblies_dir=${libdir}/appindicator-sharp-0.1
+
+Name: appindicator-sharp
+Description: application indicators for .NET
+Version: @VERSION@
+Libraries: ${assemblies_dir}/appindicator-sharp.dll ${assemblies_dir}/appindicator-sharp.dll.config
+Requires: gtk-sharp-2.0
+Cflags:
+Libs: -r:${assemblies_dir}/appindicator-sharp.dll
diff --git a/bindings/mono/appindicator-sharp.dll.config.in b/bindings/mono/appindicator-sharp.dll.config.in
new file mode 100644
index 0000000..c8caa80
--- /dev/null
+++ b/bindings/mono/appindicator-sharp.dll.config.in
@@ -0,0 +1,7 @@
+<configuration>
+ <dllmap dll="libappindicator.dll" target="libappindicator@LIB_PREFIX@.0@LIB_SUFFIX@"/>
+ <dllmap dll="libgtk-2.0-0.dll" target="libgtk-2.0@LIB_PREFIX@.0@LIB_SUFFIX@"/>
+ <dllmap dll="libglib-2.0-0.dll" target="libglib-2.0@LIB_PREFIX@.0@LIB_SUFFIX@"/>
+ <dllmap dll="libgobject-2.0-0.dll" target="libgobject-2.0@LIB_PREFIX@.0@LIB_SUFFIX@"/>
+ <dllmap dll="libgthread-2.0-0.dll" target="libgthread-2.0@LIB_PREFIX@.0@LIB_SUFFIX@"/>
+</configuration>
diff --git a/bindings/mono/examples/IndicatorExample.cs b/bindings/mono/examples/IndicatorExample.cs
new file mode 100644
index 0000000..0cb72a1
--- /dev/null
+++ b/bindings/mono/examples/IndicatorExample.cs
@@ -0,0 +1,36 @@
+using Gtk;
+using AppIndicator;
+
+public class IndicatorExample
+{
+ public static void Main ()
+ {
+ Application.Init ();
+
+ Window win = new Window ("Test");
+ win.Resize (200, 200);
+
+ Label label = new Label ();
+ label.Text = "Hello, world!";
+
+ win.Add (label);
+
+ ApplicationIndicator indicator = new ApplicationIndicator ("my-id",
+ "my-name",
+ Category.ApplicationStatus);
+
+ indicator.Status = Status.Attention;
+
+ /*
+ Menu menu = new Menu ();
+ menu.Append (new MenuItem ("Foo"));
+ menu.Append (new MenuItem ("Bar"));
+
+ indicator.Menu = menu;
+ */
+
+ win.ShowAll ();
+
+ Application.Run ();
+ }
+} \ No newline at end of file
diff --git a/bindings/mono/examples/Makefile.am b/bindings/mono/examples/Makefile.am
new file mode 100644
index 0000000..b929492
--- /dev/null
+++ b/bindings/mono/examples/Makefile.am
@@ -0,0 +1,12 @@
+ASSEMBLY = IndicatorExample.exe
+CSFILES = IndicatorExample.cs
+CLEANFILES = $(ASSEMBLY)
+
+EXTRA_DIST = $(CSFILES)
+
+references = $(GTK_SHARP_LIBS) -r:$(top_builddir)/bindings/mono/appindicator-sharp.dll
+
+$(ASSEMBLY): $(CSFILES) Makefile.am
+ $(CSC) $(CSFLAGS) -out:$(ASSEMBLY) -target:exe $(references) $(srcdir)/$(CSFILES)
+
+all: $(ASSEMBLY)
diff --git a/bindings/mono/examples/indicator-example.in b/bindings/mono/examples/indicator-example.in
new file mode 100755
index 0000000..3eca155
--- /dev/null
+++ b/bindings/mono/examples/indicator-example.in
@@ -0,0 +1,2 @@
+#!/bin/sh
+MONO_PATH=@top_builddir@/bindings/mono @top_builddir@/bindings/mono/examples/IndicatorExample.exe
diff --git a/bindings/mono/libappindicator-api.metadata b/bindings/mono/libappindicator-api.metadata
new file mode 100644
index 0000000..ad0ebc0
--- /dev/null
+++ b/bindings/mono/libappindicator-api.metadata
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<metadata>
+ <attr path="/api/namespace/object[@cname='AppIndicator']" name="name">ApplicationIndicator</attr>
+ <attr path="/api/namespace/object[@cname='AppIndicator']/signal[@field_name='new_attention_icon']" name="name">NewAttentionIcon</attr>
+ <attr path="/api/namespace/object[@cname='AppIndicator']/signal[@field_name='new_status']" name="name">NewStatus</attr>
+ <attr path="/api/namespace/object[@cname='AppIndicator']/signal[@field_name='connection_changed']" name="name">ConnectionChanged</attr>
+ <attr path="/api/namespace/object[@cname='AppIndicator']/signal[@field_name='new_icon']" name="name">NewIcon</attr>
+ <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_ID_S']" name="name">ID</attr>
+ <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_CATEGORY_S']" name="name">Category</attr>
+ <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_STATUS_S']" name="name">Status</attr>
+ <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_ICON_NAME_S']" name="name">IconName</attr>
+ <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_ATTENTION_ICON_NAME_S']" name="name">AttentionIconName</attr>
+ <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_MENU_S']" name="name">Menu</attr>
+ <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_MENU_S']" name="type">GtkMenu*</attr>
+ <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_CONNECTED_S']" name="name">Connected</attr>
+ <attr path="/api/namespace/object[@cname='AppIndicator']/method[@name='SetMenu']" name="name">SetMenu</attr>
+</metadata>
diff --git a/configure.ac b/configure.ac
index 33d296c..ca1793a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,14 +26,15 @@ AC_PATH_PROG([GLIB_GENMARSHAL], [glib-genmarshal])
PKG_PROG_PKG_CONFIG
###########################
-# GTK Doc
+# GTK Doc
###########################
GTK_DOC_CHECK([1.9])
AC_CONFIG_MACRO_DIR(m4)
+
###########################
-# Dependencies
+# Dependencies
###########################
GTK_REQUIRED_VERSION=2.12
@@ -48,6 +49,57 @@ AC_SUBST(INDICATOR_CFLAGS)
AC_SUBST(INDICATOR_LIBS)
###########################
+# Check for Mono support
+###########################
+MONO_REQUIRED_VERSION=1.0
+PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, has_mono=true, has_mono=false)
+
+AC_PATH_PROG(AL, al, no)
+if test "x$AL" = "xno" ; then
+ AC_MSG_ERROR([No al tool found. You need to install Mono.])
+fi
+
+if test "x$has_mono" = "xtrue" ; then
+ GENERATED_SOURCES=generated/*.cs
+ AC_PATH_PROG(RUNTIME, mono, no)
+
+ if test "x$RUNTIME" != "no" ; then
+ RUNTIME=mono
+ fi
+
+ AC_PATH_PROG(CSC, gmcs, no)
+ LIB_PREFIX=.so
+ LIB_SUFFIX=
+fi
+
+if test "x$CSC" = "xno" ; then
+ AC_MSG_ERROR([No Mono compiler found.])
+fi
+
+AC_SUBST(RUNTIME)
+AC_SUBST(CSC)
+AC_SUBST(LIB_PREFIX)
+AC_SUBST(LIB_SUFFIX)
+AC_SUBST(GENERATED_SOURCES)
+
+GLIB_SHARP_REQ_VERSION=2.12.1
+GTK_SHARP_REQ_VERSION=2.12
+PKG_CHECK_MODULES(GTK_SHARP, gtk-sharp-2.0 >= $GTK_SHARP_REQ_VERSION)
+AC_SUBST(GTK_SHARP_LIBS)
+AC_SUBST(GTK_SHARP_CFLAGS)
+
+PKG_CHECK_MODULES(GAPI, gapi-2.0 >= $GLIB_SHARP_REQ_VERSION)
+AC_PATH_PROG(GAPI_PARSER, gapi2-parser, no)
+AC_SUBST(GAPI_PARSER)
+AC_PATH_PROG(GAPI_CODEGEN, gapi2-codegen, no)
+AC_SUBST(GAPI_CODEGEN)
+AC_PATH_PROG(GAPI_FIXUP, gapi2-fixup, no)
+AC_SUBST(GAPI_FIXUP)
+
+PKG_CHECK_MODULES(NUNIT, nunit-2.4 >= 2.4.7)
+AC_SUBST(NUNIT_LIBS)
+
+###########################
# Check to see if we're local
###########################
@@ -87,6 +139,12 @@ AC_OUTPUT([
Makefile
src/Makefile
src/libappindicator/appindicator-0.1.pc
+bindings/Makefile
+bindings/mono/Makefile
+bindings/mono/appindicator-sharp.dll.config
+bindings/mono/appindicator-sharp-0.1.pc
+bindings/mono/examples/Makefile
+bindings/mono/examples/indicator-example
data/Makefile
tests/Makefile
example/Makefile
diff --git a/debian/changelog b/debian/changelog
index c7e6f23..c9c3854 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+indicator-application (0.0.4-0ubuntu1~ppa2) UNRELEASED; urgency=low
+
+ * Upstream work
+ * Mono bindings
+
+ -- Ted Gould <ted@ubuntu.com> Mon, 14 Dec 2009 11:15:01 -0600
+
indicator-application (0.0.4-0ubuntu1~ppa1) karmic; urgency=low
* Upstream release 0.0.4