]> git.webhop.me Git - lcd4linux.git/commitdiff
event plugin and dbus interface by Ed Martin
authormichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Sun, 15 Nov 2009 06:49:13 +0000 (06:49 +0000)
committermichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Sun, 15 Nov 2009 06:49:13 +0000 (06:49 +0000)
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1053 3ae390bd-cb1e-0410-b409-cd5a39f66f1f

13 files changed:
Makefile.am
Makefile.in
aclocal.m4
config.h.in
configure
lcd4linux.c
lcd4linux.conf.sample
plugin.c
plugins.m4
smoketest.sh
timer.c
timer.h
widget_text.c

index e3286d5586f4f071074564082a421ff0878443de..c39038760fb3157845035d8dbf1c5ab0bd292eb4 100644 (file)
@@ -38,6 +38,7 @@ thread.c      thread.h        \
 udelay.c      udelay.h        \
 qprintf.c     qprintf.h       \
 rgb.c         rgb.h           \
+event.c       event.h         \
                               \
 widget.c      widget.h        \
 widget_text.c widget_text.h   \
@@ -124,6 +125,7 @@ plugin_apm.c                  \
 plugin_asterisk.c             \
 plugin_button_exec.c          \
 plugin_cpuinfo.c              \
+plugin_dbus.c                 \
 plugin_diskstats.c            \
 plugin_dvb.c                  \
 plugin_exec.c                 \
index 9d11120152d64bd52acf1f3c70bca09164c439a2..7182566f340338478f2edc27927288e3a8b9115e 100644 (file)
@@ -65,12 +65,13 @@ am_lcd4linux_OBJECTS = lcd4linux.$(OBJEXT) cfg.$(OBJEXT) \
        evaluator.$(OBJEXT) property.$(OBJEXT) hash.$(OBJEXT) \
        layout.$(OBJEXT) pid.$(OBJEXT) timer.$(OBJEXT) \
        thread.$(OBJEXT) udelay.$(OBJEXT) qprintf.$(OBJEXT) \
-       rgb.$(OBJEXT) widget.$(OBJEXT) widget_text.$(OBJEXT) \
-       widget_bar.$(OBJEXT) widget_icon.$(OBJEXT) \
-       widget_keypad.$(OBJEXT) widget_timer.$(OBJEXT) \
-       widget_gpo.$(OBJEXT) plugin.$(OBJEXT) plugin_cfg.$(OBJEXT) \
-       plugin_math.$(OBJEXT) plugin_string.$(OBJEXT) \
-       plugin_test.$(OBJEXT) plugin_time.$(OBJEXT)
+       rgb.$(OBJEXT) event.$(OBJEXT) widget.$(OBJEXT) \
+       widget_text.$(OBJEXT) widget_bar.$(OBJEXT) \
+       widget_icon.$(OBJEXT) widget_keypad.$(OBJEXT) \
+       widget_timer.$(OBJEXT) widget_gpo.$(OBJEXT) plugin.$(OBJEXT) \
+       plugin_cfg.$(OBJEXT) plugin_math.$(OBJEXT) \
+       plugin_string.$(OBJEXT) plugin_test.$(OBJEXT) \
+       plugin_time.$(OBJEXT)
 lcd4linux_OBJECTS = $(am_lcd4linux_OBJECTS)
 lcd4linux_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
        $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
@@ -118,6 +119,8 @@ CPPFLAGS = @CPPFLAGS@
 CURSES_INCLUDEDIR = @CURSES_INCLUDEDIR@
 CURSES_LIBS = @CURSES_LIBS@
 CYGPATH_W = @CYGPATH_W@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DRIVERS = @DRIVERS@
@@ -162,6 +165,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
 PLUGINLIBS = @PLUGINLIBS@
 PLUGINS = @PLUGINS@
 POW_LIB = @POW_LIB@
@@ -262,6 +266,7 @@ thread.c      thread.h        \
 udelay.c      udelay.h        \
 qprintf.c     qprintf.h       \
 rgb.c         rgb.h           \
+event.c                       \
                               \
 widget.c      widget.h        \
 widget_text.c widget_text.h   \
@@ -320,6 +325,7 @@ drv_Noritake.c                \
 drv_NULL.c                    \
 drv_Pertelian.c               \
 drv_PHAnderson.c              \
+drv_PICGraphic.c              \
 drv_picoLCD.c                 \
 drv_picoLCDGraphic.c          \
 drv_RouterBoard.c             \
@@ -347,6 +353,7 @@ plugin_apm.c                  \
 plugin_asterisk.c             \
 plugin_button_exec.c          \
 plugin_cpuinfo.c              \
+plugin_dbus.c                 \
 plugin_diskstats.c            \
 plugin_dvb.c                  \
 plugin_exec.c                 \
@@ -536,6 +543,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_NULL.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_Noritake.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_PHAnderson.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_PICGraphic.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_Pertelian.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_RouterBoard.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_Sample.Po@am__quote@
@@ -562,6 +570,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_ula200.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_vnc.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evaluator.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/event.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/layout.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lcd4linux.Po@am__quote@
@@ -572,6 +581,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_button_exec.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_cfg.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_cpuinfo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_dbus.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_diskstats.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_dvb.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_exec.Po@am__quote@
index 23cadd7c04dca060ede5c6bd8769bfa29b56b65f..56f9af53f31a96f97fbbb192d649b1a4e02340ff 100644 (file)
@@ -9172,6 +9172,164 @@ m4_ifndef([_LT_AC_LANG_RC_CONFIG],      [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
 m4_ifndef([AC_LIBTOOL_CONFIG],         [AC_DEFUN([AC_LIBTOOL_CONFIG])])
 m4_ifndef([_LT_AC_FILE_LTDLL_C],       [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
 
+# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
+# 
+# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY 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, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
+# ----------------------------------
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+       AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
+if test -n "$PKG_CONFIG"; then
+       _pkg_min_version=m4_default([$1], [0.9.0])
+       AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
+       if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+               AC_MSG_RESULT([yes])
+       else
+               AC_MSG_RESULT([no])
+               PKG_CONFIG=""
+       fi
+               
+fi[]dnl
+])# PKG_PROG_PKG_CONFIG
+
+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# Check to see whether a particular set of modules exists.  Similar
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
+#
+#
+# Similar to PKG_CHECK_MODULES, make sure that the first instance of
+# this or PKG_CHECK_MODULES is called, or make sure to call
+# PKG_CHECK_EXISTS manually
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+  m4_ifval([$2], [$2], [:])
+m4_ifvaln([$3], [else
+  $3])dnl
+fi])
+
+
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+# ---------------------------------------------
+m4_define([_PKG_CONFIG],
+[if test -n "$PKG_CONFIG"; then
+    if test -n "$$1"; then
+        pkg_cv_[]$1="$$1"
+    else
+        PKG_CHECK_EXISTS([$3],
+                         [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
+                        [pkg_failed=yes])
+    fi
+else
+       pkg_failed=untried
+fi[]dnl
+])# _PKG_CONFIG
+
+# _PKG_SHORT_ERRORS_SUPPORTED
+# -----------------------------
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi[]dnl
+])# _PKG_SHORT_ERRORS_SUPPORTED
+
+
+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+# [ACTION-IF-NOT-FOUND])
+#
+#
+# Note that if there is a possibility the first call to
+# PKG_CHECK_MODULES might not happen, you should be sure to include an
+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
+#
+#
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_MODULES],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
+
+pkg_failed=no
+AC_MSG_CHECKING([for $1])
+
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
+and $1[]_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
+        _PKG_SHORT_ERRORS_SUPPORTED
+        if test $_pkg_short_errors_supported = yes; then
+               $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
+        else 
+               $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+       ifelse([$4], , [AC_MSG_ERROR(dnl
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT
+])],
+               [AC_MSG_RESULT([no])
+                $4])
+elif test $pkg_failed = untried; then
+       ifelse([$4], , [AC_MSG_FAILURE(dnl
+[The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
+               [$4])
+else
+       $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+       $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+        AC_MSG_RESULT([yes])
+       ifelse([$3], , :, [$3])
+fi[]dnl
+])# PKG_CHECK_MODULES
+
 # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
index 3ae5d4261053ebd8c5550814c2fb89bccd6d800c..76539db258bbdede728d9a10e0112de5857cea13 100644 (file)
 /* cpuinfo plugin */
 #undef PLUGIN_CPUINFO
 
+/* dbus plugin */
+#undef PLUGIN_DBUS
+
 /* diskstats plugin */
 #undef PLUGIN_DISKSTATS
 
 /* dvb plugin */
 #undef PLUGIN_DVB
 
+/* event plugin */
+#undef PLUGIN_EVENT
+
 /* exec plugin */
 #undef PLUGIN_EXEC
 
 /* PHAnderson driver */
 #undef WITH_PHANDERSON
 
+/* PICGraphic driver */
+#undef WITH_PICGRAPHIC
+
 /* picoLCD driver */
 #undef WITH_PICOLCD
 
index ec9c3becca6dd78b34aac1655cba1252bd654a0b..3ffc13a2b23861c5e6bea74f56bd4a2117e0370a 100755 (executable)
--- a/configure
+++ b/configure
@@ -773,6 +773,9 @@ build_os
 build_vendor
 build_cpu
 build
+DBUS_LIBS
+DBUS_CFLAGS
+PKG_CONFIG
 DRVLIBS
 DRIVERS
 PYTHON_EXTRA_LDFLAGS
@@ -903,7 +906,10 @@ LIBS
 CPPFLAGS
 CPP
 XMKMF
-PYTHON_VERSION'
+PYTHON_VERSION
+PKG_CONFIG
+DBUS_CFLAGS
+DBUS_LIBS'
 
 
 # Initialize some variables set by options.
@@ -1557,7 +1563,7 @@ Optional Packages:
                           BeckmannEgle, BWCT, CrystalFontz, Curses, Cwlinux, D4D,
                           G15, GLCD2USB, HD44780, IRLCD, LCD2USB, LCDLinux, LCDTerm,
                           LPH7508, LUIse, LW_ABP, M50530, MatrixOrbital, MilfordInstruments,
-                          Noritake, NULL, PNG, PPM, Pertelian, PHAnderson, picoLCD,
+                          Noritake, NULL, PNG, PPM, Pertelian, PHAnderson, PICGraphic, picoLCD,
                           picoLCDGraphic, RouterBoard, Sample, serdisplib, ShuttleVFD,
                           SimpleLCD, st2205, T6963, Trefon, ULA200, USBLCD, USBHUB,
                           VNC, WincorNixdorf, X11
@@ -1587,6 +1593,9 @@ Some influential environment variables:
               The installed Python version to use, for example '2.3'. This
               string will be appended to the Python interpreter canonical
               name.
+  PKG_CONFIG  path to pkg-config utility
+  DBUS_CFLAGS C compiler flags for DBUS, overriding pkg-config
+  DBUS_LIBS   linker flags for DBUS, overriding pkg-config
 
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
@@ -4652,7 +4661,7 @@ $as_echo "Please note that some screen refreshs may fail" >&6; }
 $as_echo_n "checking for ncurses version... " >&6; }
        ncurses_version=unknown
 cat > conftest.$ac_ext <<EOF
-#line 4655 "configure"
+#line 4664 "configure"
 #include "confdefs.h"
 #ifdef RENAMED_NCURSES
 #include <curses.h>
@@ -6192,6 +6201,7 @@ for driver in $drivers; do
          NULL="yes"
          PERTELIAN="yes"
          PHANDERSON="yes"
+         PICGRAPHIC="yes"
          PICOLCD="yes"
         PICOLCDGRAPHIC="yes"
          PNG="yes"
@@ -6292,6 +6302,9 @@ for driver in $drivers; do
       PHAnderson)
          PHANDERSON=$val
          ;;
+      PICGraphic)
+         PICGRAPHIC=$val
+         ;;
       picoLCD)
          PICOLCD=$val
          ;;
@@ -6681,6 +6694,16 @@ $as_echo "#define WITH_PHANDERSON 1" >>confdefs.h
 
 fi
 
+if test "$PICGRAPHIC" = "yes"; then
+   GRAPHIC="yes"
+   GPIO="yes"
+   SERIAL="yes"
+   DRIVERS="$DRIVERS drv_PICGraphic.o"
+
+$as_echo "#define WITH_PICGRAPHIC 1" >>confdefs.h
+
+fi
+
 if test "$PICOLCD" = "yes"; then
    if test "$has_usb" = "true"; then
       TEXT="yes"
@@ -7042,23 +7065,25 @@ for plugin in $plugins; do
    case "$plugin" in
       list)
          { $as_echo "$as_me:${as_lineno-$LINENO}: result: available plugins:
-             apm,cpuinfo,diskstats,dvb,exec,file,gps,i2c_sensors,iconv,imon,isdn,kvv,
-             loadavg,meminfo,mpd,mpris_dbus,mysql,netdev,netinfo,pop3,ppp,proc_stat,
-             sample,seti,statfs,uname,uptime,wireless,xmms" >&5
+             apm,cpuinfo,dbus,diskstats,dvb,exec,event,file,gps,i2c_sensors,iconv,imon,
+             isdn,kvv,loadavg,meminfo,mpd,mpris_dbus,mysql,netdev,netinfo,pop3,ppp,
+             proc_stat,sample,seti,statfs,uname,uptime,wireless,xmms" >&5
 $as_echo "available plugins:
-             apm,cpuinfo,diskstats,dvb,exec,file,gps,i2c_sensors,iconv,imon,isdn,kvv,
-             loadavg,meminfo,mpd,mpris_dbus,mysql,netdev,netinfo,pop3,ppp,proc_stat,
-             sample,seti,statfs,uname,uptime,wireless,xmms" >&6; }
+             apm,cpuinfo,dbus,diskstats,dvb,exec,event,file,gps,i2c_sensors,iconv,imon,
+             isdn,kvv,loadavg,meminfo,mpd,mpris_dbus,mysql,netdev,netinfo,pop3,ppp,
+             proc_stat,sample,seti,statfs,uname,uptime,wireless,xmms" >&6; }
          as_fn_error "run ./configure --with-plugins=..." "$LINENO" 5
          ;;
       all)
          PLUGIN_APM="yes"
-        PLUGIN_ASTERISK="yes"
+                PLUGIN_ASTERISK="yes"
         PLUGIN_BUTTON_EXEC="yes"
          PLUGIN_CPUINFO="yes"
+         PLUGIN_DBUS="yes"
          PLUGIN_DISKSTATS="yes"
          PLUGIN_DVB="yes"
          PLUGIN_EXEC="yes"
+         PLUGIN_EVENT="yes"
          PLUGIN_FIFO="yes"
          PLUGIN_FILE="yes"
          PLUGIN_GPS="yes"
@@ -7101,6 +7126,9 @@ $as_echo "available plugins:
       cpuinfo)
          PLUGIN_CPUINFO=$val
          ;;
+      dbus)
+         PLUGIN_DBUS=$val
+         ;;
       diskstats)
          PLUGIN_DISKSTATS=$val
          ;;
@@ -7110,6 +7138,9 @@ $as_echo "available plugins:
       exec)
          PLUGIN_EXEC=$val
          ;;
+      event)
+         PLUGIN_EVENT=$val
+         ;;
       fifo)
          PLUGIN_FIFO=$val
          ;;
@@ -7255,6 +7286,227 @@ $as_echo "#define PLUGIN_CPUINFO 1" >>confdefs.h
 
 fi
 
+#DBus
+if test "$PLUGIN_DBUS" = "yes"; then
+
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+       if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_PKG_CONFIG"; then
+  ac_pt_PKG_CONFIG=$PKG_CONFIG
+  # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $ac_pt_PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
+if test -n "$ac_pt_PKG_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_pt_PKG_CONFIG" = x; then
+    PKG_CONFIG=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    PKG_CONFIG=$ac_pt_PKG_CONFIG
+  fi
+else
+  PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+fi
+
+fi
+if test -n "$PKG_CONFIG"; then
+       _pkg_min_version=0.9.0
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
+       if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       else
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+               PKG_CONFIG=""
+       fi
+
+fi
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DBUS" >&5
+$as_echo_n "checking for DBUS... " >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$DBUS_CFLAGS"; then
+        pkg_cv_DBUS_CFLAGS="$DBUS_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbus-1\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "dbus-1") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_DBUS_CFLAGS=`$PKG_CONFIG --cflags "dbus-1" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$DBUS_LIBS"; then
+        pkg_cv_DBUS_LIBS="$DBUS_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbus-1\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "dbus-1") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_DBUS_LIBS=`$PKG_CONFIG --libs "dbus-1" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+               DBUS_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "dbus-1"`
+        else
+               DBUS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "dbus-1"`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$DBUS_PKG_ERRORS" >&5
+
+       as_fn_error "Package requirements (dbus-1) were not met:
+
+$DBUS_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables DBUS_CFLAGS
+and DBUS_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+" "$LINENO" 5
+elif test $pkg_failed = untried; then
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables DBUS_CFLAGS
+and DBUS_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details." "$LINENO" 5; }
+else
+       DBUS_CFLAGS=$pkg_cv_DBUS_CFLAGS
+       DBUS_LIBS=$pkg_cv_DBUS_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       :
+fi
+   if test "x$DBUS_LIBS" != "x"; then
+      PLUGINS="$PLUGINS plugin_dbus.o"
+      PLUGINLIBS="$PLUGINLIBS $DBUS_LIBS"
+      CPPFLAGS="$CPPFLAGS $DBUS_CFLAGS"
+
+$as_echo "#define PLUGIN_DBUS 1" >>confdefs.h
+
+   else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: dbus-1 not found check that PKG_CONFIG_PATH is set correctly: dbus plugin disabled" >&5
+$as_echo "$as_me: WARNING: dbus-1 not found check that PKG_CONFIG_PATH is set correctly: dbus plugin disabled" >&2;}
+   fi
+fi
+
 # /proc/diskstat
 if test "$PLUGIN_DISKSTATS" = "yes"; then
    PLUGINS="$PLUGINS plugin_diskstats.o"
@@ -7318,6 +7570,14 @@ $as_echo "#define PLUGIN_EXEC 1" >>confdefs.h
 
 fi
 
+# event
+if test "$PLUGIN_EVENT" = "yes"; then
+   PLUGINS="$PLUGINS plugin_event.o"
+
+$as_echo "#define PLUGIN_EVENT 1" >>confdefs.h
+
+fi
+
 # file
 if test "$PLUGIN_FILE" = "yes"; then
    PLUGINS="$PLUGINS plugin_file.o"
@@ -12153,13 +12413,13 @@ if test "${lt_cv_nm_interface+set}" = set; then :
 else
   lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:12156: $ac_compile\"" >&5)
+  (eval echo "\"\$as_me:12416: $ac_compile\"" >&5)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:12159: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval echo "\"\$as_me:12419: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:12162: output\"" >&5)
+  (eval echo "\"\$as_me:12422: output\"" >&5)
   cat conftest.out >&5
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
@@ -13353,7 +13613,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 13356 "configure"' > conftest.$ac_ext
+  echo '#line 13616 "configure"' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -14611,11 +14871,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14614: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14874: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:14618: \$? = $ac_status" >&5
+   echo "$as_me:14878: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -14950,11 +15210,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14953: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:15213: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:14957: \$? = $ac_status" >&5
+   echo "$as_me:15217: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -15055,11 +15315,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:15058: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:15318: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:15062: \$? = $ac_status" >&5
+   echo "$as_me:15322: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -15110,11 +15370,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:15113: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:15373: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:15117: \$? = $ac_status" >&5
+   echo "$as_me:15377: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -17493,7 +17753,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17496 "configure"
+#line 17756 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -17589,7 +17849,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17592 "configure"
+#line 17852 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
index 79941ca15aea7e2d2ada8943b140e010229c7e70..bf17f5e8af426f99be721bd65aed41795daaa5ae 100644 (file)
@@ -48,7 +48,7 @@
 #include "layout.h"
 #include "plugin.h"
 #include "thread.h"
-
+#include "event.h"
 #include "widget.h"
 #include "widget_timer.h"
 
@@ -389,7 +389,7 @@ int main(int argc, char *argv[])
        struct timespec delay;
        if (timer_process(&delay) < 0)
            break;
-       nanosleep(&delay, NULL);
+       event_process(&delay);
     }
 
     debug("leaving main loop");
index d6d2ab1fc87b790de8fe35d2bbf38b102d71fe41..4df3d509a7576c0d55a4a4469d08abf6a1ec4a88 100644 (file)
@@ -327,7 +327,7 @@ Display HD44780-I2C {
 
 
 Display LCDTerm {
-    Driver 'LCDTerm
+    Driver 'LCDTerm'
     Port '/dev/tts/0'
     Speed 19200
     Size '20x4'
@@ -559,6 +559,31 @@ Plugin Pop3 {
 }
 
 
+Plugin DBus {
+       # signal 0 is displayed IM msg
+       #
+       signal0sender 'im.pidgin.purple.PurpleService'      # should be in the form com.domain.app.service,
+                                                           # the :1.23 form given by dbus-monitor will NOT work,
+                                                           # if unsure skip it
+       signal0path '/im/pidgin/purple/PurpleObject'        # find using dbus-monitor
+       signal0interface 'im.pidgin.purple.PurpleInterface' # find using dbus-monitor
+       signal0member 'DisplayedImMsg'                      # find using dbus-monitor
+       signal0eventname 'got_im' # make something up, all Text widgets with an
+                                 # event option matching this will be updated
+}
+
+
+#this example prints the second argument of signal# 0
+#(in this case it prints the message displayed)
+Widget Pidgin {
+    class 'Text'
+    expression dbus::argument(0, 1) . ': ' . dbus::argument(0, 2))
+    width 20   
+    align 'R'  
+    event 'got_im'     
+}      
+
+
 Widget OS {
     class 'Text'
     expression '*** '.uname('sysname').' '.uname('release').' ***'
index ed400423656e01f6789319d5beeeba55f1ba3b8d..aa44e0d2574c206edbb5433616440104ad8ebb71 100644 (file)
--- a/plugin.c
+++ b/plugin.c
@@ -62,6 +62,9 @@ char *Plugins[] = {
 #ifdef PLUGIN_CPUINFO
     "cpuinfo",
 #endif
+#ifdef PLUGIN_DBUS
+    "dbus",
+#endif
 #ifdef PLUGIN_DISKSTATS
     "diskstats",
 #endif
@@ -71,6 +74,9 @@ char *Plugins[] = {
 #ifdef PLUGIN_EXEC
     "exec",
 #endif
+#ifdef PLUGIN_EVENT
+    "event",
+#endif
 #ifdef PLUGIN_FIFO
     "fifo",
 #endif
@@ -179,12 +185,16 @@ int plugin_init_button_exec(void);
 void plugin_exit_button_exec(void);
 int plugin_init_cpuinfo(void);
 void plugin_exit_cpuinfo(void);
+int plugin_init_dbus(void);
+void plugin_exit_dbus(void);
 int plugin_init_diskstats(void);
 void plugin_exit_diskstats(void);
 int plugin_init_dvb(void);
 void plugin_exit_dvb(void);
 int plugin_init_exec(void);
 void plugin_exit_exec(void);
+int plugin_init_event(void);
+void plugin_exit_event(void);
 int plugin_init_fifo(void);
 void plugin_exit_fifo(void);
 int plugin_init_file(void);
@@ -277,6 +287,9 @@ int plugin_init(void)
 #ifdef PLUGIN_CPUINFO
     plugin_init_cpuinfo();
 #endif
+#ifdef PLUGIN_DBUS
+    plugin_init_dbus();
+#endif
 #ifdef PLUGIN_DISKSTATS
     plugin_init_diskstats();
 #endif
@@ -286,6 +299,9 @@ int plugin_init(void)
 #ifdef PLUGIN_EXEC
     plugin_init_exec();
 #endif
+#ifdef PLUGIN_EVENT
+    plugin_init_event();
+#endif
 #ifdef PLUGIN_FIFO
     plugin_init_fifo();
 #endif
@@ -389,6 +405,9 @@ void plugin_exit(void)
 #ifdef PLUGIN_CPUINFO
     plugin_exit_cpuinfo();
 #endif
+#ifdef PLUGIN_DBUS
+    plugin_exit_dbus();
+#endif
 #ifdef PLUGIN_DISKSTATS
     plugin_exit_diskstats();
 #endif
@@ -398,6 +417,9 @@ void plugin_exit(void)
 #ifdef PLUGIN_EXEC
     plugin_exit_exec();
 #endif
+#ifdef PLUGIN_EVENT
+    plugin_exit_event();
+#endif
 #ifdef PLUGIN_FIFO
     plugin_exit_fifo();
 #endif
index 28aa26dea7f69cd5d621de7514ca813014d080d9..949bdc29506b5e70f9192408594c35de70ca148d 100644 (file)
@@ -53,19 +53,21 @@ for plugin in $plugins; do
       list)
          AC_MSG_RESULT(
             [available plugins:]
-            [ apm,cpuinfo,diskstats,dvb,exec,file,gps,i2c_sensors,iconv,imon,isdn,kvv,]
-            [ loadavg,meminfo,mpd,mpris_dbus,mysql,netdev,netinfo,pop3,ppp,proc_stat,]
-            [ sample,seti,statfs,uname,uptime,wireless,xmms])
+            [ apm,cpuinfo,dbus,diskstats,dvb,exec,event,file,gps,i2c_sensors,iconv,imon,]
+            [ isdn,kvv,loadavg,meminfo,mpd,mpris_dbus,mysql,netdev,netinfo,pop3,ppp,]
+            [ proc_stat,sample,seti,statfs,uname,uptime,wireless,xmms])
          AC_MSG_ERROR([run ./configure --with-plugins=...])
          ;;
       all)
          PLUGIN_APM="yes"
-        PLUGIN_ASTERISK="yes"
+                PLUGIN_ASTERISK="yes"
         PLUGIN_BUTTON_EXEC="yes"
          PLUGIN_CPUINFO="yes"
+         PLUGIN_DBUS="yes"
          PLUGIN_DISKSTATS="yes"
          PLUGIN_DVB="yes"
          PLUGIN_EXEC="yes"
+         PLUGIN_EVENT="yes"
          PLUGIN_FIFO="yes"
          PLUGIN_FILE="yes"
          PLUGIN_GPS="yes"
@@ -108,6 +110,9 @@ for plugin in $plugins; do
       cpuinfo)
          PLUGIN_CPUINFO=$val
          ;;
+      dbus)
+         PLUGIN_DBUS=$val
+         ;;
       diskstats)
          PLUGIN_DISKSTATS=$val
          ;;
@@ -117,6 +122,9 @@ for plugin in $plugins; do
       exec)
          PLUGIN_EXEC=$val
          ;;
+      event)
+         PLUGIN_EVENT=$val
+         ;;
       fifo)
          PLUGIN_FIFO=$val
          ;;
@@ -239,6 +247,19 @@ if test "$PLUGIN_CPUINFO" = "yes"; then
    AC_DEFINE(PLUGIN_CPUINFO,1,[cpuinfo plugin])
 fi
 
+#DBus
+if test "$PLUGIN_DBUS" = "yes"; then
+   PKG_CHECK_MODULES(DBUS, dbus-1)
+   if test "x$DBUS_LIBS" != "x"; then
+      PLUGINS="$PLUGINS plugin_dbus.o"
+      PLUGINLIBS="$PLUGINLIBS $DBUS_LIBS"
+      CPPFLAGS="$CPPFLAGS $DBUS_CFLAGS"
+      AC_DEFINE(PLUGIN_DBUS,1,[dbus plugin])
+   else
+      AC_MSG_WARN(dbus-1 not found check that PKG_CONFIG_PATH is set correctly: dbus plugin disabled)
+   fi
+fi
+
 # /proc/diskstat
 if test "$PLUGIN_DISKSTATS" = "yes"; then
    PLUGINS="$PLUGINS plugin_diskstats.o"
@@ -268,6 +289,12 @@ if test "$PLUGIN_EXEC" = "yes"; then
    AC_DEFINE(PLUGIN_EXEC,1,[exec plugin])
 fi
 
+# event
+if test "$PLUGIN_EVENT" = "yes"; then
+   PLUGINS="$PLUGINS plugin_event.o"
+   AC_DEFINE(PLUGIN_EVENT,1,[event plugin])
+fi
+
 # file
 if test "$PLUGIN_FILE" = "yes"; then
    PLUGINS="$PLUGINS plugin_file.o"
index 37de78a0e6e119765b93804a06c37d2630cfe0a1..0a86ddb514abe627195e9cc4b58cef962558b75a 100755 (executable)
@@ -23,7 +23,7 @@ for driver in BeckmannEgle BWCT CrystalFontz Curses Cwlinux D4D EA232graphic G15
     
 done
 
-for plugin in apm asterisk button_exec cpuinfo diskstats dvb exec fifo file hddtemp i2c_sensors iconv imon isdn kvv loadavg meminfo mpd mysql netdev netinfo pop3 ppp proc_stat python sample seti statfs uname uptime w1retap wireless xmms; do
+for plugin in apm asterisk button_exec cpuinfo dbus diskstats dvb exec fifo file hddtemp i2c_sensors iconv imon isdn kvv loadavg meminfo mpd mysql netdev netinfo pop3 ppp proc_stat python sample seti statfs uname uptime w1retap wireless xmms; do
 
     make distclean
     ./configure --with-drivers=NULL --with-plugins=$plugin
diff --git a/timer.c b/timer.c
index 751a7e19f2c8b7eaf253faa5517857f1d2d021ca..5ac2965d31b88860128834d4db72155a8bb2c30a 100644 (file)
--- a/timer.c
+++ b/timer.c
  * int timer_process (struct timespec *delay);
  *   process timer queue
  *
+ * int timer_remove(void (*callback) (void *data), void *data);
+ *   remove a timer with given callback and data
+ *
+ * int timer_add_late(void (*callback) (void *data), void *data, const int interval, const int one_shot)
+ *   same as timer_add, but the one shot does not fire now (useful for scheduling things)
+ *
  * void timer_exit();
  *   release all timers
  *
@@ -80,6 +86,38 @@ static void timer_inc(struct timeval *tv, const int msec)
     }
 }
 
+int timer_remove(void (*callback) (void *data), void *data)
+{
+    int i;
+    for (i = 0; i < nTimers; i++) {
+       if (Timers[i].callback == callback && Timers[i].data == data && Timers[i].active) {
+           Timers[i].active = 0;
+           return 0;
+       }
+    }
+    return -1;
+}
+
+int timer_add_late(void (*callback) (void *data), void *data, const int interval, const int one_shot)
+{
+    if (!timer_add(callback, data, interval, 1)) {
+       return -1;
+    }
+    if (one_shot) {
+       return 0;
+    }
+    int i;
+    for (i = 0; i < nTimers; i++) {
+       if (Timers[i].callback == callback && Timers[i].data == data && Timers[i].active
+           && Timers[i].interval == interval && Timers[i].one_shot) {
+           //we forced it to one_shot when adding to make it late (which gives us the alternate behavior)
+           Timers[i].one_shot = one_shot;
+           return 0;
+       }
+    }
+
+    return -1;
+}
 
 int timer_add(void (*callback) (void *data), void *data, const int interval, const int one_shot)
 {
diff --git a/timer.h b/timer.h
index 4803ae1dfba4e30b4357b584c54a5262628c90dc..9135a5e512673086c605a1d4a58f5cefb3053baa 100644 (file)
--- a/timer.h
+++ b/timer.h
@@ -29,6 +29,9 @@
 #define _TIMER_H_
 
 int timer_add(void (*callback) (void *data), void *data, const int interval, const int one_shot);
+//exactly the same as above but does not trigger now
+int timer_add_late(void (*callback) (void *data), void *data, const int interval, const int one_shot);
+int timer_remove(void (*callback) (void *data), void *data);
 int timer_process(struct timespec *delay);
 void timer_exit();
 
index 1678812b39bb1d20fccb7f77d6f8ecaf2de82855..f5699dcc1ef87984efcfd6a59e6d7bdd917d8257 100644 (file)
 #include "evaluator.h"
 #include "property.h"
 #include "timer.h"
+#include "event.h"
 #include "widget.h"
 #include "widget_text.h"
-#
+
 #ifdef WITH_DMALLOC
 #include <dmalloc.h>
 #endif
@@ -346,6 +347,16 @@ int widget_text_init(WIDGET * Self)
     if (Text->align == ALIGN_MARQUEE || Text->align == ALIGN_AUTOMATIC || Text->align == ALIGN_PINGPONG) {
        cfg_number(section, "speed", 500, 10, -1, &(Text->speed));
     }
+    //update on this event
+    char *event_name = cfg_get(section, "event", "");
+    if (*event_name != '\0') {
+       named_event_add(event_name, widget_text_update, Self);
+       if (Text->update == 1000) {
+           Text->update = 0;
+       }
+    }
+    free(event_name);
+
 
     /* buffer */
     Text->buffer = malloc(Text->width + 1);