From 79ee7381ad65688995ff37e290d58dcaa0c2ec08 Mon Sep 17 00:00:00 2001 From: Dave Peticolas Date: Sat, 8 Jul 2000 12:35:12 +0000 Subject: [PATCH] Bill Gribble's patch to add gtkhtml support, key-value pairs, and g-wrapping of the query api. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2545 57a11ea4-9604-0410-9ed3-97b8803252fd --- Makefile.in | 1 - acconfig.h | 4 +- config.h.in | 3 + configure | 170 +++--- configure.in | 56 +- debian/Makefile.in | 1 - doc/examples/Makefile.in | 1 - doc/html/C/Makefile.in | 1 - doc/html/C/image/Makefile.in | 1 - doc/html/Makefile.in | 1 - doc/html/fr/Makefile.in | 1 - doc/html/fr/image/Makefile.in | 1 - rpm/Makefile.in | 1 - src/Makefile.in | 1 - src/doc/Makefile.in | 1 - src/engine/Account.c | 35 ++ src/engine/Account.h | 5 + src/engine/AccountP.h | 6 + src/engine/Makefile.am | 6 +- src/engine/Makefile.in | 10 +- src/engine/Transaction.c | 67 +++ src/engine/Transaction.h | 21 + src/engine/TransactionP.h | 13 + src/engine/guid.h | 2 +- src/engine/kvp_frame.c | 526 ++++++++++++++++++ src/engine/kvp_frame.h | 95 ++++ src/engine/sql/Makefile.in | 1 - src/experimental/Makefile.in | 1 - src/experimental/cbb/Makefile.in | 1 - src/experimental/cbb/cbb-engine/Makefile.in | 1 - src/experimental/gg/Makefile.in | 1 - src/experimental/ofx/Makefile.in | 1 - src/experimental/ofx/dtd/Makefile.in | 1 - src/experimental/ofx/explore/Makefile.in | 1 - src/experimental/ofx/parser/Makefile.in | 1 - src/gnome/Makefile.in | 1 - src/gnome/print-session.c | 6 + src/gnome/top-level.c | 45 +- src/gnome/window-help.c | 44 +- src/gnome/window-html.c | 579 ++++++++++++++------ src/gnome/window-html.h | 50 +- src/gnome/window-report.c | 19 +- src/optional/Makefile.in | 1 - src/optional/swig/Makefile.in | 1 - src/pixmaps/Makefile.in | 1 - src/quotes/Makefile.in | 1 - src/register/Makefile.in | 1 - src/register/gnome/Makefile.in | 1 - src/scm/Makefile.in | 1 - src/scm/gnumeric/Makefile.in | 1 - src/scm/printing/Makefile.in | 1 - src/scm/printing/print-check.scm | 36 +- src/scm/qif-import/Makefile.in | 1 - src/scm/report/Makefile.in | 1 - src/scm/srfi/Makefile.in | 1 - 55 files changed, 1351 insertions(+), 480 deletions(-) create mode 100644 src/engine/kvp_frame.c create mode 100644 src/engine/kvp_frame.h diff --git a/Makefile.in b/Makefile.in index a31d85b5ff..c354092feb 100644 --- a/Makefile.in +++ b/Makefile.in @@ -81,7 +81,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/acconfig.h b/acconfig.h index eab6ce7b37..3928e474f7 100644 --- a/acconfig.h +++ b/acconfig.h @@ -63,8 +63,8 @@ /* If configure found libXpm, then use it */ #define HAVE_XPM -/* Use the new XmHTML widdget instead of the old htmlw widget */ -#define HAVE_LIBXMHTML 1 +/* Use the new gtkhtml widget instead of the old xmhtml widget */ +#define HAVE_LIBGTKHTML 1 /* use gnomeprint if it's available */ #undef HAVE_LIBGNOMEPRINT diff --git a/config.h.in b/config.h.in index cb84b731ee..627e6d71b4 100644 --- a/config.h.in +++ b/config.h.in @@ -78,6 +78,9 @@ /* If configure found libXpm, then use it */ #define HAVE_XPM +/* Use the new gtkhtml widget instead of the old xmhtml widget */ +#define HAVE_LIBGTKHTML 1 + /* use gnomeprint if it's available */ #undef HAVE_LIBGNOMEPRINT diff --git a/configure b/configure index afb6e4e7ec..93a3c759e6 100755 --- a/configure +++ b/configure @@ -5296,7 +5296,7 @@ if test "${with_imlib+set}" = set; then fi -# the XmHTML widget needs libz, libjpeg, and libpng. +# the gtkhtml widget needs libz, libjpeg, and libpng. # it also uses #ifdef's not #if's so DONT #def to zero. echo $ac_n "checking for deflateEnd in -lz""... $ac_c" 1>&6 echo "configure:5303: checking for deflateEnd in -lz" >&5 @@ -5482,108 +5482,12 @@ EOF fi -### ------------------------------------------------------------------------- -## gtk-xmhtml -# if gtk-xmhtml header or library not found, gnome builds are disabled -# make gnome will run make gnome.disabled which echoes a warning message - -## XXX - need to do this because gtk-xmhtml requires glibconfig.h -## and I don't want CPPFLAGS permanently altered. -## If there's a better way to tackle this please let me know! - -OLDCPPFLAGS="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS `$GNOME_CONFIG_BIN --cflags gnome`" - - -# gnome targets if all goes well -# XXX - should we shift these to the rest of the gnome configuration -# section? - -GNOME_TARGET="gnome.real" -GNOME_STATIC_TARGET="gnome.static.real" - -#AC_CHECK_HEADER might work, but I'm not sure it uses CPPFLAGS -# this guarantees it - it works. Promise!! -echo $ac_n "checking gtk-xmhtml/gtk-xmhtml.h""... $ac_c" 1>&6 -echo "configure:5509: checking gtk-xmhtml/gtk-xmhtml.h" >&5 -cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5516: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - echo "$ac_t""yes" 1>&6 -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - { echo "configure: error: Cannot find gtk-xmhtml.h. See the README for more info." 1>&2; exit 1; } -fi -rm -f conftest* - -#undo damage to CPPFLAGS -CPPFLAGS="$OLDCPPFLAGS" - - -### -------------------------------------------------------------------------- -EXTRALIBS=`$GNOME_CONFIG_BIN --libs gtkxmhtml` - -#check for gtkxmhtml, export library link to variable GTK_XMHTML -echo $ac_n "checking for gtk_xmhtml_new in -lgtkxmhtml""... $ac_c" 1>&6 -echo "configure:5539: checking for gtk_xmhtml_new in -lgtkxmhtml" >&5 -ac_lib_var=`echo gtkxmhtml'_'gtk_xmhtml_new | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lgtkxmhtml $EXTRALIBS $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - GTK_XMHTML="gtkxmhtml" -else - echo "$ac_t""no" 1>&6 -{ echo "configure: error: Cannot find libgtkxmhtml. See the README for more info." 1>&2; exit 1; } -fi - - - - ### -------------------------------------------------------------------------- EXTRALIBS=`$GNOME_CONFIG_BIN --libs xml` #check for libxml echo $ac_n "checking for xmlDefaultSAXHandlerInit in -lxml""... $ac_c" 1>&6 -echo "configure:5587: checking for xmlDefaultSAXHandlerInit in -lxml" >&5 +echo "configure:5491: checking for xmlDefaultSAXHandlerInit in -lxml" >&5 ac_lib_var=`echo xml'_'xmlDefaultSAXHandlerInit | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5591,7 +5495,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lxml $EXTRALIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5510: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5630,7 +5534,7 @@ EXTRALIBS=`$GNOME_CONFIG_BIN --libs print` # check for gnome-print and enable it via HAVE_LIBGNOMEPRINT # if found echo $ac_n "checking for gnome_print_context_new in -lgnomeprint""... $ac_c" 1>&6 -echo "configure:5634: checking for gnome_print_context_new in -lgnomeprint" >&5 +echo "configure:5538: checking for gnome_print_context_new in -lgnomeprint" >&5 ac_lib_var=`echo gnomeprint'_'gnome_print_context_new | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5638,7 +5542,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgnomeprint $EXTRALIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5557: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5673,6 +5577,55 @@ else echo "$ac_t""no" 1>&6 fi +### -------------------------------------------------------------------------- +EXTRALIBS=`$GNOME_CONFIG_BIN --libs gtkhtml` + +# check for gtkhtml and enable it via HAVE_LIBGTKHTML +# if found +echo $ac_n "checking for gtk_html_new in -lgtkhtml""... $ac_c" 1>&6 +echo "configure:5587: checking for gtk_html_new in -lgtkhtml" >&5 +ac_lib_var=`echo gtkhtml'_'gtk_html_new | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lgtkhtml $EXTRALIBS $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + GNOMEBUILDLIBS="${GNOMEBUILDLIBS} gtkhtml" + cat >> confdefs.h <<\EOF +#define HAVE_LIBGTKHTML 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + @@ -5688,7 +5641,7 @@ cat >> confdefs.h <<\EOF EOF -GNOMEBUILDLIBS="gnomeui gnome gtkxmhtml xml ${GNOMEBUILDLIBS}" +GNOMEBUILDLIBS="gnomeui gnome xml ${GNOMEBUILDLIBS}" if test "${GNOME_CONFIG_BIN}"x != GNOME_CONFIG_NOT_FOUNDx then @@ -5709,7 +5662,7 @@ G_WRAP_LINK_ARGS="" # Extract the first word of "g-wrap-config", so it can be a program name with args. set dummy g-wrap-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5713: checking for $ac_word" >&5 +echo "configure:5666: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_G_WRAP_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5753,7 +5706,7 @@ fi # Extract the first word of "g-wrap", so it can be a program name with args. set dummy g-wrap; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5757: checking for $ac_word" >&5 +echo "configure:5710: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_G_WRAP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5811,7 +5764,7 @@ GUILE_LINK_ARGS="" # Extract the first word of "guile-config", so it can be a program name with args. set dummy guile-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5815: checking for $ac_word" >&5 +echo "configure:5768: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GUILE_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5855,7 +5808,7 @@ fi # Extract the first word of "guile", so it can be a program name with args. set dummy guile; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5859: checking for $ac_word" >&5 +echo "configure:5812: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GUILE'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6141,7 +6094,6 @@ s%@X_CFLAGS@%$X_CFLAGS%g s%@X_PRE_LIBS@%$X_PRE_LIBS%g s%@X_LIBS@%$X_LIBS%g s%@X_EXTRA_LIBS@%$X_EXTRA_LIBS%g -s%@GTK_XMHTML@%$GTK_XMHTML%g s%@GNOME_TARGET@%$GNOME_TARGET%g s%@GNOME_STATIC_TARGET@%$GNOME_STATIC_TARGET%g s%@GNOME_CFLAGS@%$GNOME_CFLAGS%g diff --git a/configure.in b/configure.in index 92cd8d8381..7b65bd9574 100644 --- a/configure.in +++ b/configure.in @@ -264,7 +264,7 @@ AC_ARG_WITH( imlib, [ --with-imlib=PATH specify where to look for imlib includes and libs], X_LIBS="${X_LIBS} -L$with_imlib/lib" X_CFLAGS="$X_CFLAGS -I$with_imlib/include" ) -# the XmHTML widget needs libz, libjpeg, and libpng. +# the gtkhtml widget needs libz, libjpeg, and libpng. # it also uses #ifdef's not #if's so DONT #def to zero. AC_CHECK_LIB(z, deflateEnd, AC_DEFINE(HAVE_ZLIB,1)) @@ -284,48 +284,6 @@ AC_CHECK_LIB(Xpm, XpmReadFileToXpmImage, AC_MSG_ERROR([Cannot find required Xpm library]), $X_PRE_LIBS -lX11 $X_LIBS $X_EXTRA_LIBS) -### ------------------------------------------------------------------------- -## gtk-xmhtml -# if gtk-xmhtml header or library not found, gnome builds are disabled -# make gnome will run make gnome.disabled which echoes a warning message - -## XXX - need to do this because gtk-xmhtml requires glibconfig.h -## and I don't want CPPFLAGS permanently altered. -## If there's a better way to tackle this please let me know! - -OLDCPPFLAGS="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS `$GNOME_CONFIG_BIN --cflags gnome`" - - -# gnome targets if all goes well -# XXX - should we shift these to the rest of the gnome configuration -# section? - -GNOME_TARGET="gnome.real" -GNOME_STATIC_TARGET="gnome.static.real" - -#AC_CHECK_HEADER might work, but I'm not sure it uses CPPFLAGS -# this guarantees it - it works. Promise!! -AC_MSG_CHECKING([gtk-xmhtml/gtk-xmhtml.h]) -AC_TRY_CPP([#include ], - AC_MSG_RESULT(yes), - AC_MSG_ERROR([Cannot find gtk-xmhtml.h. See the README for more info.])) - -#undo damage to CPPFLAGS -CPPFLAGS="$OLDCPPFLAGS" - - -### -------------------------------------------------------------------------- -EXTRALIBS=`$GNOME_CONFIG_BIN --libs gtkxmhtml` - -#check for gtkxmhtml, export library link to variable GTK_XMHTML -AC_CHECK_LIB(gtkxmhtml, gtk_xmhtml_new, - GTK_XMHTML="gtkxmhtml", - AC_MSG_ERROR([Cannot find libgtkxmhtml. See the README for more info.]), - $EXTRALIBS) -AC_SUBST(GTK_XMHTML) - - ### -------------------------------------------------------------------------- EXTRALIBS=`$GNOME_CONFIG_BIN --libs xml` @@ -345,6 +303,16 @@ AC_CHECK_LIB(gnomeprint, gnome_print_context_new, AC_DEFINE(HAVE_LIBGNOMEPRINT), , $EXTRALIBS) +### -------------------------------------------------------------------------- +EXTRALIBS=`$GNOME_CONFIG_BIN --libs gtkhtml` + +# check for gtkhtml and enable it via HAVE_LIBGTKHTML +# if found +AC_CHECK_LIB(gtkhtml, gtk_html_new, + GNOMEBUILDLIBS="${GNOMEBUILDLIBS} gtkhtml" + AC_DEFINE(HAVE_LIBGTKHTML), + , + $EXTRALIBS) AC_SUBST(GNOME_TARGET) AC_SUBST(GNOME_STATIC_TARGET) @@ -357,7 +325,7 @@ AC_SUBST(GNOME_STATIC_TARGET) GNOME=1 AC_DEFINE(GNOME) -GNOMEBUILDLIBS="gnomeui gnome gtkxmhtml xml ${GNOMEBUILDLIBS}" +GNOMEBUILDLIBS="gnomeui gnome xml ${GNOMEBUILDLIBS}" if test "${GNOME_CONFIG_BIN}"x != GNOME_CONFIG_NOT_FOUNDx then diff --git a/debian/Makefile.in b/debian/Makefile.in index 43dd6f9da7..d06c23b281 100644 --- a/debian/Makefile.in +++ b/debian/Makefile.in @@ -84,7 +84,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/doc/examples/Makefile.in b/doc/examples/Makefile.in index ad9e0dda3f..ab3c7fce3f 100644 --- a/doc/examples/Makefile.in +++ b/doc/examples/Makefile.in @@ -81,7 +81,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/doc/html/C/Makefile.in b/doc/html/C/Makefile.in index 603602153f..3a99790f43 100644 --- a/doc/html/C/Makefile.in +++ b/doc/html/C/Makefile.in @@ -81,7 +81,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/doc/html/C/image/Makefile.in b/doc/html/C/image/Makefile.in index 615718d87e..af90f31a45 100644 --- a/doc/html/C/image/Makefile.in +++ b/doc/html/C/image/Makefile.in @@ -81,7 +81,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/doc/html/Makefile.in b/doc/html/Makefile.in index ddeabac6d1..eb3754c96b 100644 --- a/doc/html/Makefile.in +++ b/doc/html/Makefile.in @@ -81,7 +81,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/doc/html/fr/Makefile.in b/doc/html/fr/Makefile.in index 5b15af13d9..34d0b06225 100644 --- a/doc/html/fr/Makefile.in +++ b/doc/html/fr/Makefile.in @@ -81,7 +81,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/doc/html/fr/image/Makefile.in b/doc/html/fr/image/Makefile.in index ed62c56b28..8fe7622969 100644 --- a/doc/html/fr/image/Makefile.in +++ b/doc/html/fr/image/Makefile.in @@ -81,7 +81,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/rpm/Makefile.in b/rpm/Makefile.in index 07b1840ecc..9e23f6e682 100644 --- a/rpm/Makefile.in +++ b/rpm/Makefile.in @@ -81,7 +81,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/src/Makefile.in b/src/Makefile.in index 29a33a5498..2b2d89180f 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -81,7 +81,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/src/doc/Makefile.in b/src/doc/Makefile.in index 070f86a0e5..fe51810efc 100644 --- a/src/doc/Makefile.in +++ b/src/doc/Makefile.in @@ -81,7 +81,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/src/engine/Account.c b/src/engine/Account.c index 99bbefec99..5308730408 100644 --- a/src/engine/Account.c +++ b/src/engine/Account.c @@ -221,6 +221,41 @@ xaccAccountCommitEdit (Account *acc) acc->open = 0; } + +/******************************************************************** + * xaccAccountGetSlot + ********************************************************************/ + +kvp_value * +xaccAccountGetSlot(Account * account, const char * key) { + if(!account || !key || !(account->kvp_data)) { + return NULL; + } + else { + return kvp_frame_get_slot(account->kvp_data, key); + } +} + + +/******************************************************************** + * xaccAccountSetSlot + ********************************************************************/ + +void +xaccAccountSetSlot(Account * account, const char * key, + const kvp_value * value) { + if(!account || !key || !value) { + return; + } + else { + if(!account->kvp_data) { + account->kvp_data = kvp_frame_new(); + } + kvp_frame_set_slot(account->kvp_data, key, value); + } +} + + /********************************************************************\ \********************************************************************/ diff --git a/src/engine/Account.h b/src/engine/Account.h index ab108abe9a..e226263f6c 100644 --- a/src/engine/Account.h +++ b/src/engine/Account.h @@ -28,6 +28,7 @@ #include "config.h" #include "AccInfo.h" #include "Transaction.h" +#include "kvp_frame.h" #include "GNCId.h" @@ -50,6 +51,10 @@ void xaccFreeAccount( Account * ); void xaccAccountBeginEdit (Account *, int defer); void xaccAccountCommitEdit (Account *); +kvp_value * xaccAccountGetSlot(Account * account, const char * key); +void xaccAccountSetSlot(Account * account, const char * key, + const kvp_value * value); + /* * The xaccAccountGetGUID() subroutine will return the * globally unique id associated with that account. diff --git a/src/engine/AccountP.h b/src/engine/AccountP.h index 742c574804..0c4e021ddf 100644 --- a/src/engine/AccountP.h +++ b/src/engine/AccountP.h @@ -43,6 +43,7 @@ #define __XACC_ACCOUNT_P_H__ #include "config.h" +#include "kvp_frame.h" #include "AccInfo.h" #include "GNCId.h" #include "Transaction.h" @@ -83,6 +84,11 @@ struct _account { */ char *notes; + /* kvp_data is a key-value pair database for storing simple + * "extra" information in splits, transactions, and accounts. + * it's NULL until accessed. */ + kvp_frame * kvp_data; + /* The type field is the account type, picked from the enumerated * list that includes BANK, STOCK, CREDIT, INCOME, etc. Its * intended use is to be a hint to the GUI as to how to display diff --git a/src/engine/Makefile.am b/src/engine/Makefile.am index 87ad45b908..b2be8de1f8 100644 --- a/src/engine/Makefile.am +++ b/src/engine/Makefile.am @@ -24,7 +24,8 @@ libgncengine_la_SOURCES = \ util.c \ GNCId.c \ guid.c \ - md5.c + md5.c \ + kvp_frame.c libgncengine_la_LDFLAGS = -version-info 1:1:1 @@ -53,7 +54,8 @@ noinst_HEADERS = \ gnc-common.h \ guid.h \ md5.h \ - util.h + util.h \ + kvp_frame.h EXTRA_DIST = \ .cvsignore \ diff --git a/src/engine/Makefile.in b/src/engine/Makefile.in index 200ed53f80..35986995c4 100644 --- a/src/engine/Makefile.in +++ b/src/engine/Makefile.in @@ -83,7 +83,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ @@ -124,12 +123,12 @@ SUBDIRS = sql lib_LTLIBRARIES = libgncengine.la # Build hell from main.c and libhello.la -libgncengine_la_SOURCES = AccInfo.c Account.c Backend.c DateUtils.c FileIO.c Group.c LedgerUtils.c Query.c Queue.c Scrub.c Session.c Transaction.c TransLog.c date.c util.c GNCId.c guid.c md5.c +libgncengine_la_SOURCES = AccInfo.c Account.c Backend.c DateUtils.c FileIO.c Group.c LedgerUtils.c Query.c Queue.c Scrub.c Session.c Transaction.c TransLog.c date.c util.c GNCId.c guid.c md5.c kvp_frame.c libgncengine_la_LDFLAGS = -version-info 1:1:1 -noinst_HEADERS = AccInfo.h AccInfoP.h Account.h AccountP.h BackendP.h DateUtils.h FileIO.h FileIOP.h GNCId.h GNCIdP.h Group.h GroupP.h LedgerUtils.h Query.h Queue.h Scrub.h Session.h TransLog.h Transaction.h TransactionP.h date.h gnc-common.h guid.h md5.h util.h +noinst_HEADERS = AccInfo.h AccInfoP.h Account.h AccountP.h BackendP.h DateUtils.h FileIO.h FileIOP.h GNCId.h GNCIdP.h Group.h GroupP.h LedgerUtils.h Query.h Queue.h Scrub.h Session.h TransLog.h Transaction.h TransactionP.h date.h gnc-common.h guid.h md5.h util.h kvp_frame.h EXTRA_DIST = .cvsignore README.query-api design.txt extensions.txt @@ -155,7 +154,8 @@ X_PRE_LIBS = @X_PRE_LIBS@ libgncengine_la_LIBADD = libgncengine_la_OBJECTS = AccInfo.lo Account.lo Backend.lo DateUtils.lo \ FileIO.lo Group.lo LedgerUtils.lo Query.lo Queue.lo Scrub.lo Session.lo \ -Transaction.lo TransLog.lo date.lo util.lo GNCId.lo guid.lo md5.lo +Transaction.lo TransLog.lo date.lo util.lo GNCId.lo guid.lo md5.lo \ +kvp_frame.lo COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) @@ -173,7 +173,7 @@ DEP_FILES = .deps/AccInfo.P .deps/Account.P .deps/Backend.P \ .deps/DateUtils.P .deps/FileIO.P .deps/GNCId.P .deps/Group.P \ .deps/LedgerUtils.P .deps/Query.P .deps/Queue.P .deps/Scrub.P \ .deps/Session.P .deps/TransLog.P .deps/Transaction.P .deps/date.P \ -.deps/guid.P .deps/md5.P .deps/util.P +.deps/guid.P .deps/kvp_frame.P .deps/md5.P .deps/util.P SOURCES = $(libgncengine_la_SOURCES) OBJECTS = $(libgncengine_la_OBJECTS) diff --git a/src/engine/Transaction.c b/src/engine/Transaction.c index 8cfa9d7334..6597357f55 100644 --- a/src/engine/Transaction.c +++ b/src/engine/Transaction.c @@ -108,6 +108,8 @@ xaccInitSplit(Split * split) split->cost_basis = 0.0; split->ticket = 0; + split->kvp_data = NULL; + xaccGUIDNew(&split->guid); xaccStoreEntity(split, &split->guid, GNC_ID_SPLIT); } @@ -193,6 +195,37 @@ xaccFreeSplit( Split *split ) _free(split); } +/******************************************************************** + * xaccSplitGetSlot + ********************************************************************/ + +kvp_value * +xaccSplitGetSlot(Split * split, const char * key) { + if(!split || !key || !(split->kvp_data)) { + return NULL; + } + else { + return kvp_frame_get_slot(split->kvp_data, key); + } +} + +/******************************************************************** + * xaccSplitSetSlot + ********************************************************************/ + +void +xaccSplitSetSlot(Split * split, const char * key, const kvp_value * value) { + if(!split || !key || !value) { + return; + } + else { + if(!split->kvp_data) { + split->kvp_data = kvp_frame_new(); + } + kvp_frame_set_slot(split->kvp_data, key, value); + } +} + /********************************************************************\ \********************************************************************/ @@ -410,6 +443,8 @@ xaccInitTransaction( Transaction * trans ) trans->open = 0; trans->orig = NULL; + trans->kvp_data = NULL; + xaccGUIDNew(&trans->guid); xaccStoreEntity(trans, &trans->guid, GNC_ID_TRANS); } @@ -526,6 +561,38 @@ xaccFreeTransaction( Transaction *trans ) LEAVE ("addr=%p\n", trans); } +/******************************************************************** + * xaccTransGetSlot + ********************************************************************/ + +kvp_value * +xaccTransGetSlot(Transaction * trans, const char * key) { + if(!trans || !key || !(trans->kvp_data)) { + return NULL; + } + else { + return kvp_frame_get_slot(trans->kvp_data, key); + } +} + +/******************************************************************** + * xaccTransSetSlot + ********************************************************************/ + +void +xaccTransSetSlot(Transaction * trans, const char * key, + const kvp_value * value) { + if(!trans || !key || !value) { + return; + } + else { + if(!trans->kvp_data) { + trans->kvp_data = kvp_frame_new(); + } + kvp_frame_set_slot(trans->kvp_data, key, value); + } +} + /********************************************************************\ \********************************************************************/ diff --git a/src/engine/Transaction.h b/src/engine/Transaction.h index 9eeff98e46..cada062c22 100644 --- a/src/engine/Transaction.h +++ b/src/engine/Transaction.h @@ -30,6 +30,7 @@ #include #include "gnc-common.h" +#include "kvp_frame.h" #include "GNCId.h" @@ -159,6 +160,16 @@ gncBoolean xaccTransIsOpen (Transaction *trans); const GUID * xaccTransGetGUID (Transaction *trans); Transaction * xaccTransLookup (const GUID *guid); + +/* xaccTransGetSlot and xaccTransSetSlot reference the kvp_data + * field of the transaction. kvp_data is used to store arbitrary + * strings, numbers, and structures which aren't "official" members + * of the transaction structure. */ + +kvp_value * xaccTransGetSlot(Transaction * trans, const char * key); +void xaccTransSetSlot(Transaction * trans, const char * key, + const kvp_value * value); + /* Convert a day, month, and year to a Timespec */ Timespec gnc_dmy2timespec(int day, int month, int year); @@ -312,6 +323,16 @@ double xaccTransGetImbalance (Transaction * trans); Split * xaccMallocSplit (void); void xaccInitSplit (Split *); /* clears a split struct */ + +/* xaccSplitGetSlot and xaccSplitSetSlot reference the kvp_data field + * of the split. kvp_data is used to store arbitrary strings, + * numbers, and structures which aren't "official" members of the + * split structure. */ + +kvp_value * xaccSplitGetSlot(Split * split, const char * key); +void xaccSplitSetSlot(Split * split, const char * key, + const kvp_value * value); + /* * The xaccSplitGetGUID() subroutine will return the * globally unique id associated with that split. diff --git a/src/engine/TransactionP.h b/src/engine/TransactionP.h index 4135d853ce..e3c91656e4 100644 --- a/src/engine/TransactionP.h +++ b/src/engine/TransactionP.h @@ -2,6 +2,7 @@ * TransactionP.h -- defines transaction for xacc (X-Accountant) * * Copyright (C) 1997 Robin D. Clark * * Copyright (C) 1997, 1998, 1999, 2000 Linas Vepstas * + * Copyright (C) 2000 Bill Gribble * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License as * @@ -45,8 +46,10 @@ #define __XACC_TRANSACTION_P_H__ #include +#include #include "config.h" +#include "kvp_frame.h" #include "Transaction.h" /* for typedefs */ #include "GNCId.h" @@ -99,6 +102,11 @@ struct _split */ char * docref; + /* kvp_data is a key-value pair database for storing simple + * "extra" information in splits, transactions, and accounts. + * it's NULL until accessed. */ + kvp_frame * kvp_data; + /* The reconciled field ... */ char reconciled; @@ -158,6 +166,11 @@ struct _transaction */ char * docref; + /* kvp_data is a key-value pair database for storing simple + * "extra" information in splits, transactions, and accounts. + * it's NULL until accessed. */ + kvp_frame * kvp_data; + Split **splits; /* list of splits, null terminated */ /* marker is used to track the progress of transaction traversals. diff --git a/src/engine/guid.h b/src/engine/guid.h index fe9c6578ca..6f332cf0dc 100644 --- a/src/engine/guid.h +++ b/src/engine/guid.h @@ -22,7 +22,7 @@ \********************************************************************/ #ifndef __GUID__ -#define __GUID__ 1 +#define __GUID__ #ifdef HAVE_CONFIG_H # include diff --git a/src/engine/kvp_frame.c b/src/engine/kvp_frame.c new file mode 100644 index 0000000000..f013f8e3b4 --- /dev/null +++ b/src/engine/kvp_frame.c @@ -0,0 +1,526 @@ +/******************************************************************** + * kvp_frame.h -- a key-value frame system for gnucash. * + * Copyright (C) 2000 Bill Gribble * + * * + * 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, contact: * + * * + * Free Software Foundation Voice: +1-617-542-5942 * + * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * + * Boston, MA 02111-1307, USA gnu@gnu.org * + * * + ********************************************************************/ + +#include "kvp_frame.h" +#include "guid.h" + +#include +#include + +struct _kvp_frame { + GHashTable * hash; +}; + +struct _kvp_list { + GList * list; +}; + +struct _kvp_value_int64 { + kvp_value_t type; + gint64 value; +}; + +struct _kvp_value_float64 { + kvp_value_t type; + double value; +}; + +struct _kvp_value_string { + kvp_value_t type; + char * value; +}; + +struct _kvp_value_guid { + kvp_value_t type; + GUID * value; +}; + +struct _kvp_value_binary { + kvp_value_t type; + void * value; + int datasize; +}; + +struct _kvp_value_frame { + kvp_value_t type; + kvp_frame * value; +}; + +struct _kvp_value_list { + kvp_value_t type; + kvp_list * value; +}; + +union _kvp_value { + kvp_value_t type; + struct _kvp_value_int64 int64; + struct _kvp_value_float64 float64; + struct _kvp_value_string str; + struct _kvp_value_guid guid; + struct _kvp_value_binary binary; + struct _kvp_value_list list; + struct _kvp_value_frame frame; +}; + + +/******************************************************************** + * kvp_frame functions + ********************************************************************/ + +static guint +kvp_hash_func(gconstpointer v) { + return g_str_hash(v); +} + +static gint +kvp_comp_func(gconstpointer v, gconstpointer v2) { + return g_str_equal(v, v2); +} + +kvp_frame * +kvp_frame_new() { + kvp_frame * retval = g_new0(kvp_frame, 1); + retval->hash = g_hash_table_new(&kvp_hash_func, + &kvp_comp_func); + return retval; +} + +static void +kvp_frame_delete_worker(gpointer key, gpointer value, gpointer user_data) { + kvp_value_delete((kvp_value *)value); +} + +void +kvp_frame_delete(kvp_frame * frame) { + /* free any allocated resource for frame or its children */ + g_hash_table_foreach(frame->hash, & kvp_frame_delete_worker, + (gpointer)frame); + + /* delete the hash table */ + g_hash_table_destroy(frame->hash); + frame->hash = NULL; + g_free(frame); +} + +static void +kvp_frame_copy_worker(gpointer key, gpointer value, gpointer user_data) { + kvp_frame * dest = (kvp_frame *)user_data; + g_hash_table_freeze(dest->hash); + g_hash_table_insert(dest->hash, + (gpointer)strdup(key), + (gpointer)kvp_value_copy(value)); + g_hash_table_thaw(dest->hash); +} + +kvp_frame * +kvp_frame_copy(const kvp_frame * frame) { + kvp_frame * retval = kvp_frame_new(); + g_hash_table_foreach(frame->hash, + & kvp_frame_copy_worker, + (gpointer)retval); + return retval; +} + +void +kvp_frame_set_slot(kvp_frame * frame, const char * slot, + const kvp_value * value) { + g_hash_table_freeze(frame->hash); + g_hash_table_insert(frame->hash, + (gpointer)strdup(slot), + (gpointer)kvp_value_copy(value)); + g_hash_table_thaw(frame->hash); +} + +kvp_value * +kvp_frame_get_slot(kvp_frame * frame, const char * slot) { + return (kvp_value *)g_hash_table_lookup(frame->hash, slot); +} + +/******************************************************************** + * kvp_list functions + ********************************************************************/ + +kvp_list * +kvp_list_new() { + kvp_list * retval = g_new0(kvp_list, 1); + retval->list = NULL; + return retval; +} + +static void +kvp_list_delete_worker(gpointer datum, gpointer user_data) { + kvp_value * val = (kvp_value *)datum; + kvp_value_delete(val); +} + +void +kvp_list_delete(kvp_list * list) { + if(list) { + if(list->list) { + /* delete the data in the list */ + g_list_foreach(list->list, & kvp_list_delete_worker, NULL); + + /* free the backbone */ + g_list_free(list->list); + } + g_free(list); + } +} + +kvp_list * +kvp_list_copy(const kvp_list * list) { + kvp_list * retval = kvp_list_new(); + GList * lptr; + + if(!list) return retval; + + /* duplicate the backbone of the list (this duplicates the POINTERS + * to the values; we need to deep-copy the values separately) */ + retval->list = g_list_copy(list->list); + + /* this step deep-copies the values */ + for(lptr = retval->list; lptr; lptr = lptr->next) { + lptr->data = kvp_value_copy(lptr->data); + } + + return retval; +} + +int +kvp_list_null_p(const kvp_list * list) { + return (!list || (list->list == NULL)); +} + +kvp_value * +kvp_list_car(kvp_list * list) { + if(!list || (list->list == NULL)) { + return NULL; + } + else { + return (kvp_value *)(list->list->data); + } +} + +kvp_list * +kvp_list_cdr(kvp_list * list) { + kvp_list * retval; + if(!list || (list->list == NULL)) { + return NULL; + } + else { + retval = kvp_list_new(); + retval->list = list->list->next; + return retval; + } +} + +/* cons semantics are "hand over": you give it pointers to + * your objects and the list handles them after that. */ + +kvp_list * +kvp_list_cons(kvp_value * car, kvp_list * cdr) { + kvp_list * retval; + if(!car || !cdr) { + return NULL; + } + else { + retval = kvp_list_new(); + retval->list = g_list_prepend( cdr->list, (gpointer)car); + + cdr->list = NULL; + kvp_list_delete(cdr); + return retval; + } +} + +kvp_list * +kvp_list_1(kvp_value * value) { + kvp_list * retval = kvp_list_new(); + + retval = kvp_list_cons(value, retval); + + return retval; +} + +kvp_list * +kvp_list_2(kvp_value * value1, kvp_value * value2) { + kvp_list * retval = kvp_list_new(); + + retval = kvp_list_cons(value2, retval); + retval = kvp_list_cons(value1, retval); + + return retval; +} + +kvp_list * +kvp_list_3(kvp_value * value1, kvp_value * value2, + kvp_value * value3) { + kvp_list * retval = kvp_list_new(); + + retval = kvp_list_cons(value3, retval); + retval = kvp_list_cons(value2, retval); + retval = kvp_list_cons(value1, retval); + + return retval; +} + +kvp_list * +kvp_list_4(kvp_value * value1, kvp_value * value2, + kvp_value * value3, kvp_value * value4) { + kvp_list * retval = kvp_list_new(); + + retval = kvp_list_cons(value4, retval); + retval = kvp_list_cons(value3, retval); + retval = kvp_list_cons(value2, retval); + retval = kvp_list_cons(value1, retval); + + return retval; +} + + +kvp_list * +kvp_list_5(kvp_value * value1, kvp_value * value2, + kvp_value * value3, kvp_value * value4, + kvp_value * value5) { + kvp_list * retval = kvp_list_new(); + + retval = kvp_list_cons(value5, retval); + retval = kvp_list_cons(value4, retval); + retval = kvp_list_cons(value3, retval); + retval = kvp_list_cons(value2, retval); + retval = kvp_list_cons(value1, retval); + + return retval; +} + +/******************************************************************** + * kvp_value functions + ********************************************************************/ + +kvp_value * +kvp_value_new() { + kvp_value * retval = g_new0(kvp_value, 1); + retval->type = KVP_TYPE_NONE; + return retval; +} + +kvp_value * +kvp_value_new_int64(gint64 value) { + kvp_value * retval = g_new0(kvp_value, 1); + retval->type = KVP_TYPE_INT64; + retval->int64.value = value; + return retval; +} + +kvp_value * +kvp_value_new_float64(double value) { + kvp_value * retval = g_new0(kvp_value, 1); + retval->type = KVP_TYPE_FLOAT64; + retval->float64.value = value; + return retval; +} + +kvp_value * +kvp_value_new_string(const char * value) { + kvp_value * retval = g_new0(kvp_value, 1); + retval->type = KVP_TYPE_STRING; + retval->str.value = strdup(value); + return retval; +} + +kvp_value * +kvp_value_new_guid(const GUID * value) { + kvp_value * retval = g_new0(kvp_value, 1); + retval->type = KVP_TYPE_GUID; + retval->guid.value = g_new0(GUID, 1); + memcpy(retval->guid.value, value, sizeof(GUID)); + return retval; +} + +kvp_value * +kvp_value_new_binary(const void * value, int datasize) { + kvp_value * retval = g_new0(kvp_value, 1); + retval->type = KVP_TYPE_BINARY; + retval->binary.value = g_new0(char, datasize); + retval->binary.datasize = datasize; + memcpy(retval->binary.value, value, datasize); + return retval; +} + +kvp_value * +kvp_value_new_list(const kvp_list * value) { + kvp_value * retval = g_new0(kvp_value, 1); + retval->type = KVP_TYPE_LIST; + retval->list.value = kvp_list_copy(value); + return retval; +} + +kvp_value * +kvp_value_new_frame(const kvp_frame * value) { + kvp_value * retval = g_new0(kvp_value, 1); + retval->type = KVP_TYPE_FRAME; + retval->frame.value = kvp_frame_copy(value); + return retval; +} + +void +kvp_value_delete(kvp_value * value) { + if(!value) return; + + switch(value->type) { + case KVP_TYPE_STRING: + g_free(value->str.value); + break; + case KVP_TYPE_GUID: + g_free(value->guid.value); + break; + case KVP_TYPE_BINARY: + g_free(value->binary.value); + break; + case KVP_TYPE_LIST: + kvp_list_delete(value->list.value); + break; + case KVP_TYPE_FRAME: + kvp_frame_delete(value->frame.value); + break; + + case KVP_TYPE_NONE: + case KVP_TYPE_INT64: + case KVP_TYPE_FLOAT64: + default: + } + g_free(value); +} + +kvp_value_t +kvp_value_get_type(const kvp_value * value) { + return value->type; +} + +gint64 +kvp_value_get_int64(const kvp_value * value) { + if(value->type == KVP_TYPE_INT64) { + return value->int64.value; + } + else { + return 0; + } +} + +double +kvp_value_get_float64(const kvp_value * value) { + if(value->type == KVP_TYPE_FLOAT64) { + return value->float64.value; + } + else { + return 0.0; + } +} + +char * +kvp_value_get_string(const kvp_value * value) { + if(value->type == KVP_TYPE_STRING) { + return value->str.value; + } + else { + return NULL; + } +} + +GUID * +kvp_value_get_guid(const kvp_value * value) { + if(value->type == KVP_TYPE_GUID) { + return value->guid.value; + } + else { + return NULL; + } +} + +void * +kvp_value_get_binary(const kvp_value * value, int * size_return) { + if(value->type == KVP_TYPE_BINARY) { + *size_return = value->binary.datasize; + return value->binary.value; + } + else { + *size_return = 0; + return NULL; + } +} + +kvp_list * +kvp_value_get_list(const kvp_value * value) { + if(value->type == KVP_TYPE_LIST) { + return value->list.value; + } + else { + return NULL; + } +} + +kvp_frame * +kvp_value_get_frame(const kvp_value * value) { + if(value->type == KVP_TYPE_FRAME) { + return value->frame.value; + } + else { + return NULL; + } +} + +kvp_value * +kvp_value_copy(const kvp_value * value) { + + if(!value) return NULL; + + switch(value->type) { + case KVP_TYPE_INT64: + return kvp_value_new_int64(value->int64.value); + break; + case KVP_TYPE_FLOAT64: + return kvp_value_new_float64(value->float64.value); + break; + case KVP_TYPE_STRING: + return kvp_value_new_string(value->str.value); + break; + case KVP_TYPE_GUID: + return kvp_value_new_guid(value->guid.value); + break; + case KVP_TYPE_BINARY: + return kvp_value_new_binary(value->binary.value, + value->binary.datasize); + break; + case KVP_TYPE_LIST: + return kvp_value_new_list(value->list.value); + break; + case KVP_TYPE_FRAME: + return kvp_value_new_frame(value->frame.value); + break; + case KVP_TYPE_NONE: + return kvp_value_new(); + break; + } + return NULL; +} + diff --git a/src/engine/kvp_frame.h b/src/engine/kvp_frame.h new file mode 100644 index 0000000000..18dcc8b52d --- /dev/null +++ b/src/engine/kvp_frame.h @@ -0,0 +1,95 @@ +/********************************************************************\ + * kvp_frame.h -- a key-value frame system for gnucash. + * Copyright (C) 2000 Bill Gribble * + * * + * 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, contact: * + * * + * Free Software Foundation Voice: +1-617-542-5942 * + * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * + * Boston, MA 02111-1307, USA gnu@gnu.org * + * * +\********************************************************************/ + +#ifndef __KVP_FRAME_H__ +#define __KVP_FRAME_H__ + +#include +#include +#include + +/* a kvp_frame is a set of associations between character strings + * (keys) and kvp_value structures. A kvp_value is a union with + * possible types enumerated in the kvp_value_t enum. + * + * Pointers passed as arguments into set_slot and get_slot are the + * responsibility of the caller. Pointers returned by get_slot are + * the responsibility of the caller (they point to newly-allocated + * structures which are deep value copies of those in the frame). + * + * kvp_frame_delete and kvp_value_delete are deep (recursive) deletes. + * kvp_frame_copy and kvp_value_copy are deep value copies. */ + +typedef enum { KVP_TYPE_NONE, + KVP_TYPE_INT64, KVP_TYPE_FLOAT64, + KVP_TYPE_STRING, KVP_TYPE_GUID, KVP_TYPE_BINARY, + KVP_TYPE_LIST, KVP_TYPE_FRAME } kvp_value_t; + +typedef struct _kvp_frame kvp_frame; +typedef struct _kvp_list kvp_list; +typedef union _kvp_value kvp_value; + +/* kvp_frame functions */ +kvp_frame * kvp_frame_new(); +void kvp_frame_delete(kvp_frame * frame); +kvp_frame * kvp_frame_copy(const kvp_frame * frame); +void kvp_frame_set_slot(kvp_frame * frame, + const char * key, const kvp_value * value); +kvp_value * kvp_frame_get_slot(kvp_frame * frame, + const char * key); + +kvp_value * kvp_value_new(); +void kvp_value_delete(kvp_value * value); +kvp_value * kvp_value_copy(const kvp_value * value); + +/* kvp_list functions */ +kvp_list * kvp_list_new(); +void kvp_list_delete(kvp_list * list); +kvp_list * kvp_list_copy(const kvp_list * list); +int kvp_list_null_p(const kvp_list * list); + +kvp_value * kvp_list_car(kvp_list * list); +kvp_list * kvp_list_cdr(kvp_list * list); +kvp_list * kvp_list_cons(kvp_value * car, kvp_list * cdr); + +/* value constructors (copying for pointer args) */ +kvp_value * kvp_value_new_int64(gint64 value); +kvp_value * kvp_value_new_float64(double value); +kvp_value * kvp_value_new_string(const char * value); +kvp_value * kvp_value_new_guid(const GUID * guid); +kvp_value * kvp_value_new_binary(const void * data, int datasize); +kvp_value * kvp_value_new_list(const kvp_list * value); +kvp_value * kvp_value_new_frame(const kvp_frame * value); + +/* value accessors (NON-copying for frames/lists/guids/binary) */ +kvp_value_t kvp_value_get_type(const kvp_value * val); + +gint64 kvp_value_get_int64(const kvp_value * val); +double kvp_value_get_float64(const kvp_value * val); +char * kvp_value_get_string(const kvp_value * val); +GUID * kvp_value_get_guid(const kvp_value * val); +void * kvp_value_get_binary(const kvp_value * val, int * size_return); +kvp_list * kvp_value_get_list(const kvp_value * val); +kvp_frame * kvp_value_get_frame(const kvp_value * val); + +#endif diff --git a/src/engine/sql/Makefile.in b/src/engine/sql/Makefile.in index 911cffb6a2..f34c21aa68 100644 --- a/src/engine/sql/Makefile.in +++ b/src/engine/sql/Makefile.in @@ -84,7 +84,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/src/experimental/Makefile.in b/src/experimental/Makefile.in index 96d2ba2c5f..c256fb6018 100644 --- a/src/experimental/Makefile.in +++ b/src/experimental/Makefile.in @@ -81,7 +81,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/src/experimental/cbb/Makefile.in b/src/experimental/cbb/Makefile.in index 19e200e13c..1d12bec3b7 100644 --- a/src/experimental/cbb/Makefile.in +++ b/src/experimental/cbb/Makefile.in @@ -81,7 +81,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/src/experimental/cbb/cbb-engine/Makefile.in b/src/experimental/cbb/cbb-engine/Makefile.in index 61ae23d7bd..a5792e5e42 100644 --- a/src/experimental/cbb/cbb-engine/Makefile.in +++ b/src/experimental/cbb/cbb-engine/Makefile.in @@ -81,7 +81,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/src/experimental/gg/Makefile.in b/src/experimental/gg/Makefile.in index 324633792b..3d711ec29e 100644 --- a/src/experimental/gg/Makefile.in +++ b/src/experimental/gg/Makefile.in @@ -81,7 +81,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/src/experimental/ofx/Makefile.in b/src/experimental/ofx/Makefile.in index f454d85813..91a4b92976 100644 --- a/src/experimental/ofx/Makefile.in +++ b/src/experimental/ofx/Makefile.in @@ -81,7 +81,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/src/experimental/ofx/dtd/Makefile.in b/src/experimental/ofx/dtd/Makefile.in index ff11a4ef46..757e969b52 100644 --- a/src/experimental/ofx/dtd/Makefile.in +++ b/src/experimental/ofx/dtd/Makefile.in @@ -81,7 +81,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/src/experimental/ofx/explore/Makefile.in b/src/experimental/ofx/explore/Makefile.in index f460a7cf9a..d62d580bcb 100644 --- a/src/experimental/ofx/explore/Makefile.in +++ b/src/experimental/ofx/explore/Makefile.in @@ -81,7 +81,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/src/experimental/ofx/parser/Makefile.in b/src/experimental/ofx/parser/Makefile.in index 826067be59..b493333b23 100644 --- a/src/experimental/ofx/parser/Makefile.in +++ b/src/experimental/ofx/parser/Makefile.in @@ -81,7 +81,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/src/gnome/Makefile.in b/src/gnome/Makefile.in index 682ffc4287..53c777f6fc 100644 --- a/src/gnome/Makefile.in +++ b/src/gnome/Makefile.in @@ -81,7 +81,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/src/gnome/print-session.c b/src/gnome/print-session.c index 0b647bd0ed..6bed3cb775 100644 --- a/src/gnome/print-session.c +++ b/src/gnome/print-session.c @@ -234,6 +234,7 @@ gnc_ui_print_dialog_ok_cb(GtkWidget * widget, gpointer user_data) { } else { gnc_print_session_print(pcd->session); + gnc_print_session_done(pcd->session); gnc_ui_print_dialog_destroy(pcd); } } @@ -276,6 +277,9 @@ gnc_print_session_create() { void gnc_print_session_destroy(PrintSession * ps) { gtk_object_unref(GTK_OBJECT(ps->meta)); + if(ps->printer) + gtk_object_unref(GTK_OBJECT(ps->printer)); + gtk_object_unref(GTK_OBJECT(ps->default_font)); g_free(ps->paper); @@ -315,6 +319,8 @@ gnc_print_session_print(PrintSession * ps) { pc = gnome_print_context_new(ps->printer); gnome_print_meta_render_from_object(GNOME_PRINT_CONTEXT(pc), GNOME_PRINT_META(ps->meta)); + gnome_print_context_close(pc); + gtk_object_unref(GTK_OBJECT(pc)); } #else diff --git a/src/gnome/top-level.c b/src/gnome/top-level.c index 1261ea8137..f051215932 100644 --- a/src/gnome/top-level.c +++ b/src/gnome/top-level.c @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include "gnome-top-level.h" #include "window-main.h" @@ -71,8 +73,8 @@ static void gnc_configure_register_borders(void); static void gnc_configure_reverse_balance_cb(void *); static void gnc_configure_reverse_balance(void); static void gnc_configure_sr_label_callbacks(); -static void gnc_configure_auto_raise_cb(void *); -static void gnc_configure_auto_raise(void); +static void gnc_configure_auto_raise_cb(void * foo) { } +static void gnc_configure_auto_raise(void) { } static void gnc_configure_auto_decimal_cb(void *); static void gnc_configure_auto_decimal(void); static void gnc_configure_register_font_cb(void *); @@ -80,7 +82,6 @@ static void gnc_configure_register_font(void); static void gnc_configure_register_hint_font_cb(void *); static void gnc_configure_register_hint_font(void); - /** GLOBALS *********************************************************/ /* This static indicates the debugging module that this .o belongs to. */ static short module = MOD_GUI; @@ -147,7 +148,12 @@ gnucash_ui_init() { gnome_init("GnuCash", NULL, fake_argc, fake_argv); gnome_is_initialized = TRUE; - + + /* initialization required for gtkhtml */ + gdk_rgb_init (); + gtk_widget_set_default_colormap (gdk_rgb_get_cmap ()); + gtk_widget_set_default_visual (gdk_rgb_get_visual ()); + app = gnome_app_new("GnuCash", "GnuCash"); gnc_options_init(); @@ -646,37 +652,6 @@ gnc_configure_register_borders(void) gnucash_style_set_register_borders (reg_borders); } -/* gnc_configure_auto_raise_cb - * Callback called when options change - sets - * auto-raise status of combocell class - * - * Args: Nothing - * Returns: Nothing - */ -static void -gnc_configure_auto_raise_cb(void *data) -{ - gnc_configure_auto_raise(); -} - -/* gnc_configure_auto_raise - * sets combocell auto raise status - * - * Args: Nothing - * Returns: Nothing - */ -static void -gnc_configure_auto_raise(void) -{ - gncBoolean auto_pop; - - auto_pop = gnc_lookup_boolean_option("Register", - "Auto-Raise Lists", - GNC_T); - - xaccComboCellSetAutoPop(auto_pop); -} - /* gnc_configure_reverse_balance_cb * Callback called when options change - sets * reverse balance info for the callback diff --git a/src/gnome/window-help.c b/src/gnome/window-help.c index 233be4867f..3dcd7dcbe9 100644 --- a/src/gnome/window-help.c +++ b/src/gnome/window-help.c @@ -109,36 +109,35 @@ help_data_set_text(HelpData *help_data, const gchar *text) static HTMLData * -helpAnchorCB(XmHTMLAnchorCallbackStruct *acbs, HTMLUserData user_data) +helpAnchorCB(URLType url_type, char * location, char * label, + HTMLUserData user_data) { HelpData *user = user_data; HTMLData *html_data; HelpData *help_data; - switch(acbs->url_type) - { + switch(url_type) { /* a local file with a possible jump to label */ - case ANCHOR_FILE_LOCAL: - help_data = help_data_new(); - help_data_set_file(help_data, acbs->href); - help_data_set_title(help_data, user->title); + case URL_TYPE_FILE: + help_data = help_data_new(); + help_data_set_file(help_data, location); + help_data_set_title(help_data, user->title); - html_data = gnc_html_data_new(user->title, help_data, - help_data_destroy, - NULL, 0); + html_data = gnc_html_data_new(user->title, help_data, + help_data_destroy, + NULL, 0); + return html_data; + break; - return html_data; - - /* other types use gnome_url_show */ - case ANCHOR_FTP: - case ANCHOR_HTTP: - case ANCHOR_MAILTO: - case ANCHOR_UNKNOWN: - default: - gnome_url_show(acbs->href); - break; + /* other types use gnc_url_show */ + default: + gnc_url_show(url_type, location, label); + return NULL; + break; } + g_warning("What's going on?\n"); + return NULL; } @@ -173,8 +172,9 @@ helpJumpCB(HTMLUserData user_data, char **set_text, char **set_label) } /* if text to display wasn't specified, use the truncated name to read */ - if (text == NULL) - text = gncReadFile(help_data->htmlfile); + if (text == NULL) { + gncReadFile(help_data->htmlfile, &text); + } if (text != NULL) { diff --git a/src/gnome/window-html.c b/src/gnome/window-html.c index 565bb132b1..a655d6070b 100644 --- a/src/gnome/window-html.c +++ b/src/gnome/window-html.c @@ -4,6 +4,7 @@ * Copyright (C) 1998 Linas Vepstas * * Copyright (C) 1999 Jeremy Collins ( gtk-xmhtml port ) * * Copyright (C) 2000 Linas Vepstas * + * Copyright (C) 2000 Bill Gribble * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License as * @@ -23,19 +24,26 @@ * Boston, MA 02111-1307, USA gnu@gnu.org * \********************************************************************/ +#include "config.h" + #include +#include +#include +#include +#include +#include +#include +#include -#include "top-level.h" - +#include "gnucash.h" +#include "messages.h" #include "window-html.h" #include "dialog-utils.h" #include "global-options.h" -#include "messages.h" +#include "print-session.h" #include "File.h" #include "util.h" -static short module = MOD_HTML; - /********************************************************************\ * HTML History functions * @@ -312,40 +320,96 @@ historyDestroy(HTMLHistory *history) struct _HTMLWindow { - GtkWidget *window; - GtkWidget *htmlwidget; + GtkWidget * window; + GtkWidget * scroller; + GtkWidget * htmlwidget; - GtkWidget *forward; - GtkWidget *back; + GtkWidget * forward; + GtkWidget * back; - GtkWidget *toolbar; - SCM toolbar_change_callback_id; + GtkWidget * dock; - HTMLHistory *history; + SCM toolbar_change_callback_id; - HTMLAnchorCB anchor_cb; - HTMLJumpCB jump_cb; + char * null_text; + char * null_label; + + HTMLHistory * history; + + HTMLAnchorCB anchor_cb; + HTMLJumpCB jump_cb; }; /** PROTOTYPES ******************************************************/ + static void htmlBackCB(GtkWidget *widget, gpointer data); static void htmlFwdCB(GtkWidget *widget, gpointer data); -static void htmlAnchorCB(GtkWidget *widget, - XmHTMLAnchorCallbackStruct *acbs, - gpointer data); +static void htmlPrintCB(GtkWidget * widget, gpointer data); +static void htmlAnchorCB(GtkHTML * html, const gchar * url, gpointer data); +static void htmlUrlCB(GtkHTML * html, char * url, + GtkHTMLStream * handle, gpointer data); static gboolean htmlKeyCB(GtkWidget *widget, GdkEventKey *event, gpointer user_data); + static void closeHtmlWinCB(GtkWidget *widget, gpointer data); static void destroyHtmlWinCB(GtkWidget *widget, gpointer data); -static XmImageInfo * htmlReadImageProc(GtkWidget *widget, String file, - gpointer data); - static void htmlSetButtonStates(HTMLWindow *hw); +/********************************************************************\ + * gnc_html_window_new * + * g_malloc and initialize HTMLWindow structure * + * * + * Args: anchor_cb - callback for new html pages * + * jump_cb - callback for html text * + * Return: g_malloc'd initialized HTMLWindow structure * +\********************************************************************/ + +HTMLWindow * +gnc_html_window_new(HTMLAnchorCB anchor_cb, HTMLJumpCB jump_cb) +{ + HTMLWindow *hw; + + hw = g_new0(HTMLWindow, 1); + + hw->history = historyNew(); + + hw->anchor_cb = anchor_cb; + hw->jump_cb = jump_cb; + + hw->null_text = NULL; + + return hw; +} + + +/********************************************************************\ + * gnc_html_window_destroy * + * destroy an HTMLWindow structure * + * * + * Args: hw - the htmlwindow structure to destroy * + * Return: none * +\********************************************************************/ + +void +gnc_html_window_destroy(HTMLWindow * hw) +{ + if (hw == NULL) + return; + + if (hw->window != NULL) + gtk_widget_destroy(hw->window); + else + { + historyDestroy(hw->history); + g_free(hw); + } +} + + /********************************************************************\ * gnc_html_window_user_data * * return the current user data for the window * @@ -353,8 +417,9 @@ static void htmlSetButtonStates(HTMLWindow *hw); * Args: none * * Return: user data for the window * \********************************************************************/ + HTMLUserData -gnc_html_window_user_data(HTMLWindow *hw) +gnc_html_window_user_data(HTMLWindow * hw) { if (hw == NULL) return NULL; @@ -370,6 +435,7 @@ gnc_html_window_user_data(HTMLWindow *hw) * Args: none * * Return: gtk window for html window * \********************************************************************/ + GtkWidget * gnc_html_window_get_window(HTMLWindow *hw) { @@ -379,60 +445,13 @@ gnc_html_window_get_window(HTMLWindow *hw) return hw->window; } - -/********************************************************************\ - * gnc_html_window_new * - * g_malloc and initialize HTMLWindow structure * - * * - * Args: anchor_cb - callback for new html pages * - * jump_cb - callback for html text * - * Return: g_malloc'd initialized HTMLWindow structure * -\********************************************************************/ -HTMLWindow * -gnc_html_window_new(HTMLAnchorCB anchor_cb, HTMLJumpCB jump_cb) -{ - HTMLWindow *hw; - - hw = g_new0(HTMLWindow, 1); - - hw->history = historyNew(); - - hw->anchor_cb = anchor_cb; - hw->jump_cb = jump_cb; - - return hw; -} - - -/********************************************************************\ - * gnc_html_window_destroy * - * destroy an HTMLWindow structure * - * * - * Args: hw - the htmlwindow structure to destroy * - * Return: none * -\********************************************************************/ -void -gnc_html_window_destroy(HTMLWindow *hw) -{ - if (hw == NULL) - return; - - if (hw->window != NULL) - gtk_widget_destroy(hw->window); - else - { - historyDestroy(hw->history); - g_free(hw); - } -} - - static void -gnc_html_window_fill_toolbar(HTMLWindow *hw) +html_window_fill_toolbar(HTMLWindow *hw) { GnomeUIInfo *toolbar_info; gint num_start, num_end; - GList *children, *node; + GtkWidget *dock_item; + GtkWidget *toolbar; HTMLData *data; gint i; @@ -460,6 +479,17 @@ gnc_html_window_fill_toolbar(HTMLWindow *hw) GnomeUIInfo toolbar_end[] = { + GNOMEUIINFO_SEPARATOR, + { GNOME_APP_UI_ITEM, + PRINT_STR, + "Print HTML Window", + htmlPrintCB, hw, + NULL, + GNOME_APP_PIXMAP_STOCK, + GNOME_STOCK_PIXMAP_PRINT, + 0, 0, NULL + }, + GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, CLOSE_STR, TOOLTIP_CLOSE_HTML, @@ -476,16 +506,23 @@ gnc_html_window_fill_toolbar(HTMLWindow *hw) if (data == NULL) return; - if (hw->toolbar == NULL) + if (hw->dock == NULL) return; - node = children = gtk_container_children(GTK_CONTAINER(hw->toolbar)); - while (node != NULL) - { - gtk_container_remove(GTK_CONTAINER(hw->toolbar), GTK_WIDGET(node->data)); - node = node->next; - } - g_list_free(children); + dock_item = GTK_WIDGET(gnome_dock_get_item_by_name(GNOME_DOCK(hw->dock), + "toolbar", NULL, NULL, + NULL, NULL)); + if (dock_item == NULL) + return; + + toolbar = gnome_dock_item_get_child(GNOME_DOCK_ITEM(dock_item)); + if (toolbar != NULL) + gtk_container_remove(GTK_CONTAINER(dock_item), toolbar); + + toolbar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH); + gtk_container_set_border_width(GTK_CONTAINER(toolbar), 2); + gtk_container_add(GTK_CONTAINER(dock_item), toolbar); + gtk_widget_show(toolbar); num_start = sizeof(toolbar_start) / sizeof(GnomeUIInfo); num_end = sizeof(toolbar_end) / sizeof(GnomeUIInfo); @@ -502,7 +539,7 @@ gnc_html_window_fill_toolbar(HTMLWindow *hw) for (i = 0; i < num_end; i++) toolbar_info[i + num_start + data->num_user_buttons] = toolbar_end[i]; - gnome_app_fill_toolbar(GTK_TOOLBAR(hw->toolbar), toolbar_info, NULL); + gnome_app_fill_toolbar(GTK_TOOLBAR(toolbar), toolbar_info, NULL); hw->back = toolbar_info[0].widget; hw->forward = toolbar_info[1].widget; @@ -512,14 +549,25 @@ gnc_html_window_fill_toolbar(HTMLWindow *hw) static void -gnc_html_toolbar_change_cb(void *data) +html_toolbar_change_cb(void *data) { HTMLWindow *hw = data; GtkToolbarStyle tbstyle; + GnomeDockItem *dock_item; + GtkWidget *toolbar; tbstyle = gnc_get_toolbar_style(); - gtk_toolbar_set_style(GTK_TOOLBAR(hw->toolbar), tbstyle); + dock_item = gnome_dock_get_item_by_name(GNOME_DOCK(hw->dock), "toolbar", + NULL, NULL, NULL, NULL); + if (dock_item == NULL) + return; + + toolbar = gnome_dock_item_get_child(dock_item); + if (toolbar == NULL) + return; + + gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), tbstyle); } @@ -559,11 +607,13 @@ htmlWindow(GtkWidget *parent, /************ CREATE HTML WINDOW HERE *****************/ { - GtkWidget *window; - GtkWidget *html; - GtkWidget *dock; - GtkWidget *dock_item; - GtkWidget *toolbar; + GtkWidget * window; + GtkWidget * html; + GtkWidget * dock; + GtkWidget * dock_item; + GtkWidget * toolbar; + GtkWidget * scroll; + GtkWidget * frame; SCM id; window = gtk_window_new(GTK_WINDOW_TOPLEVEL); @@ -573,42 +623,56 @@ htmlWindow(GtkWidget *parent, dock = gnome_dock_new(); gtk_container_add(GTK_CONTAINER(window), dock); + hw->dock = dock; dock_item = gnome_dock_item_new("toolbar", GNOME_DOCK_ITEM_BEH_EXCLUSIVE); toolbar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH); gtk_container_set_border_width(GTK_CONTAINER(toolbar), 2); gtk_container_add(GTK_CONTAINER(dock_item), toolbar); - hw->toolbar = toolbar; - - id = gnc_register_option_change_callback(gnc_html_toolbar_change_cb, hw, - "General", "Toolbar Buttons"); - hw->toolbar_change_callback_id = id; gnome_dock_add_item (GNOME_DOCK(dock), GNOME_DOCK_ITEM(dock_item), GNOME_DOCK_TOP, 0, 0, 0, TRUE); - html = gtk_xmhtml_new(); + id = gnc_register_option_change_callback(html_toolbar_change_cb, hw, + "General", "Toolbar Buttons"); + hw->toolbar_change_callback_id = id; + + frame = gtk_frame_new(NULL); + scroll = gtk_scrolled_window_new(NULL, NULL); + html = gtk_html_new(); hw->htmlwidget = html; - gnome_dock_set_client_area(GNOME_DOCK(dock), html); - gtk_xmhtml_set_image_procs(GTK_XMHTML(html), htmlReadImageProc, - NULL, NULL, NULL); + hw->scroller = scroll; + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); - gnc_html_load(hw); + gtk_signal_connect (GTK_OBJECT(html), "url_requested", + GTK_SIGNAL_FUNC (htmlUrlCB), + (gpointer)hw); - gtk_signal_connect(GTK_OBJECT(hw->htmlwidget), "activate", - GTK_SIGNAL_FUNC(htmlAnchorCB), hw); + gtk_signal_connect (GTK_OBJECT(html), "link_clicked", + GTK_SIGNAL_FUNC (htmlAnchorCB), + (gpointer)hw); + + gtk_signal_connect (GTK_OBJECT(html), "key_press_event", + GTK_SIGNAL_FUNC(htmlKeyCB), hw); gtk_signal_connect(GTK_OBJECT(window), "destroy", GTK_SIGNAL_FUNC(destroyHtmlWinCB), hwp); - gtk_signal_connect(GTK_OBJECT(window), "key_press_event", - GTK_SIGNAL_FUNC(htmlKeyCB), hw); + gtk_container_add(GTK_CONTAINER(frame), scroll); + gtk_container_add(GTK_CONTAINER(scroll), html); + gtk_html_load_empty(GTK_HTML(html)); + + gnome_dock_set_client_area(GNOME_DOCK(dock), frame); + gtk_widget_realize(GTK_WIDGET(html)); gtk_widget_show_all(window); + gnc_html_load(hw); } - gnc_html_toolbar_change_cb(hw); + html_toolbar_change_cb(hw); htmlSetButtonStates(hw); } @@ -652,16 +716,15 @@ htmlSetButtonStates(HTMLWindow *hw) static gboolean htmlKeyCB(GtkWidget *widget, GdkEventKey *event, gpointer data) { - HTMLWindow *hw = (HTMLWindow *) data; - GtkXmHTML *html = GTK_XMHTML(hw->htmlwidget); - GtkAdjustment *vadj, *hadj; - gfloat v_value, h_value; + HTMLWindow * hw = (HTMLWindow *) data; - vadj = GTK_ADJUSTMENT(html->vsba); - hadj = GTK_ADJUSTMENT(html->hsba); + GtkAdjustment * vadj = + gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(hw->scroller)); + GtkAdjustment * hadj = + gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(hw->scroller)); - v_value = vadj->value; - h_value = hadj->value; + gfloat v_value = vadj->value; + gfloat h_value = hadj->value; switch (event->keyval) { @@ -756,6 +819,15 @@ htmlFwdCB(GtkWidget *widget, gpointer data) htmlSetButtonStates(hw); } +/********************************************************************\ + * htmlPrintCB + * callback for printing from toolbar button +\********************************************************************/ +static void +htmlPrintCB(GtkWidget * widget, gpointer data) { + HTMLWindow * hw = (HTMLWindow *)data; + gnc_html_print(hw); +} /********************************************************************\ * closeHtmlWinCB - callback for closing html window * @@ -783,7 +855,7 @@ closeHtmlWinCB(GtkWidget *widget, gpointer data) static void destroyHtmlWinCB(GtkWidget *widget, gpointer data) { - HTMLWindow **hwp = (HTMLWindow **) data; + HTMLWindow **hwp = data; HTMLWindow *hw = *hwp; /* Delete the history: */ @@ -796,49 +868,190 @@ destroyHtmlWinCB(GtkWidget *widget, gpointer data) g_free(hw); *hwp = NULL; - - DEBUG("HTML window destroyed.\n"); } /********************************************************************\ * htmlAnchorCB - called when user clicks on html anchor tag * - * * - * Args: widget - the html widget that called us * - * acbs - callback structure * - * data - html window structure * - * Return: none * + * the URL needs to be processed and the user callback called. * \********************************************************************/ + static void -htmlAnchorCB(GtkWidget *widget, XmHTMLAnchorCallbackStruct *acbs, - gpointer data) -{ - HTMLWindow *hw = (HTMLWindow *) data; - HTMLData *html_data; +htmlAnchorCB(GtkHTML * html, const gchar * url, gpointer data) { + HTMLWindow * hw = (HTMLWindow *)data; + HTMLData * html_data; + char * url_location; + char * url_label; + int url_type; + + /* printf("in htmlAnchorCB: url='%s'\n", url); */ - if (acbs->reason != XmCR_ACTIVATE) return; + url_type = gnc_html_parse_url(hw, url, &url_location, &url_label); - switch(acbs->url_type) - { - /* a named anchor on a page that is already displayed */ - case ANCHOR_JUMP: - XmHTMLAnchorScrollToName(widget, acbs->href); - break; + switch(url_type) { + case URL_TYPE_JUMP: + gtk_html_jump_to_anchor(html, url_label); + g_free(url_location); + g_free(url_label); + break; - default: - if (hw->anchor_cb == NULL) - return; + default: + if (hw->anchor_cb == NULL) { + g_free(url_location); + g_free(url_label); + return; + } + + html_data = (hw->anchor_cb)(url_type, url_location, url_label, + historyUserData(hw->history)); + g_free(url_location); + g_free(url_label); - html_data = (hw->anchor_cb)(acbs, historyUserData(hw->history)); - if (html_data == NULL) - return; + if (html_data == NULL) + return; + + historyInsert(hw->history, html_data); + gnc_html_load(hw); + break; + } +} - historyInsert(hw->history, html_data); - gnc_html_load(hw); - break; + +/********************************************************************\ + * htmlUrlCB - called by the GtkHTML widget when a URL needs to be * + * loaded. At this point, the StreamHandle is already open. * +\********************************************************************/ + +static void +htmlUrlCB(GtkHTML * html, char * url, GtkHTMLStream * handle, + gpointer user_data) { + HTMLWindow * hw = (HTMLWindow *)user_data; + + char * text=NULL; + char * location=NULL; + char * label=NULL; + int fsize; + + URLType type; + + if(!url) return; + + if(!strcmp(url, "")) { + gtk_html_write(GTK_HTML(hw->htmlwidget), handle, + hw->null_text, (hw->null_text ? + strlen(hw->null_text) : 0)); + gtk_html_end(GTK_HTML(hw->htmlwidget), handle, GTK_HTML_STREAM_OK); + + if(hw->null_label) { + gtk_html_jump_to_anchor(GTK_HTML(hw->htmlwidget), + hw->null_label); + } + } + else { + type = gnc_html_parse_url(hw, url, &location, &label); + fsize = gncReadFile(location, &text); + if(text == NULL) { + gtk_html_end(html, handle, GTK_HTML_STREAM_OK); + } + else { + gtk_html_write(GTK_HTML(hw->htmlwidget), handle, + text, fsize); + gtk_html_end(GTK_HTML(hw->htmlwidget), handle, GTK_HTML_STREAM_OK); + if(label) { + gtk_html_jump_to_anchor(GTK_HTML(hw->htmlwidget), label); + } + g_free(text); + } + } +} + + +/********************************************************************\ + * gnc_html_parse_url + * this takes a URL and the HTMLWindow context and determines the + * protocol type, location, and possible anchor name from the URL. +\********************************************************************/ + +URLType +gnc_html_parse_url(HTMLWindow * html, const gchar * url, + char ** url_location, char ** url_label) { + char uri_rexp[] = "^(([^:]*):)?([^#]+)?(#(.*))?$"; + regex_t compiled; + regmatch_t match[6]; + char * protocol=NULL, * path=NULL, * label=NULL; + int found_protocol=0, found_path=0, found_label=0; + URLType retval; + + regcomp(&compiled, uri_rexp, REG_EXTENDED); + + if(!regexec(&compiled, url, 6, match, 0)) { + if(match[2].rm_so != -1) { + protocol = g_new0(char, match[2].rm_eo - match[2].rm_so + 1); + strncpy(protocol, url + match[2].rm_so, + match[2].rm_eo - match[2].rm_so); + protocol[match[2].rm_eo - match[2].rm_so] = 0; + found_protocol = 1; + } + if(match[3].rm_so != -1) { + path = g_new0(char, match[3].rm_eo - match[3].rm_so + 1); + strncpy(path, url+match[3].rm_so, + match[3].rm_eo - match[3].rm_so); + path[match[3].rm_eo - match[3].rm_so] = 0; + found_path = 1; + } + if(match[5].rm_so != -1) { + label = g_new0(char, match[5].rm_eo - match[5].rm_so + 1); + strncpy(label, url+match[5].rm_so, + match[5].rm_eo - match[5].rm_so); + label[match[5].rm_eo - match[5].rm_so] = 0; + found_label = 1; + } } - htmlSetButtonStates(hw); + if(found_protocol) { + if(!strcmp(protocol, "file")) { + retval = URL_TYPE_FILE; + } + else if(!strcmp(protocol, "http")) { + retval = URL_TYPE_HTTP; + } + else if(!strcmp(protocol, "ftp")) { + retval = URL_TYPE_FTP; + } + else if(!strcmp(protocol, "https")) { + retval = URL_TYPE_SECURE; + } + else { + retval = URL_TYPE_OTHER; + } + } + else if(found_label && !found_path) { + retval = URL_TYPE_JUMP; + } + else { + retval = URL_TYPE_FILE; /* FIXME BG */ + } + + g_free(protocol); + + switch(retval) { + case URL_TYPE_FILE: + *url_location = path; + break; + + case URL_TYPE_JUMP: + *url_location = NULL; + g_free(path); + break; + + case URL_TYPE_OTHER: + default: + * url_location = path; + break; + } + + * url_label = label; + return retval; } @@ -851,9 +1064,9 @@ htmlAnchorCB(GtkWidget *widget, XmHTMLAnchorCallbackStruct *acbs, void gnc_html_load(HTMLWindow *hw) { - HTMLData *data; - char *label = NULL; - char *text = NULL; + HTMLData * data; + GtkHTMLStream * handle; + char * text=NULL, * label=NULL; if (hw == NULL) return; @@ -863,52 +1076,66 @@ gnc_html_load(HTMLWindow *hw) data = historyData(hw->history); gtk_window_set_title(GTK_WINDOW(hw->window), data->title); - gnc_html_window_fill_toolbar(hw); + + html_window_fill_toolbar(hw); htmlSetButtonStates(hw); - (hw->jump_cb)(data->user_data, &text, &label); + (hw->jump_cb)(data->user_data, &hw->null_text, &hw->null_label); if (text == NULL) { text = ""; label = NULL; } - - gtk_xmhtml_source(GTK_XMHTML(hw->htmlwidget), text); - - if (label != NULL) - XmHTMLAnchorScrollToName(hw->htmlwidget, label); - else - XmHTMLTextScrollToLine(hw->htmlwidget, 0); + handle = gtk_html_begin(GTK_HTML(hw->htmlwidget)); + htmlUrlCB(GTK_HTML(hw->htmlwidget), "", handle, (gpointer)hw); } +void +gnc_url_show(URLType type, char * location, char * label) { + char * full_url; + char proto_tag[8]; -/********************************************************************\ - * htmlReadImageProc - callback function for the html widget * - * used to find an image file * - * * - * Args: widget - the html widget * - * file - the name of the image file to read * - * data - some data, not used * - * Return: none * -\********************************************************************/ -static XmImageInfo * -htmlReadImageProc (GtkWidget *widget, String file, gpointer data) -{ - char *filename; - XmImageInfo *retval = NULL; + switch(type) { + case URL_TYPE_FILE: + case URL_TYPE_JUMP: + strcpy(proto_tag, "file:"); + break; + case URL_TYPE_HTTP: + strcpy(proto_tag, "http:"); + break; + case URL_TYPE_FTP: + strcpy(proto_tag, "ftp:"); + break; + case URL_TYPE_SECURE: + strcpy(proto_tag, "https:"); + break; + default: + strcpy(proto_tag, ""); + } - /* construct absolute path -- twiddle the relative path we received */ - filename = gncFindFile(file); + full_url = g_new0(char, + (proto_tag ? strlen(proto_tag) : 0) + + (location ? strlen(location) : 0) + + (label ? strlen(label) : 0) + 1); + strcpy(full_url, proto_tag); + if(location) strcat(full_url, location); + if(label) strcat(full_url, label); - /* use the default proc for the hard work */ - retval = XmHTMLImageDefaultProc(widget, filename, NULL, 0); - - if (filename != NULL) - free(filename); - - return retval; + gnome_url_show(full_url); } -/* ----------------------- END OF FILE --------------------- */ +/******************************************************************** + * gnc_html_print : print an html window + ********************************************************************/ + +void +gnc_html_print(HTMLWindow * hw) { + PrintSession * ps = gnc_print_session_create(); + + gtk_html_print(GTK_HTML(hw->htmlwidget), + GNOME_PRINT_CONTEXT(ps->meta)); + gnc_print_session_done(ps); + gnc_ui_print_dialog_create(ps); +} diff --git a/src/gnome/window-html.h b/src/gnome/window-html.h index 2811e7f084..320a90f14b 100644 --- a/src/gnome/window-html.h +++ b/src/gnome/window-html.h @@ -4,6 +4,8 @@ * Copyright (C) 1998 Linas Vepstas * * Copyright (C) 1999 Jeremy Collins ( gtk-xmhtml port ) * * Copyright (C) 2000 Linas Vepstas * + * Copyright (C) 2000 Bill Gribble * + * (gtkhtml port) * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License as * @@ -27,39 +29,45 @@ #define __WINDOW_HTML_H__ #include -#include - +#include typedef struct _HTMLWindow HTMLWindow; -typedef struct _HTMLData HTMLData; -typedef void * HTMLUserData; +typedef struct _HTMLData HTMLData; +typedef void * HTMLUserData; +typedef enum { URL_TYPE_FILE, URL_TYPE_JUMP, + URL_TYPE_HTTP, URL_TYPE_FTP, + URL_TYPE_SECURE, URL_TYPE_OTHER } URLType; typedef void (*HTMLDestroyUserDataFunc)(HTMLUserData); -typedef HTMLData* (*HTMLAnchorCB)(XmHTMLAnchorCallbackStruct *acbs, - HTMLUserData user_data); +typedef HTMLData * (*HTMLAnchorCB)(URLType url_type, char * location, + char * label, HTMLUserData user_data); -typedef void (*HTMLJumpCB)(HTMLUserData user_data, - char **text, char **label); +typedef void (*HTMLJumpCB)(HTMLUserData user_data, char ** location, + char ** label); +HTMLData * gnc_html_data_new(const char * title, + HTMLUserData user_data, + HTMLDestroyUserDataFunc destroy, + GnomeUIInfo * user_buttons, + int num_user_buttons); + +HTMLWindow * gnc_html_window_new(HTMLAnchorCB anchor_cb, HTMLJumpCB jump_cb); +void gnc_html_window_destroy(HTMLWindow *hw); +void gnc_html_load(HTMLWindow *hw); +void gnc_html_print(HTMLWindow * hw); + +URLType gnc_html_parse_url(HTMLWindow * html, const gchar * url, + char ** location, char ** label); HTMLUserData gnc_html_window_user_data(HTMLWindow *hw); -GtkWidget * gnc_html_window_get_window(HTMLWindow *hw); +GtkWidget * gnc_html_window_get_window(HTMLWindow *hw); -HTMLWindow * gnc_html_window_new(HTMLAnchorCB anchor_cb, HTMLJumpCB jump_cb); -void gnc_html_window_destroy(HTMLWindow *hw); +void htmlWindow(GtkWidget * parent, HTMLWindow ** hwp, HTMLData * data); -HTMLData * gnc_html_data_new(const char *title, HTMLUserData user_data, - HTMLDestroyUserDataFunc destroy, - GnomeUIInfo *user_buttons, - int num_user_buttons); - -void htmlWindow(GtkWidget *parent, - HTMLWindow **hwp, - HTMLData *data); - -void gnc_html_load(HTMLWindow *hw); +/* for showing URLS with an external browser */ +void gnc_url_show(URLType type, char * location, char * label); #endif diff --git a/src/gnome/window-report.c b/src/gnome/window-report.c index 0b145e31a3..f71e85866c 100644 --- a/src/gnome/window-report.c +++ b/src/gnome/window-report.c @@ -177,21 +177,16 @@ report_data_set_guile_options(ReportData *report_data, const SCM guile_options) static HTMLData * -reportAnchorCB(XmHTMLAnchorCallbackStruct *acbs, +reportAnchorCB(URLType url_type, char * location, char * label, HTMLUserData user_data) { - switch(acbs->url_type) - { - case ANCHOR_FILE_LOCAL: - case ANCHOR_FTP: - case ANCHOR_HTTP: - case ANCHOR_MAILTO: - case ANCHOR_UNKNOWN: - default: - gnome_url_show(acbs->href); - break; + /* this isn't called for "jump to anchor" clicks. That's */ + /* handled internally in the HTML widget. */ + switch(url_type) { + default: + gnc_url_show(url_type, location, label); + break; } - return NULL; } diff --git a/src/optional/Makefile.in b/src/optional/Makefile.in index 6a1c4c726b..bb1b4d8ad8 100644 --- a/src/optional/Makefile.in +++ b/src/optional/Makefile.in @@ -81,7 +81,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/src/optional/swig/Makefile.in b/src/optional/swig/Makefile.in index 05814fbb69..2db59241d9 100644 --- a/src/optional/swig/Makefile.in +++ b/src/optional/swig/Makefile.in @@ -81,7 +81,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/src/pixmaps/Makefile.in b/src/pixmaps/Makefile.in index 3eab5ccf18..26262baca5 100644 --- a/src/pixmaps/Makefile.in +++ b/src/pixmaps/Makefile.in @@ -81,7 +81,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/src/quotes/Makefile.in b/src/quotes/Makefile.in index 608b75348a..6140be0311 100644 --- a/src/quotes/Makefile.in +++ b/src/quotes/Makefile.in @@ -81,7 +81,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/src/register/Makefile.in b/src/register/Makefile.in index fb875449d1..21528c79b2 100644 --- a/src/register/Makefile.in +++ b/src/register/Makefile.in @@ -81,7 +81,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/src/register/gnome/Makefile.in b/src/register/gnome/Makefile.in index 7a159c2194..1c1a6e243b 100644 --- a/src/register/gnome/Makefile.in +++ b/src/register/gnome/Makefile.in @@ -81,7 +81,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/src/scm/Makefile.in b/src/scm/Makefile.in index d1c9152f82..5a06883b2a 100644 --- a/src/scm/Makefile.in +++ b/src/scm/Makefile.in @@ -81,7 +81,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/src/scm/gnumeric/Makefile.in b/src/scm/gnumeric/Makefile.in index 76fd1551c4..aac3a232a4 100644 --- a/src/scm/gnumeric/Makefile.in +++ b/src/scm/gnumeric/Makefile.in @@ -81,7 +81,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/src/scm/printing/Makefile.in b/src/scm/printing/Makefile.in index e50a473ee8..c2247498ca 100644 --- a/src/scm/printing/Makefile.in +++ b/src/scm/printing/Makefile.in @@ -81,7 +81,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/src/scm/printing/print-check.scm b/src/scm/printing/print-check.scm index df2c4f45a8..b986be7795 100644 --- a/src/scm/printing/print-check.scm +++ b/src/scm/printing/print-check.scm @@ -23,32 +23,32 @@ date-format custom-info))) -(define (print-check-format? self) - (eq? (simple-obj-type self) 'print-check-format)) +(define print-check-format? + (record-predicate )) -(define (print-check-format:format self) - (simple-obj-getter self 'format)) +(define print-check-format:format + (simple-obj-getter 'format)) -(define (print-check-format:set-format! self value) - (simple-obj-setter self 'format value)) +(define print-check-format:set-format! + (simple-obj-setter 'format)) -(define (print-check-format:position self) - (simple-obj-getter self 'position)) +(define print-check-format:position + (simple-obj-getter 'position)) -(define (print-check-format:set-position! self value) - (simple-obj-setter self 'position value)) +(define print-check-format:set-position! + (simple-obj-setter 'position)) -(define (print-check-format:date-format self) - (simple-obj-getter self 'date-format)) +(define print-check-format:date-format + (simple-obj-getter 'date-format)) -(define (print-check-format:set-date-format! self value) - (simple-obj-setter self 'date-format value)) +(define print-check-format:set-date-format! + (simple-obj-setter 'date-format)) -(define (print-check-format:custom-info self) - (simple-obj-getter self 'custom-info)) +(define print-check-format:custom-info + (simple-obj-getter 'custom-info)) -(define (print-check-format:set-custom-info! self value) - (simple-obj-setter self 'custom-info value)) +(define print-check-format:set-custom-info! + (simple-obj-setter 'custom-info)) (define (make-print-check-format fmt pos dateformat cust) (let ((retval (make-simple-obj ))) diff --git a/src/scm/qif-import/Makefile.in b/src/scm/qif-import/Makefile.in index 7dd308d61f..50599fda20 100644 --- a/src/scm/qif-import/Makefile.in +++ b/src/scm/qif-import/Makefile.in @@ -81,7 +81,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/src/scm/report/Makefile.in b/src/scm/report/Makefile.in index b4468de05a..0e4a623b48 100644 --- a/src/scm/report/Makefile.in +++ b/src/scm/report/Makefile.in @@ -81,7 +81,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@ diff --git a/src/scm/srfi/Makefile.in b/src/scm/srfi/Makefile.in index 74fdb6f7f2..03e400d626 100644 --- a/src/scm/srfi/Makefile.in +++ b/src/scm/srfi/Makefile.in @@ -81,7 +81,6 @@ GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ GNOME_LIBS = @GNOME_LIBS@ GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ GNOME_TARGET = @GNOME_TARGET@ -GTK_XMHTML = @GTK_XMHTML@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ GUILE = @GUILE@