mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-07-30 08:08:15 -05:00
Switch to using db1 for database access.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3336 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
+1
-5
@@ -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
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
+34
-6
@@ -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)
|
||||
|
||||
|
||||
### --------------------------------------------------------------------------
|
||||
|
||||
@@ -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
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ LDADD = \
|
||||
${GTKHTML_LIBS} \
|
||||
${GHTTP_LIBS} \
|
||||
${GUPPI_LIBS} \
|
||||
${DB2_LIBS} \
|
||||
${DB_LIBS} \
|
||||
${INTLLIBS}
|
||||
|
||||
gnucash_SOURCES = \
|
||||
|
||||
+51
-30
@@ -26,15 +26,42 @@
|
||||
\********************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include <gnome.h>
|
||||
|
||||
#include <guile/gh.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <gnome.h>
|
||||
#include <guile/gh.h>
|
||||
#include <limits.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <db2/db.h>
|
||||
|
||||
/* 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 <db1/db.h>
|
||||
#else
|
||||
# ifdef HAVE_DB_185_H
|
||||
# include <db_185.h>
|
||||
# else
|
||||
# include <db.h>
|
||||
# endif
|
||||
#endif
|
||||
#else
|
||||
#ifdef HAVE_DB_185_H
|
||||
# include <db_185.h>
|
||||
#else
|
||||
# ifdef HAVE_DB_H
|
||||
# include <db.h>
|
||||
# else
|
||||
# include <db1/db.h>
|
||||
# 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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#define __GNC_HELP_WINDOW_H__
|
||||
|
||||
#include <gnome.h>
|
||||
|
||||
#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,
|
||||
|
||||
Reference in New Issue
Block a user