diff options
27 files changed, 463 insertions, 181 deletions
@@ -10,8 +10,8 @@ src/notification-watcher-client.h src/notification-watcher-server.h src/libappindicator.la src/libappindicator_la-application-indicator.lo -src/libappindicatorindicator/application-indicator-enum-types.h -src/libappindicatorindicator/application-indicator-enum-types.c +src/application-indicator-enum-types.h +src/application-indicator-enum-types.c src/stamp-enum-types src/libappindicator_la-application-indicator-enum-types.lo tests/.deps @@ -41,8 +41,8 @@ src/libappindicator_la-app-indicator.lo src/libapplication.la src/libapplication_la-application-service-marshal.lo src/libapplication_la-indicator-application.lo -src/libappindicator/app-indicator-enum-types.c -src/libappindicator/app-indicator-enum-types.h +src/app-indicator-enum-types.c +src/app-indicator-enum-types.h gtk-doc.make py-compile bindings/mono/appindicator-sharp-0.1.pc @@ -85,7 +85,7 @@ docs/reference/version.xml docs/reference/xml docs/reference/tmpl/app-indicator.sgml docs/reference/tmpl/app-indicator.sgml.bak -src/libappindicator/appindicator-0.1.pc +src/appindicator-0.1.pc tests/test-libappindicator-fallback-item tests/test-libappindicator-fallback-watcher tests/test-libappindicator-fallback @@ -95,8 +95,15 @@ tests/test-libappindicator-status-server bindings/mono/AppIndicator.Test.dll bindings/mono/libappindicator-api.middle bindings/mono/examples/IndicatorExample.exe -src/libappindicator/app-indicator-enum-types.gen.c +src/app-indicator-enum-types.gen.c indicator-application-[0-9].[0-9].[0-9].tar.gz indicator-application-[0-9].[0-9].[0-9].tar.gz.asc indicator-application-[0-9].[0-9].[0-9][0-9].tar.gz indicator-application-[0-9].[0-9].[0-9][0-9].tar.gz.asc +m4/gtk-doc.m4 +src/AppIndicator-0.1.gir +src/AppIndicator-0.1.typelib +docs/reference/libappindicator-decl.txt.bak +docs/reference/libappindicator-decl-list.txt.bak +src/AppIndicator-0.1.vapi +bindings/mono/policy.appindicator-sharp.dll diff --git a/Makefile.am b/Makefile.am index 4d38ef8..ba772b0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,6 +6,7 @@ SUBDIRS = data \ docs EXTRA_DIST = \ + m4/introspection.m4 \ gtk-doc.make \ omf.make \ xmldocs.make \ @@ -14,7 +15,7 @@ EXTRA_DIST = \ COPYING.LGPL.3 \ ChangeLog -DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-localinstall +DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-localinstall --enable-introspection dist-hook: @if test -d "$(top_srcdir)/.bzr"; \ diff --git a/bindings/mono/Makefile.am b/bindings/mono/Makefile.am index 7e2b0d2..98fe6f9 100644 --- a/bindings/mono/Makefile.am +++ b/bindings/mono/Makefile.am @@ -10,11 +10,33 @@ MIDDLE_API = libappindicator-api.middle 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-0.1 +ASSEMBLY_VERSION = 0.1.0.0 +ASSEMBLY = $(ASSEMBLY_NAME).dll +POLICY = policy.$(POLICY_VERSION).$(ASSEMBLY_NAME) +POLICY_VERSION = 0.0 +DLLPOLICY = $(POLICY).dll + +TARGET = \ + $(ASSEMBLY) \ + $(ASSEMBLY).config \ + $(DLLPOLICY) \ + $(POLICY).config + +assemblydir = $(libdir)/cli/appindicator-sharp-0.1 assembly_DATA = $(TARGET) -CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb generated-stamp generated/*.cs $(API) $(MIDDLE_API) $(RAW_API) $(TEST) + +CLEANFILES = \ + $(ASSEMBLY) \ + $(ASSEMBLY).mdb \ + generated-stamp \ + generated/*.cs \ + $(API) \ + $(MIDDLE_API) \ + $(RAW_API) \ + $(TEST) \ + $(DLLPOLICY) \ + $(POLICY).config + DISTCLEANFILES = $(ASSEMBLY).config TEST_SOURCES = TestIndicator.cs customs = ApplicationIndicator.custom @@ -26,10 +48,11 @@ EXTRA_DIST = \ appindicator-sharp.dll.config.in \ app-indicator.sources.xml \ $(ASSEMBLY_NAME).snk \ + $(POLICY).config.in \ $(customs) \ $(TEST_SOURCES) -GACUTIL_FLAGS="-package $(ASSEMBLY_NAME) -root $(DESTDIR)$(prefix)/lib" +GACUTIL_FLAGS=-package $(ASSEMBLY_NAME) -root $(DESTDIR)$(prefix)/lib references = $(GTK_SHARP_LIBS) test_references = $(GTK_SHARP_LIBS) $(NUNIT_LIBS) -r:$(ASSEMBLY) @@ -46,21 +69,13 @@ $(MIDDLE_API): $(METADATA) $(RAW_API) fi $(API): $(MIDDLE_API) Makefile.am - sed -e "s|PROP_ID_S|ID|" \ - -e "s|PROP_ID_S|id|" \ - -e "s|PROP_STATUS_S|Status|" \ + sed -e "s|PROP_ID_S|id|" \ -e "s|PROP_STATUS_S|status|" \ - -e "s|PROP_CATEGORY_S|Category|" \ -e "s|PROP_CATEGORY_S|category|" \ - -e "s|PROP_ICON_NAME_S|IconName|" \ -e "s|PROP_ICON_NAME_S|icon-name|" \ - -e "s|PROP_ATTENTION_ICON_NAME_S|AttentionIconName|" \ -e "s|PROP_ATTENTION_ICON_NAME_S|attention-icon-name|" \ - -e "s|PROP_ICON_THEME_PATH_S|IconThemePath|" \ -e "s|PROP_ICON_THEME_PATH_S|icon-theme-path|" \ - -e "s|PROP_MENU_S|Menu|" \ -e "s|PROP_MENU_S|menu|" \ - -e "s|PROP_CONNECTED_S|Connected|" \ -e "s|PROP_CONNECTED_S|connected|" \ $< > $@ @@ -80,14 +95,27 @@ $(ASSEMBLY): generated-stamp $(srcdir)/AssemblyInfo.cs $(CSC) $(CSFLAGS) -keyfile:$(srcdir)/$(ASSEMBLY_NAME).snk -nowarn:0169,0612,0618 -unsafe -out:$(ASSEMBLY) -target:library $(references) $(builddir)/$(GENERATED_SOURCES) $(srcdir)/AssemblyInfo.cs install-data-local: - echo "$(GACUTIL) -i $(ASSEMBLY_NAME).dll -package $(ASSEMBLY_NAME) -root $(DESTDIR)$(prefix)/lib"; \ - $(GACUTIL) -i $(ASSEMBLY_NAME).dll -package $(ASSEMBLY_NAME) -root $(DESTDIR)$(prefix)/lib || exit 1; + echo "$(GACUTIL) -i $(ASSEMBLY_NAME).dll $(GACUTIL_FLAGS)"; \ + $(GACUTIL) -i $(ASSEMBLY_NAME).dll $(GACUTIL_FLAGS) || exit 1; + echo "$(GACUTIL) -i $(DLLPOLICY) $(GACUTIL_FLAGS)"; \ + $(GACUTIL) -i $(DLLPOLICY) $(GACUTIL_FLAGS) || exit 1; uninstall-local: - echo "$(GACUTIL) -u $(ASSEMBLY_NAME) -package $(ASSEMBLY_NAME) -root $(DESTDIR)$(prefix)/lib"; \ - $(GACUTIL) -u $(ASSEMBLY_NAME) -package $(ASSEMBLY_NAME) -root $(DESTDIR)$(prefix)/lib || exit 1; + echo "$(GACUTIL) -u $(ASSEMBLY_NAME) $(GACUTIL_FLAGS)"; \ + $(GACUTIL) -u $(ASSEMBLY_NAME) $(GACUTIL_FLAGS) || exit 1; + echo "$(GACUTIL) -u $(DLLPOLICY) $(GACUTIL_FLAGS)"; \ + $(GACUTIL) -u $(POLICY) $(GACUTIL_FLAGS) || exit 1; $(TEST): $(ASSEMBLY) $(TEST_SOURCES) $(CSC) -out:$(TEST) -target:library $(test_references) $(srcdir)/$(TEST_SOURCES) all: $(TEST) + +$(POLICY).config: $(POLICY).config.in Makefile + sed -e "s|@ASSEMBLY_NAME@|$(ASSEMBLY_NAME)|" \ + -e "s|@ASSEMBLY_VERSION@|$(ASSEMBLY_VERSION)|g" \ + $< > $@ + +$(DLLPOLICY): $(POLICY).config $(ASSEMBLY_NAME).snk Makefile + $(AL) -link:$(POLICY).config -out:$(DLLPOLICY) -keyfile:$(srcdir)/$(ASSEMBLY_NAME).snk + diff --git a/bindings/mono/app-indicator.sources.xml b/bindings/mono/app-indicator.sources.xml index 3585c44..2649eb4 100644 --- a/bindings/mono/app-indicator.sources.xml +++ b/bindings/mono/app-indicator.sources.xml @@ -2,10 +2,10 @@ <api filename="libappindicator-api.raw"> <library name="libappindicator.so.0"> <namespace name="AppIndicator"> - <directory path="../../src/libappindicator"> - <exclude>app-indicator-enum-types.h.in</exclude> - <exclude>app-indicator-enum-types.c.in</exclude> - </directory> + <file>../../src/app-indicator.c</file> + <file>../../src/app-indicator-enum-types.c</file> + <file>../../src/app-indicator-enum-types.h</file> + <file>../../src/app-indicator.h</file> </namespace> </library> </api> diff --git a/bindings/mono/appindicator-sharp-0.1.pc.in b/bindings/mono/appindicator-sharp-0.1.pc.in index 33ff1d7..11ae719 100644 --- a/bindings/mono/appindicator-sharp-0.1.pc.in +++ b/bindings/mono/appindicator-sharp-0.1.pc.in @@ -1,7 +1,7 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ -assemblies_dir=${libdir}/appindicator-sharp-0.1 +assemblies_dir=${libdir}/cli/appindicator-sharp-0.1 Name: appindicator-sharp Description: application indicators for .NET diff --git a/bindings/mono/libappindicator-api.metadata b/bindings/mono/libappindicator-api.metadata index c94cc5b..8f9df53 100644 --- a/bindings/mono/libappindicator-api.metadata +++ b/bindings/mono/libappindicator-api.metadata @@ -9,27 +9,33 @@ <attr path="/api/namespace/object[@cname='AppIndicator']/signal[@field_name='connection_changed']" name="cname">connection-changed</attr> <attr path="/api/namespace/object[@cname='AppIndicator']/signal[@field_name='new_icon']" name="name">NewIcon</attr> <attr path="/api/namespace/object[@cname='AppIndicator']/signal[@field_name='new_icon']" name="cname">new-icon</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='id']" name="name">ID</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_CATEGORY_S']" name="hidden"></attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_CATEGORY_S']" name="hidden"></attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_STATUS_S']" name="hidden"></attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_STATUS_S']" name="hidden"></attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='icon-name']" name="name">IconName</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='attention-icon-name']" name="name">AttentionIconName</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='menu']" name="name">Menu</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='menu']" name="type">GtkMenu*</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='connected']" name="name">Connected</attr> - <attr path="/api/namespace/object[@cname='AppIndicator']/method[@name='SetMenu']" name="name">SetMenu</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="hidden">true</attr> + <attr path="/api/namespace/object[@cname='AppIndicator']/property[@cname='PROP_STATUS_S']" name="hidden">true</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_ICON_THEME_PATH_S']" name="name">IconThemePath</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> - <remove-node path="/api/namespace/object/method[@cname='app_indicator_get_id']" /> - <remove-node path="/api/namespace/object/method[@cname='app_indicator_get_status']" /> - <remove-node path="/api/namespace/object/method[@cname='app_indicator_get_icon']" /> - <remove-node path="/api/namespace/object/method[@cname='app_indicator_get_category']" /> - <remove-node path="/api/namespace/object/method[@cname='app_indicator_get_attention_icon']" /> + <attr path="/api/namespace/object[@cname='AppIndicator']/constructor[@cname='app_indicator_new']/*/*[@name='id']" name="property_name">id</attr> + <attr path="/api/namespace/object[@cname='AppIndicator']/constructor[@cname='app_indicator_new']/*/*[@name='icon_name']" name="property_name">icon-name</attr> + <attr path="/api/namespace/object[@cname='AppIndicator']/constructor[@cname='app_indicator_new']/*/*[@name='category']" name="property_name">category</attr> + <attr path="/api/namespace/object[@cname='AppIndicator']/constructor[@cname='app_indicator_new_with_path']/*/*[@name='id']" name="property_name">id</attr> + <attr path="/api/namespace/object[@cname='AppIndicator']/constructor[@cname='app_indicator_new_with_path']/*/*[@name='icon_name']" name="property_name">icon-name</attr> + <attr path="/api/namespace/object[@cname='AppIndicator']/constructor[@cname='app_indicator_new_with_path']/*/*[@name='category']" name="property_name">category</attr> + <attr path="/api/namespace/object[@cname='AppIndicator']/constructor[@cname='app_indicator_new_with_path']/*/*[@name='icon_path']" name="property_name">icon-theme-path</attr> + + <remove-node path="/api/namespace/object/method[@cname='app_indicator_get_id']" /> + <remove-node path="/api/namespace/object/method[@cname='app_indicator_get_status']" /> + <remove-node path="/api/namespace/object/method[@cname='app_indicator_get_icon']" /> + <remove-node path="/api/namespace/object/method[@cname='app_indicator_get_category']" /> + <remove-node path="/api/namespace/object/method[@cname='app_indicator_get_attention_icon']" /> <remove-node path="/api/namespace/object/method[@cname='app_indicator_set_id']" /> - <remove-node path="/api/namespace/object/method[@cname='app_indicator_set_status']" /> - <remove-node path="/api/namespace/object/method[@cname='app_indicator_set_icon']" /> - <remove-node path="/api/namespace/object/method[@cname='app_indicator_set_category']" /> - <remove-node path="/api/namespace/object/method[@cname='app_indicator_set_attention_icon']" /> + <remove-node path="/api/namespace/object/method[@cname='app_indicator_set_status']" /> + <remove-node path="/api/namespace/object/method[@cname='app_indicator_set_icon']" /> + <remove-node path="/api/namespace/object/method[@cname='app_indicator_set_attention_icon']" /> </metadata> diff --git a/bindings/mono/policy.0.0.appindicator-sharp.config.in b/bindings/mono/policy.0.0.appindicator-sharp.config.in new file mode 100644 index 0000000..95c21ed --- /dev/null +++ b/bindings/mono/policy.0.0.appindicator-sharp.config.in @@ -0,0 +1,10 @@ +<configuration> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="@ASSEMBLY_NAME@" publicKeyToken="bcae265d1c7ab4c2" /> + <bindingRedirect oldVersion="0.0.0.0-@ASSEMBLY_VERSION@" newVersion="@ASSEMBLY_VERSION@"/> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration> diff --git a/bindings/python/appindicator.override b/bindings/python/appindicator.override index a01a9a6..b252994 100644 --- a/bindings/python/appindicator.override +++ b/bindings/python/appindicator.override @@ -28,8 +28,8 @@ License version 3 and version 2.1 along with this program. If not, see %% headers #include <Python.h> -#include "../src/libappindicator/app-indicator.h" -#include "../src/libappindicator/app-indicator-enum-types.h" +#include "../src/app-indicator.h" +#include "../src/app-indicator-enum-types.h" #include <glib.h> #include "pygobject.h" #include "pyglib.h" diff --git a/configure.ac b/configure.ac index 9d5b26d..bd3c6a4 100644 --- a/configure.ac +++ b/configure.ac @@ -1,11 +1,11 @@ -AC_INIT(indicator-application, 0.0.21, ted@canonical.com) +AC_INIT(indicator-application, 0.2.1, ted@canonical.com) AC_COPYRIGHT([Copyright 2009, 2010 Canonical]) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(indicator-application, 0.0.21) +AM_INIT_AUTOMAKE(indicator-application, 0.2.1) AM_MAINTAINER_MODE @@ -53,6 +53,18 @@ AC_SUBST(INDICATOR_CFLAGS) AC_SUBST(INDICATOR_LIBS) ########################### +# GObject Introspection +########################### + +GOBJECT_INTROSPECTION_CHECK([0.6.7]) + +########################### +# Vala API Generation +########################### + +AC_PATH_PROG([VALA_API_GEN], [vapigen]) + +########################### # Check for Mono support ########################### @@ -178,7 +190,7 @@ AC_MSG_RESULT($PYGTK_CODEGEN) AC_OUTPUT([ Makefile src/Makefile -src/libappindicator/appindicator-0.1.pc +src/appindicator-0.1.pc bindings/Makefile bindings/mono/Makefile bindings/mono/appindicator-sharp.dll.config diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am index 1292f4d..10d8b2a 100644 --- a/docs/reference/Makefile.am +++ b/docs/reference/Makefile.am @@ -22,7 +22,7 @@ DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml # gtk-doc will search all .c & .h files beneath here for inline comments # documenting the functions and macros. # e.g. DOC_SOURCE_DIR=../../../gtk -DOC_SOURCE_DIR=../../src/libappindicator +DOC_SOURCE_DIR=../../src # Extra options to pass to gtkdoc-scangobj. Not normally needed. SCANGOBJ_OPTIONS=--nogtkinit --type-init-func="g_type_init()" @@ -50,12 +50,26 @@ FIXXREF_OPTIONS= # Used for dependencies. The docs will be rebuilt if any of these change. # e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h # e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c -HFILE_GLOB=$(top_srcdir)/src/libappindicator/*.h -CFILE_GLOB=$(top_srcdir)/src/libappindicator/*.c +HFILE_GLOB=$(top_srcdir)/src/app-indicator*.h +CFILE_GLOB=$(top_srcdir)/src/app-indicator*.c # Header files to ignore when scanning. # e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h -IGNORE_HFILES=app-indicator-enum-types.h application-service-appstore.h application-service-client.h application-service-marshal.h application-service-server.h application-service-watcher.h dbus-properties-client.h dbus-properties-server.h dbus-shared.h notification-item-client.h notification-item-server.h notification-watcher-client.h notification-watcher-server.h +IGNORE_HFILES= \ + app-indicator-enum-types.h \ + application-service-appstore.h \ + application-service-client.h \ + application-service-lru-file.h \ + application-service-marshal.h \ + application-service-server.h \ + application-service-watcher.h \ + dbus-properties-client.h \ + dbus-properties-server.h \ + dbus-shared.h \ + notification-item-client.h \ + notification-item-server.h \ + notification-watcher-client.h \ + notification-watcher-server.h # Images to copy into HTML directory. # e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png @@ -75,7 +89,7 @@ expand_content_files= # signals and properties. # e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) # e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) -GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_srcdir)/src -I$(top_srcdir)/src/libappindicator $(INDICATOR_CFLAGS) +GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_srcdir)/src -I$(top_srcdir)/src $(INDICATOR_CFLAGS) GTKDOC_LIBS=$(top_builddir)/src/libappindicator.la $(top_builddir)/src/libapplication.la # This includes the standard gtk-doc make rules, copied by gtkdocize. diff --git a/example/simple-client.c b/example/simple-client.c index a698b48..fbcaaaa 100644 --- a/example/simple-client.c +++ b/example/simple-client.c @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "libappindicator/app-indicator.h" +#include "app-indicator.h" #include "libdbusmenu-glib/server.h" #include "libdbusmenu-glib/menuitem.h" diff --git a/m4/introspection.m4 b/m4/introspection.m4 new file mode 100644 index 0000000..589721c --- /dev/null +++ b/m4/introspection.m4 @@ -0,0 +1,94 @@ +dnl -*- mode: autoconf -*- +dnl Copyright 2009 Johan Dahlin +dnl +dnl This file is free software; the author(s) gives unlimited +dnl permission to copy and/or distribute it, with or without +dnl modifications, as long as this notice is preserved. +dnl + +# serial 1 + +m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL], +[ + AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first + AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first + AC_BEFORE([LT_INIT],[$0])dnl setup libtool first + + dnl enable/disable introspection + m4_if([$2], [require], + [dnl + enable_introspection=yes + ],[dnl + AC_ARG_ENABLE(introspection, + AS_HELP_STRING([--enable-introspection[=@<:@no/auto/yes@:>@]], + [Enable introspection for this build]),, + [enable_introspection=auto]) + ])dnl + + AC_MSG_CHECKING([for gobject-introspection]) + + dnl presence/version checking + AS_CASE([$enable_introspection], + [no], [dnl + found_introspection="no (disabled, use --enable-introspection to enable)" + ],dnl + [yes],[dnl + PKG_CHECK_EXISTS([gobject-introspection-1.0],, + AC_MSG_ERROR([gobject-introspection-1.0 is not installed])) + PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], + found_introspection=yes, + AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build AC_PACKAGE_NAME])) + ],dnl + [auto],[dnl + PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], found_introspection=yes, found_introspection=no) + ],dnl + [dnl + AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@]) + ])dnl + + AC_MSG_RESULT([$found_introspection]) + + INTROSPECTION_SCANNER= + INTROSPECTION_COMPILER= + INTROSPECTION_GENERATE= + INTROSPECTION_GIRDIR= + INTROSPECTION_TYPELIBDIR= + if test "x$found_introspection" = "xyes"; then + INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0` + INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0` + INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0` + INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0` + INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)" + INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0` + INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0` + INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection + fi + AC_SUBST(INTROSPECTION_SCANNER) + AC_SUBST(INTROSPECTION_COMPILER) + AC_SUBST(INTROSPECTION_GENERATE) + AC_SUBST(INTROSPECTION_GIRDIR) + AC_SUBST(INTROSPECTION_TYPELIBDIR) + AC_SUBST(INTROSPECTION_CFLAGS) + AC_SUBST(INTROSPECTION_LIBS) + AC_SUBST(INTROSPECTION_MAKEFILE) + + AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes") +]) + + +dnl Usage: +dnl GOBJECT_INTROSPECTION_CHECK([minimum-g-i-version]) + +AC_DEFUN([GOBJECT_INTROSPECTION_CHECK], +[ + _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1]) +]) + +dnl Usage: +dnl GOBJECT_INTROSPECTION_REQUIRE([minimum-g-i-version]) + + +AC_DEFUN([GOBJECT_INTROSPECTION_REQUIRE], +[ + _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1], [require]) +]) diff --git a/src/Makefile.am b/src/Makefile.am index 9f2771e..787ba2f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,7 +1,7 @@ CLEANFILES = DISTCLEANFILES = BUILT_SOURCES = -EXTRA_DIST = libappindicator/appindicator-0.1.pc.in +EXTRA_DIST = appindicator-0.1.pc.in include $(top_srcdir)/Makefile.am.enum include $(top_srcdir)/Makefile.am.marshal @@ -32,27 +32,32 @@ libapplication_la_LDFLAGS = -module -avoid-version libexec_PROGRAMS = indicator-application-service +BUILT_SOURCES += \ + application-service-server.h \ + application-service-marshal.h \ + application-service-marshal.c \ + dbus-properties-client.h \ + notification-item-client.h \ + notification-watcher-server.h + indicator_application_service_SOURCES = \ application-service.c \ application-service-appstore.h \ application-service-appstore.c \ application-service-lru-file.h \ application-service-lru-file.c \ - application-service-marshal.h \ application-service-marshal.c \ - application-service-server.h \ application-service-watcher.h \ application-service-watcher.c \ - dbus-properties-client.h \ - dbus-shared.h \ - notification-item-client.h \ - notification-watcher-server.h + app-indicator-enum-types.c \ + dbus-shared.h indicator_application_service_CFLAGS = \ $(INDICATOR_CFLAGS) \ -Wall -Werror \ -DG_LOG_DOMAIN=\"indicator-application-service\" indicator_application_service_LDADD = \ - $(INDICATOR_LIBS) + $(INDICATOR_LIBS) \ + libappindicator.la glib_marshal_list = application-service-marshal.list glib_marshal_prefix = _application_service_marshal @@ -61,24 +66,14 @@ glib_marshal_prefix = _application_service_marshal # Library ################################## -pkgconfig_DATA = libappindicator/appindicator-0.1.pc +pkgconfig_DATA = appindicator-0.1.pc pkgconfigdir = $(libdir)/pkgconfig -glib_enum_h = libappindicator/app-indicator-enum-types.h -glib_enum_c = libappindicator/app-indicator-enum-types.gen.c -glib_enum_headers = $(libappindicator_headers) - -libappindicator/app-indicator-enum-types.c: libappindicator/app-indicator-enum-types.gen.c - sed -e "s|\"passive\"|\"Passive\"|" \ - -e "s|\"active\"|\"Active\"|" \ - -e "s|\"attention\"|\"NeedsAttention\"|" \ - -e "s|\"application-status\"|\"ApplicationStatus\"|" \ - -e "s|\"communications\"|\"Communications\"|" \ - -e "s|\"system-services\"|\"SystemServices\"|" \ - -e "s|\"hardware\"|\"Hardware\"|" \ - -e "s|\"other\"|\"Other\"|" \ - $< > $@ -DISTCLEANFILES += libappindicator/app-indicator-enum-types.c +glib_enum_h = app-indicator-enum-types.h +glib_enum_c = app-indicator-enum-types.c +glib_enum_headers = $(addprefix $(srcdir)/, $(libappindicator_headers)) + +DISTCLEANFILES += app-indicator-enum-types.c lib_LTLIBRARIES = \ libappindicator.la @@ -86,18 +81,20 @@ lib_LTLIBRARIES = \ libappindicatorincludedir=$(includedir)/libappindicator-0.1/libappindicator libappindicator_headers = \ - $(srcdir)/libappindicator/app-indicator.h + app-indicator.h libappindicatorinclude_HEADERS = \ $(libappindicator_headers) \ $(glib_enum_h) +BUILT_SOURCES += \ + notification-watcher-client.h \ + notification-item-server.h + libappindicator_la_SOURCES = \ $(libappindicator_headers) \ - libappindicator/app-indicator-enum-types.c \ - notification-watcher-client.h \ - notification-item-server.h \ - libappindicator/app-indicator.c + app-indicator-enum-types.c \ + app-indicator.c libappindicator_la_LDFLAGS = \ -version-info 0:0:0 \ @@ -117,6 +114,7 @@ libappindicator_la_LIBADD = \ ################################## DBUS_SPECS = \ + dbus-properties.xml \ application-service.xml \ notification-item.xml \ notification-watcher.xml @@ -142,3 +140,60 @@ BUILT_SOURCES += \ CLEANFILES += $(BUILT_SOURCES) EXTRA_DIST += $(DBUS_SPECS) + +######################### +# GObject Introsepction +######################### + +-include $(INTROSPECTION_MAKEFILE) +INTROSPECTION_GIRS = +INTROSPECTION_SCANNER_ARGS = \ + --add-include-path=$(srcdir) \ + $(addprefix --c-include=libappindicator/, $(introspection_sources)) +INTROSPECTION_COMPILER_ARGS = --includedir=$(builddir) + +if HAVE_INTROSPECTION + +introspection_sources = \ + $(addprefix $(srcdir)/,$(libappindicator_headers)) \ + $(addprefix $(top_builddir)/src/, $(glib_enum_h)) + +AppIndicator-0.1.gir: libappindicator.la $(glib_enum_h) +AppIndicator_0_1_gir_INCLUDES = \ + GObject-2.0 \ + Gtk-2.0 +AppIndicator_0_1_gir_CFLAGS = $(INDICATOR_CFLAGS) -I$(srcdir) -I$(top_builddir)/src +AppIndicator_0_1_gir_LIBS = libappindicator.la +AppIndicator_0_1_gir_FILES = $(introspection_sources) + +INTROSPECTION_GIRS += AppIndicator-0.1.gir + +girdir = $(datadir)/gir-1.0 +gir_DATA = $(INTROSPECTION_GIRS) + +typelibdir = $(libdir)/girepository-1.0 +typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) + +CLEANFILES += $(gir_DATA) $(typelib_DATA) + +endif + +######################### +# VAPI Files +######################### + +if HAVE_INTROSPECTION + +vapidir = $(datadir)/vala/vapi +vapi_DATA = AppIndicator-0.1.vapi + +AppIndicator-0.1.vapi: AppIndicator-0.1.gir Makefile.am + $(VALA_API_GEN) --library=AppIndicator-0.1 \ + --pkg gtk+-2.0 \ + --vapidir=$(top_builddir)/src \ + $< + +CLEANFILES += $(vapi_DATA) + +endif + diff --git a/src/libappindicator/app-indicator-enum-types.gen.c.in b/src/app-indicator-enum-types.c.in index 449f3fc..e200396 100644 --- a/src/libappindicator/app-indicator-enum-types.gen.c.in +++ b/src/app-indicator-enum-types.c.in @@ -27,7 +27,7 @@ License version 3 and version 2.1 along with this program. If not, see <http://www.gnu.org/licenses/> */ -#include "libappindicator/app-indicator-enum-types.h" +#include "app-indicator-enum-types.h" /*** END file-header ***/ @@ -36,6 +36,13 @@ License version 3 and version 2.1 along with this program. If not, see /*** END file-production ***/ /*** BEGIN value-header ***/ +/** + @enum_name@_get_type: + + Builds a GLib type for the #@EnumName@ enumeration. + + Return value: A unique #GType for the #@EnumName@ enum. +*/ GType @enum_name@_get_type (void) { diff --git a/src/libappindicator/app-indicator-enum-types.h.in b/src/app-indicator-enum-types.h.in index da3bf98..a055d71 100644 --- a/src/libappindicator/app-indicator-enum-types.h.in +++ b/src/app-indicator-enum-types.h.in @@ -48,13 +48,6 @@ G_END_DECLS /*** END file-production ***/ /*** BEGIN value-header ***/ -/** - @enum_name@_get_type: - - Builds a glib type for the @EnumName@ enumeration. - - Return value: A registered type for the enum -*/ GType @enum_name@_get_type (void) G_GNUC_CONST; #define APP_INDICATOR_TYPE_@ENUMSHORT@ (@enum_name@_get_type()) diff --git a/src/libappindicator/app-indicator.c b/src/app-indicator.c index 03819ca..32f512f 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/app-indicator.c @@ -35,8 +35,8 @@ License version 3 and version 2.1 along with this program. If not, see #include <libdbusmenu-glib/server.h> #include <libdbusmenu-gtk/client.h> -#include "libappindicator/app-indicator.h" -#include "libappindicator/app-indicator-enum-types.h" +#include "app-indicator.h" +#include "app-indicator-enum-types.h" #include "notification-item-server.h" #include "notification-watcher-client.h" @@ -52,13 +52,13 @@ License version 3 and version 2.1 along with this program. If not, see application indicator. */ /* Private Fields - @id: The ID of the indicator. Maps to AppIndicator::id. - @category: Which category the indicator is. Maps to AppIndicator::category. - @status: The status of the indicator. Maps to AppIndicator::status. - @icon_name: The name of the icon to use. Maps to AppIndicator::icon-name. - @attention_icon_name: The name of the attention icon to use. Maps to AppIndicator::attention-icon-name. - @menu: The menu for this indicator. Maps to AppIndicator::menu - @watcher_proxy: The proxy connection to the watcher we're connected to. If we're not connected to one this will be #NULL. + @id: The ID of the indicator. Maps to AppIndicator:id. + @category: Which category the indicator is. Maps to AppIndicator:category. + @status: The status of the indicator. Maps to AppIndicator:status. + @icon_name: The name of the icon to use. Maps to AppIndicator:icon-name. + @attention_icon_name: The name of the attention icon to use. Maps to AppIndicator:attention-icon-name. + @menu: The menu for this indicator. Maps to AppIndicator:menu + @watcher_proxy: The proxy connection to the watcher we're connected to. If we're not connected to one this will be %NULL. */ struct _AppIndicatorPrivate { /*< Private >*/ @@ -175,38 +175,68 @@ app_indicator_class_init (AppIndicatorClass *klass) klass->unfallback = unfallback; /* Properties */ + + /** + AppIndicator:id: + + The ID for this indicator, which should be unique, but used consistently + by this program and its indicator. + */ g_object_class_install_property (object_class, PROP_ID, g_param_spec_string(PROP_ID_S, "The ID for this indicator", - "An ID that should be unique, but used consistently by this program and it's indicator.", + "An ID that should be unique, but used consistently by this program and its indicator.", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY)); + /** + AppIndicator:category: + + The type of indicator that this represents. Please don't use 'Other'. + Defaults to 'ApplicationStatus'. + */ g_object_class_install_property (object_class, PROP_CATEGORY, g_param_spec_string (PROP_CATEGORY_S, "Indicator Category", - "The type of indicator that this represents. Please don't use 'other'. Defaults to 'Application Status'.", + "The type of indicator that this represents. Please don't use 'other'. Defaults to 'ApplicationStatus'.", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY)); + /** + AppIndicator:status: + + Whether the indicator is shown or requests attention. Defaults to + 'Passive'. + */ g_object_class_install_property (object_class, PROP_STATUS, g_param_spec_string (PROP_STATUS_S, "Indicator Status", - "Whether the indicator is shown or requests attention. Defaults to 'off'.", + "Whether the indicator is shown or requests attention. Defaults to 'Passive'.", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + AppIndicator:icon-name: + + The name of the regular icon that is shown for the indicator. + */ g_object_class_install_property(object_class, - PROP_ICON_NAME, + PROP_ICON_NAME, g_param_spec_string (PROP_ICON_NAME_S, "An icon for the indicator", "The default icon that is shown for the indicator.", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + AppIndicator:attention-icon-name: + + If the indicator sets it's status to %APP_INDICATOR_STATUS_ATTENTION + then this icon is shown. + */ g_object_class_install_property (object_class, PROP_ATTENTION_ICON_NAME, g_param_spec_string (PROP_ATTENTION_ICON_NAME_S, @@ -214,7 +244,12 @@ app_indicator_class_init (AppIndicatorClass *klass) "If the indicator sets it's status to 'attention' then this icon is shown.", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - + /** + AppIndicator:icon-theme-path: + + An additional place to look for icon names that may be installed by the + application. + */ g_object_class_install_property(object_class, PROP_ICON_THEME_PATH, g_param_spec_string (PROP_ICON_THEME_PATH_S, @@ -222,8 +257,13 @@ app_indicator_class_init (AppIndicatorClass *klass) "An additional place to look for icon names that may be installed by the application.", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY)); - - g_object_class_install_property(object_class, + + /** + AppIndicator:menu: + + A method for getting the menu path as a string for DBus. + */ + g_object_class_install_property(object_class, PROP_MENU, g_param_spec_boxed (PROP_MENU_S, "The object path of the menu on DBus.", @@ -231,6 +271,12 @@ app_indicator_class_init (AppIndicatorClass *klass) DBUS_TYPE_G_OBJECT_PATH, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + /** + AppIndicator:connected: + + Pretty simple, %TRUE if we have a reasonable expectation of being + displayed through this object. You should hide your TrayIcon if so. + */ g_object_class_install_property (object_class, PROP_CONNECTED, g_param_spec_boolean (PROP_CONNECTED_S, @@ -246,8 +292,7 @@ app_indicator_class_init (AppIndicatorClass *klass) AppIndicator::new-icon: @arg0: The #AppIndicator object - Signaled when there is a new icon set for the - object. + Emitted when #AppIndicator:icon-name is changed */ signals[NEW_ICON] = g_signal_new (APP_INDICATOR_SIGNAL_NEW_ICON, G_TYPE_FROM_CLASS(klass), @@ -261,8 +306,7 @@ app_indicator_class_init (AppIndicatorClass *klass) AppIndicator::new-attention-icon: @arg0: The #AppIndicator object - Signaled when there is a new attention icon set for the - object. + Emitted when #AppIndicator:attention-icon-name is changed */ signals[NEW_ATTENTION_ICON] = g_signal_new (APP_INDICATOR_SIGNAL_NEW_ATTENTION_ICON, G_TYPE_FROM_CLASS(klass), @@ -277,7 +321,7 @@ app_indicator_class_init (AppIndicatorClass *klass) @arg0: The #AppIndicator object @arg1: The string value of the #AppIndicatorStatus enum. - Signaled when the status of the indicator changes. + Emitted when #AppIndicator:status is changed */ signals[NEW_STATUS] = g_signal_new (APP_INDICATOR_SIGNAL_NEW_STATUS, G_TYPE_FROM_CLASS(klass), @@ -293,8 +337,7 @@ app_indicator_class_init (AppIndicatorClass *klass) @arg0: The #AppIndicator object @arg1: Whether we're connected or not - Signaled when we connect to a watcher, or when it drops - away. + Signaled when we connect to a watcher, or when it drops away. */ signals[CONNECTION_CHANGED] = g_signal_new (APP_INDICATOR_SIGNAL_CONNECTION_CHANGED, G_TYPE_FROM_CLASS(klass), @@ -957,8 +1000,8 @@ append_panel_icon_suffix (const gchar *icon_name) @category: The category of indicator. Creates a new #AppIndicator setting the properties: - #AppIndicator::id with @id, #AppIndicator::category - with @category and #AppIndicator::icon-name with + #AppIndicator:id with @id, #AppIndicator:category + with @category and #AppIndicator:icon-name with @icon_name. Return value: A pointer to a new #AppIndicator object. @@ -985,9 +1028,9 @@ app_indicator_new (const gchar *id, @icon_path: A custom path for finding icons. Creates a new #AppIndicator setting the properties: - #AppIndicator::id with @id, #AppIndicator::category - with @category, #AppIndicator::icon-name with - @icon_name and #AppIndicator::icon-theme-path with @icon_path. + #AppIndicator:id with @id, #AppIndicator:category + with @category, #AppIndicator:icon-name with + @icon_name and #AppIndicator:icon-theme-path with @icon_path. Return value: A pointer to a new #AppIndicator object. */ @@ -1020,7 +1063,7 @@ app_indicator_new_with_path (const gchar *id, @self: The #AppIndicator object to use @status: The status to set for this indicator - Wrapper function for property #AppIndicator::status. + Wrapper function for property #AppIndicator:status. */ void app_indicator_set_status (AppIndicator *self, AppIndicatorStatus status) @@ -1041,7 +1084,7 @@ app_indicator_set_status (AppIndicator *self, AppIndicatorStatus status) @self: The #AppIndicator object to use @icon_name: The name of the attention icon to set for this indicator - Wrapper function for property #AppIndicator::attention-icon. + Wrapper function for property #AppIndicator:attention-icon-name. */ void app_indicator_set_attention_icon (AppIndicator *self, const gchar *icon_name) @@ -1070,6 +1113,7 @@ app_indicator_set_attention_icon (AppIndicator *self, const gchar *icon_name) Sets the default icon to use when the status is active but not set to attention. In most cases, this should be the application icon for the program. + Wrapper function for property #AppIndicator:icon-name. **/ void app_indicator_set_icon (AppIndicator *self, const gchar *icon_name) @@ -1481,6 +1525,8 @@ client_menu_changed (GtkWidget *widget, Sets the menu that should be shown when the Application Indicator is clicked on in the panel. An application indicator will not be rendered unless it has a menu. + + Wrapper function for property #AppIndicator:menu. **/ void app_indicator_set_menu (AppIndicator *self, GtkMenu *menu) @@ -1519,7 +1565,7 @@ app_indicator_set_menu (AppIndicator *self, GtkMenu *menu) app_indicator_get_id: @self: The #AppIndicator object to use - Wrapper function for property #AppIndicator::id. + Wrapper function for property #AppIndicator:id. Return value: The current ID */ @@ -1535,7 +1581,7 @@ app_indicator_get_id (AppIndicator *self) app_indicator_get_category: @self: The #AppIndicator object to use - Wrapper function for property #AppIndicator::category. + Wrapper function for property #AppIndicator:category. Return value: The current category. */ @@ -1551,7 +1597,7 @@ app_indicator_get_category (AppIndicator *self) app_indicator_get_status: @self: The #AppIndicator object to use - Wrapper function for property #AppIndicator::status. + Wrapper function for property #AppIndicator:status. Return value: The current status. */ @@ -1567,7 +1613,7 @@ app_indicator_get_status (AppIndicator *self) app_indicator_get_icon: @self: The #AppIndicator object to use - Wrapper function for property #AppIndicator::icon-name. + Wrapper function for property #AppIndicator:icon-name. Return value: The current icon name. */ @@ -1583,7 +1629,7 @@ app_indicator_get_icon (AppIndicator *self) app_indicator_get_attention_icon: @self: The #AppIndicator object to use - Wrapper function for property #AppIndicator::attention-icon-name. + Wrapper function for property #AppIndicator:attention-icon-name. Return value: The current attention icon name. */ @@ -1600,8 +1646,9 @@ app_indicator_get_attention_icon (AppIndicator *self) @self: The #AppIndicator object to use Gets the menu being used for this application indicator. + Wrapper function for property #AppIndicator:menu. - Return value: A menu object or #NULL if one hasn't been set. + Return value: A #GtkMenu object or %NULL if one hasn't been set. */ GtkMenu * app_indicator_get_menu (AppIndicator *self) diff --git a/src/libappindicator/app-indicator.h b/src/app-indicator.h index 549ab35..e37abd4 100644 --- a/src/libappindicator/app-indicator.h +++ b/src/app-indicator.h @@ -113,11 +113,11 @@ G_BEGIN_DECLS users can find indicators that are similar together. */ typedef enum { /*< prefix=APP_INDICATOR_CATEGORY >*/ - APP_INDICATOR_CATEGORY_APPLICATION_STATUS, - APP_INDICATOR_CATEGORY_COMMUNICATIONS, - APP_INDICATOR_CATEGORY_SYSTEM_SERVICES, - APP_INDICATOR_CATEGORY_HARDWARE, - APP_INDICATOR_CATEGORY_OTHER + APP_INDICATOR_CATEGORY_APPLICATION_STATUS, /*< nick=ApplicationStatus >*/ + APP_INDICATOR_CATEGORY_COMMUNICATIONS, /*< nick=Communications >*/ + APP_INDICATOR_CATEGORY_SYSTEM_SERVICES, /*< nick=SystemServices >*/ + APP_INDICATOR_CATEGORY_HARDWARE, /*< nick=Hardware >*/ + APP_INDICATOR_CATEGORY_OTHER /*< nick=Other >*/ } AppIndicatorCategory; /** @@ -132,9 +132,9 @@ typedef enum { /*< prefix=APP_INDICATOR_CATEGORY >*/ shown by setting it to @APP_INDICATOR_STATUS_ACTIVE. */ typedef enum { /*< prefix=APP_INDICATOR_STATUS >*/ - APP_INDICATOR_STATUS_PASSIVE, - APP_INDICATOR_STATUS_ACTIVE, - APP_INDICATOR_STATUS_ATTENTION + APP_INDICATOR_STATUS_PASSIVE, /*< nick=Passive >*/ + APP_INDICATOR_STATUS_ACTIVE, /*< nick=Active >*/ + APP_INDICATOR_STATUS_ATTENTION /*< nick=NeedsAttention >*/ } AppIndicatorStatus; typedef struct _AppIndicator AppIndicator; diff --git a/src/libappindicator/appindicator-0.1.pc.in b/src/appindicator-0.1.pc.in index b80fded..b80fded 100644 --- a/src/libappindicator/appindicator-0.1.pc.in +++ b/src/appindicator-0.1.pc.in diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index b189a45..15abea3 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -25,6 +25,8 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #endif #include <dbus/dbus-glib.h> +#include "app-indicator.h" +#include "app-indicator-enum-types.h" #include "application-service-appstore.h" #include "application-service-marshal.h" #include "dbus-properties-client.h" @@ -55,17 +57,6 @@ struct _ApplicationServiceAppstorePrivate { AppLruFile * lrufile; }; -#define APP_STATUS_PASSIVE_STR "Passive" -#define APP_STATUS_ACTIVE_STR "Active" -#define APP_STATUS_ATTENTION_STR "NeedsAttention" - -typedef enum _ApplicationStatus ApplicationStatus; -enum _ApplicationStatus { - APP_STATUS_PASSIVE, - APP_STATUS_ACTIVE, - APP_STATUS_ATTENTION -}; - typedef struct _Application Application; struct _Application { gchar * id; @@ -76,7 +67,7 @@ struct _Application { DBusGProxy * dbus_proxy; DBusGProxy * prop_proxy; gboolean validated; /* Whether we've gotten all the parameters and they look good. */ - ApplicationStatus status; + AppIndicatorStatus status; gchar * icon; gchar * aicon; gchar * menu; @@ -102,8 +93,8 @@ static void application_service_appstore_class_init (ApplicationServiceAppstoreC static void application_service_appstore_init (ApplicationServiceAppstore *self); static void application_service_appstore_dispose (GObject *object); static void application_service_appstore_finalize (GObject *object); -static ApplicationStatus string_to_status(const gchar * status_string); -static void apply_status (Application * app, ApplicationStatus status); +static AppIndicatorStatus string_to_status(const gchar * status_string); +static void apply_status (Application * app, AppIndicatorStatus status); G_DEFINE_TYPE (ApplicationServiceAppstore, application_service_appstore, G_TYPE_OBJECT); @@ -249,14 +240,24 @@ get_all_properties_cb (DBusGProxy * proxy, GHashTable * properties, GError * err } /* Simple translation function -- could be optimized */ -static ApplicationStatus +static AppIndicatorStatus string_to_status(const gchar * status_string) { - if (!g_strcmp0(status_string, APP_STATUS_ACTIVE_STR)) - return APP_STATUS_ACTIVE; - if (!g_strcmp0(status_string, APP_STATUS_ATTENTION_STR)) - return APP_STATUS_ATTENTION; - return APP_STATUS_PASSIVE; + GEnumClass * klass = G_ENUM_CLASS(g_type_class_ref(APP_INDICATOR_TYPE_INDICATOR_STATUS)); + g_return_val_if_fail(klass != NULL, APP_INDICATOR_STATUS_PASSIVE); + + AppIndicatorStatus retval = APP_INDICATOR_STATUS_PASSIVE; + + GEnumValue * val = g_enum_get_value_by_nick(klass, status_string); + if (val == NULL) { + g_warning("Unrecognized status '%s' assuming passive.", status_string); + } else { + retval = (AppIndicatorStatus)val->value; + } + + g_type_class_unref(klass); + + return retval; } /* A small helper function to get the position of an application @@ -330,7 +331,7 @@ application_removed_cb (DBusGProxy * proxy, gpointer userdata) Application * app = (Application *)userdata; /* Remove from the panel */ - apply_status(app, APP_STATUS_PASSIVE); + apply_status(app, APP_INDICATOR_STATUS_PASSIVE); /* Destroy the data */ application_free(app); @@ -375,7 +376,7 @@ app_sort_func (gconstpointer a, gconstpointer b, gpointer userdata) it removes it from the panel. If we're coming online, then it add it to the panel. Otherwise it changes the icon. */ static void -apply_status (Application * app, ApplicationStatus status) +apply_status (Application * app, AppIndicatorStatus status) { if (app->status == status) { return; @@ -386,7 +387,7 @@ apply_status (Application * app, ApplicationStatus status) ApplicationServiceAppstorePrivate * priv = APPLICATION_SERVICE_APPSTORE_GET_PRIVATE(appstore); /* This means we're going off line */ - if (status == APP_STATUS_PASSIVE) { + if (status == APP_INDICATOR_STATUS_PASSIVE) { gint position = get_position(app); if (position == -1) return; @@ -397,12 +398,12 @@ apply_status (Application * app, ApplicationStatus status) } else { /* Figure out which icon we should be using */ gchar * newicon = app->icon; - if (status == APP_STATUS_ATTENTION && app->aicon != NULL && app->aicon[0] != '\0') { + if (status == APP_INDICATOR_STATUS_ATTENTION && app->aicon != NULL && app->aicon[0] != '\0') { newicon = app->aicon; } /* Determine whether we're already shown or not */ - if (app->status == APP_STATUS_PASSIVE) { + if (app->status == APP_INDICATOR_STATUS_PASSIVE) { if (can_add_application (priv->applications, app)) { /* Put on panel */ priv->applications = g_list_insert_sorted_with_data (priv->applications, app, app_sort_func, priv->lrufile); @@ -457,7 +458,7 @@ new_icon_cb (DBusGProxy * proxy, GValue value, GError * error, gpointer userdata if (app->icon != NULL) g_free(app->icon); app->icon = g_strdup(newicon); - if (app->status == APP_STATUS_ACTIVE) { + if (app->status == APP_INDICATOR_STATUS_ACTIVE) { gint position = get_position(app); if (position == -1) return; @@ -495,7 +496,7 @@ new_aicon_cb (DBusGProxy * proxy, GValue value, GError * error, gpointer userdat if (app->aicon != NULL) g_free(app->aicon); app->aicon = g_strdup(newicon); - if (app->status == APP_STATUS_ATTENTION) { + if (app->status == APP_INDICATOR_STATUS_ATTENTION) { gint position = get_position(app); if (position == -1) return; @@ -576,7 +577,7 @@ application_service_appstore_application_add (ApplicationServiceAppstore * appst app->dbus_name = g_strdup(dbus_name); app->dbus_object = g_strdup(dbus_object); app->appstore = appstore; - app->status = APP_STATUS_PASSIVE; + app->status = APP_INDICATOR_STATUS_PASSIVE; app->icon = NULL; app->aicon = NULL; app->menu = NULL; diff --git a/tests/Makefile.am b/tests/Makefile.am index d3b18d8..8d356bc 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -142,7 +142,7 @@ XML_REPORT = libappindicator-check-results.xml HTML_REPORT = libappindicator-check-results.html libappindicator-tests: libappindicator-tests-gtester Makefile.am - @echo "#!/bin/sh" > $@ + @echo "#!/bin/bash" > $@ @echo . $(srcdir)/run-xvfb.sh >> $@ @echo $(DBUS_RUNNER) --task ./libappindicator-tests-gtester >> $@ @chmod +x $@ diff --git a/tests/test-libappindicator-dbus-client.c b/tests/test-libappindicator-dbus-client.c index f5482aa..1500213 100644 --- a/tests/test-libappindicator-dbus-client.c +++ b/tests/test-libappindicator-dbus-client.c @@ -25,7 +25,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <dbus/dbus-glib.h> #include <dbus/dbus-glib-bindings.h> #include <dbus/dbus-glib-lowlevel.h> -#include <libappindicator/app-indicator.h> +#include <app-indicator.h> #include "test-defines.h" #include "../src/dbus-shared.h" diff --git a/tests/test-libappindicator-dbus-server.c b/tests/test-libappindicator-dbus-server.c index 2d68950..995d49b 100644 --- a/tests/test-libappindicator-dbus-server.c +++ b/tests/test-libappindicator-dbus-server.c @@ -24,7 +24,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <dbus/dbus-glib.h> #include <dbus/dbus-glib-lowlevel.h> #include <gtk/gtk.h> -#include <libappindicator/app-indicator.h> +#include <app-indicator.h> #include "test-defines.h" static GMainLoop * mainloop = NULL; diff --git a/tests/test-libappindicator-fallback-item.c b/tests/test-libappindicator-fallback-item.c index 9fd1b45..418b779 100644 --- a/tests/test-libappindicator-fallback-item.c +++ b/tests/test-libappindicator-fallback-item.c @@ -2,7 +2,7 @@ #include <glib-object.h> #include <dbus/dbus-glib.h> #include <dbus/dbus-glib-bindings.h> -#include <libappindicator/app-indicator.h> +#include <app-indicator.h> #define TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE (test_libappindicator_fallback_item_get_type ()) #define TEST_LIBAPPINDICATOR_FALLBACK_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_LIBAPPINDICATOR_FALLBACK_ITEM_TYPE, TestLibappindicatorFallbackItem)) @@ -138,7 +138,7 @@ main (int argc, char ** argv) GtkWidget * menu = gtk_menu_new(); app_indicator_set_menu(APP_INDICATOR(item), GTK_MENU(menu)); - g_timeout_add_seconds(1, kill_func, NULL); + g_timeout_add_seconds(2, kill_func, NULL); mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); diff --git a/tests/test-libappindicator-fallback-watcher.c b/tests/test-libappindicator-fallback-watcher.c index 70e01d1..5494082 100644 --- a/tests/test-libappindicator-fallback-watcher.c +++ b/tests/test-libappindicator-fallback-watcher.c @@ -27,6 +27,8 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include "../src/dbus-shared.h" +gboolean kill_func (gpointer userdata); + static GMainLoop * mainloop = NULL; static DBusHandlerResult @@ -36,6 +38,10 @@ dbus_filter (DBusConnection * connection, DBusMessage * message, void * user_dat DBusMessage * reply = dbus_message_new_method_return(message); dbus_connection_send(connection, reply, NULL); dbus_message_unref(reply); + + /* Let the messages get out, but we're done at this point */ + g_timeout_add(50, kill_func, NULL); + return DBUS_HANDLER_RESULT_HANDLED; } @@ -78,7 +84,7 @@ main (int argv, char ** argc) return 1; } - g_usleep(250000); + g_usleep(500000); g_debug("Initing"); @@ -96,8 +102,9 @@ main (int argv, char ** argc) dbus_connection_add_filter(dbus_g_connection_get_connection(session_bus), dbus_filter, NULL, NULL); - /* After we've got the name, let it unfallback, and then we'll drop again */ - g_timeout_add(250, kill_func, NULL); + /* This is the final kill function. It really shouldn't happen + unless we get an error. */ + g_timeout_add(2000, kill_func, NULL); g_debug("Entering Mainloop"); diff --git a/tests/test-libappindicator-status-server.c b/tests/test-libappindicator-status-server.c index 79b1759..8cd5571 100644 --- a/tests/test-libappindicator-status-server.c +++ b/tests/test-libappindicator-status-server.c @@ -25,7 +25,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <dbus/dbus-glib.h> #include <dbus/dbus-glib-lowlevel.h> #include <glib.h> -#include <libappindicator/app-indicator.h> +#include <app-indicator.h> static GMainLoop * mainloop = NULL; static gboolean active = FALSE; diff --git a/tests/test-libappindicator.c b/tests/test-libappindicator.c index c987a8f..86879b3 100644 --- a/tests/test-libappindicator.c +++ b/tests/test-libappindicator.c @@ -23,7 +23,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <glib.h> #include <glib-object.h> -#include <libappindicator/app-indicator.h> +#include <app-indicator.h> void test_libappindicator_prop_signals_status_helper (AppIndicator * ci, gchar * status, gboolean * signalactivated) diff --git a/tests/test-simple-app.c b/tests/test-simple-app.c index f5957c8..d60d9b9 100644 --- a/tests/test-simple-app.c +++ b/tests/test-simple-app.c @@ -24,7 +24,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <dbus/dbus-glib-lowlevel.h> #include <glib.h> #include <libdbusmenu-glib/server.h> -#include <libappindicator/app-indicator.h> +#include <app-indicator.h> static GMainLoop * mainloop = NULL; |