*** empty log message ***

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2103 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2000-03-23 04:20:01 +00:00
parent 2d7022d07b
commit 3d6fc24d2b
11 changed files with 1352 additions and 15 deletions

View File

@ -23,8 +23,6 @@
#include <gnome.h>
#include <stdio.h>
#include "glade-account-picker.h"
#include "glade-cb-account-picker.h"
#include "dialog-account-picker.h"
#include <guile/gh.h>
@ -99,7 +97,7 @@ accountPickerBox(char * initial_selection, int initial_type) {
wind = g_new0(QIFAccountPickerDialog, 1);
wind->dialog = create_GNUcash_Account_Picker();
wind->dialog = create_QIF_Import_Account_Picker();
wind->treeview =
gtk_object_get_data(GTK_OBJECT(wind->dialog), "account_tree");
wind->acct_entry =

View File

@ -21,8 +21,8 @@
#ifndef __DIALOG_ACCOUNT_PICKER_H_
#define __DIALOG_ACCOUNT_PICKER_H_
#include "glade-account-picker.h"
#include "glade-cb-account-picker.h"
#include "glade-gnc-dialogs.h"
#include "glade-cb-gnc-dialogs.h"
#include <guile/gh.h>

View File

@ -31,6 +31,7 @@
#include "dialog-account-picker.h"
#include "window-help.h"
#include "messages.h"
#include "messages_i18n.h"
#include "gnome-top-level.h"
#include "ui-callbacks.h"
@ -227,7 +228,9 @@ gnc_ui_qif_import_select_file_cb(GtkButton * button,
new_file_name = fileBox(_("Select QIF File"), "*.qif");
if(new_file_name) {
if(new_file_name && (access(new_file_name, R_OK) == 0)) {
/* set the filename entry for what was selected */
if(wind->filename_entry) {
@ -278,6 +281,7 @@ gnc_ui_qif_import_load_file_cb (GtkButton *button,
char * path_to_load;
char * qif_account;
char * currency;
char * error_string = NULL;
int radix_format;
int date_format;
@ -288,6 +292,7 @@ gnc_ui_qif_import_load_file_cb (GtkButton *button,
SCM scm_filename, scm_currency, scm_radix, scm_date, scm_qif_account;
SCM scm_qiffile;
SCM imported_files = SCM_EOL;
SCM load_return;
char * radix_symbols [] = { "unknown", "decimal", "comma" };
char * date_symbols [] = { "unknown", "m-d-y", "d-m-y",
@ -378,13 +383,21 @@ gnc_ui_qif_import_load_file_cb (GtkButton *button,
* guile-space */
scm_protect_object(wind->selected_file);
load_return = gh_call2(qif_file_load, gh_car(imported_files),
scm_filename);
/* import the file into it */
if(gh_call2(qif_file_load,
gh_car(imported_files),
scm_filename) != SCM_BOOL_T) {
gnc_error_dialog_parented
(GTK_WINDOW(wind->dialog),
_("Failed to load QIF file. Are you sure it's a QIF file?"));
if(load_return != SCM_BOOL_T) {
if(gh_list_p(load_return)) {
asprintf(&error_string,
QIF_LOAD_FAILED_FORMAT_MSG,
gh_scm2newstr(gh_cadr(load_return), NULL));
}
else {
error_string = QIF_LOAD_FAILED_DEFAULT_MSG;
}
gnc_error_dialog_parented(GTK_WINDOW(wind->dialog), error_string);
imported_files =
gh_call2(unload_qif_file, scm_filename, imported_files);
}

View File

@ -23,8 +23,8 @@
#include <guile/gh.h>
#include "glade-qif-import.h"
#include "glade-cb-qif-import.h"
#include "glade-gnc-dialogs.h"
#include "glade-cb-gnc-dialogs.h"
#include "ui-callbacks.h"

View File

@ -0,0 +1,77 @@
#include <gnome.h>
void
gnc_ui_qif_import_select_loaded_file_cb
(GtkList *list,
GtkWidget *widget,
gpointer user_data);
void
gnc_ui_qif_import_select_file_cb (GtkButton *button,
gpointer user_data);
void
gnc_ui_qif_import_load_file_cb (GtkButton *button,
gpointer user_data);
void
gnc_ui_qif_import_account_line_select_cb
(GtkCList *clist,
gint row,
gint column,
GdkEvent *event,
gpointer user_data);
void
gnc_ui_qif_import_category_line_select_cb
(GtkCList *clist,
gint row,
gint column,
GdkEvent *event,
gpointer user_data);
void
gnc_ui_qif_import_ok_cb (GtkButton *button,
gpointer user_data);
void
gnc_ui_qif_import_cancel_cb (GtkButton *button,
gpointer user_data);
void
gnc_ui_qif_import_help_cb (GtkButton *button,
gpointer user_data);
void
gnc_ui_account_picker_select_cb (GtkTree *tree,
GtkWidget *widget,
gpointer user_data);
void
gnc_ui_account_picker_ok_cb (GtkButton *button,
gpointer user_data);
void
gnc_ui_account_picker_cancel_cb (GtkButton *button,
gpointer user_data);
void
gnc_ui_print_preview_OK_cb (GtkButton *button,
gpointer user_data);
void
gnc_ui_print_dialog_select_printer_cb (GtkButton *button,
gpointer user_data);
void
gnc_ui_print_dialog_preview_cb (GtkButton *button,
gpointer user_data);
void
gnc_ui_print_dialog_ok_cb (GtkButton *button,
gpointer user_data);
void
gnc_ui_print_dialog_cancel_cb (GtkButton *button,
gpointer user_data);

View File

@ -0,0 +1,829 @@
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <gnome.h>
#include "glade-cb-gnc-dialogs.h"
#include "glade-gnc-dialogs.h"
#include "glade-support-gnc-dialogs.h"
GtkWidget*
create_QIF_File_Import_Dialog (void)
{
GtkWidget *QIF_File_Import_Dialog;
GtkWidget *dialog_vbox2;
GtkWidget *notebook1;
GtkWidget *hbox1;
GtkWidget *frame2;
GtkWidget *scrolledwindow1;
GtkWidget *viewport1;
GtkWidget *selected_file_list;
GtkWidget *frame3;
GtkWidget *vbox2;
GtkWidget *hbox10;
GtkWidget *vbox3;
GtkWidget *label1;
GtkWidget *label679;
GtkWidget *currency_label;
GtkWidget *radix_format_label;
GtkWidget *date_format_label;
GtkWidget *vbox4;
GtkWidget *qif_filename_entry;
GtkWidget *hbox11;
GtkWidget *qif_account_auto_check;
GtkWidget *qif_account_entry;
GtkWidget *qif_currency_entry;
GtkWidget *qif_radix_picker;
GtkWidget *qif_radix_picker_menu;
GtkWidget *glade_menuitem;
GtkWidget *qif_date_picker;
GtkWidget *qif_date_picker_menu;
GtkWidget *hbox9;
GtkWidget *file_select_btn;
GtkWidget *add_file_button;
GtkWidget *label69;
GtkWidget *scrolledwindow2;
GtkWidget *account_page_list;
GtkWidget *label682;
GtkWidget *label683;
GtkWidget *label684;
GtkWidget *label685;
GtkWidget *label2;
GtkWidget *scrolledwindow3;
GtkWidget *category_page_list;
GtkWidget *label686;
GtkWidget *label687;
GtkWidget *label688;
GtkWidget *label689;
GtkWidget *foo6868;
GtkWidget *dialog_action_area2;
GtkWidget *button2;
GtkWidget *button3;
GtkWidget *button4;
QIF_File_Import_Dialog = gnome_dialog_new (NULL, NULL);
gtk_object_set_data (GTK_OBJECT (QIF_File_Import_Dialog), "QIF_File_Import_Dialog", QIF_File_Import_Dialog);
gtk_window_set_policy (GTK_WINDOW (QIF_File_Import_Dialog), TRUE, TRUE, TRUE);
dialog_vbox2 = GNOME_DIALOG (QIF_File_Import_Dialog)->vbox;
gtk_object_set_data (GTK_OBJECT (QIF_File_Import_Dialog), "dialog_vbox2", dialog_vbox2);
gtk_widget_show (dialog_vbox2);
notebook1 = gtk_notebook_new ();
gtk_widget_ref (notebook1);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "notebook1", notebook1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (notebook1);
gtk_box_pack_start (GTK_BOX (dialog_vbox2), notebook1, TRUE, TRUE, 0);
hbox1 = gtk_hbox_new (FALSE, 0);
gtk_widget_ref (hbox1);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "hbox1", hbox1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (hbox1);
gtk_container_add (GTK_CONTAINER (notebook1), hbox1);
frame2 = gtk_frame_new (_("Loaded Files"));
gtk_widget_ref (frame2);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "frame2", frame2,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (frame2);
gtk_box_pack_start (GTK_BOX (hbox1), frame2, TRUE, TRUE, 0);
gtk_widget_set_usize (frame2, 200, -2);
scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_ref (scrolledwindow1);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "scrolledwindow1", scrolledwindow1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (scrolledwindow1);
gtk_container_add (GTK_CONTAINER (frame2), scrolledwindow1);
gtk_widget_set_usize (scrolledwindow1, -2, 150);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
viewport1 = gtk_viewport_new (NULL, NULL);
gtk_widget_ref (viewport1);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "viewport1", viewport1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (viewport1);
gtk_container_add (GTK_CONTAINER (scrolledwindow1), viewport1);
selected_file_list = gtk_list_new ();
gtk_widget_ref (selected_file_list);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "selected_file_list", selected_file_list,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (selected_file_list);
gtk_container_add (GTK_CONTAINER (viewport1), selected_file_list);
frame3 = gtk_frame_new (_("File Info"));
gtk_widget_ref (frame3);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "frame3", frame3,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (frame3);
gtk_box_pack_start (GTK_BOX (hbox1), frame3, TRUE, TRUE, 0);
vbox2 = gtk_vbox_new (FALSE, 0);
gtk_widget_ref (vbox2);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "vbox2", vbox2,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (vbox2);
gtk_container_add (GTK_CONTAINER (frame3), vbox2);
hbox10 = gtk_hbox_new (FALSE, 0);
gtk_widget_ref (hbox10);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "hbox10", hbox10,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (hbox10);
gtk_box_pack_start (GTK_BOX (vbox2), hbox10, TRUE, TRUE, 0);
vbox3 = gtk_vbox_new (TRUE, 0);
gtk_widget_ref (vbox3);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "vbox3", vbox3,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (vbox3);
gtk_box_pack_start (GTK_BOX (hbox10), vbox3, TRUE, TRUE, 5);
label1 = gtk_label_new (_("QIF Filename:"));
gtk_widget_ref (label1);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "label1", label1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label1);
gtk_box_pack_start (GTK_BOX (vbox3), label1, FALSE, FALSE, 0);
gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_RIGHT);
gtk_misc_set_alignment (GTK_MISC (label1), 1, 0.5);
label679 = gtk_label_new (_("QIF Account:"));
gtk_widget_ref (label679);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "label679", label679,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label679);
gtk_box_pack_start (GTK_BOX (vbox3), label679, FALSE, FALSE, 5);
gtk_label_set_justify (GTK_LABEL (label679), GTK_JUSTIFY_RIGHT);
gtk_misc_set_alignment (GTK_MISC (label679), 1, 0.5);
currency_label = gtk_label_new (_("Currency:"));
gtk_widget_ref (currency_label);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "currency_label", currency_label,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (currency_label);
gtk_box_pack_start (GTK_BOX (vbox3), currency_label, FALSE, FALSE, 0);
gtk_label_set_justify (GTK_LABEL (currency_label), GTK_JUSTIFY_RIGHT);
gtk_misc_set_alignment (GTK_MISC (currency_label), 1, 0.5);
radix_format_label = gtk_label_new (_("Radix format:"));
gtk_widget_ref (radix_format_label);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "radix_format_label", radix_format_label,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (radix_format_label);
gtk_box_pack_start (GTK_BOX (vbox3), radix_format_label, FALSE, FALSE, 0);
gtk_label_set_justify (GTK_LABEL (radix_format_label), GTK_JUSTIFY_RIGHT);
gtk_misc_set_alignment (GTK_MISC (radix_format_label), 1, 0.5);
date_format_label = gtk_label_new (_("Date format:"));
gtk_widget_ref (date_format_label);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "date_format_label", date_format_label,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (date_format_label);
gtk_box_pack_start (GTK_BOX (vbox3), date_format_label, FALSE, FALSE, 0);
gtk_label_set_justify (GTK_LABEL (date_format_label), GTK_JUSTIFY_RIGHT);
gtk_misc_set_alignment (GTK_MISC (date_format_label), 1, 0.5);
vbox4 = gtk_vbox_new (TRUE, 0);
gtk_widget_ref (vbox4);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "vbox4", vbox4,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (vbox4);
gtk_box_pack_start (GTK_BOX (hbox10), vbox4, TRUE, TRUE, 5);
qif_filename_entry = gtk_entry_new ();
gtk_widget_ref (qif_filename_entry);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "qif_filename_entry", qif_filename_entry,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (qif_filename_entry);
gtk_box_pack_start (GTK_BOX (vbox4), qif_filename_entry, FALSE, FALSE, 0);
GTK_WIDGET_SET_FLAGS (qif_filename_entry, GTK_CAN_DEFAULT);
hbox11 = gtk_hbox_new (FALSE, 0);
gtk_widget_ref (hbox11);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "hbox11", hbox11,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (hbox11);
gtk_box_pack_start (GTK_BOX (vbox4), hbox11, TRUE, TRUE, 0);
qif_account_auto_check = gtk_check_button_new_with_label (_("Auto"));
gtk_widget_ref (qif_account_auto_check);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "qif_account_auto_check", qif_account_auto_check,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (qif_account_auto_check);
gtk_box_pack_start (GTK_BOX (hbox11), qif_account_auto_check, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (qif_account_auto_check), TRUE);
qif_account_entry = gtk_entry_new ();
gtk_widget_ref (qif_account_entry);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "qif_account_entry", qif_account_entry,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (qif_account_entry);
gtk_box_pack_start (GTK_BOX (hbox11), qif_account_entry, TRUE, TRUE, 0);
qif_currency_entry = gtk_entry_new ();
gtk_widget_ref (qif_currency_entry);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "qif_currency_entry", qif_currency_entry,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (qif_currency_entry);
gtk_box_pack_start (GTK_BOX (vbox4), qif_currency_entry, FALSE, FALSE, 0);
qif_radix_picker = gtk_option_menu_new ();
gtk_widget_ref (qif_radix_picker);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "qif_radix_picker", qif_radix_picker,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (qif_radix_picker);
gtk_box_pack_start (GTK_BOX (vbox4), qif_radix_picker, FALSE, FALSE, 0);
qif_radix_picker_menu = gtk_menu_new ();
glade_menuitem = gtk_menu_item_new_with_label (_("Autodetect"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (qif_radix_picker_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("Decimal (1,000.00)"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (qif_radix_picker_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("Comma (1.000,00)"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (qif_radix_picker_menu), glade_menuitem);
gtk_option_menu_set_menu (GTK_OPTION_MENU (qif_radix_picker), qif_radix_picker_menu);
qif_date_picker = gtk_option_menu_new ();
gtk_widget_ref (qif_date_picker);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "qif_date_picker", qif_date_picker,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (qif_date_picker);
gtk_box_pack_start (GTK_BOX (vbox4), qif_date_picker, FALSE, FALSE, 0);
qif_date_picker_menu = gtk_menu_new ();
glade_menuitem = gtk_menu_item_new_with_label (_("Autodetect "));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (qif_date_picker_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("MM/DD/YYYY"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (qif_date_picker_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("DD/MM/YYYY"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (qif_date_picker_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("YYYY/MM/DD"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (qif_date_picker_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("YYYY/DD/MM"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (qif_date_picker_menu), glade_menuitem);
gtk_option_menu_set_menu (GTK_OPTION_MENU (qif_date_picker), qif_date_picker_menu);
hbox9 = gtk_hbox_new (TRUE, 0);
gtk_widget_ref (hbox9);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "hbox9", hbox9,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (hbox9);
gtk_box_pack_start (GTK_BOX (vbox2), hbox9, FALSE, FALSE, 5);
file_select_btn = gtk_button_new_with_label (_("Select file"));
gtk_widget_ref (file_select_btn);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "file_select_btn", file_select_btn,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (file_select_btn);
gtk_box_pack_start (GTK_BOX (hbox9), file_select_btn, TRUE, TRUE, 5);
add_file_button = gtk_button_new_with_label (_("Load file"));
gtk_widget_ref (add_file_button);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "add_file_button", add_file_button,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (add_file_button);
gtk_box_pack_start (GTK_BOX (hbox9), add_file_button, TRUE, TRUE, 5);
label69 = gtk_label_new (_("Files"));
gtk_widget_ref (label69);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "label69", label69,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label69);
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 0), label69);
scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_ref (scrolledwindow2);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "scrolledwindow2", scrolledwindow2,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (scrolledwindow2);
gtk_container_add (GTK_CONTAINER (notebook1), scrolledwindow2);
account_page_list = gtk_clist_new (4);
gtk_widget_ref (account_page_list);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "account_page_list", account_page_list,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (account_page_list);
gtk_container_add (GTK_CONTAINER (scrolledwindow2), account_page_list);
gtk_clist_set_column_width (GTK_CLIST (account_page_list), 0, 116);
gtk_clist_set_column_width (GTK_CLIST (account_page_list), 1, 80);
gtk_clist_set_column_width (GTK_CLIST (account_page_list), 2, 204);
gtk_clist_set_column_width (GTK_CLIST (account_page_list), 3, 80);
gtk_clist_column_titles_show (GTK_CLIST (account_page_list));
label682 = gtk_label_new (_("QIF Account"));
gtk_widget_ref (label682);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "label682", label682,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label682);
gtk_clist_set_column_widget (GTK_CLIST (account_page_list), 0, label682);
label683 = gtk_label_new (_("Transactions"));
gtk_widget_ref (label683);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "label683", label683,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label683);
gtk_clist_set_column_widget (GTK_CLIST (account_page_list), 1, label683);
label684 = gtk_label_new (_("GNUCash Account Name"));
gtk_widget_ref (label684);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "label684", label684,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label684);
gtk_clist_set_column_widget (GTK_CLIST (account_page_list), 2, label684);
label685 = gtk_label_new (_("Type"));
gtk_widget_ref (label685);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "label685", label685,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label685);
gtk_clist_set_column_widget (GTK_CLIST (account_page_list), 3, label685);
label2 = gtk_label_new (_("Accounts"));
gtk_widget_ref (label2);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "label2", label2,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label2);
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 1), label2);
scrolledwindow3 = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_ref (scrolledwindow3);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "scrolledwindow3", scrolledwindow3,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (scrolledwindow3);
gtk_container_add (GTK_CONTAINER (notebook1), scrolledwindow3);
category_page_list = gtk_clist_new (4);
gtk_widget_ref (category_page_list);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "category_page_list", category_page_list,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (category_page_list);
gtk_container_add (GTK_CONTAINER (scrolledwindow3), category_page_list);
gtk_clist_set_column_width (GTK_CLIST (category_page_list), 0, 117);
gtk_clist_set_column_width (GTK_CLIST (category_page_list), 1, 80);
gtk_clist_set_column_width (GTK_CLIST (category_page_list), 2, 204);
gtk_clist_set_column_width (GTK_CLIST (category_page_list), 3, 80);
gtk_clist_column_titles_show (GTK_CLIST (category_page_list));
label686 = gtk_label_new (_("QIF Category"));
gtk_widget_ref (label686);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "label686", label686,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label686);
gtk_clist_set_column_widget (GTK_CLIST (category_page_list), 0, label686);
label687 = gtk_label_new (_("Transactions"));
gtk_widget_ref (label687);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "label687", label687,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label687);
gtk_clist_set_column_widget (GTK_CLIST (category_page_list), 1, label687);
label688 = gtk_label_new (_("GNUCash Account Name"));
gtk_widget_ref (label688);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "label688", label688,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label688);
gtk_clist_set_column_widget (GTK_CLIST (category_page_list), 2, label688);
label689 = gtk_label_new (_("Type"));
gtk_widget_ref (label689);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "label689", label689,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label689);
gtk_clist_set_column_widget (GTK_CLIST (category_page_list), 3, label689);
foo6868 = gtk_label_new (_("Categories"));
gtk_widget_ref (foo6868);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "foo6868", foo6868,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (foo6868);
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 2), foo6868);
dialog_action_area2 = GNOME_DIALOG (QIF_File_Import_Dialog)->action_area;
gtk_object_set_data (GTK_OBJECT (QIF_File_Import_Dialog), "dialog_action_area2", dialog_action_area2);
gtk_widget_show (dialog_action_area2);
gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area2), GTK_BUTTONBOX_SPREAD);
gtk_button_box_set_spacing (GTK_BUTTON_BOX (dialog_action_area2), 8);
gnome_dialog_append_button (GNOME_DIALOG (QIF_File_Import_Dialog), GNOME_STOCK_BUTTON_OK);
button2 = g_list_last (GNOME_DIALOG (QIF_File_Import_Dialog)->buttons)->data;
gtk_widget_ref (button2);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "button2", button2,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button2);
GTK_WIDGET_SET_FLAGS (button2, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (QIF_File_Import_Dialog), GNOME_STOCK_BUTTON_CANCEL);
button3 = g_list_last (GNOME_DIALOG (QIF_File_Import_Dialog)->buttons)->data;
gtk_widget_ref (button3);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "button3", button3,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button3);
GTK_WIDGET_SET_FLAGS (button3, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (QIF_File_Import_Dialog), GNOME_STOCK_BUTTON_HELP);
button4 = g_list_last (GNOME_DIALOG (QIF_File_Import_Dialog)->buttons)->data;
gtk_widget_ref (button4);
gtk_object_set_data_full (GTK_OBJECT (QIF_File_Import_Dialog), "button4", button4,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button4);
GTK_WIDGET_SET_FLAGS (button4, GTK_CAN_DEFAULT);
gtk_signal_connect (GTK_OBJECT (selected_file_list), "select_child",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_select_loaded_file_cb),
QIF_File_Import_Dialog);
gtk_signal_connect (GTK_OBJECT (file_select_btn), "clicked",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_select_file_cb),
QIF_File_Import_Dialog);
gtk_signal_connect (GTK_OBJECT (add_file_button), "clicked",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_load_file_cb),
QIF_File_Import_Dialog);
gtk_signal_connect (GTK_OBJECT (account_page_list), "select_row",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_account_line_select_cb),
NULL);
gtk_signal_connect (GTK_OBJECT (category_page_list), "select_row",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_category_line_select_cb),
NULL);
gtk_signal_connect (GTK_OBJECT (button2), "clicked",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_ok_cb),
QIF_File_Import_Dialog);
gtk_signal_connect (GTK_OBJECT (button3), "clicked",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_cancel_cb),
QIF_File_Import_Dialog);
gtk_signal_connect (GTK_OBJECT (button4), "clicked",
GTK_SIGNAL_FUNC (gnc_ui_qif_import_help_cb),
QIF_File_Import_Dialog);
gtk_widget_grab_default (qif_filename_entry);
return QIF_File_Import_Dialog;
}
GtkWidget*
create_QIF_Import_Account_Picker (void)
{
GtkWidget *QIF_Import_Account_Picker;
GtkWidget *vbox1;
GtkWidget *vbox2;
GtkWidget *frame1;
GtkWidget *scrolledwindow1;
GtkWidget *viewport1;
GtkWidget *account_tree;
GtkWidget *hbox5;
GtkWidget *vbox4;
GtkWidget *label1;
GtkWidget *label2;
GtkWidget *label3;
GtkWidget *vbox5;
GtkWidget *acct_entry;
GtkWidget *acct_description_entry;
GtkWidget *acct_type_picker;
GtkWidget *acct_type_picker_menu;
GtkWidget *glade_menuitem;
GtkWidget *hbuttonbox1;
GtkWidget *button1;
GtkWidget *button2;
QIF_Import_Account_Picker = gnome_dialog_new (NULL, NULL);
gtk_object_set_data (GTK_OBJECT (QIF_Import_Account_Picker), "QIF_Import_Account_Picker", QIF_Import_Account_Picker);
gtk_window_set_policy (GTK_WINDOW (QIF_Import_Account_Picker), TRUE, TRUE, FALSE);
vbox1 = GNOME_DIALOG (QIF_Import_Account_Picker)->vbox;
gtk_object_set_data (GTK_OBJECT (QIF_Import_Account_Picker), "vbox1", vbox1);
gtk_widget_show (vbox1);
vbox2 = gtk_vbox_new (FALSE, 0);
gtk_widget_ref (vbox2);
gtk_object_set_data_full (GTK_OBJECT (QIF_Import_Account_Picker), "vbox2", vbox2,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (vbox2);
gtk_box_pack_start (GTK_BOX (vbox1), vbox2, TRUE, TRUE, 0);
frame1 = gtk_frame_new (_("Accounts"));
gtk_widget_ref (frame1);
gtk_object_set_data_full (GTK_OBJECT (QIF_Import_Account_Picker), "frame1", frame1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (frame1);
gtk_box_pack_start (GTK_BOX (vbox2), frame1, TRUE, TRUE, 0);
scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_ref (scrolledwindow1);
gtk_object_set_data_full (GTK_OBJECT (QIF_Import_Account_Picker), "scrolledwindow1", scrolledwindow1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (scrolledwindow1);
gtk_container_add (GTK_CONTAINER (frame1), scrolledwindow1);
gtk_widget_set_usize (scrolledwindow1, 250, 200);
viewport1 = gtk_viewport_new (NULL, NULL);
gtk_widget_ref (viewport1);
gtk_object_set_data_full (GTK_OBJECT (QIF_Import_Account_Picker), "viewport1", viewport1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (viewport1);
gtk_container_add (GTK_CONTAINER (scrolledwindow1), viewport1);
account_tree = gtk_tree_new ();
gtk_widget_ref (account_tree);
gtk_object_set_data_full (GTK_OBJECT (QIF_Import_Account_Picker), "account_tree", account_tree,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (account_tree);
gtk_container_add (GTK_CONTAINER (viewport1), account_tree);
hbox5 = gtk_hbox_new (FALSE, 0);
gtk_widget_ref (hbox5);
gtk_object_set_data_full (GTK_OBJECT (QIF_Import_Account_Picker), "hbox5", hbox5,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (hbox5);
gtk_box_pack_start (GTK_BOX (vbox1), hbox5, FALSE, FALSE, 0);
vbox4 = gtk_vbox_new (TRUE, 0);
gtk_widget_ref (vbox4);
gtk_object_set_data_full (GTK_OBJECT (QIF_Import_Account_Picker), "vbox4", vbox4,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (vbox4);
gtk_box_pack_start (GTK_BOX (hbox5), vbox4, TRUE, TRUE, 5);
label1 = gtk_label_new (_("Selected account:"));
gtk_widget_ref (label1);
gtk_object_set_data_full (GTK_OBJECT (QIF_Import_Account_Picker), "label1", label1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label1);
gtk_box_pack_start (GTK_BOX (vbox4), label1, FALSE, FALSE, 0);
gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_RIGHT);
gtk_misc_set_alignment (GTK_MISC (label1), 1, 0.5);
label2 = gtk_label_new (_("Description:"));
gtk_widget_ref (label2);
gtk_object_set_data_full (GTK_OBJECT (QIF_Import_Account_Picker), "label2", label2,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label2);
gtk_box_pack_start (GTK_BOX (vbox4), label2, FALSE, FALSE, 0);
gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_RIGHT);
gtk_misc_set_alignment (GTK_MISC (label2), 1, 0.5);
label3 = gtk_label_new (_("Account type:"));
gtk_widget_ref (label3);
gtk_object_set_data_full (GTK_OBJECT (QIF_Import_Account_Picker), "label3", label3,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label3);
gtk_box_pack_start (GTK_BOX (vbox4), label3, FALSE, FALSE, 0);
gtk_label_set_justify (GTK_LABEL (label3), GTK_JUSTIFY_RIGHT);
gtk_misc_set_alignment (GTK_MISC (label3), 1, 0.5);
vbox5 = gtk_vbox_new (TRUE, 0);
gtk_widget_ref (vbox5);
gtk_object_set_data_full (GTK_OBJECT (QIF_Import_Account_Picker), "vbox5", vbox5,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (vbox5);
gtk_box_pack_start (GTK_BOX (hbox5), vbox5, TRUE, TRUE, 0);
acct_entry = gtk_entry_new ();
gtk_widget_ref (acct_entry);
gtk_object_set_data_full (GTK_OBJECT (QIF_Import_Account_Picker), "acct_entry", acct_entry,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (acct_entry);
gtk_box_pack_start (GTK_BOX (vbox5), acct_entry, FALSE, FALSE, 0);
acct_description_entry = gtk_entry_new ();
gtk_widget_ref (acct_description_entry);
gtk_object_set_data_full (GTK_OBJECT (QIF_Import_Account_Picker), "acct_description_entry", acct_description_entry,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (acct_description_entry);
gtk_box_pack_start (GTK_BOX (vbox5), acct_description_entry, FALSE, FALSE, 0);
acct_type_picker = gtk_option_menu_new ();
gtk_widget_ref (acct_type_picker);
gtk_object_set_data_full (GTK_OBJECT (QIF_Import_Account_Picker), "acct_type_picker", acct_type_picker,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (acct_type_picker);
gtk_box_pack_start (GTK_BOX (vbox5), acct_type_picker, FALSE, FALSE, 0);
gtk_widget_set_usize (acct_type_picker, 150, 30);
acct_type_picker_menu = gtk_menu_new ();
glade_menuitem = gtk_menu_item_new_with_label (_("Bank"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (acct_type_picker_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("Cash"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (acct_type_picker_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("Asset"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (acct_type_picker_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("Credit"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (acct_type_picker_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("Liability"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (acct_type_picker_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("Stock"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (acct_type_picker_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("Mutual"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (acct_type_picker_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("Currency"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (acct_type_picker_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("Income"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (acct_type_picker_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("Expense"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (acct_type_picker_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("Equity"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (acct_type_picker_menu), glade_menuitem);
gtk_option_menu_set_menu (GTK_OPTION_MENU (acct_type_picker), acct_type_picker_menu);
hbuttonbox1 = GNOME_DIALOG (QIF_Import_Account_Picker)->action_area;
gtk_object_set_data (GTK_OBJECT (QIF_Import_Account_Picker), "hbuttonbox1", hbuttonbox1);
gtk_widget_show (hbuttonbox1);
gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox1), GTK_BUTTONBOX_SPREAD);
gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbuttonbox1), 8);
gnome_dialog_append_button (GNOME_DIALOG (QIF_Import_Account_Picker), GNOME_STOCK_BUTTON_OK);
button1 = g_list_last (GNOME_DIALOG (QIF_Import_Account_Picker)->buttons)->data;
gtk_widget_ref (button1);
gtk_object_set_data_full (GTK_OBJECT (QIF_Import_Account_Picker), "button1", button1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button1);
GTK_WIDGET_SET_FLAGS (button1, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (QIF_Import_Account_Picker), GNOME_STOCK_BUTTON_CANCEL);
button2 = g_list_last (GNOME_DIALOG (QIF_Import_Account_Picker)->buttons)->data;
gtk_widget_ref (button2);
gtk_object_set_data_full (GTK_OBJECT (QIF_Import_Account_Picker), "button2", button2,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button2);
GTK_WIDGET_SET_FLAGS (button2, GTK_CAN_DEFAULT);
gtk_signal_connect (GTK_OBJECT (account_tree), "select_child",
GTK_SIGNAL_FUNC (gnc_ui_account_picker_select_cb),
QIF_Import_Account_Picker);
gtk_signal_connect (GTK_OBJECT (button1), "clicked",
GTK_SIGNAL_FUNC (gnc_ui_account_picker_ok_cb),
QIF_Import_Account_Picker);
gtk_signal_connect (GTK_OBJECT (button2), "clicked",
GTK_SIGNAL_FUNC (gnc_ui_account_picker_cancel_cb),
QIF_Import_Account_Picker);
return QIF_Import_Account_Picker;
}
GtkWidget*
create_Print_Preview_Dialog (void)
{
GtkWidget *Print_Preview_Dialog;
GtkWidget *dialog_vbox3;
GtkWidget *scrolledwindow4;
GtkWidget *preview_canvas;
GtkWidget *dialog_action_area3;
GtkWidget *button5;
Print_Preview_Dialog = gnome_dialog_new (NULL, NULL);
gtk_object_set_data (GTK_OBJECT (Print_Preview_Dialog), "Print_Preview_Dialog", Print_Preview_Dialog);
gtk_window_set_policy (GTK_WINDOW (Print_Preview_Dialog), TRUE, TRUE, FALSE);
dialog_vbox3 = GNOME_DIALOG (Print_Preview_Dialog)->vbox;
gtk_object_set_data (GTK_OBJECT (Print_Preview_Dialog), "dialog_vbox3", dialog_vbox3);
gtk_widget_show (dialog_vbox3);
scrolledwindow4 = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_ref (scrolledwindow4);
gtk_object_set_data_full (GTK_OBJECT (Print_Preview_Dialog), "scrolledwindow4", scrolledwindow4,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (scrolledwindow4);
gtk_box_pack_start (GTK_BOX (dialog_vbox3), scrolledwindow4, TRUE, TRUE, 0);
gtk_widget_set_usize (scrolledwindow4, 500, 250);
gtk_container_set_border_width (GTK_CONTAINER (scrolledwindow4), 1);
gdk_rgb_init ();
gtk_widget_push_visual (gdk_rgb_get_visual ());
gtk_widget_push_colormap (gdk_rgb_get_cmap ());
preview_canvas = gnome_canvas_new_aa ();
gtk_widget_pop_colormap ();
gtk_widget_pop_visual ();
gtk_widget_ref (preview_canvas);
gtk_object_set_data_full (GTK_OBJECT (Print_Preview_Dialog), "preview_canvas", preview_canvas,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (preview_canvas);
gtk_container_add (GTK_CONTAINER (scrolledwindow4), preview_canvas);
gnome_canvas_set_scroll_region (GNOME_CANVAS (preview_canvas), 0, 0, 100, 100);
dialog_action_area3 = GNOME_DIALOG (Print_Preview_Dialog)->action_area;
gtk_object_set_data (GTK_OBJECT (Print_Preview_Dialog), "dialog_action_area3", dialog_action_area3);
gtk_widget_show (dialog_action_area3);
gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area3), GTK_BUTTONBOX_SPREAD);
gtk_button_box_set_spacing (GTK_BUTTON_BOX (dialog_action_area3), 8);
gnome_dialog_append_button (GNOME_DIALOG (Print_Preview_Dialog), GNOME_STOCK_BUTTON_OK);
button5 = g_list_last (GNOME_DIALOG (Print_Preview_Dialog)->buttons)->data;
gtk_widget_ref (button5);
gtk_object_set_data_full (GTK_OBJECT (Print_Preview_Dialog), "button5", button5,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button5);
GTK_WIDGET_SET_FLAGS (button5, GTK_CAN_DEFAULT);
gtk_signal_connect (GTK_OBJECT (button5), "clicked",
GTK_SIGNAL_FUNC (gnc_ui_print_preview_OK_cb),
Print_Preview_Dialog);
return Print_Preview_Dialog;
}
GtkWidget*
create_Print_Dialog (void)
{
GtkWidget *Print_Dialog;
GtkWidget *dialog_vbox4;
GtkWidget *vbox6;
GtkWidget *button12;
GtkWidget *button13;
GtkWidget *dialog_action_area4;
GtkWidget *button9;
GtkWidget *button11;
Print_Dialog = gnome_dialog_new (_("Print Check"), NULL);
gtk_object_set_data (GTK_OBJECT (Print_Dialog), "Print_Dialog", Print_Dialog);
gtk_window_set_policy (GTK_WINDOW (Print_Dialog), FALSE, FALSE, FALSE);
dialog_vbox4 = GNOME_DIALOG (Print_Dialog)->vbox;
gtk_object_set_data (GTK_OBJECT (Print_Dialog), "dialog_vbox4", dialog_vbox4);
gtk_widget_show (dialog_vbox4);
vbox6 = gtk_vbox_new (FALSE, 0);
gtk_widget_ref (vbox6);
gtk_object_set_data_full (GTK_OBJECT (Print_Dialog), "vbox6", vbox6,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (vbox6);
gtk_box_pack_start (GTK_BOX (dialog_vbox4), vbox6, TRUE, TRUE, 0);
button12 = gtk_button_new_with_label (_("Select Printer"));
gtk_widget_ref (button12);
gtk_object_set_data_full (GTK_OBJECT (Print_Dialog), "button12", button12,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button12);
gtk_box_pack_start (GTK_BOX (vbox6), button12, FALSE, FALSE, 0);
button13 = gtk_button_new_with_label (_("Preview"));
gtk_widget_ref (button13);
gtk_object_set_data_full (GTK_OBJECT (Print_Dialog), "button13", button13,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button13);
gtk_box_pack_start (GTK_BOX (vbox6), button13, FALSE, FALSE, 0);
dialog_action_area4 = GNOME_DIALOG (Print_Dialog)->action_area;
gtk_object_set_data (GTK_OBJECT (Print_Dialog), "dialog_action_area4", dialog_action_area4);
gtk_widget_show (dialog_action_area4);
gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area4), GTK_BUTTONBOX_SPREAD);
gtk_button_box_set_spacing (GTK_BUTTON_BOX (dialog_action_area4), 8);
gnome_dialog_append_button (GNOME_DIALOG (Print_Dialog), GNOME_STOCK_BUTTON_OK);
button9 = g_list_last (GNOME_DIALOG (Print_Dialog)->buttons)->data;
gtk_widget_ref (button9);
gtk_object_set_data_full (GTK_OBJECT (Print_Dialog), "button9", button9,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button9);
GTK_WIDGET_SET_FLAGS (button9, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (Print_Dialog), GNOME_STOCK_BUTTON_CANCEL);
button11 = g_list_last (GNOME_DIALOG (Print_Dialog)->buttons)->data;
gtk_widget_ref (button11);
gtk_object_set_data_full (GTK_OBJECT (Print_Dialog), "button11", button11,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button11);
GTK_WIDGET_SET_FLAGS (button11, GTK_CAN_DEFAULT);
gtk_signal_connect (GTK_OBJECT (button12), "clicked",
GTK_SIGNAL_FUNC (gnc_ui_print_dialog_select_printer_cb),
Print_Dialog);
gtk_signal_connect (GTK_OBJECT (button13), "clicked",
GTK_SIGNAL_FUNC (gnc_ui_print_dialog_preview_cb),
Print_Dialog);
gtk_signal_connect (GTK_OBJECT (button9), "clicked",
GTK_SIGNAL_FUNC (gnc_ui_print_dialog_ok_cb),
Print_Dialog);
gtk_signal_connect (GTK_OBJECT (button11), "clicked",
GTK_SIGNAL_FUNC (gnc_ui_print_dialog_cancel_cb),
Print_Dialog);
return Print_Dialog;
}

View File

@ -0,0 +1,8 @@
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
GtkWidget* create_QIF_File_Import_Dialog (void);
GtkWidget* create_QIF_Import_Account_Picker (void);
GtkWidget* create_Print_Preview_Dialog (void);
GtkWidget* create_Print_Dialog (void);

View File

@ -0,0 +1,34 @@
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
#include <gnome.h>
/*
* Public Functions.
*/
/*
* This function returns a widget in a component created by Glade.
* Call it with the toplevel widget in the component (i.e. a window/dialog),
* or alternatively any widget in the component, and the name of the widget
* you want returned.
*/
GtkWidget* lookup_widget (GtkWidget *widget,
const gchar *widget_name);
/* get_widget() is deprecated. Use lookup_widget instead. */
#define get_widget lookup_widget
/*
* Private Functions.
*/
/* This is used to create the pixmaps in the interface. */
GtkWidget* create_pixmap (GtkWidget *widget,
const gchar *filename,
gboolean gnome_pixmap);
GdkImlibImage* create_image (const gchar *filename);

229
src/gnome/print-session.c Normal file
View File

@ -0,0 +1,229 @@
/********************************************************************\
* print-session.c -- simple printing manager for gnucash *
* Copyright (C) 2000 Bill Gribble <grib@billgribble.com> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
\********************************************************************/
#include "config.h"
#include <gnome.h>
#include "print-session.h"
#ifdef HAVE_LIBGNOMEPRINT
PrintPreviewDialog *
gnc_ui_print_preview_create(PrintSession * ps) {
PrintPreviewDialog * ppd = g_new0(PrintPreviewDialog, 1);
ppd->toplevel = create_Print_Preview_Dialog();
ppd->canvas = gtk_object_get_data(GTK_OBJECT(ppd->toplevel),
"preview_canvas");
ppd->session = ps;
ppd->pc =
gnome_print_preview_new (GNOME_CANVAS(ppd->canvas), "US-Letter");
gtk_object_set_data(GTK_OBJECT(ppd->toplevel), "print_preview_struct",
ppd);
gnome_print_meta_render_from_object(GNOME_PRINT_CONTEXT(ppd->pc),
GNOME_PRINT_META(ppd->session->meta));
gnome_print_context_close(GNOME_PRINT_CONTEXT(ppd->pc));
gtk_widget_show_all(ppd->toplevel);
return ppd;
}
void
gnc_ui_print_preview_OK_cb(GtkWidget * widget, gpointer user_data) {
PrintPreviewDialog * ppd;
if(user_data) {
ppd = gtk_object_get_data(GTK_OBJECT(user_data), "print_preview_struct");
gnc_ui_print_preview_destroy(ppd);
}
}
void
gnc_ui_print_preview_destroy(PrintPreviewDialog * ppd) {
gtk_widget_destroy(ppd->toplevel);
gtk_object_unref(GTK_OBJECT(ppd->pc));
ppd->session = NULL;
g_free(ppd);
}
PrintDialog *
gnc_ui_print_dialog_create(PrintSession * ps) {
PrintDialog * pcd = g_new0(PrintDialog, 1);
pcd->toplevel = create_Print_Dialog();
pcd->session = ps;
gtk_object_set_data(GTK_OBJECT(pcd->toplevel), "print_struct",
pcd);
gtk_widget_show_all(pcd->toplevel);
return pcd;
}
void
gnc_ui_print_dialog_destroy(PrintDialog * pcd) {
gtk_widget_destroy(pcd->toplevel);
gnc_print_session_destroy(pcd->session);
g_free(pcd);
}
void
gnc_ui_print_dialog_select_printer_cb(GtkWidget * widget, gpointer user_data) {
PrintDialog * pcd;
if(user_data) {
pcd = gtk_object_get_data(GTK_OBJECT(user_data), "print_struct");
pcd->session->printer =
gnome_printer_dialog_new_modal();
}
}
void
gnc_ui_print_dialog_preview_cb(GtkWidget * widget, gpointer user_data) {
PrintDialog * pcd;
if(user_data) {
pcd = gtk_object_get_data(GTK_OBJECT(user_data), "print_struct");
gnc_print_session_preview(pcd->session);
}
}
void
gnc_ui_print_dialog_ok_cb(GtkWidget * widget, gpointer user_data) {
PrintDialog * pcd;
if(user_data) {
pcd = gtk_object_get_data(GTK_OBJECT(user_data), "print_struct");
if(!pcd->session->printer) {
gnc_error_dialog(_("You must select a printer first."));
}
else {
gnc_print_session_print(pcd->session);
gnc_ui_print_dialog_destroy(pcd);
}
}
}
void
gnc_ui_print_dialog_cancel_cb(GtkWidget * widget, gpointer user_data) {
PrintDialog * pcd;
if(user_data) {
pcd = gtk_object_get_data(GTK_OBJECT(user_data), "print_struct");
gnc_ui_print_dialog_destroy(pcd);
}
}
PrintSession *
gnc_print_session_create() {
PrintSession * ps = g_new0(PrintSession, 1);
/* this is about the most basic we can get */
ps->meta = gnome_print_meta_new();
ps->default_font = gnome_font_new("Courier", 13);
gnome_print_setrgbcolor(GNOME_PRINT_CONTEXT(ps->meta),
0.0, 0.0, 0.0);
gnome_print_setfont(GNOME_PRINT_CONTEXT(ps->meta),
GNOME_FONT(ps->default_font));
return ps;
}
void
gnc_print_session_destroy(PrintSession * ps) {
gtk_object_unref(GTK_OBJECT(ps->meta));
gtk_object_unref(GTK_OBJECT(ps->default_font));
g_free(ps);
}
void
gnc_print_session_moveto(PrintSession * ps, double x, double y) {
gnome_print_moveto(GNOME_PRINT_CONTEXT(ps->meta), x, y);
}
void
gnc_print_session_text(PrintSession * ps, char * text) {
gnome_print_show(GNOME_PRINT_CONTEXT(ps->meta), text);
}
void
gnc_print_session_done(PrintSession * ps) {
gnome_print_showpage(GNOME_PRINT_CONTEXT(ps->meta));
gnome_print_context_close(GNOME_PRINT_CONTEXT(ps->meta));
}
void
gnc_print_session_preview(PrintSession * ps) {
gnc_ui_print_preview_create(ps);
}
void
gnc_print_session_print(PrintSession * ps) {
GnomePrintContext * pc;
pc = gnome_print_context_new(ps->printer);
gnome_print_meta_render_from_object(GNOME_PRINT_CONTEXT(pc),
GNOME_PRINT_META(ps->meta));
}
#else
/* print preview dialog stuff */
PrintPreviewDialog * gnc_ui_print_preview_create(PrintSession * ps) {
return NULL;
}
void gnc_ui_print_preview_OK_cb(GtkWidget * widget, gpointer user_data) { }
void gnc_ui_print_preview_destroy(PrintPreviewDialog * ppd) { }
/* print check dialog stuff */
PrintDialog * gnc_ui_print_dialog_create(PrintSession * ps) {
return NULL;
}
void gnc_ui_print_dialog_destroy(PrintDialog * pcd) { }
void gnc_ui_print_dialog_select_printer_cb(GtkWidget * widget,
gpointer user_data) { }
void gnc_ui_print_dialog_preview_cb(GtkWidget * widget, gpointer user_data) {}
void gnc_ui_print_dialog_ok_cb(GtkWidget * widget, gpointer user_data) {}
void gnc_ui_print_dialog_cancel_cb(GtkWidget * widget, gpointer user_data) {}
/* printsession stuff */
PrintSession * gnc_print_session_create() { return NULL; }
void gnc_print_session_destroy(PrintSession * ps) {}
void gnc_print_session_moveto(PrintSession * ps, double x, double y) {}
void gnc_print_session_text(PrintSession * ps, char * text) {}
void gnc_print_session_done(PrintSession * ps) {}
void gnc_print_session_preview(PrintSession * ps) {}
void gnc_print_session_print(PrintSession * ps) {}
#endif

93
src/gnome/print-session.h Normal file
View File

@ -0,0 +1,93 @@
/********************************************************************\
* print-session.h -- data structures for printing via gnome print *
* (GnuCash) *
* Copyright (C) 2000 Bill Gribble <grib@billgribble.com> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
\********************************************************************/
#ifndef __PRINT_SESSION_H_
#define __PRINT_SESSION_H_
#include "config.h"
#ifdef HAVE_LIBGNOMEPRINT
#include <gnome.h>
#include <libgnomeprint/gnome-printer.h>
#include <libgnomeprint/gnome-print.h>
#include <libgnomeprint/gnome-print-meta.h>
#include <libgnomeprint/gnome-print-preview.h>
#include <libgnomeprint/gnome-printer-dialog.h>
#include <libgnomeprint/gnome-printer-profile.h>
#include <libgnomeprint/gnome-font.h>
#include "glade-gnc-dialogs.h"
typedef struct {
GnomePrintMeta * meta;
GnomePrinter * printer;
GnomeFont * default_font;
} PrintSession;
typedef struct {
GtkWidget * toplevel;
GtkWidget * canvas;
GnomePrintContext * pc;
PrintSession * session;
} PrintPreviewDialog;
typedef struct {
GtkWidget * toplevel;
PrintSession * session;
} PrintDialog;
#else
/* type stubs for g-wrap */
typedef int PrintSession;
typedef int PrintPreviewDialog;
typedef int PrintDialog;
#endif
/* print preview dialog stuff */
PrintPreviewDialog * gnc_ui_print_preview_create(PrintSession * ps);
void gnc_ui_print_preview_OK_cb(GtkWidget * widget, gpointer user_data);
void gnc_ui_print_preview_destroy(PrintPreviewDialog * ppd);
/* print check dialog stuff */
PrintDialog * gnc_ui_print_dialog_create(PrintSession * ps);
void gnc_ui_print_dialog_destroy(PrintDialog * pcd);
void gnc_ui_print_dialog_select_printer_cb(GtkWidget * widget,
gpointer user_data);
void gnc_ui_print_dialog_preview_cb(GtkWidget * widget, gpointer user_data);
void gnc_ui_print_dialog_ok_cb(GtkWidget * widget, gpointer user_data);
void gnc_ui_print_dialog_cancel_cb(GtkWidget * widget, gpointer user_data);
/* printsession stuff */
PrintSession * gnc_print_session_create();
void gnc_print_session_destroy(PrintSession * ps);
void gnc_print_session_moveto(PrintSession * ps, double x, double y);
void gnc_print_session_text(PrintSession * ps, char * text);
void gnc_print_session_done(PrintSession * ps);
void gnc_print_session_preview(PrintSession * ps);
void gnc_print_session_print(PrintSession * ps);
#endif

View File

@ -30,6 +30,7 @@
#include "top-level.h"
#include <gnome.h>
#include <math.h>
#include "gnome-top-level.h"
#include "MultiLedger.h"
@ -128,6 +129,7 @@ static void closeCB(GtkWidget *w, gpointer data);
static void dateCB(GtkWidget *w, gpointer data);
static void new_trans_cb(GtkWidget *widget, gpointer data);
static void jump_cb(GtkWidget *widget, gpointer data);
static void print_check_cb(GtkWidget * widget, gpointer data);
static gboolean gnc_register_include_date(RegWindow *regData, time_t date);
@ -926,6 +928,52 @@ jump_cb(GtkWidget *widget, gpointer data)
gnc_register_jump_to_split(regData, split);
}
static void
print_check_cb(GtkWidget * widget, gpointer data)
{
RegWindow * reg_data = (RegWindow *)data;
#ifdef HAVE_LIBGNOMEPRINT
Split * split = xaccSRGetCurrentSplit(reg_data->ledger->ledger);
Transaction * trans = xaccSplitGetParent(split);
char * payee;
char * memo;
double amount;
char datestring[1024];
struct tm * timestruct;
time_t date;
SCM print_check = gh_eval_str("gnc:print-check");
if(split && trans &&
gh_procedure_p(print_check))
{
payee = xaccTransGetDescription(trans);
amount = xaccSplitGetValue(split);
date = xaccTransGetDate(trans);
memo = xaccSplitGetMemo(split);
timestruct = localtime(&date);
if(!timestruct) {
g_warning("print_check_cb: error in date translation\n");
return;
}
strftime(datestring, sizeof(datestring), "%B %d, %Y", timestruct);
gh_apply(print_check,
SCM_LIST4(gh_str02scm(payee),
gh_double2scm(fabs(amount)),
gh_str02scm(datestring),
gh_str02scm(memo)));
}
#else
gnc_info_dialog_parented(reg_data->dialog,
_"You need to install the gnome-print library.");
#endif
}
static void
gnc_register_scrub_cb(GtkWidget *widget, gpointer data)
{
@ -1126,6 +1174,14 @@ gnc_register_create_menu_bar(RegWindow *regData, GtkWidget *statusbar)
GNOME_APP_PIXMAP_NONE, NULL,
0, 0, NULL
},
GNOMEUIINFO_SEPARATOR,
{
GNOME_APP_UI_ITEM,
PRINT_CHECK_MENU_STR, TOOLTIP_PRINT_CHECK,
print_check_cb, regData, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
0, 0, NULL
},
GNOMEUIINFO_END
};