2001-05-13 Dave Peticolas <dave@krondo.com>

* src/gnome/new-user.glade: tweak gui

	* src/gnome/window-main.c: the "destroy" handler does not
	return a result. add menu item & functionality for account
	hierarchy export.

	* src/scm/report/welcome-to-gnucash.scm: take out the ugly :)


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4175 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2001-05-13 10:05:38 +00:00
parent 0338dff9b6
commit fc4562838e
5 changed files with 144 additions and 17 deletions

View File

@ -1,3 +1,13 @@
2001-05-13 Dave Peticolas <dave@krondo.com>
* src/gnome/new-user.glade: tweak gui
* src/gnome/window-main.c: the "destroy" handler does not
return a result. add menu item & functionality for account
hierarchy export.
* src/scm/report/welcome-to-gnucash.scm: take out the ugly :)
2001-05-12 Christian Stimming <stimming@tuhh.de>
* src/scm/report/category-barchart.scm, net-barchart.scm,

View File

@ -215,7 +215,7 @@ create_newUserDialog (void)
gtk_widget_show (hbox1);
gtk_box_pack_start (GTK_BOX (druid_vbox1), hbox1, TRUE, TRUE, 0);
frame1 = gtk_frame_new (_("Long Description"));
frame1 = gtk_frame_new (_("Detailed Description"));
gtk_widget_set_name (frame1, "frame1");
gtk_widget_ref (frame1);
gtk_object_set_data_full (GTK_OBJECT (newUserDialog), "frame1", frame1,

View File

@ -252,7 +252,7 @@
<widget>
<class>GtkFrame</class>
<name>frame1</name>
<label>Long Description</label>
<label>Detailed Description</label>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>

View File

@ -24,14 +24,20 @@
#include "config.h"
#include <errno.h>
#include <gnome.h>
#include <guile/gh.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "gfec.h"
#include "gnc-engine.h"
#include "gnc-ui.h"
#include "gnucash.h"
#include "io-utils.h"
#include "top-level.h"
#include "extensions.h"
@ -54,12 +60,12 @@
#include "window-register.h"
#include "window-report.h"
#include "mainwindow-account-tree.h"
#include "gnc-component-manager.h"
#include "option-util.h"
#include "global-options.h"
#include "query-user.h"
#include "file-history.h"
#include "global-options.h"
#include "gnc-component-manager.h"
#include "mainwindow-account-tree.h"
#include "option-util.h"
#include "query-user.h"
#define WINDOW_MAIN_CM_CLASS "window-main"
@ -70,10 +76,9 @@ static void gnc_main_window_create_menus(GNCMainInfo * maininfo);
* Shut down the Gnucash ui windows
********************************************************************/
static int
static void
gnc_main_window_destroy_cb(GtkObject * w) {
gnc_shutdown (0);
return TRUE;
}
@ -694,6 +699,112 @@ gnc_main_window_file_import_cb(GtkWidget * widget) {
gncFileQIFImport();
}
static void
gnc_main_window_file_export_cb(GtkWidget * widget) {
const char *filename;
struct stat statbuf;
gboolean ok;
FILE *file;
int rc;
filename = fileBox (_("Export"), NULL, NULL);
if (!filename)
return;
rc = stat (filename, &statbuf);
/* Check for an error that isn't a non-existant file. */
if (rc != 0 && errno != ENOENT)
{
const char *message = _("You cannot save to that filename.");
char *string;
string = g_strconcat (message, "\n\n", strerror (errno), NULL);
gnc_error_dialog_parented (GTK_WINDOW (gtk_widget_get_toplevel (widget)),
string);
g_free (string);
return;
}
/* Check for a file that isn't a regular file. */
if (rc == 0 && !S_ISREG (statbuf.st_mode))
{
const char *message = _("You cannot save to that file.");
gnc_error_dialog_parented (GTK_WINDOW (gtk_widget_get_toplevel (widget)),
message);
return;
}
if (rc == 0)
{
const char *format = _("The file \n %s\n already exists.\n"
"Are you sure you want to overwrite it?");
char *string;
gboolean result;
string = g_strdup_printf (format, filename);
result = gnc_verify_dialog_parented (gtk_widget_get_toplevel (widget),
string, FALSE);
g_free (string);
if (!result)
return;
}
file = fopen (filename, "w");
if (!file)
{
const char *message = _("You cannot save to that file.");
char *string;
string = g_strconcat (message, "\n\n", strerror (errno), NULL);
gnc_error_dialog_parented (GTK_WINDOW (gtk_widget_get_toplevel (widget)),
string);
g_free (string);
return;
}
ok = FALSE;
do
{
rc = fputs ("<?xml version=\"1.0\"?>\n", file);
if (rc == EOF)
break;
rc = fputs ("<gnc-v2>\n", file);
if (rc == EOF)
break;
write_accounts (file, gncGetCurrentBook ());
rc = fputs ("<\\gnc-v2>\n", file);
if (rc == EOF)
break;
write_emacs_trailer (file);
rc = fclose (file);
if (rc != 0)
break;
ok = TRUE;
} while (FALSE);
if (!ok)
{
const char *message = _("There was an error saving the file.");
char *string;
string = g_strconcat (message, "\n\n", strerror (errno), NULL);
gnc_error_dialog_parented (GTK_WINDOW (gtk_widget_get_toplevel (widget)),
string);
g_free (string);
return;
}
}
static void
gnc_main_window_file_shutdown_cb(GtkWidget * widget) {
gnc_shutdown(0);
@ -810,6 +921,14 @@ gnc_main_window_create_menus(GNCMainInfo * maininfo) {
GNOMEUIINFO_MENU_OPEN_ITEM(gnc_main_window_file_open_cb, NULL),
GNOMEUIINFO_MENU_SAVE_ITEM(gnc_main_window_file_save_cb, NULL),
GNOMEUIINFO_MENU_SAVE_AS_ITEM(gnc_main_window_file_save_as_cb, NULL),
{
GNOME_APP_UI_ITEM,
N_("Export Accounts..."),
N_("Export the account hierarchy to a new file"),
gnc_main_window_file_export_cb, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
0, 0, NULL
},
GNOMEUIINFO_SEPARATOR,
{
GNOME_APP_UI_ITEM,

View File

@ -31,11 +31,11 @@
(sub-income-pie (gnc:make-report "Income Accounts"))
(sub-bar (gnc:make-report "Income/Expense Chart"))
(options #f))
(define (set-option! section name value)
(gnc:option-set-value
(gnc:lookup-option options section name) value))
(set! options (gnc:report-options (gnc:find-report view)))
(set-option! "General" "Report name" "Welcome to GnuCash 1.6")
(set-option! "General" "Number of columns" 2)
@ -67,15 +67,13 @@
(gnc:html-document-add-object!
doc
(gnc:make-html-text
(gnc:html-markup-h2 "Welcome to GnuCash 1.6!")
(gnc:html-markup-p
"GnuCash 1.6 has lots of nice features. Here are a few.")
(gnc:html-markup-p
"I know this is ugly.")))
(gnc:html-markup-h2 (_ "Welcome to GnuCash 1.6!"))
(gnc:html-markup-p
(_ "GnuCash 1.6 has lots of nice features. Here are a few."))))
doc))
(gnc:define-report
'name "Welcome to GnuCash 1.6"
'name (N_ "Welcome to GnuCash 1.6")
'in-menu? #f
'options-generator options
'renderer renderer))