Build system

Configure

In configure.ac a variable should be defined that contains the location where the .panel-applet files are installed. You can fetch this directory during configure with the following code:

                       LIBPANEL_APPLET_DIR=`$PKG_CONFIG --variable=libpanel_applet_dir libpanel-applet`
                       AC_SUBST(LIBPANEL_APPLET_DIR)
                   

Makefiles

A typical Makefile for that is used to build and install an applet contains the following declarations:
  • A rule to install the .panel-applet file.

  • A rule to install the D-Bus service file if the applet is an out process applet.

  • The .panel-applet file and the D-Bus .service file are added to EXTRA_DIST and CLEANFILES.

Installing the Panel Applet File

                           appletdir       = $(LIBPANEL_APPLET_DIR)
                           applet_in_files = org.gnome.HelloWorld.panel-applet.in
                           applet_DATA     = $(applet_in_files:.panel-applet.in=.panel-applet)

                           $(applet_in_files): $(applet_in_files).in Makefile
                               $(AM_V_GEN)sed \
                               -e "s|\@LIBEXECDIR\@|$(libexecdir)|" \
                               -e "s|\@VERSION\@|$(PACKAGE_VERSION)|" \
                               $< > $@

                           %.panel-applet: %.panel-applet.in \
                                           $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; \
                                           $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
                       

Installing the D-Bus service file

To install the service file the following rule can be placed in the applets Makefile:

                           servicedir       = $(datadir)/dbus-1/services
                           service_in_files = org.gnome.panel.applet.HelloWorldFactory.service.in
                           service_DATA     = $(service_in_files:.service.in=.service)

                           org.gnome.panel.applet.HelloWorldFactory.service: $(service_in_files)
                               $(AM_V_GEN) sed -e "s|\@LOCATION\@|$(APPLET_LOCATION)|" $< > $@
                       

Distribution and Cleanup

Add panel-applet .in.in and service file to EXTRA_DIST and $(applet_DATA) $(applet_DATA).in to CLEANFILES

                       EXTRA_DIST = \
                           GNOME_MixerApplet.panel-applet.in.in \
                           $(service_in_files) \
                           $(ui_DATA) \
                           $(schemas_in_files)

                       CLEANFILES = $(applet_DATA) $(applet_DATA).in $(service_DATA) $(schemas_DATA)