mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -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 \
|
-Lengine -Lengine/.libs \
|
||||||
-Lgnc-module -Lgnc-module/.libs \
|
-Lgnc-module -Lgnc-module/.libs \
|
||||||
-Lcalculation -Lcalculation/.libs \
|
-Lcalculation -Lcalculation/.libs \
|
||||||
|
-Lapp-utils -Lapp-utils/.libs \
|
||||||
gnc-module/libgncmodule.la \
|
gnc-module/libgncmodule.la \
|
||||||
gnome-utils/libgncmod-gnome-utils.la \
|
gnome-utils/libgncmod-gnome-utils.la \
|
||||||
app-utils/libgncmod-app-utils.la \
|
app-utils/libgncmod-app-utils.la \
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
SUBDIRS = . test
|
SUBDIRS = . #test
|
||||||
|
|
||||||
pkglib_LTLIBRARIES = libgncmod-gnome-utils.la
|
pkglib_LTLIBRARIES = libgncmod-gnome-utils.la
|
||||||
|
|
||||||
@ -40,7 +40,8 @@ libgncmod_gnome_utils_la_SOURCES = \
|
|||||||
gnc-html.c \
|
gnc-html.c \
|
||||||
gnc-menu-extensions.c \
|
gnc-menu-extensions.c \
|
||||||
gncmod-gnome-utils.c \
|
gncmod-gnome-utils.c \
|
||||||
gtkselect.c
|
gtkselect.c \
|
||||||
|
print-session.c
|
||||||
|
|
||||||
noinst_HEADERS = \
|
noinst_HEADERS = \
|
||||||
dialog-commodity.h \
|
dialog-commodity.h \
|
||||||
@ -59,7 +60,8 @@ noinst_HEADERS = \
|
|||||||
gnc-html-guppi.h \
|
gnc-html-guppi.h \
|
||||||
gnc-html.h \
|
gnc-html.h \
|
||||||
gnc-menu-extensions.h \
|
gnc-menu-extensions.h \
|
||||||
gtkselect.h
|
gtkselect.h \
|
||||||
|
print-session.h
|
||||||
|
|
||||||
libgncmod_gnome_utils_la_LDFLAGS = -module
|
libgncmod_gnome_utils_la_LDFLAGS = -module
|
||||||
|
|
||||||
|
@ -45,7 +45,6 @@
|
|||||||
#include "Account.h"
|
#include "Account.h"
|
||||||
#include "Group.h"
|
#include "Group.h"
|
||||||
#include "file-utils.h"
|
#include "file-utils.h"
|
||||||
#include "FileBox.h"
|
|
||||||
#include "FileDialog.h"
|
#include "FileDialog.h"
|
||||||
#include "dialog-utils.h"
|
#include "dialog-utils.h"
|
||||||
#include "window-register.h"
|
#include "window-register.h"
|
||||||
@ -1353,30 +1352,22 @@ raw_html_receiver (gpointer engine,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
gboolean
|
||||||
gnc_html_export(gnc_html * html) {
|
gnc_html_export(gnc_html * html, const char *filepath) {
|
||||||
const char *filepath;
|
|
||||||
FILE *fh;
|
FILE *fh;
|
||||||
|
|
||||||
filepath = fileBox (_("Save HTML To File"), NULL, NULL);
|
g_return_val_if_fail (html != NULL, FALSE);
|
||||||
if (!filepath)
|
g_return_val_if_fail (filepath != NULL, FALSE);
|
||||||
return;
|
|
||||||
|
|
||||||
PINFO (" user selected file=%s\n", filepath ? filepath : "(null)");
|
|
||||||
|
|
||||||
fh = fopen (filepath, "w");
|
fh = fopen (filepath, "w");
|
||||||
if (NULL == fh) {
|
if (!fh)
|
||||||
const char *fmt = _("Could not open the file\n"
|
return FALSE;
|
||||||
" %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;
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_html_save (GTK_HTML(html->html), raw_html_receiver, fh);
|
gtk_html_save (GTK_HTML(html->html), raw_html_receiver, fh);
|
||||||
|
|
||||||
fclose (fh);
|
fclose (fh);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -66,7 +66,7 @@ void gnc_html_show_url(gnc_html * html,
|
|||||||
void gnc_html_show_data(gnc_html * html,
|
void gnc_html_show_data(gnc_html * html,
|
||||||
const char * data, int datalen);
|
const char * data, int datalen);
|
||||||
void gnc_html_reload(gnc_html * html);
|
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_print(gnc_html * html);
|
||||||
void gnc_html_cancel(gnc_html * html);
|
void gnc_html_cancel(gnc_html * html);
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
TESTS =
|
TESTS = \
|
||||||
# test-link-module
|
test-link-module
|
||||||
# test-load-module
|
# test-load-module
|
||||||
|
|
||||||
TESTS_ENVIRONMENT= \
|
TESTS_ENVIRONMENT= \
|
||||||
@ -23,8 +23,8 @@ LDADD = \
|
|||||||
${top_srcdir}/src/engine/test-core/libgncmod-test-engine.la \
|
${top_srcdir}/src/engine/test-core/libgncmod-test-engine.la \
|
||||||
-lltdl
|
-lltdl
|
||||||
|
|
||||||
bin_PROGRAMS =
|
bin_PROGRAMS = \
|
||||||
# test-link-module
|
test-link-module
|
||||||
|
|
||||||
#EXTRA_DIST = test-load-module
|
#EXTRA_DIST = test-load-module
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@ libgncgnome_a_SOURCES = \
|
|||||||
gnc-network.c \
|
gnc-network.c \
|
||||||
gnc-splash.c \
|
gnc-splash.c \
|
||||||
mainwindow-account-tree.c \
|
mainwindow-account-tree.c \
|
||||||
print-session.c \
|
|
||||||
reconcile-list.c \
|
reconcile-list.c \
|
||||||
top-level.c \
|
top-level.c \
|
||||||
window-acct-tree.c \
|
window-acct-tree.c \
|
||||||
@ -78,7 +77,6 @@ noinst_HEADERS = \
|
|||||||
gnc-network.h \
|
gnc-network.h \
|
||||||
gnc-splash.h \
|
gnc-splash.h \
|
||||||
mainwindow-account-tree.h \
|
mainwindow-account-tree.h \
|
||||||
print-session.h \
|
|
||||||
reconcile-list.h \
|
reconcile-list.h \
|
||||||
top-level.h \
|
top-level.h \
|
||||||
window-acct-tree.h \
|
window-acct-tree.h \
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include <g-wrap-runtime-guile.h>
|
#include <g-wrap-runtime-guile.h>
|
||||||
|
|
||||||
|
#include "FileBox.h"
|
||||||
#include "dialog-options.h"
|
#include "dialog-options.h"
|
||||||
#include "dialog-utils.h"
|
#include "dialog-utils.h"
|
||||||
#include "gnc-component-manager.h"
|
#include "gnc-component-manager.h"
|
||||||
@ -335,7 +336,25 @@ gnc_report_window_export_button_cb(GtkWidget * w, gpointer data) {
|
|||||||
do_html = TRUE;
|
do_html = TRUE;
|
||||||
|
|
||||||
if (do_html)
|
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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -350,7 +369,7 @@ gnc_report_window_params_cb(GtkWidget * w, gpointer data) {
|
|||||||
|
|
||||||
if(report->cur_report != SCM_BOOL_F) {
|
if(report->cur_report != SCM_BOOL_F) {
|
||||||
if(gh_call1(start_editor, 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 {
|
else {
|
||||||
gnc_report_window_add_edited_report(report, report->cur_report);
|
gnc_report_window_add_edited_report(report, report->cur_report);
|
||||||
|
Loading…
Reference in New Issue
Block a user