r14963 - gnucash/branches/swig-redo/src - Convert the gnome-utils module from gwrap to swig.
Chris Shoemaker
chris at cvs.gnucash.org
Mon Oct 9 19:56:51 EDT 2006
Author: chris
Date: 2006-10-09 19:56:50 -0400 (Mon, 09 Oct 2006)
New Revision: 14963
Trac: http://svn.gnucash.org/trac/changeset/14963
Added:
gnucash/branches/swig-redo/src/gnome-utils/gnome-utils.i
Modified:
gnucash/branches/swig-redo/src/gnome-utils/Makefile.am
gnucash/branches/swig-redo/src/gnome-utils/gncmod-gnome-utils.c
gnucash/branches/swig-redo/src/report/report-system/report-utilities.scm
Log:
Convert the gnome-utils module from gwrap to swig.
Add the interface definition.
Build and load the swig module.
Use "" instead of #f to represent an empty string.
Modified: gnucash/branches/swig-redo/src/gnome-utils/Makefile.am
===================================================================
--- gnucash/branches/swig-redo/src/gnome-utils/Makefile.am 2006-10-09 23:56:08 UTC (rev 14962)
+++ gnucash/branches/swig-redo/src/gnome-utils/Makefile.am 2006-10-09 23:56:50 UTC (rev 14963)
@@ -1,7 +1,7 @@
SUBDIRS = glade schemas . test ui
PWD := $(shell pwd)
-pkglib_LTLIBRARIES = libgncmod-gnome-utils.la libgw-gnome-utils.la
+pkglib_LTLIBRARIES = libgncmod-gnome-utils.la
# Note that src/gnome-utils CANNOT depend on src/gnome!
@@ -97,6 +97,7 @@
print-session.c \
search-param.c \
gnc-dialog.c \
+ swig-gnome-utils.c \
window-main-summarybar.c
gncincludedir = ${GNC_INCLUDE_DIR}
@@ -195,20 +196,10 @@
${GOFFICE_LIBS} \
${LIBXML2_LIBS}
-nodist_libgw_gnome_utils_la_SOURCES = gw-gnome-utils.c
-libgw_gnome_utils_la_LIBADD = \
- libgncmod-gnome-utils.la \
- ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
- ${top_builddir}/src/engine/libgw-engine.la \
- ${top_builddir}/src/core-utils/libcore-utils.la \
- ${QOF_LIBS} \
- ${G_WRAP_LINK_ARGS} \
- ${GLIB_LIBS}
+swig-gnome-utils.c: gnome-utils.i ${noinst_HEADERS} ${gncinclude_HEADERS}
+ swig -guile $(SWIG_ARGS) -Linkage module \
+ -I${top_srcdir}/src/engine -o $@ $<
-gwmoddir = ${GNC_GWRAP_LIBDIR}
-gwmod_DATA = gw-gnome-utils-spec.scm
-nodist_gwmod_DATA = gw-gnome-utils.scm
-
gncmoddir = ${GNC_SHAREDIR}/guile-modules/gnucash
gncmod_DATA = gnome-utils.scm
@@ -218,7 +209,6 @@
EXTRA_DIST = \
gnc-dir.h.in \
gnc-svninfo.h \
- ${gwmod_DATA} \
${gncmod_DATA} \
${gncscm_DATA}
@@ -280,18 +270,15 @@
BUILT_SOURCES = gnc-dir.h gnc-version.h
if GNUCASH_SEPARATE_BUILDDIR
-#For compiling
-SCM_FILE_LINKS = gw-gnome-utils-spec.scm
#For executing test cases
-SCM_FILE_LINKS += \
+SCM_FILE_LINKS = \
${gncmod_DATA} \
${gncscm_DATA}
endif
.scm-links:
- rm -f gnucash g-wrapped
+ rm -f gnucash
$(LN_S) -f . gnucash
- $(LN_S) -f . g-wrapped
if GNUCASH_SEPARATE_BUILDDIR
for X in ${SCM_FILE_LINKS} ; do \
$(LN_S) -f ${srcdir}/$$X . ; \
@@ -299,19 +286,9 @@
endif
touch .scm-links
-gw-gnome-utils.scm gw-gnome-utils.c gw-gnome-utils.h: \
- .scm-links gw-gnome-utils-spec.scm ${top_builddir}/config.status Makefile
- FLAVOR=gnome $(GUILE) -c \
- "(set! %load-path (cons \"${G_WRAP_MODULE_DIR}\" %load-path)) \
- (set! %load-path (cons \"${PWD}\" %load-path)) \
- (set! %load-path (cons \"${top_builddir}/src/engine\" %load-path)) \
- (set! %load-path (cons \"${top_builddir}/src/app-utils\" %load-path)) \
- (primitive-load \"./gw-gnome-utils-spec.scm\") \
- (gw:generate-wrapset \"gw-gnome-utils\")"
-BUILT_SOURCES += gw-gnome-utils.scm gw-gnome-utils.c gw-gnome-utils.h
-CLEANFILES = $(BUILT_SOURCES) gnucash g-wrapped .scm-links \
- ${SCM_FILE_LINKS} gw-gnome-utils.html
+BUILT_SOURCES += swig-gnome-utils.c
+CLEANFILES = $(BUILT_SOURCES) gnucash .scm-links ${SCM_FILE_LINKS}
#
# I hate inconsistent standards. Autotools puts help files into
Modified: gnucash/branches/swig-redo/src/gnome-utils/gncmod-gnome-utils.c
===================================================================
--- gnucash/branches/swig-redo/src/gnome-utils/gncmod-gnome-utils.c 2006-10-09 23:56:08 UTC (rev 14962)
+++ gnucash/branches/swig-redo/src/gnome-utils/gncmod-gnome-utils.c 2006-10-09 23:56:50 UTC (rev 14963)
@@ -57,6 +57,8 @@
g_free(form);
}
+extern SCM scm_init_sw_gnome_utils_module(void);
+
int
libgncmod_gnome_utils_LTX_gnc_module_init(int refcount) {
/* load the engine (we depend on it) */
@@ -79,8 +81,8 @@
return FALSE;
}
- /* publish g-wrapped bindings */
- lmod("(g-wrapped gw-gnome-utils)");
+ scm_init_sw_gnome_utils_module();
+ lmod("(sw_gnome_utils)");
lmod("(gnucash gnome-utils)");
/* Initialize the options-ui database */
Added: gnucash/branches/swig-redo/src/gnome-utils/gnome-utils.i
===================================================================
--- gnucash/branches/swig-redo/src/gnome-utils/gnome-utils.i 2006-10-09 23:56:08 UTC (rev 14962)
+++ gnucash/branches/swig-redo/src/gnome-utils/gnome-utils.i 2006-10-09 23:56:50 UTC (rev 14963)
@@ -0,0 +1,98 @@
+%module sw_gnome_utils
+%{
+/* Includes the header in the wrapper code */
+#include <config.h>
+#include <gtk/gtk.h>
+#include <dialog-options.h>
+#include <dialog-utils.h>
+#include <druid-utils.h>
+#include <gnc-amount-edit.h>
+#include <gnc-date-edit.h>
+#include <gnc-file.h>
+//#include <gnc-gconf-utils.h>
+#include <gnc-gnome-utils.h>
+#include <gnc-gui-query.h>
+#include <gnc-html.h>
+#include <gnc-main-window.h>
+#include <gnc-window.h>
+#include <gnc-menu-extensions.h>
+#include <gnc-plugin-file-history.h>
+#include <gnc-ui.h>
+#include <print-session.h>
+#include <gnc-splash.h>
+%}
+
+// Temporary SWIG<->G-wrap converters for engine types
+%typemap(in) gboolean "$1 = SCM_NFALSEP($input) ? TRUE : FALSE;"
+%typemap(out) gboolean "$result = $1 ? SCM_BOOL_T : SCM_BOOL_F;"
+
+// End of temporary typemaps.
+typedef char * URLType;
+typedef char gchar;
+
+//%include "gnc-main-window.h"
+%include "gnc-html.h"
+
+/* Parse the header file to generate wrappers */
+
+GNCOptionWin * gnc_options_dialog_new(gchar *title);
+void gnc_options_dialog_destroy(GNCOptionWin * win);
+void gnc_options_dialog_build_contents(GNCOptionWin *propertybox,
+ GNCOptionDB *odb);
+void gnc_options_dialog_set_scm_callbacks (GNCOptionWin *win,
+ SCM apply_cb, SCM close_cb);
+
+%include "print-session.h"
+
+gboolean
+gnc_verify_dialog(GtkWidget *parent, gboolean yes_is_default,
+ const gchar *format, ...);
+
+void
+gnc_warning_dialog(GtkWidget *parent,
+ const gchar *format, ...);
+void
+gnc_error_dialog(GtkWidget *parent,
+ const char *format, ...);
+void
+gnc_info_dialog(GtkWidget *parent,
+ const char *format, ...);
+
+
+void gnc_add_scm_extension (SCM extension);
+//char * gnc_html_encode_string(const char * str);
+//char * gnc_build_url (const gchar * type, const gchar * location,
+// const gchar * label);
+
+void gnc_set_busy_cursor (GtkWidget *w, gboolean update_now);
+void gnc_unset_busy_cursor (GtkWidget *w);
+void gnc_window_show_progress (const char *message, double percentage);
+
+gboolean gnucash_ui_is_running(void);
+
+%init {
+ {
+ char tmp[100];
+
+#define SET_ENUM(e) snprintf(tmp, 100, "(set! %s (%s))", (e), (e)); \
+ scm_c_eval_string(tmp);
+
+ SET_ENUM("URL-TYPE-FILE");
+ SET_ENUM("URL-TYPE-JUMP");
+ SET_ENUM("URL-TYPE-HTTP");
+ SET_ENUM("URL-TYPE-FTP");
+ SET_ENUM("URL-TYPE-SECURE");
+ SET_ENUM("URL-TYPE-REGISTER");
+ SET_ENUM("URL-TYPE-ACCTTREE");
+ SET_ENUM("URL-TYPE-REPORT");
+ SET_ENUM("URL-TYPE-OPTIONS");
+ SET_ENUM("URL-TYPE-SCHEME");
+ SET_ENUM("URL-TYPE-HELP");
+ SET_ENUM("URL-TYPE-XMLDATA");
+ SET_ENUM("URL-TYPE-PRICE");
+ SET_ENUM("URL-TYPE-OTHER");
+
+#undefine SET_ENUM
+ }
+
+}
Modified: gnucash/branches/swig-redo/src/report/report-system/report-utilities.scm
===================================================================
--- gnucash/branches/swig-redo/src/report/report-system/report-utilities.scm 2006-10-09 23:56:08 UTC (rev 14962)
+++ gnucash/branches/swig-redo/src/report/report-system/report-utilities.scm 2006-10-09 23:56:50 UTC (rev 14963)
@@ -701,10 +701,10 @@
0))
(define (gnc:report-percent-done percent)
- (gnc:window-show-progress #f percent))
+ (gnc:window-show-progress "" percent))
(define (gnc:report-finished)
- (gnc:window-show-progress #f -1))
+ (gnc:window-show-progress "" -1))
;; function to count the total number of splits to be iterated
(define (gnc:accounts-count-splits accounts)
More information about the gnucash-changes
mailing list