r14961 - gnucash/branches/swig-redo/src/report/report-gnome - Convert the report-gnome module from gwrap to swig. All at once:
Chris Shoemaker
chris at cvs.gnucash.org
Mon Oct 9 19:55:31 EDT 2006
Author: chris
Date: 2006-10-09 19:55:31 -0400 (Mon, 09 Oct 2006)
New Revision: 14961
Trac: http://svn.gnucash.org/trac/changeset/14961
Added:
gnucash/branches/swig-redo/src/report/report-gnome/report-gnome.i
Modified:
gnucash/branches/swig-redo/src/report/report-gnome/Makefile.am
gnucash/branches/swig-redo/src/report/report-gnome/dialog-column-view.c
gnucash/branches/swig-redo/src/report/report-gnome/gnc-plugin-page-report.c
gnucash/branches/swig-redo/src/report/report-gnome/gncmod-report-gnome.c
gnucash/branches/swig-redo/src/report/report-gnome/report-gnome.scm
gnucash/branches/swig-redo/src/report/report-gnome/window-report.c
Log:
Convert the report-gnome module from gwrap to swig. All at once:
Add the interface definition.
Convert the runtime code from gwrap to swig.
Rename wrapped function calls to their swig-names.
Modified: gnucash/branches/swig-redo/src/report/report-gnome/Makefile.am
===================================================================
--- gnucash/branches/swig-redo/src/report/report-gnome/Makefile.am 2006-10-09 23:54:41 UTC (rev 14960)
+++ gnucash/branches/swig-redo/src/report/report-gnome/Makefile.am 2006-10-09 23:55:31 UTC (rev 14961)
@@ -3,7 +3,7 @@
# to get the test-link-mumble to link correctly; plz assist.
PWD := $(shell pwd)
-pkglib_LTLIBRARIES = libgncmod-report-gnome.la libgw-report-gnome.la
+pkglib_LTLIBRARIES = libgncmod-report-gnome.la
AM_CFLAGS = \
-I${top_srcdir}/src \
@@ -24,6 +24,7 @@
${GLIB_CFLAGS}
libgncmod_report_gnome_la_SOURCES = \
+ swig-report-gnome.c \
dialog-column-view.c \
dialog-style-sheet.c \
gnc-plugin-page-report.c \
@@ -51,15 +52,10 @@
${QOF_LIBS} \
${GLIB_LIBS}
-nodist_libgw_report_gnome_la_SOURCES = gw-report-gnome.c
-libgw_report_gnome_la_LIBADD = \
- libgncmod-report-gnome.la \
- ${G_WRAP_LINK_ARGS}
+swig-report-gnome.c: report-gnome.i ${gncinclude_HEADERS}
+ swig -guile $(SWIG_ARGS) -Linkage module \
+ -I${top_srcdir}/src/engine -o $@ $<
-gwmoddir = ${GNC_GWRAP_LIBDIR}
-gwmod_DATA = gw-report-gnome-spec.scm
-nodist_gwmod_DATA = gw-report-gnome.scm
-
gncmoddir = ${GNC_SHAREDIR}/guile-modules/gnucash/report
gncmod_DATA = report-gnome.scm
@@ -75,22 +71,18 @@
EXTRA_DIST = \
${glade_DATA} \
- ${gwmod_DATA} \
${gncmod_DATA} \
${ui_DATA}
if GNUCASH_SEPARATE_BUILDDIR
#Only needed when srcdir and builddir are different
-# for compiling
-SCM_FILE_LINKS = gw-report-gnome-spec.scm
# for running
-SCM_FILE_LINKS += ${gncmod_DATA}
+SCM_FILE_LINKS = ${gncmod_DATA}
endif
.scm-links:
- rm -f gnucash g-wrapped
+ rm -f gnucash
$(LN_S) -f . gnucash
- $(LN_S) -f . g-wrapped
$(LN_S) -f ${srcdir} report
if GNUCASH_SEPARATE_BUILDDIR
for X in ${SCM_FILE_LINKS} ; do \
@@ -99,18 +91,5 @@
endif
touch .scm-links
-gw-report-gnome.scm gw-report-gnome.c gw-report-gnome.h: \
- .scm-links gw-report-gnome-spec.scm ${top_builddir}/config.status
- 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)) \
- (set! %load-path (cons \"${top_builddir}/src/gnome-utils\" %load-path)) \
- (set! %load-path (cons \"${top_builddir}/src/gnome\" %load-path)) \
- (primitive-load \"./gw-report-gnome-spec.scm\") \
- (gw:generate-wrapset \"gw-report-gnome\")"
-
-BUILT_SOURCES = gw-report-gnome.scm gw-report-gnome.c gw-report-gnome.h
-CLEANFILES = $(BUILT_SOURCES) gnucash g-wrapped report .scm-links \
- ${SCM_FILE_LINKS} gw-report-gnome.html
+BUILT_SOURCES = swig-report-gnome.c
+CLEANFILES = $(BUILT_SOURCES) gnucash report .scm-links ${SCM_FILE_LINKS}
Modified: gnucash/branches/swig-redo/src/report/report-gnome/dialog-column-view.c
===================================================================
--- gnucash/branches/swig-redo/src/report/report-gnome/dialog-column-view.c 2006-10-09 23:54:41 UTC (rev 14960)
+++ gnucash/branches/swig-redo/src/report/report-gnome/dialog-column-view.c 2006-10-09 23:55:31 UTC (rev 14961)
@@ -25,7 +25,7 @@
#include <glib/gi18n.h>
#include <libguile.h>
-#include <g-wrap-wct.h>
+#include "swig-runtime.h"
#include "dialog-column-view.h"
#include "dialog-options.h"
@@ -65,7 +65,6 @@
int contents_selected;
};
-
static void gnc_column_view_edit_add_cb(GtkButton * button,
gpointer user_data);
static void gnc_column_view_edit_remove_cb(GtkButton * button,
@@ -271,8 +270,10 @@
ptr = scm_call_1(get_editor, view);
if(ptr != SCM_BOOL_F) {
- GtkWindow * w = gw_wcp_get_ptr(ptr);
+#define FUNC_NAME "gtk_window_present"
+ GtkWindow * w = SWIG_MustGetPtr(ptr, SWIG_TypeQuery("_p_GtkWidget"), 1, 0);
gtk_window_present(w);
+#undef FUNC_NAME
return NULL;
}
else {
Modified: gnucash/branches/swig-redo/src/report/report-gnome/gnc-plugin-page-report.c
===================================================================
--- gnucash/branches/swig-redo/src/report/report-gnome/gnc-plugin-page-report.c 2006-10-09 23:54:41 UTC (rev 14960)
+++ gnucash/branches/swig-redo/src/report/report-gnome/gnc-plugin-page-report.c 2006-10-09 23:55:31 UTC (rev 14961)
@@ -45,7 +45,6 @@
#ifndef HAVE_GLIB26
#include "gkeyfile.h"
#endif
-#include <g-wrap-wct.h>
#include <libguile.h>
#include <sys/stat.h>
#include <errno.h>
@@ -67,6 +66,7 @@
#include "guile-util.h"
#include "option-util.h"
#include "window-report.h"
+#include "swig-runtime.h"
#define WINDOW_REPORT_CM_CLASS "window-report"
@@ -904,7 +904,12 @@
editor = scm_call_1(get_editor, SCM_CAR(edited));
scm_call_2(set_editor, SCM_CAR(edited), SCM_BOOL_F);
if (editor != SCM_BOOL_F) {
- gtk_widget_destroy(GTK_WIDGET(gw_wcp_get_ptr(editor)));
+ GtkWidget *w = NULL;
+ #define FUNC_NAME "gtk_widget_destroy"
+ w = SWIG_MustGetPtr(editor,
+ SWIG_TypeQuery("_p_GtkWidget"), 1, 0);
+ #undef FUNC_NAME
+ gtk_widget_destroy(GTK_WIDGET(w));
}
}
@@ -1101,7 +1106,11 @@
{
SCM get_editor = scm_c_eval_string("gnc:report-editor-widget");
SCM editor = scm_call_1(get_editor, report);
- gtk_window_present(gw_wcp_get_ptr(editor));
+ #define FUNC_NAME "gtk_window_present"
+ GtkWidget *w = SWIG_MustGetPtr(editor,
+ SWIG_TypeQuery("_p_GtkWidget"), 1, 0);
+ #undef FUNC_NAME
+ gtk_window_present(GTK_WINDOW(w));
}
static void
Modified: gnucash/branches/swig-redo/src/report/report-gnome/gncmod-report-gnome.c
===================================================================
--- gnucash/branches/swig-redo/src/report/report-gnome/gncmod-report-gnome.c 2006-10-09 23:54:41 UTC (rev 14960)
+++ gnucash/branches/swig-redo/src/report/report-gnome/gncmod-report-gnome.c 2006-10-09 23:55:31 UTC (rev 14961)
@@ -52,6 +52,7 @@
scm_c_eval_string(form);
g_free(form);
}
+extern SCM scm_init_sw_report_gnome_module(void);
int
libgncmod_report_gnome_LTX_gnc_module_init(int refcount)
@@ -67,8 +68,9 @@
if(!gnc_module_load("gnucash/report/report-system", 0)) {
return FALSE;
}
+ scm_init_sw_report_gnome_module();
- lmod ("(g-wrapped gw-report-gnome)");
+ lmod ("(sw_report_gnome)");
lmod ("(gnucash report report-gnome)");
if (refcount == 0)
Added: gnucash/branches/swig-redo/src/report/report-gnome/report-gnome.i
===================================================================
--- gnucash/branches/swig-redo/src/report/report-gnome/report-gnome.i 2006-10-09 23:54:41 UTC (rev 14960)
+++ gnucash/branches/swig-redo/src/report/report-gnome/report-gnome.i 2006-10-09 23:55:31 UTC (rev 14961)
@@ -0,0 +1,24 @@
+%module sw_report_gnome
+%{
+/* Includes the header in the wrapper code */
+#include <config.h>
+#include <gtk/gtk.h>
+#include <dialog-column-view.h>
+#include <gnc-plugin-page-report.h>
+#include <window-report.h>
+
+#include <g-wrap-wct.h> //Temporary. Adds no link dep?!?
+%}
+
+// Temporary SWIG<->G-wrap converters
+%typemap(in) GncMainWindow * "$1 = (GncMainWindow *)gw_wcp_get_ptr($input);"
+%typemap(out) GncMainWindow * {
+ $result = gw_wcp_assimilate_ptr($1, scm_c_eval_string("<gnc:MainWindow*>"));
+}
+// End of temporary typemaps.
+
+void gnc_report_raise_editor(SCM report);
+void gnc_main_window_open_report(int report_id, GncMainWindow *window);
+GtkWidget * gnc_report_window_default_params_editor(SCM options, SCM report);
+GtkWidget * gnc_column_view_edit_options(SCM options, SCM view);
+
Modified: gnucash/branches/swig-redo/src/report/report-gnome/report-gnome.scm
===================================================================
--- gnucash/branches/swig-redo/src/report/report-gnome/report-gnome.scm 2006-10-09 23:54:41 UTC (rev 14960)
+++ gnucash/branches/swig-redo/src/report/report-gnome/report-gnome.scm 2006-10-09 23:55:31 UTC (rev 14961)
@@ -14,7 +14,7 @@
(require 'printf)
(use-modules (g-wrapped gw-core-utils))
-(use-modules (g-wrapped gw-report-gnome))
+(use-modules (sw_report_gnome))
(gnc:module-load "gnucash/gnome-utils" 0)
(gnc:module-load "gnucash/report/report-system" 0)
@@ -28,15 +28,15 @@
;; and returns a widget
(define (gnc:report-options-editor report)
(if (equal? (gnc:report-type report) "Multicolumn View")
- gnc:column-view-edit-options
- gnc:default-options-editor))
+ gnc-column-view-edit-options
+ gnc-report-window-default-params-editor))
;; do not rely on the return value of this function - it has none.
;; instead, this function's side-effect is to set the report's editor widget.
(define (gnc:report-edit-options report)
(let* ((editor-widg (gnc:report-editor-widget report)))
(if editor-widg
- (gnc:report-raise-editor report)
+ (gnc-report-raise-editor report)
(begin
(if (gnc:report-options report)
(begin
@@ -79,7 +79,7 @@
(lambda (window)
(let ((report (gnc:make-report
(gnc:report-template-name template))))
- (gnc:main-window-open-report report window)))))
+ (gnc-main-window-open-report report window)))))
(gnc:add-extension item))))
(define (add-template name template)
@@ -127,5 +127,5 @@
(N_ "Welcome-to-GnuCash report screen")
(list gnc:menuname-reports gnc:menuname-utility "")
(lambda (window)
- (gnc:main-window-open-report (gnc:make-welcome-report) window))))
+ (gnc-main-window-open-report (gnc:make-welcome-report) window))))
)
Modified: gnucash/branches/swig-redo/src/report/report-gnome/window-report.c
===================================================================
--- gnucash/branches/swig-redo/src/report/report-gnome/window-report.c 2006-10-09 23:54:41 UTC (rev 14960)
+++ gnucash/branches/swig-redo/src/report/report-gnome/window-report.c 2006-10-09 23:55:31 UTC (rev 14961)
@@ -33,8 +33,7 @@
#include <libguile.h>
#include <sys/stat.h>
-#include <g-wrap-wct.h>
-
+#include "swig-runtime.h"
#include "dialog-options.h"
#include "file-utils.h"
#include "gnc-gkeyfile-utils.h"
@@ -151,8 +150,10 @@
ptr = scm_call_1(get_editor, report);
if(ptr != SCM_BOOL_F) {
- GtkWindow * w = gw_wcp_get_ptr(ptr);
+ #define FUNC_NAME "gtk_window_present"
+ GtkWindow * w = SWIG_MustGetPtr(ptr, SWIG_TypeQuery("_p_GtkWidget"), 1, 0);
gtk_window_present(w);
+ #undef FUNC_NAME
return NULL;
}
else {
@@ -192,9 +193,13 @@
void
gnc_report_raise_editor(SCM report)
{
- SCM get_editor = scm_c_eval_string("gnc:report-editor-widget");
- SCM editor = scm_call_1(get_editor, report);
- gtk_window_present(gw_wcp_get_ptr(editor));
+ SCM get_editor = scm_c_eval_string("gnc:report-editor-widget");
+ SCM editor = scm_call_1(get_editor, report);
+ #define FUNC_NAME "gtk_window_present"
+ GtkWidget *w = SWIG_MustGetPtr(editor,
+ SWIG_TypeQuery("_p_GtkWidget"), 1, 0);
+ #undef FUNC_NAME
+ gtk_window_present(GTK_WINDOW(w));
}
static gboolean
@@ -228,6 +233,7 @@
return ok;
}
+/* TODO: unroll start_editor */
static gboolean
gnc_html_options_url_cb (const char *location, const char *label,
gboolean new_window, GNCURLResult *result)
More information about the gnucash-changes
mailing list