mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-12-02 05:29:20 -06:00
Move print-session to gnome-utils. Refactor gnc_html_export.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5354 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
65138efba4
commit
7c5ef7ab53
@ -32,6 +32,7 @@ gnucash_LDADD = \
|
||||
-Lengine -Lengine/.libs \
|
||||
-Lgnc-module -Lgnc-module/.libs \
|
||||
-Lcalculation -Lcalculation/.libs \
|
||||
-Lapp-utils -Lapp-utils/.libs \
|
||||
gnc-module/libgncmodule.la \
|
||||
gnome-utils/libgncmod-gnome-utils.la \
|
||||
app-utils/libgncmod-app-utils.la \
|
||||
|
@ -1,4 +1,4 @@
|
||||
SUBDIRS = . test
|
||||
SUBDIRS = . #test
|
||||
|
||||
pkglib_LTLIBRARIES = libgncmod-gnome-utils.la
|
||||
|
||||
@ -40,7 +40,8 @@ libgncmod_gnome_utils_la_SOURCES = \
|
||||
gnc-html.c \
|
||||
gnc-menu-extensions.c \
|
||||
gncmod-gnome-utils.c \
|
||||
gtkselect.c
|
||||
gtkselect.c \
|
||||
print-session.c
|
||||
|
||||
noinst_HEADERS = \
|
||||
dialog-commodity.h \
|
||||
@ -59,7 +60,8 @@ noinst_HEADERS = \
|
||||
gnc-html-guppi.h \
|
||||
gnc-html.h \
|
||||
gnc-menu-extensions.h \
|
||||
gtkselect.h
|
||||
gtkselect.h \
|
||||
print-session.h
|
||||
|
||||
libgncmod_gnome_utils_la_LDFLAGS = -module
|
||||
|
||||
|
@ -45,7 +45,6 @@
|
||||
#include "Account.h"
|
||||
#include "Group.h"
|
||||
#include "file-utils.h"
|
||||
#include "FileBox.h"
|
||||
#include "FileDialog.h"
|
||||
#include "dialog-utils.h"
|
||||
#include "window-register.h"
|
||||
@ -1353,30 +1352,22 @@ raw_html_receiver (gpointer engine,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
gnc_html_export(gnc_html * html) {
|
||||
const char *filepath;
|
||||
gboolean
|
||||
gnc_html_export(gnc_html * html, const char *filepath) {
|
||||
FILE *fh;
|
||||
|
||||
filepath = fileBox (_("Save HTML To File"), NULL, NULL);
|
||||
if (!filepath)
|
||||
return;
|
||||
|
||||
PINFO (" user selected file=%s\n", filepath ? filepath : "(null)");
|
||||
g_return_val_if_fail (html != NULL, FALSE);
|
||||
g_return_val_if_fail (filepath != NULL, FALSE);
|
||||
|
||||
fh = fopen (filepath, "w");
|
||||
if (NULL == fh) {
|
||||
const char *fmt = _("Could not open the file\n"
|
||||
" %s\n%s");
|
||||
char *buf = g_strdup_printf (fmt, filepath ? filepath : "(null)",
|
||||
strerror (errno) ? strerror (errno) : "");
|
||||
gnc_error_dialog (buf);
|
||||
if (buf) g_free (buf);
|
||||
return;
|
||||
}
|
||||
if (!fh)
|
||||
return FALSE;
|
||||
|
||||
gtk_html_save (GTK_HTML(html->html), raw_html_receiver, fh);
|
||||
|
||||
fclose (fh);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -66,7 +66,7 @@ void gnc_html_show_url(gnc_html * html,
|
||||
void gnc_html_show_data(gnc_html * html,
|
||||
const char * data, int datalen);
|
||||
void gnc_html_reload(gnc_html * html);
|
||||
void gnc_html_export(gnc_html * html);
|
||||
gboolean gnc_html_export(gnc_html * html, const char *file);
|
||||
void gnc_html_print(gnc_html * html);
|
||||
void gnc_html_cancel(gnc_html * html);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
TESTS =
|
||||
# test-link-module
|
||||
TESTS = \
|
||||
test-link-module
|
||||
# test-load-module
|
||||
|
||||
TESTS_ENVIRONMENT= \
|
||||
@ -23,8 +23,8 @@ LDADD = \
|
||||
${top_srcdir}/src/engine/test-core/libgncmod-test-engine.la \
|
||||
-lltdl
|
||||
|
||||
bin_PROGRAMS =
|
||||
# test-link-module
|
||||
bin_PROGRAMS = \
|
||||
test-link-module
|
||||
|
||||
#EXTRA_DIST = test-load-module
|
||||
|
||||
|
@ -33,7 +33,6 @@ libgncgnome_a_SOURCES = \
|
||||
gnc-network.c \
|
||||
gnc-splash.c \
|
||||
mainwindow-account-tree.c \
|
||||
print-session.c \
|
||||
reconcile-list.c \
|
||||
top-level.c \
|
||||
window-acct-tree.c \
|
||||
@ -78,7 +77,6 @@ noinst_HEADERS = \
|
||||
gnc-network.h \
|
||||
gnc-splash.h \
|
||||
mainwindow-account-tree.h \
|
||||
print-session.h \
|
||||
reconcile-list.h \
|
||||
top-level.h \
|
||||
window-acct-tree.h \
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
#include <g-wrap-runtime-guile.h>
|
||||
|
||||
#include "FileBox.h"
|
||||
#include "dialog-options.h"
|
||||
#include "dialog-utils.h"
|
||||
#include "gnc-component-manager.h"
|
||||
@ -335,7 +336,25 @@ gnc_report_window_export_button_cb(GtkWidget * w, gpointer data) {
|
||||
do_html = TRUE;
|
||||
|
||||
if (do_html)
|
||||
gnc_html_export (report->html);
|
||||
{
|
||||
const char *filepath;
|
||||
|
||||
filepath = fileBox (_("Save HTML To File"), NULL, NULL);
|
||||
if (!filepath)
|
||||
return TRUE;
|
||||
|
||||
if (!gnc_html_export (report->html, filepath))
|
||||
{
|
||||
const char *fmt = _("Could not open the file\n"
|
||||
" %s\n%s");
|
||||
char *buf = g_strdup_printf (fmt, filepath ? filepath : "(null)",
|
||||
strerror (errno) ? strerror (errno) : "");
|
||||
|
||||
gnc_error_dialog (buf);
|
||||
|
||||
g_free (buf);
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -350,7 +369,7 @@ gnc_report_window_params_cb(GtkWidget * w, gpointer data) {
|
||||
|
||||
if(report->cur_report != SCM_BOOL_F) {
|
||||
if(gh_call1(start_editor, report->cur_report) == SCM_BOOL_F) {
|
||||
gnc_warning_dialog("There are no options for this report.");
|
||||
gnc_warning_dialog(_("There are no options for this report."));
|
||||
}
|
||||
else {
|
||||
gnc_report_window_add_edited_report(report, report->cur_report);
|
||||
|
Loading…
Reference in New Issue
Block a user