diff --git a/Makefile.am b/Makefile.am index a8d4543057..e656738232 100644 --- a/Makefile.am +++ b/Makefile.am @@ -35,10 +35,6 @@ EXTRA_DIST = \ old/country.sql \ old/currencynames \ old/Gnucash.app-defaults \ - old/gnome/graph/Makefile \ - old/gnome/graph/colors.c \ - old/gnome/graph/design.txt \ - old/gnome/graph/plot-test.c \ old/perl-reports/report-baln.phtml \ old/perl-reports/report-folio.phtml \ old/perl-reports/report-formtest.html \ @@ -60,7 +56,7 @@ make-gnucash-patch: make-gnucash-patch.in chmod +x $@.tmp mv $@.tmp $@ -CLEANFILES += cscope.files etags.files make-gnucash-patch +CLEANFILES += cscope.files etags.files make-gnucash-patch cscope.files: find . -name '*.[ch]' > cscope.files diff --git a/acconfig.h b/acconfig.h index 8f7fecd1aa..800b4aa1a9 100644 --- a/acconfig.h +++ b/acconfig.h @@ -56,8 +56,8 @@ /* New or old Guile Smob for G-wrap */ #undef GWRAP_OLD_GUILE_SMOB -/* The db2 database library */ -#undef HAVE_DB2 +/* The db1 database library */ +#undef PREFER_DB1 /* Use the new gtkhtml widget instead of the old xmhtml widget */ #undef HAVE_LIBGTKHTML diff --git a/configure.in b/configure.in index 306403a0a6..d89b363a26 100644 --- a/configure.in +++ b/configure.in @@ -216,14 +216,42 @@ LIBS="$LIBS -lm" ### -------------------------------------------------------------------------- -DB2_LIBS="-ldb2" +### Berkeley db +AC_ARG_ENABLE(prefer-db1, [ --enable-prefer-db1 Prefer Berkeley DB 1.x],[prefer_db1="$enableval"],[prefer_db1=yes]) -AC_CHECK_LIB(db2, db_open, - AC_DEFINE(HAVE_DB2), - AC_MSG_ERROR([Cannot find db2. See the README for more info.]), - $DB2_LIBS) +DB_LIBS= +AC_CHECK_FUNC(dbopen, [], +if test "$prefer_db1" = "yes"; then + AC_CHECK_LIB(db1, dbopen, DB_LIBS="-ldb1", + AC_CHECK_LIB(db, dbopen, DB_LIBS="-ldb", + AC_MSG_ERROR([Your db library is missing db 1.85 compatibility mode]) + ) + ) +else + AC_CHECK_LIB(db, dbopen, DB_LIBS="-ldb", + AC_CHECK_LIB(db1, dbopen, DB_LIBS="-ldb1", + AC_MSG_ERROR([Your db library is missing db 1.85 compatibility mode]) + ) + ) +fi +) -AC_SUBST(DB2_LIBS) +dnl look for db headers +if test "$prefer_db1" = "yes"; then + AC_CHECK_HEADERS(db_185.h db1/db.h) + if test "$ac_cv_header_db_185_h$ac_cv_header_db1_db_h" = nono; then + AC_MSG_ERROR([Berkeley db library required for GnuCash]) + fi + AC_DEFINE(PREFER_DB1) +else + AC_CHECK_HEADERS(db.h db_185.h db1/db.h) + + if test "$ac_cv_header_db_h$ac_cv_header_db_185_h$ac_cv_header_db1_db_h" = nonono; then + AC_MSG_ERROR([Berkeley db library required for GnuCash]) + fi +fi + +AC_SUBST(DB_LIBS) ### -------------------------------------------------------------------------- diff --git a/po/POTFILES.in b/po/POTFILES.in index c538fb51a6..5004a77a67 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -28,6 +28,7 @@ src/gnome/gnc-datedelta.c src/gnome/gnc-dateedit.c src/gnome/print-session.c src/gnome/reconcile-list.c +src/gnome/window-help.c src/gnome/window-main.c src/gnome/window-reconcile.c src/gnome/window-register.c diff --git a/src/Makefile.am b/src/Makefile.am index e9460e445e..32e4a0557e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -36,7 +36,7 @@ LDADD = \ ${GTKHTML_LIBS} \ ${GHTTP_LIBS} \ ${GUPPI_LIBS} \ - ${DB2_LIBS} \ + ${DB_LIBS} \ ${INTLLIBS} gnucash_SOURCES = \ diff --git a/src/gnome/window-help.c b/src/gnome/window-help.c index 3fe445c219..3f1354faf9 100644 --- a/src/gnome/window-help.c +++ b/src/gnome/window-help.c @@ -26,15 +26,42 @@ \********************************************************************/ #include "config.h" -#include -#include -#include -#include +#include #include +#include +#include #include +#include +#include #include -#include + +/* needed for db.h with 'gcc -ansi -pedantic' */ +#ifndef _BSD_SOURCE +# define _BSD_SOURCE 1 +#endif + +#ifdef PREFER_DB1 +#ifdef HAVE_DB1_DB_H +# include +#else +# ifdef HAVE_DB_185_H +# include +# else +# include +# endif +#endif +#else +#ifdef HAVE_DB_185_H +# include +#else +# ifdef HAVE_DB_H +# include +# else +# include +# endif +#endif +#endif #include "glade-gnc-dialogs.h" #include "glade-cb-gnc-dialogs.h" @@ -344,16 +371,16 @@ gnc_help_window_search_button_cb(GtkButton * button, gpointer data) { /* initialize search key/value */ memset(&key, 0, sizeof(DBT)); memset(&value, 0, sizeof(DBT)); + key.data = search_string; key.size = strlen(search_string); - value.flags = DB_DBT_MALLOC; /* do the search */ if(help->index_db) { - err = help->index_db->get(help->index_db, NULL, &key, &value, 0); + err = help->index_db->get(help->index_db, &key, &value, 0); } - if((err == 0) || (err == DB_NOTFOUND)) { + if(err == 0) { /* the data in the DB is a newline-separated list of filenames */ show_search_results(help, value.data); } @@ -361,13 +388,15 @@ gnc_help_window_search_button_cb(GtkButton * button, gpointer data) { void gnc_help_window_search_help_button_cb(GtkButton * button, gpointer data) { +#if 0 GtkObject * hw = data; gnc_help_window * help = gtk_object_get_data(hw, "help_window_struct"); - +#endif + printf("help on help\n"); } -void +static void gnc_help_window_search_result_select_cb(GtkWidget * list, GtkWidget * child, gpointer user_data) { gnc_help_window * help = user_data; @@ -385,15 +414,12 @@ gnc_help_window_new() { gnc_help_window * help = g_new0(gnc_help_window, 1); GtkObject * tlo; - DB_INFO dbinfo; - DB_ENV dbenv; char * indexfile; - int err; GnomeUIInfo toolbar_data[] = { { GNOME_APP_UI_ITEM, - _("Back"), - _("Move back one step in the history"), + N_("Back"), + N_("Move back one step in the history"), gnc_help_window_back_cb, help, NULL, GNOME_APP_PIXMAP_STOCK, @@ -401,8 +427,8 @@ gnc_help_window_new() { 0, 0, NULL }, { GNOME_APP_UI_ITEM, - _("Forward"), - _("Move forward one step in the history"), + N_("Forward"), + N_("Move forward one step in the history"), gnc_help_window_fwd_cb, help, NULL, GNOME_APP_PIXMAP_STOCK, @@ -411,8 +437,8 @@ gnc_help_window_new() { }, GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - _("Print"), - _("Print Help window"), + N_("Print"), + N_("Print Help window"), gnc_help_window_print_cb, help, NULL, GNOME_APP_PIXMAP_STOCK, @@ -421,8 +447,8 @@ gnc_help_window_new() { }, GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, - _("Close"), - _("Close this Help window"), + N_("Close"), + N_("Close this Help window"), gnc_help_window_destroy_cb, help, NULL, GNOME_APP_PIXMAP_STOCK, @@ -476,12 +502,10 @@ gnc_help_window_new() { (gpointer)help); indexfile = gncFindFile("help-search-index.db"); - if((err = db_open(indexfile, - DB_UNKNOWN, DB_RDONLY, 0644, - NULL, NULL, &(help->index_db))) != 0) { + help->index_db = dbopen(indexfile, O_RDONLY, 0644, DB_HASH, NULL); + if (!help->index_db) { PERR("Failed to open help index DB '%s' : %s\n", - indexfile, strerror(err)); - help->index_db = NULL; + indexfile, strerror(errno)); } g_free(indexfile); @@ -508,7 +532,7 @@ gnc_help_window_destroy(gnc_help_window * help) { (gpointer)help); /* close the help index db */ if(help->index_db) { - help->index_db->close(help->index_db, 0); + help->index_db->close(help->index_db); } /* take care of the gnc-html object specially */ @@ -550,6 +574,3 @@ gnc_ui_destroy_help_windows() { gnc_help_window_destroy((gnc_help_window *)(open_help_windows->data)); } } - - - diff --git a/src/gnome/window-help.h b/src/gnome/window-help.h index 6f71ab7b99..c54b2dd1a9 100644 --- a/src/gnome/window-help.h +++ b/src/gnome/window-help.h @@ -24,6 +24,7 @@ #define __GNC_HELP_WINDOW_H__ #include + #include "gnc-html.h" typedef struct _gnc_help_window gnc_help_window; @@ -32,7 +33,7 @@ typedef struct _gnc_help_window gnc_help_window; void helpWindow(GtkWidget *parent, const char *title, const char * htmlfile); -gnc_help_window * gnc_help_window_new(); +gnc_help_window * gnc_help_window_new(void); void gnc_help_window_destroy(gnc_help_window * help); void gnc_help_window_show_help(gnc_help_window * hw, const gchar * loc,