r22085 - gnucash/trunk - Bug #672157: New CSV account and transaction exporter

Christian Stimming cstim at code.gnucash.org
Fri Mar 16 16:26:04 EDT 2012


Author: cstim
Date: 2012-03-16 16:26:04 -0400 (Fri, 16 Mar 2012)
New Revision: 22085
Trac: http://svn.gnucash.org/trac/changeset/22085

Added:
   gnucash/trunk/src/import-export/csv-export/
   gnucash/trunk/src/import-export/csv-export/Makefile.am
   gnucash/trunk/src/import-export/csv-export/assistant-csv-export.c
   gnucash/trunk/src/import-export/csv-export/assistant-csv-export.glade
   gnucash/trunk/src/import-export/csv-export/assistant-csv-export.h
   gnucash/trunk/src/import-export/csv-export/csv-transactions-export.c
   gnucash/trunk/src/import-export/csv-export/csv-transactions-export.h
   gnucash/trunk/src/import-export/csv-export/csv-tree-export.c
   gnucash/trunk/src/import-export/csv-export/csv-tree-export.h
   gnucash/trunk/src/import-export/csv-export/gnc-plugin-csv-export-ui.xml
   gnucash/trunk/src/import-export/csv-export/gnc-plugin-csv-export.c
   gnucash/trunk/src/import-export/csv-export/gnc-plugin-csv-export.h
   gnucash/trunk/src/import-export/csv-export/gncmod-csv-export.c
   gnucash/trunk/src/import-export/csv-export/schemas/
   gnucash/trunk/src/import-export/csv-export/schemas/Makefile.am
   gnucash/trunk/src/import-export/csv-export/schemas/apps_gnucash_dialog_export_csv.schemas.in
Modified:
   gnucash/trunk/configure.ac
   gnucash/trunk/po/POTFILES.in
   gnucash/trunk/src/bin/gnucash-bin.c
   gnucash/trunk/src/import-export/Makefile.am
Log:
Bug #672157: New CSV account and transaction exporter

Patch by Robert Fewell:

I have put together a new feature to export the account tree and transactions
to a deliminated file. Both options allow you to select the deliminator and the
use of quotes. Every thing seems to work on the testing I have done but may be
some of the text and the headings in the output might need changing.

Modified: gnucash/trunk/configure.ac
===================================================================
--- gnucash/trunk/configure.ac	2012-03-16 19:39:41 UTC (rev 22084)
+++ gnucash/trunk/configure.ac	2012-03-16 20:26:04 UTC (rev 22085)
@@ -1279,6 +1279,8 @@
   src/import-export/ofx/Makefile
   src/import-export/ofx/test/Makefile
   src/import-export/csv/Makefile
+  src/import-export/csv-export/Makefile
+  src/import-export/csv-export/schemas/Makefile
   src/import-export/log-replay/Makefile
   src/import-export/aqbanking/Makefile
   src/import-export/aqbanking/schemas/Makefile

Modified: gnucash/trunk/po/POTFILES.in
===================================================================
--- gnucash/trunk/po/POTFILES.in	2012-03-16 19:39:41 UTC (rev 22084)
+++ gnucash/trunk/po/POTFILES.in	2012-03-16 20:26:04 UTC (rev 22085)
@@ -371,6 +371,13 @@
 src/import-export/csv/gnc-csv-model.c
 src/import-export/csv/gncmod-csv-import.c
 src/import-export/csv/gnc-plugin-csv.c
+src/import-export/csv-export/assistant-csv-export.c
+src/import-export/csv-export/assistant-csv-export.glade
+src/import-export/csv-export/csv-transactions-export.c
+src/import-export/csv-export/csv-tree-export.c
+src/import-export/csv-export/gnc-plugin-csv-export.c
+src/import-export/csv-export/gncmod-csv-export.c
+src/import-export/csv-export/schemas/apps_gnucash_dialog_export.schemas.in
 src/import-export/dialog-import.glade
 src/import-export/gncmod-generic-import.c
 src/import-export/import-account-matcher.c

Modified: gnucash/trunk/src/bin/gnucash-bin.c
===================================================================
--- gnucash/trunk/src/bin/gnucash-bin.c	2012-03-16 19:39:41 UTC (rev 22084)
+++ gnucash/trunk/src/bin/gnucash-bin.c	2012-03-16 20:26:04 UTC (rev 22085)
@@ -570,6 +570,7 @@
         { "gnucash/import-export/qif-import", 0, FALSE },
         { "gnucash/import-export/ofx", 0, TRUE },
         { "gnucash/import-export/csv", 0, TRUE },
+        { "gnucash/import-export/csv-export", 0, TRUE },
         { "gnucash/import-export/log-replay", 0, TRUE },
         { "gnucash/import-export/aqbanking", 0, TRUE },
         { "gnucash/report/report-system", 0, FALSE },

Modified: gnucash/trunk/src/import-export/Makefile.am
===================================================================
--- gnucash/trunk/src/import-export/Makefile.am	2012-03-16 19:39:41 UTC (rev 22084)
+++ gnucash/trunk/src/import-export/Makefile.am	2012-03-16 20:26:04 UTC (rev 22085)
@@ -5,7 +5,7 @@
     AQBANKING_DIR=aqbanking
 endif
 SUBDIRS = . schemas qif qif-import \
-	${OFX_DIR} ${AQBANKING_DIR} log-replay test csv
+	${OFX_DIR} ${AQBANKING_DIR} log-replay test csv csv-export
 
 pkglib_LTLIBRARIES=libgncmod-generic-import.la
 

Added: gnucash/trunk/src/import-export/csv-export/Makefile.am
===================================================================
--- gnucash/trunk/src/import-export/csv-export/Makefile.am	                        (rev 0)
+++ gnucash/trunk/src/import-export/csv-export/Makefile.am	2012-03-16 20:26:04 UTC (rev 22085)
@@ -0,0 +1,60 @@
+SUBDIRS = . schemas
+
+pkglib_LTLIBRARIES=libgncmod-csv-export.la
+
+libgncmod_csv_export_la_SOURCES = \
+  gncmod-csv-export.c \
+  gnc-plugin-csv-export.c \
+  assistant-csv-export.c \
+  csv-tree-export.c \
+  csv-transactions-export.c
+
+noinst_HEADERS = \
+  gnc-plugin-csv-export.h \
+  assistant-csv-export.h \
+  csv-tree-export.h \
+  csv-transactions-export.h
+
+libgncmod_csv_export_la_LDFLAGS = -avoid-version
+
+libgncmod_csv_export_la_LIBADD = \
+  ${top_builddir}/src/import-export/libgncmod-generic-import.la \
+  ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
+  ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
+  ${top_builddir}/src/engine/libgncmod-engine.la \
+  ${top_builddir}/src/core-utils/libgnc-core-utils.la \
+  ${top_builddir}/src/gnc-module/libgnc-module.la \
+  ${top_builddir}/lib/stf/libgnc-stf.la \
+  ${top_builddir}/lib/libc/libc-missing.la \
+  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
+  ${GOFFICE_LIBS} \
+  ${GLIB_LIBS}
+
+AM_CPPFLAGS = \
+  -I${top_srcdir}/src \
+  -I${top_srcdir}/src/core-utils \
+  -I${top_srcdir}/src/engine \
+  -I${top_srcdir}/src/gnc-module \
+  -I${top_srcdir}/src/app-utils \
+  -I${top_srcdir}/src/gnome \
+  -I${top_srcdir}/src/gnome-utils \
+  -I${top_srcdir}/src/import-export \
+  -I${top_srcdir}/src/libqof/qof \
+  -I${top_srcdir}/lib/libc \
+  -I${top_srcdir}/lib \
+  ${GCONF_CFLAGS} \
+  ${GUILE_INCS} \
+  ${GLIB_CFLAGS} \
+  $(GOFFICE_CFLAGS)
+
+uidir = $(GNC_UI_DIR)
+ui_DATA = \
+	gnc-plugin-csv-export-ui.xml
+
+gtkbuilderdir = ${GNC_GTKBUILDER_DIR}
+gtkbuilder_DATA = \
+	assistant-csv-export.glade
+
+EXTRA_DIST = $(ui_DATA) $(gtkbuilder_DATA)
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.export.csv\"

Added: gnucash/trunk/src/import-export/csv-export/assistant-csv-export.c
===================================================================
--- gnucash/trunk/src/import-export/csv-export/assistant-csv-export.c	                        (rev 0)
+++ gnucash/trunk/src/import-export/csv-export/assistant-csv-export.c	2012-03-16 20:26:04 UTC (rev 22085)
@@ -0,0 +1,1044 @@
+/*******************************************************************\
+ * assistant-csv-export.c -- An assistant for exporting Accounts    *
+ *                            and Transactions to a file            *
+ *                                                                  *
+ * Copyright (C) 2012 Robert Fewell                                 *
+ *                                                                  *
+ * 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, contact:                        *
+ *                                                                  *
+ * Free Software Foundation           Voice:  +1-617-542-5942       *
+ * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
+ * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
+\********************************************************************/
+/** @file assistant-csv-export.c
+    @brief CSV Export Assistant
+    @author Copyright (c) 2012 Robert Fewell
+*/
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+
+#include "gnc-ui.h"
+#include "gnc-uri-utils.h"
+#include "gnc-component-manager.h"
+#include "gnc-date-edit.h"
+#include "gnc-gconf-utils.h"
+#include "gnc-tree-view-account.h"
+#include "dialog-utils.h"
+#include "Query.h"
+#include "Transaction.h"
+
+#include "assistant-utils.h"
+#include "assistant-csv-export.h"
+#include "csv-tree-export.h"
+#include "csv-transactions-export.h"
+
+#define GCONF_SECTION "dialogs/export/csv"
+#define PANED_POSITION "paned_position"
+#define ASSISTANT_CSV_EXPORT_CM_CLASS "assistant-csv-export"
+
+/* This static indicates the debugging module that this .o belongs to.  */
+static QofLogModule log_module = GNC_MOD_ASSISTANT;
+
+/*************************************************************************/
+
+void csv_export_assistant_prepare (GtkAssistant  *assistant, GtkWidget *page, gpointer user_data);
+void csv_export_assistant_finish (GtkAssistant *gtkassistant, gpointer user_data);
+void csv_export_assistant_cancel (GtkAssistant *gtkassistant, gpointer user_data);
+void csv_export_assistant_close (GtkAssistant *gtkassistant, gpointer user_data);
+
+void csv_export_assistant_start_page_prepare (GtkAssistant *assistant, gpointer user_data);
+void csv_export_assistant_account_page_prepare (GtkAssistant *gtkassistant, gpointer user_data);
+void csv_export_assistant_file_page_prepare (GtkAssistant *assistant, gpointer user_data);
+void csv_export_assistant_finish_page_prepare (GtkAssistant *assistant, gpointer user_data);
+void csv_export_assistant_summary_page_prepare (GtkAssistant *assistant, gpointer user_data);
+
+void csv_export_quote_cb (GtkToggleButton *button, gpointer user_data );
+void csv_export_sep_cb (GtkWidget *radio, gpointer user_data );
+void csv_export_custom_entry_cb (GtkWidget *widget, gpointer user_data );
+
+void csv_export_show_range_cb (GtkRadioButton *button, gpointer user_data);
+void csv_export_start_date_cb (GtkWidget *radio, gpointer user_data);
+void csv_export_end_date_cb (GtkWidget *radio, gpointer user_data);
+
+void csv_export_file_chooser_confirm_cb (GtkWidget *button, CsvExportInfo *info);
+
+static const gchar *finish_tree_string = N_(
+             /* Translators: %s is the file name string. */
+            "The account tree will be exported to the file '%s' when you click 'Apply'.\n\n"
+            "You can also go back and verify your selections by clicking on 'Back'"
+            " or 'Cancel' to Abort Export.\n");
+
+static const gchar *finish_trans_string = N_(
+            /* Translators: %s is the file name string and %u the number of accounts. */
+            "When you click 'Apply', the transactions will be exported to the file '%s' and"
+            " the number of accounts exported is %u.\n\n"
+            "You can also go back and verify your selections by clicking on 'Back'"
+            " or 'Cancel' to Abort Export.\n");
+
+static const gchar *start_tree_string = N_(
+            "This assistant will help you export the Account Tree to a file.\n\n"
+            "Select the settings you require for the file and then click 'Forward' to proceed"
+            " or 'Cancel' to Abort Export.\n");
+
+static const gchar *start_trans_string = N_(
+            "This assistant will help you export the Transactions to a file.\n\n"
+            "Select the settings you require for the file and then click 'Forward' to proceed"
+            " or 'Cancel' to Abort Export.\n");
+
+
+/**************************************************
+ * csv_export_file_chooser_confirm_cb
+ *
+ * call back for ok button in file chooser widget
+ **************************************************/
+void
+csv_export_file_chooser_confirm_cb (GtkWidget *button, CsvExportInfo *info)
+{
+    GtkAssistant *assistant = GTK_ASSISTANT(info->window);
+    gint num = gtk_assistant_get_current_page (assistant);
+    GtkWidget *page = gtk_assistant_get_nth_page (assistant, num);
+
+    gchar *file_name;
+
+    gtk_assistant_set_page_complete (assistant, page, FALSE);
+
+    file_name = gtk_file_chooser_get_filename ( GTK_FILE_CHOOSER(info->file_chooser ));
+
+    if (file_name)
+    {
+	if (g_file_test(file_name, G_FILE_TEST_EXISTS ))
+	{
+        const char *format = _("The file %s already exists. "
+                               "Are you sure you want to overwrite it?");
+
+        /* if user says cancel, we should break out */
+        if (!gnc_verify_dialog (NULL, FALSE, format, file_name))
+            return;
+        }
+
+        info->file_name = g_strdup(file_name);
+        gtk_assistant_set_page_complete (assistant, page, TRUE);
+    }
+
+    if (file_name)
+    {
+        gchar *filepath = gnc_uri_get_path ( file_name );
+        gchar *filedir = g_path_get_dirname( filepath );
+        info->starting_dir = g_strdup(filedir);
+        g_free ( filedir );
+        g_free ( filepath );
+    }
+    g_free(file_name); 
+
+    DEBUG("file_name selected is %s", info->file_name);
+    DEBUG("starting directory is %s", info->starting_dir);
+}
+
+
+/*******************************************************
+ * csv_export_sep_cb
+ *
+ * call back for type of separartor required
+ *******************************************************/
+void csv_export_sep_cb (GtkWidget *radio, gpointer user_data )
+{
+    CsvExportInfo *info = user_data;
+    const gchar *name;
+
+    GtkAssistant *assistant = GTK_ASSISTANT(info->window);
+    gint num = gtk_assistant_get_current_page (assistant);
+    GtkWidget *page = gtk_assistant_get_nth_page (assistant, num);
+
+    if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio)))
+    {
+        LEAVE("1st callback of pair. Defer to 2nd callback.");
+        return;
+    }
+
+    name = gtk_buildable_get_name(GTK_BUILDABLE(radio));
+
+    gtk_widget_set_sensitive(info->custom_entry, FALSE);
+    info->use_custom = FALSE;
+    gtk_assistant_set_page_complete (assistant, page, TRUE);
+
+    if (g_strcmp0(name, "comma_radio") == 0)
+        info->separator_str = ",";
+    if (g_strcmp0(name, "colon_radio") == 0)
+        info->separator_str = ":";
+    if (g_strcmp0(name, "semicolon_radio") == 0)
+        info->separator_str = ";";
+
+    if (g_strcmp0(name, "custom_radio") == 0)
+    {
+        gtk_widget_set_sensitive(info->custom_entry, TRUE);
+        info->use_custom = TRUE;
+        if (gtk_entry_get_text_length (GTK_ENTRY(info->custom_entry)) == 0)
+            gtk_assistant_set_page_complete (assistant, page, FALSE);
+    }
+}
+
+
+/*******************************************************
+ * csv_export_quote_cb
+ *
+ * call back for use of quotes
+ *******************************************************/
+void csv_export_quote_cb (GtkToggleButton *button, gpointer user_data )
+{
+    CsvExportInfo *info = user_data;
+    const gchar *name;
+
+    name = gtk_buildable_get_name(GTK_BUILDABLE(button));
+
+    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)))
+        info->use_quotes = TRUE;
+    else
+        info->use_quotes = FALSE;
+}
+
+
+/*******************************************************
+ * csv_export_custom_entry_cb
+ *
+ * call back for custom separator
+ *******************************************************/
+void csv_export_custom_entry_cb (GtkWidget *widget, gpointer user_data )
+{
+    CsvExportInfo *info = user_data;
+    const gchar *custom_str;
+
+    GtkAssistant *assistant = GTK_ASSISTANT(info->window);
+    gint num = gtk_assistant_get_current_page (assistant);
+    GtkWidget *page = gtk_assistant_get_nth_page (assistant, num);
+
+    custom_str = gtk_entry_get_text(GTK_ENTRY(info->custom_entry));
+    info->separator_str = strdup(custom_str);
+
+    if (info->use_custom == TRUE && gtk_entry_get_text_length (GTK_ENTRY(info->custom_entry)) == 0)
+
+        gtk_assistant_set_page_complete (assistant, page, FALSE);
+    else
+        gtk_assistant_set_page_complete (assistant, page, TRUE);
+}
+
+
+/*******************************************************
+ * load_settings
+ *
+ * load the default settings for the assistant
+ *******************************************************/
+static
+void load_settings (CsvExportInfo *info)
+{
+    info->use_quotes = TRUE;
+    info->separator_str = ",";
+    info->file_name = NULL;
+    info->starting_dir = NULL;
+
+    /* The default directory for the user to select files. */
+    info->starting_dir = gnc_get_default_directory(GCONF_SECTION);
+}
+
+/* =============================================================== */
+
+/*******************************************************
+ * csv_export_cursor_changed_cb
+ *
+ * call back for cursor selection in account tree
+ *******************************************************/
+static void
+csv_export_cursor_changed_cb (GtkWidget *widget, gpointer user_data)
+{
+    CsvExportInfo *info = user_data;
+    GncTreeViewAccount *account_tree;
+    Account *account;
+    gint num_children;
+
+    account_tree = GNC_TREE_VIEW_ACCOUNT (info->csva.account_treeview);
+    account = gnc_tree_view_account_get_cursor_account (account_tree);
+    if (!account)
+    {
+        gtk_widget_set_sensitive(info->csva.select_button, FALSE);
+        return;
+    }
+    num_children = gnc_tree_view_account_count_children(account_tree, account);
+    gtk_widget_set_sensitive(info->csva.select_button, num_children > 0);
+}
+
+
+/*******************************************************
+ * show_acct_type_accounts
+ *
+ * show required accounts in account tree
+ *******************************************************/
+static void
+show_acct_type_accounts (CsvExportInfo *info)
+{
+    GncTreeViewAccount *tree;
+    AccountViewInfo Viewinfo;
+    GNCAccountType type;
+
+    tree = GNC_TREE_VIEW_ACCOUNT (info->csva.account_treeview);
+
+    gnc_tree_view_account_get_view_info (tree, &Viewinfo);
+
+    for (type = 0; type < NUM_ACCOUNT_TYPES; type++) /* from Account.h */
+    {
+        if (info->csva.account_type == ACCT_TYPE_EXPENSE)
+            Viewinfo.include_type[type] = (type == ACCT_TYPE_EXPENSE);
+        else if (info->csva.account_type == ACCT_TYPE_INCOME)
+            Viewinfo.include_type[type] = (type == ACCT_TYPE_INCOME);
+        else if (info->csva.account_type == ACCT_TYPE_ASSET)
+            Viewinfo.include_type[type] = ((type == ACCT_TYPE_BANK)  ||
+                                       (type == ACCT_TYPE_CASH)      ||
+                                       (type == ACCT_TYPE_ASSET)     ||
+                                       (type == ACCT_TYPE_STOCK)     ||
+                                       (type == ACCT_TYPE_MUTUAL)    ||
+                                       (type == ACCT_TYPE_RECEIVABLE));
+        else if (info->csva.account_type == ACCT_TYPE_LIABILITY)
+            Viewinfo.include_type[type] = ((type == ACCT_TYPE_CREDIT)||
+                                       (type == ACCT_TYPE_LIABILITY) ||
+                                       (type == ACCT_TYPE_EQUITY)    ||
+                                       (type == ACCT_TYPE_PAYABLE));
+        else
+            Viewinfo.include_type[type] = FALSE;
+    }
+    gnc_tree_view_account_set_view_info (tree, &Viewinfo);
+    csv_export_cursor_changed_cb(GTK_WIDGET(tree), info);
+}
+
+
+/*******************************************************
+ * account_filter_func
+ *
+ * update filter for account tree
+ *******************************************************/
+static gboolean
+account_filter_func (Account *account, gpointer user_data)
+{
+    CsvExportInfo *info = user_data;
+    gboolean included = FALSE;
+
+    if ((info->csva.account_type == ACCT_TYPE_INCOME) ||
+            (info->csva.account_type == ACCT_TYPE_EXPENSE))
+        included = (xaccAccountGetType (account) == info->csva.account_type);
+    else if (info->csva.account_type == ACCT_TYPE_ASSET)
+        included = ((xaccAccountGetType (account) == ACCT_TYPE_BANK) ||
+                    (xaccAccountGetType (account) == ACCT_TYPE_CASH) ||
+                    (xaccAccountGetType (account) == ACCT_TYPE_ASSET) ||
+                    (xaccAccountGetType (account) == ACCT_TYPE_STOCK) ||
+                    (xaccAccountGetType (account) == ACCT_TYPE_MUTUAL) ||
+                    (xaccAccountGetType (account) == ACCT_TYPE_RECEIVABLE));
+    else if (info->csva.account_type == ACCT_TYPE_LIABILITY)
+        included = ((xaccAccountGetType (account) == ACCT_TYPE_CREDIT) ||
+                    (xaccAccountGetType (account) == ACCT_TYPE_LIABILITY) ||
+                    (xaccAccountGetType (account) == ACCT_TYPE_EQUITY) ||
+                    (xaccAccountGetType (account) == ACCT_TYPE_PAYABLE));
+    else
+        included = FALSE;
+    return included;
+}
+
+
+/*******************************************************
+ * update_accounts_tree
+ *
+ * update the account tree
+ *******************************************************/
+static int
+update_accounts_tree (CsvExportInfo *info)
+{
+    GncTreeViewAccount *tree;
+    GtkTreeSelection* selection;
+    GtkWidget *label;
+    int num_accounts;
+    char *string;
+
+    tree = GNC_TREE_VIEW_ACCOUNT(info->csva.account_treeview);
+    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(tree));
+    num_accounts = gtk_tree_selection_count_selected_rows (selection);
+
+    label = info->csva.num_acct_label;
+
+    string = g_strdup_printf ("%d", num_accounts);
+    gtk_label_set_text (GTK_LABEL (label), string);
+    g_free (string);
+
+    return num_accounts;
+}
+
+
+/*******************************************************
+ * csv_export_account_changed_cb
+ *
+ * update account list after selection changed
+ *******************************************************/
+static void
+csv_export_account_changed_cb (GtkTreeSelection *selection,
+                                 gpointer user_data)
+{
+    CsvExportInfo *info = user_data;
+    GtkAssistant *assistant = GTK_ASSISTANT(info->window);
+    gint num = gtk_assistant_get_current_page (assistant);
+    GtkWidget *page = gtk_assistant_get_nth_page (assistant, num);
+
+    GncTreeViewAccount *view;
+
+    g_return_if_fail(GTK_IS_TREE_SELECTION(selection));
+
+    info->csva.num_accounts = update_accounts_tree (info);
+
+    /* Enable the Forward Assistant Button if we have accounts */
+    if(info->csva.num_accounts > 0)
+        gtk_assistant_set_page_complete (assistant, page, TRUE);
+    else
+        gtk_assistant_set_page_complete (assistant, page, FALSE);
+
+    view = GNC_TREE_VIEW_ACCOUNT(info->csva.account_treeview);
+    info->csva.account_list = gnc_tree_view_account_get_selected_accounts (view);
+}
+
+
+/*******************************************************
+ * csv_export_select_subaccounts_clicked_cb
+ *
+ * select all the sub accounts
+ *******************************************************/
+static void
+csv_export_select_subaccounts_clicked_cb (GtkWidget *widget, gpointer user_data)
+{
+    CsvExportInfo *info = user_data;
+    GncTreeViewAccount *account_tree;
+    Account *account;
+
+    account_tree = GNC_TREE_VIEW_ACCOUNT (info->csva.account_treeview);
+    account = gnc_tree_view_account_get_cursor_account (account_tree);
+    if (!account)
+        return;
+
+    gnc_tree_view_account_select_subaccounts (account_tree, account);
+
+    gtk_widget_grab_focus (info->csva.account_treeview);
+}
+
+
+/*******************************************************
+ * csv_export_info_acct_type_cb
+ *
+ * select which type of accounts to display
+ *******************************************************/
+static void
+csv_export_info_acct_type_cb (GtkWidget *w, gpointer user_data)
+{
+    CsvExportInfo *info = user_data;
+    const gchar *button_name;
+
+    if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w)))
+    {
+        button_name = gtk_buildable_get_name(GTK_BUILDABLE(w));
+        if (safe_strcmp (button_name, "income_radio") == 0)
+            info->csva.account_type = ACCT_TYPE_INCOME;
+        else if (safe_strcmp (button_name, "expense_radio") == 0)
+            info->csva.account_type = ACCT_TYPE_EXPENSE;
+        else if (safe_strcmp (button_name, "asset_radio") == 0)
+            info->csva.account_type = ACCT_TYPE_ASSET;
+        else if (safe_strcmp (button_name, "liab_eq_radio") == 0)
+            info->csva.account_type = ACCT_TYPE_LIABILITY;
+        else
+            return;
+
+        show_acct_type_accounts (info);
+        gnc_tree_view_account_refilter
+        (GNC_TREE_VIEW_ACCOUNT (info->csva.account_treeview));
+        update_accounts_tree (info);
+    }
+    else
+        return;
+}
+
+/* =============================================================== */
+
+/*******************************************************
+ * get_filter_times
+ *
+ * get the start and end times from the dialog
+ *******************************************************/
+static void
+get_filter_times (CsvExportInfo *info)
+{
+    GtkWidget *button, *today, *gde;
+    time_t time_val;
+
+    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(info->csvd.start_date_choose)))
+    {
+        time_val = gnc_date_edit_get_date(GNC_DATE_EDIT(info->csvd.start_date));
+        time_val = gnc_timet_get_day_start(time_val);
+        info->csvd.start_time = time_val;
+    }
+    else
+    {
+        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(info->csvd.start_date_today)))
+        {
+            info->csvd.start_time = gnc_timet_get_today_start();
+        }
+        else
+        {
+            info->csvd.start_time = 0;
+        }
+    }
+
+    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(info->csvd.end_date_choose)))
+    {
+        time_val = gnc_date_edit_get_date(GNC_DATE_EDIT(info->csvd.end_date));
+        time_val = gnc_timet_get_day_end(time_val);
+        info->csvd.end_time = time_val;
+    }
+    else
+    {
+        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(info->csvd.start_date_today)))
+        {
+            info->csvd.end_time = gnc_timet_get_today_end();
+        }
+        else
+        {
+            info->csvd.end_time = time(NULL);
+        }
+    }
+}
+
+
+/*******************************************************
+ * csv_export_show_range_cb
+ *
+ * call back for show range button
+ *******************************************************/
+void
+csv_export_show_range_cb (GtkRadioButton *button, gpointer user_data)
+{
+    CsvExportInfo *info = user_data;
+    gboolean active;
+
+    g_return_if_fail(GTK_IS_RADIO_BUTTON(button));
+
+    active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
+    gtk_widget_set_sensitive(info->csvd.table, active);
+}
+
+
+/*******************************************************
+ * csv_export_date_changed_cb
+ *
+ * call back for when a date changes
+ *******************************************************/
+static void
+csv_export_date_changed_cb (GtkWidget *w, gpointer user_data)
+{
+    CsvExportInfo *info = user_data;
+
+    get_filter_times(info);
+}
+
+
+/*******************************************************
+ * csv_export_start_date_cb
+ *
+ * call back for when the start date changes
+ *******************************************************/
+void
+csv_export_start_date_cb (GtkWidget *radio, gpointer user_data)
+{
+    CsvExportInfo *info = user_data;
+    const gchar *name;
+    gboolean active;
+
+    g_return_if_fail(GTK_IS_RADIO_BUTTON(radio));
+
+    if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio)))
+    {
+        LEAVE("1st callback of pair. Defer to 2nd callback.");
+        return;
+    }
+
+    name = gtk_buildable_get_name(GTK_BUILDABLE(radio));
+    active = ( g_strcmp0(name, g_strdup("start_date_choose")) == 0 ? 1 : 0 );
+    gtk_widget_set_sensitive(info->csvd.start_date, active);
+    get_filter_times(info);
+}
+
+
+/*******************************************************
+ * csv_export_end_date_cb
+ *
+ * call back for when the end date changes
+ *******************************************************/
+void
+csv_export_end_date_cb (GtkWidget *radio, gpointer user_data)
+{
+    CsvExportInfo *info = user_data;
+    const gchar *name;
+    gboolean active;
+
+    g_return_if_fail(GTK_IS_RADIO_BUTTON(radio));
+
+    if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio)))
+    {
+        LEAVE("1st callback of pair. Defer to 2nd callback.");
+        return;
+    }
+
+    name = gtk_buildable_get_name(GTK_BUILDABLE(radio));
+    active = ( g_strcmp0(name, g_strdup("end_date_choose")) == 0 ? 1 : 0 );
+    gtk_widget_set_sensitive(info->csvd.end_date, active);
+    get_filter_times(info);
+}
+
+
+/*******************************************************************
+ * get_earliest_in_book
+ *
+ * Find the earliest date occuring in the book.  Do this by making
+ * a query and sorting by date. Since the truncated sort returns
+ * only the *last* search results, sort in decreasing order.
+ *******************************************************************/
+static time_t
+get_earliest_in_book (QofBook *book)
+{
+    QofQuery *q;
+    GSList *p1, *p2;
+    GList *res;
+    time_t earliest;
+
+    q = qof_query_create_for(GNC_ID_SPLIT);
+    qof_query_set_max_results(q, 1);
+    qof_query_set_book (q, book);
+
+    /* Sort by transaction date */
+    p1 = g_slist_prepend (NULL, TRANS_DATE_POSTED);
+    p1 = g_slist_prepend (p1, SPLIT_TRANS);
+    p2 = g_slist_prepend (NULL, QUERY_DEFAULT_SORT);
+    qof_query_set_sort_order (q, p1, p2, NULL);
+
+    /* Reverse the sort order */
+    qof_query_set_sort_increasing (q, FALSE, FALSE, FALSE);
+
+    /* Run the query, find the earliest transaction date */
+    res = qof_query_run (q);
+
+    if (res)
+    {
+        earliest = xaccQueryGetEarliestDateFound (q);
+    }
+    else
+    {
+        /* If no results, we don't want to bomb totally */
+        earliest = time (0);
+    }
+
+    qof_query_destroy (q);
+    return earliest;
+}
+
+
+/* =============================================================== */
+
+
+/*******************************************************
+ * Assistant page prepare functions
+ *******************************************************/
+void
+csv_export_assistant_start_page_prepare (GtkAssistant *assistant,
+                                   gpointer user_data)
+{
+    CsvExportInfo *info = user_data;
+    gint num = gtk_assistant_get_current_page (assistant);
+    GtkWidget *page = gtk_assistant_get_nth_page (assistant, num);
+
+    /* Set Start page text */
+    if (info->export_type == XML_EXPORT_TREE)
+	gtk_label_set_text (GTK_LABEL(info->start_label), start_tree_string);
+    else
+	gtk_label_set_text (GTK_LABEL(info->start_label), start_trans_string);
+
+    /* Enable the Assistant Buttons */
+    gtk_assistant_set_page_complete (assistant, page, TRUE);
+}
+
+
+void
+csv_export_assistant_account_page_prepare (GtkAssistant *assistant,
+                                   gpointer user_data)
+{
+    CsvExportInfo *info = user_data;
+    gint num = gtk_assistant_get_current_page (assistant);
+    GtkWidget *page = gtk_assistant_get_nth_page (assistant, num);
+
+    /* If we are doing tree export, step over account select page */
+    if (info->export_type == XML_EXPORT_TREE)
+        gtk_assistant_set_current_page (assistant, num + 1 );
+
+    /* Enable the Forward Assistant Button if we have accounts */
+    if(info->csva.num_accounts > 0)
+        gtk_assistant_set_page_complete (assistant, page, TRUE);
+    else
+        gtk_assistant_set_page_complete (assistant, page, FALSE);
+}
+
+
+void
+csv_export_assistant_file_page_prepare (GtkAssistant *assistant,
+                                   gpointer user_data)
+{
+    CsvExportInfo *info = user_data;
+    gint num = gtk_assistant_get_current_page (assistant);
+    GtkWidget *page = gtk_assistant_get_nth_page (assistant, num);
+
+    /* Set the default directory */
+    if (info->starting_dir)
+        gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(info->file_chooser), info->starting_dir);
+    gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER(info->file_chooser), "");
+
+    /* Disable the Forward Assistant Button */
+    gtk_assistant_set_page_complete (assistant, page, FALSE);
+}
+
+
+void
+csv_export_assistant_finish_page_prepare (GtkAssistant *assistant,
+                                   gpointer user_data)
+{
+    CsvExportInfo *info = user_data;
+    gint num = gtk_assistant_get_current_page (assistant);
+    GtkWidget *page = gtk_assistant_get_nth_page (assistant, num);
+    gchar *text;
+
+    /* Set Finish page text */
+    if (info->export_type == XML_EXPORT_TREE)
+        text = g_strdup_printf (gettext (finish_tree_string), info->file_name);
+    else
+        text = g_strdup_printf (gettext (finish_trans_string), info->file_name, info->csva.num_accounts);
+
+    gtk_label_set_text (GTK_LABEL(info->finish_label), text);
+    g_free(text);
+
+    /* Enable the Assistant Buttons */
+    gtk_assistant_set_page_complete (assistant, page, TRUE);
+}
+
+
+void
+csv_export_assistant_summary_page_prepare (GtkAssistant *assistant,
+                                   gpointer user_data)
+{
+    CsvExportInfo *info = user_data;
+    gchar *text, *mtext;
+
+    /* Save the Window size, paned position and directory */
+    gnc_gconf_set_int(GCONF_SECTION, PANED_POSITION,
+                          gtk_paned_get_position(GTK_PANED(info->csva.paned)), NULL);
+    gnc_set_default_directory(GCONF_SECTION, info->starting_dir);
+    gnc_save_window_size(GCONF_SECTION, GTK_WINDOW(info->window));
+
+    if(info->failed)
+	text = _("There was a problem with the export, this could be due to lack of space, "
+		 "permissions or unable to access folder. Check the trace file for further logging!\n"
+		 "You may need to enable debuging.\n");
+    else
+	text = _("File exported successfully!\n");
+
+    mtext = g_strdup_printf("<span size=\"medium\"><b>%s</b></span>",text);
+
+    gtk_label_set_markup(GTK_LABEL(info->summary_label), mtext);
+
+    g_free(mtext);
+}
+
+
+void
+csv_export_assistant_prepare (GtkAssistant *assistant, GtkWidget *page,
+                      gpointer user_data)
+{
+    CsvExportInfo *info = user_data;
+    gint currentpage = gtk_assistant_get_current_page(assistant);
+
+    switch (currentpage)
+    {
+    case 0:
+        /* Current page is Start page */
+        csv_export_assistant_start_page_prepare (assistant, user_data);
+        break;
+    case 1:
+        /* Current page is Account select page */
+        csv_export_assistant_account_page_prepare (assistant, user_data);
+        break;
+    case 2:
+        /* Current page is file select page */
+        csv_export_assistant_file_page_prepare (assistant, user_data);
+        break;
+    case 3:
+        /* Current page is Finish page */
+        csv_export_assistant_finish_page_prepare (assistant, user_data);
+        break;
+    case 4:
+        /* Current page is Summary page */
+        csv_export_assistant_summary_page_prepare (assistant, user_data);
+        break;
+    }
+}
+
+
+/*******************************************************
+ * Assistant call back functions
+ *******************************************************/
+static void
+csv_export_assistant_destroy_cb (GtkObject *object, gpointer user_data)
+{
+    CsvExportInfo *info = user_data;
+    gnc_unregister_gui_component_by_data (ASSISTANT_CSV_EXPORT_CM_CLASS, info);
+    g_free (info);
+}
+
+void
+csv_export_assistant_cancel (GtkAssistant *assistant, gpointer user_data)
+{
+    CsvExportInfo *info = user_data;
+    gnc_close_gui_component_by_data (ASSISTANT_CSV_EXPORT_CM_CLASS, info);
+}
+
+void
+csv_export_assistant_close (GtkAssistant *assistant, gpointer user_data)
+{
+    CsvExportInfo *info = user_data;
+    gnc_close_gui_component_by_data (ASSISTANT_CSV_EXPORT_CM_CLASS, info);
+}
+
+void
+csv_export_assistant_finish (GtkAssistant *assistant, gpointer user_data)
+{
+    CsvExportInfo *info = user_data;
+
+    if (info->export_type == XML_EXPORT_TREE)
+	csv_tree_export (info);
+    else
+        csv_transactions_export (info);
+}
+
+static void
+csv_export_close_handler (gpointer user_data)
+{
+    CsvExportInfo *info = user_data;
+
+    g_free(info->file_name);
+    g_free(info->starting_dir);
+
+    gtk_widget_destroy (info->window);
+}
+
+/*******************************************************
+ * Create the Assistant
+ *******************************************************/
+static GtkWidget *
+csv_export_assistant_create (CsvExportInfo *info)
+{
+    GtkBuilder *builder;
+    GtkWidget *window;
+    GtkWidget *box;
+    GtkWidget *button;
+    GtkWidget *toggle, *start_date, *end_date, *table, *hbox;
+    time_t start_time, end_time, time_val;
+    gboolean sensitive, value;
+
+    builder = gtk_builder_new();
+    gnc_builder_add_from_file  (builder , "assistant-csv-export.glade", "CSV Export Assistant");
+    window = GTK_WIDGET(gtk_builder_get_object (builder, "CSV Export Assistant"));
+    info->window = window;
+
+    /* Set the assistant colors */
+    gnc_assistant_set_colors (GTK_ASSISTANT (info->window));
+
+    /* Load default settings */
+    load_settings (info);
+
+    /* Start Page */
+    info->start_label = GTK_WIDGET(gtk_builder_get_object(builder, "start_label"));
+    info->custom_entry = GTK_WIDGET(gtk_builder_get_object(builder, "custom_entry"));
+    gtk_widget_set_sensitive(info->custom_entry, FALSE);
+
+    /* Account Page */
+    {
+        GtkTreeView *tree_view;
+        GtkTreeSelection *selection;
+        GtkWidget *income_radio, *expense_radio, *asset_radio,
+                  *liab_eq_radio, *box, *label;
+
+        info->csva.acct_info = GTK_WIDGET(gtk_builder_get_object (builder, "acct_info_vbox"));
+        info->csva.num_acct_label = GTK_WIDGET(gtk_builder_get_object (builder, "num_accounts_label"));
+
+        tree_view = gnc_tree_view_account_new (FALSE);
+        gnc_tree_view_account_set_filter (GNC_TREE_VIEW_ACCOUNT(tree_view),
+                                          account_filter_func, info, NULL);
+        info->csva.account_treeview = GTK_WIDGET(tree_view);
+
+        selection = gtk_tree_view_get_selection (tree_view);
+        gtk_tree_selection_set_mode (selection, GTK_SELECTION_EXTENDED);
+        g_signal_connect (G_OBJECT (selection), "changed",
+                          G_CALLBACK (csv_export_account_changed_cb), info);
+
+        gtk_widget_show (info->csva.account_treeview);
+        box = GTK_WIDGET(gtk_builder_get_object (builder, "account_scroll"));
+        gtk_container_add (GTK_CONTAINER (box), info->csva.account_treeview);
+
+        label = GTK_WIDGET(gtk_builder_get_object (builder, "accounts_label"));
+        gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(tree_view));
+
+        income_radio = GTK_WIDGET(gtk_builder_get_object (builder, "income_radio"));
+        expense_radio = GTK_WIDGET(gtk_builder_get_object (builder, "expense_radio"));
+        info->csva.expense_radio = expense_radio;
+        asset_radio = GTK_WIDGET(gtk_builder_get_object (builder, "asset_radio"));
+        info->csva.asset_radio = asset_radio;
+        liab_eq_radio = GTK_WIDGET(gtk_builder_get_object (builder, "liab_eq_radio"));
+        info->csva.liab_eq_radio = liab_eq_radio;
+        info->csva.account_type = ACCT_TYPE_EXPENSE;
+        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(expense_radio), TRUE);
+
+        g_signal_connect (G_OBJECT (income_radio), "toggled",
+                          G_CALLBACK  (csv_export_info_acct_type_cb), info);
+        g_signal_connect (G_OBJECT (expense_radio), "toggled",
+                          G_CALLBACK  (csv_export_info_acct_type_cb), info);
+        g_signal_connect (G_OBJECT (asset_radio), "toggled",
+                          G_CALLBACK  (csv_export_info_acct_type_cb), info);
+        g_signal_connect (G_OBJECT (liab_eq_radio), "toggled",
+                          G_CALLBACK  (csv_export_info_acct_type_cb), info);
+    }
+
+    /* select subaccounts button */
+    {
+        GtkWidget *button;
+
+        button = GTK_WIDGET(gtk_builder_get_object (builder, "select_subaccounts_button"));
+        info->csva.select_button = button;
+
+        g_signal_connect (G_OBJECT (button), "clicked",
+                          G_CALLBACK  (csv_export_select_subaccounts_clicked_cb), info);
+        g_signal_connect (G_OBJECT (info->csva.account_treeview), "cursor_changed",
+                          G_CALLBACK  (csv_export_cursor_changed_cb), info);
+    }
+
+    /* Set the date info */
+    button = GTK_WIDGET(gtk_builder_get_object (builder, "show_range"));
+
+    /* Earliest and Latest in Book */
+    start_time = get_earliest_in_book (gnc_get_current_book());
+    end_time = time(NULL);
+
+    info->csvd.start_time = start_time;
+    info->csvd.end_time = end_time;
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), FALSE);
+
+    table = GTK_WIDGET(gtk_builder_get_object (builder, "select_range_table"));
+    info->csvd.table = table;
+    gtk_widget_set_sensitive(GTK_WIDGET(table), FALSE);
+
+    info->csvd.start_date_choose = GTK_WIDGET(gtk_builder_get_object (builder, "start_date_choose"));
+    info->csvd.start_date_today = GTK_WIDGET(gtk_builder_get_object (builder, "start_date_today"));
+    info->csvd.end_date_choose = GTK_WIDGET(gtk_builder_get_object (builder, "end_date_choose"));
+    info->csvd.end_date_today = GTK_WIDGET(gtk_builder_get_object (builder, "end_date_today"));
+
+    /* Start date info */
+    info->csvd.start_date = gnc_date_edit_new (time (NULL), FALSE, FALSE);
+    hbox = GTK_WIDGET(gtk_builder_get_object (builder, "start_date_hbox"));
+    gtk_box_pack_start (GTK_BOX (hbox), info->csvd.start_date, TRUE, TRUE, 0);
+    gtk_widget_show (info->csvd.start_date);
+    gnc_date_edit_set_time(GNC_DATE_EDIT(info->csvd.start_date), start_time);
+    g_signal_connect (G_OBJECT (info->csvd.start_date), "date-changed",
+                          G_CALLBACK (csv_export_date_changed_cb), info);
+
+    /* End date info */
+    info->csvd.end_date = gnc_date_edit_new (time (NULL), FALSE, FALSE);
+    hbox = GTK_WIDGET(gtk_builder_get_object (builder, "end_date_hbox"));
+    gtk_box_pack_start (GTK_BOX (hbox), info->csvd.end_date, TRUE, TRUE, 0);
+    gtk_widget_show (info->csvd.end_date);
+    gnc_date_edit_set_time(GNC_DATE_EDIT(info->csvd.end_date), end_time);
+    g_signal_connect (G_OBJECT (info->csvd.end_date), "date-changed",
+                          G_CALLBACK (csv_export_date_changed_cb), info);
+
+    /* Load Accounts */
+    show_acct_type_accounts (info);
+    update_accounts_tree (info);
+
+    /* File chooser Page */
+    info->file_chooser = gtk_file_chooser_widget_new (GTK_FILE_CHOOSER_ACTION_SAVE);
+    button = gtk_button_new_from_stock(GTK_STOCK_OK);
+    gtk_widget_show (button);
+    gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER(info->file_chooser), button);
+    g_signal_connect (G_OBJECT (button), "clicked",
+                  G_CALLBACK (csv_export_file_chooser_confirm_cb), info);
+
+    box = GTK_WIDGET(gtk_builder_get_object(builder, "file_page"));
+    gtk_box_pack_start (GTK_BOX (box), info->file_chooser, TRUE, TRUE, 6);
+    gtk_widget_show (info->file_chooser);
+
+    /* Finish Page */
+    info->finish_label = GTK_WIDGET(gtk_builder_get_object(builder, "end_page"));
+
+    /* Summary Page */
+    info->summary_label = GTK_WIDGET(gtk_builder_get_object(builder, "summary_page"));
+
+    g_signal_connect (G_OBJECT(window), "destroy",
+                      G_CALLBACK (csv_export_assistant_destroy_cb), info);
+
+    gnc_restore_window_size (GCONF_SECTION, GTK_WINDOW(info->window));
+
+    info->csva.paned = GTK_WIDGET(gtk_builder_get_object (builder, "paned"));
+
+    if (gnc_gconf_get_bool(GCONF_SECTION, KEY_SAVE_GEOMETRY, NULL))
+    {
+        gint position = gnc_gconf_get_int(GCONF_SECTION, PANED_POSITION, NULL);
+        gtk_paned_set_position(GTK_PANED(info->csva.paned), position);
+    }
+
+    gtk_builder_connect_signals(builder, info);
+    g_object_unref(G_OBJECT(builder));
+    return window;
+}
+
+
+/********************************************************************\
+ * gnc_file_csv_export                                              *
+ * opens up a assistant to export accounts or transactions based on *
+ * the type.                                                        *
+ * Args:   export_type                                              *
+ * Return: nothing                                                  *
+\********************************************************************/
+void
+gnc_file_csv_export (CsvExportType export_type)
+{
+    CsvExportInfo *info;
+    gint component_id;
+
+    info = g_new0 (CsvExportInfo, 1);
+
+    info->export_type = export_type;
+
+    csv_export_assistant_create (info);
+
+    component_id = gnc_register_gui_component (ASSISTANT_CSV_EXPORT_CM_CLASS,
+                   NULL, csv_export_close_handler,
+                   info);
+
+    gtk_widget_show_all (info->window);
+
+    gnc_window_adjust_for_screen (GTK_WINDOW(info->window));
+}


Property changes on: gnucash/trunk/src/import-export/csv-export/assistant-csv-export.c
___________________________________________________________________
Added: svn:eol-style
   + LF

Added: gnucash/trunk/src/import-export/csv-export/assistant-csv-export.glade
===================================================================
--- gnucash/trunk/src/import-export/csv-export/assistant-csv-export.glade	                        (rev 0)
+++ gnucash/trunk/src/import-export/csv-export/assistant-csv-export.glade	2012-03-16 20:26:04 UTC (rev 22085)
@@ -0,0 +1,913 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy project-wide -->
+  <object class="GtkAssistant" id="CSV Export Assistant">
+    <property name="can_focus">False</property>
+    <property name="border_width">12</property>
+    <property name="title" translatable="yes">CSV Export Assistant</property>
+    <property name="default_width">400</property>
+    <property name="default_height">500</property>
+    <signal name="close" handler="csv_export_assistant_close" swapped="no"/>
+    <signal name="apply" handler="csv_export_assistant_finish" swapped="no"/>
+    <signal name="prepare" handler="csv_export_assistant_prepare" swapped="no"/>
+    <signal name="cancel" handler="csv_export_assistant_cancel" swapped="no"/>
+    <child>
+      <object class="GtkVBox" id="start_page">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="border_width">12</property>
+        <child>
+          <object class="GtkLabel" id="start_label">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">
+Select the type of Export required and the separator that will be used.
+</property>
+            <property name="justify">center</property>
+            <property name="wrap">True</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <object class="GtkHSeparator" id="hseparator1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="padding">6</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <object class="GtkFrame" id="frame1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="border_width">6</property>
+            <property name="label_xalign">0</property>
+            <property name="shadow_type">none</property>
+            <child>
+              <object class="GtkAlignment" id="alignment1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="left_padding">20</property>
+                <child>
+                  <object class="GtkTable" id="table1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="n_columns">3</property>
+                    <property name="column_spacing">3</property>
+                    <property name="row_spacing">3</property>
+                    <child>
+                      <object class="GtkCheckButton" id="quote_tbutton">
+                        <property name="label" translatable="yes">Quotes</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="active">True</property>
+                        <property name="draw_indicator">True</property>
+                        <signal name="toggled" handler="csv_export_quote_cb" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="y_options">GTK_FILL</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child type="label">
+              <object class="GtkLabel" id="label1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Use Quotes</property>
+                <property name="use_markup">True</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">4</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkFrame" id="frame2">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="border_width">6</property>
+            <property name="label_xalign">0</property>
+            <property name="shadow_type">none</property>
+            <child>
+              <object class="GtkAlignment" id="alignment2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="left_padding">20</property>
+                <child>
+                  <object class="GtkTable" id="table2">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="n_rows">2</property>
+                    <property name="n_columns">3</property>
+                    <property name="column_spacing">3</property>
+                    <property name="row_spacing">3</property>
+                    <property name="homogeneous">True</property>
+                    <child>
+                      <object class="GtkRadioButton" id="comma_radio">
+                        <property name="label" translatable="yes">Comma (,)</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="active">True</property>
+                        <property name="draw_indicator">True</property>
+                        <signal name="toggled" handler="csv_export_sep_cb" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="y_options">GTK_FILL</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkRadioButton" id="colon_radio">
+                        <property name="label" translatable="yes">Colon (:)</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="active">True</property>
+                        <property name="draw_indicator">True</property>
+                        <property name="group">comma_radio</property>
+                        <signal name="toggled" handler="csv_export_sep_cb" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options">GTK_FILL</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkRadioButton" id="semicolon_radio">
+                        <property name="label" translatable="yes">Semicolon (;)</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="active">True</property>
+                        <property name="draw_indicator">True</property>
+                        <property name="group">comma_radio</property>
+                        <signal name="toggled" handler="csv_export_sep_cb" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="left_attach">2</property>
+                        <property name="right_attach">3</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options">GTK_FILL</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkRadioButton" id="custom_radio">
+                        <property name="label" translatable="yes">Custom</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="active">True</property>
+                        <property name="draw_indicator">True</property>
+                        <property name="group">comma_radio</property>
+                        <signal name="toggled" handler="csv_export_sep_cb" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="top_attach">1</property>
+                        <property name="bottom_attach">2</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options">GTK_FILL</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkEntry" id="custom_entry">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="invisible_char">&#x25CF;</property>
+                        <property name="invisible_char_set">True</property>
+                        <property name="primary_icon_activatable">False</property>
+                        <property name="secondary_icon_activatable">False</property>
+                        <property name="primary_icon_sensitive">True</property>
+                        <property name="secondary_icon_sensitive">True</property>
+                        <signal name="changed" handler="csv_export_custom_entry_cb" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">3</property>
+                        <property name="top_attach">1</property>
+                        <property name="bottom_attach">2</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options">GTK_FILL</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child type="label">
+              <object class="GtkLabel" id="label2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Separators</property>
+                <property name="use_markup">True</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">5</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="page_type">intro</property>
+        <property name="title" translatable="yes">Choose Export Settings</property>
+        <property name="complete">True</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkVBox" id="account_page">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="border_width">12</property>
+        <child>
+          <object class="GtkLabel" id="label5">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">Select the accounts to be exported and date range if required.</property>
+            <property name="wrap">True</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkHPaned" id="paned">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="position">1</property>
+            <child>
+              <object class="GtkVBox" id="acct_info_vbox">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="border_width">6</property>
+                <child>
+                  <object class="GtkLabel" id="accounts_label">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                    <property name="ypad">2</property>
+                    <property name="label" translatable="yes"><b>_Accounts</b></property>
+                    <property name="use_markup">True</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkAlignment" id="alignment3">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <object class="GtkVBox" id="vbox96">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <object class="GtkTable" id="table3">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="n_rows">2</property>
+                            <property name="n_columns">2</property>
+                            <child>
+                              <object class="GtkRadioButton" id="income_radio">
+                                <property name="label" translatable="yes">_Income</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="use_underline">True</property>
+                                <property name="active">True</property>
+                                <property name="draw_indicator">True</property>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkRadioButton" id="expense_radio">
+                                <property name="label" translatable="yes">_Expense</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="use_underline">True</property>
+                                <property name="draw_indicator">True</property>
+                                <property name="group">income_radio</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkRadioButton" id="asset_radio">
+                                <property name="label" translatable="yes">_Asset</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="use_underline">True</property>
+                                <property name="draw_indicator">True</property>
+                                <property name="group">income_radio</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">1</property>
+                                <property name="bottom_attach">2</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkRadioButton" id="liab_eq_radio">
+                                <property name="label" translatable="yes">_Liability/Equity</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="use_underline">True</property>
+                                <property name="draw_indicator">True</property>
+                                <property name="group">income_radio</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">1</property>
+                                <property name="bottom_attach">2</property>
+                              </packing>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkScrolledWindow" id="account_scroll">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="hscrollbar_policy">automatic</property>
+                            <property name="vscrollbar_policy">automatic</property>
+                            <property name="shadow_type">in</property>
+                            <child>
+                              <placeholder/>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkHBox" id="hbox98">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="border_width">3</property>
+                            <property name="spacing">2</property>
+                            <child>
+                              <object class="GtkLabel" id="label42">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                              </object>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">False</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="label847733">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">1</property>
+                                <property name="label" translatable="yes">Accounts Selected:</property>
+                                <property name="justify">center</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="num_accounts_label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">0</property>
+                                <property name="justify">center</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">2</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="label43">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                              </object>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">False</property>
+                                <property name="position">3</property>
+                              </packing>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">2</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkHButtonBox" id="hbox99">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <child>
+                              <object class="GtkButton" id="select_subaccounts_button">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">True</property>
+                                <property name="border_width">3</property>
+                                <property name="use_action_appearance">False</property>
+                                <child>
+                                  <object class="GtkAlignment" id="alignment5">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="xscale">0</property>
+                                    <property name="yscale">0</property>
+                                    <child>
+                                      <object class="GtkHBox" id="hbox100">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="spacing">2</property>
+                                        <child>
+                                          <object class="GtkImage" id="image1">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="stock">gtk-add</property>
+                                          </object>
+                                          <packing>
+                                            <property name="expand">False</property>
+                                            <property name="fill">False</property>
+                                            <property name="position">0</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkLabel" id="label847737">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="label" translatable="yes">_Select Subaccounts</property>
+                                            <property name="use_underline">True</property>
+                                          </object>
+                                          <packing>
+                                            <property name="expand">False</property>
+                                            <property name="fill">False</property>
+                                            <property name="position">1</property>
+                                          </packing>
+                                        </child>
+                                      </object>
+                                    </child>
+                                  </object>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">3</property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="resize">False</property>
+                <property name="shrink">False</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkVBox" id="date_vbox">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="border_width">12</property>
+                <child>
+                  <object class="GtkLabel" id="label847680">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes"><b>_Dates</b></property>
+                    <property name="use_markup">True</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkRadioButton" id="show_all">
+                    <property name="label" translatable="yes">Show _All</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="use_underline">True</property>
+                    <property name="active">True</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkRadioButton" id="show_range">
+                    <property name="label" translatable="yes">Select Range:</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="use_underline">True</property>
+                    <property name="draw_indicator">True</property>
+                    <property name="group">show_all</property>
+                    <signal name="toggled" handler="csv_export_show_range_cb" swapped="no"/>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkTable" id="select_range_table">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="n_rows">7</property>
+                    <property name="n_columns">3</property>
+                    <property name="column_spacing">6</property>
+                    <child>
+                      <object class="GtkLabel" id="label847682">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Start:</property>
+                      </object>
+                      <packing>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                        <property name="x_padding">12</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkRadioButton" id="start_date_earliest">
+                        <property name="label" translatable="yes">_Earliest</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="active">True</property>
+                        <property name="draw_indicator">True</property>
+                        <signal name="clicked" handler="csv_export_start_date_cb" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkRadioButton" id="end_date_choose">
+                        <property name="label" translatable="yes">Choo_se Date:</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="draw_indicator">True</property>
+                        <signal name="clicked" handler="csv_export_end_date_cb" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">6</property>
+                        <property name="bottom_attach">7</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkRadioButton" id="end_date_today">
+                        <property name="label" translatable="yes">Toda_y</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="draw_indicator">True</property>
+                        <property name="group">end_date_choose</property>
+                        <signal name="clicked" handler="csv_export_end_date_cb" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">5</property>
+                        <property name="bottom_attach">6</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkRadioButton" id="end_date_latest">
+                        <property name="label" translatable="yes">_Latest</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="active">True</property>
+                        <property name="draw_indicator">True</property>
+                        <property name="group">end_date_choose</property>
+                        <signal name="clicked" handler="csv_export_end_date_cb" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">4</property>
+                        <property name="bottom_attach">5</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label847683">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                      </object>
+                      <packing>
+                        <property name="top_attach">3</property>
+                        <property name="bottom_attach">4</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label847684">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">End:</property>
+                      </object>
+                      <packing>
+                        <property name="top_attach">4</property>
+                        <property name="bottom_attach">5</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                        <property name="x_padding">12</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkRadioButton" id="start_date_choose">
+                        <property name="label" translatable="yes">C_hoose Date:</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="draw_indicator">True</property>
+                        <property name="group">start_date_earliest</property>
+                        <signal name="clicked" handler="csv_export_start_date_cb" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">2</property>
+                        <property name="bottom_attach">3</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkRadioButton" id="start_date_today">
+                        <property name="label" translatable="yes">_Today</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="draw_indicator">True</property>
+                        <property name="group">start_date_earliest</property>
+                        <signal name="clicked" handler="csv_export_start_date_cb" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">1</property>
+                        <property name="bottom_attach">2</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkHBox" id="start_date_hbox">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <placeholder/>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="left_attach">2</property>
+                        <property name="right_attach">3</property>
+                        <property name="top_attach">2</property>
+                        <property name="bottom_attach">3</property>
+                        <property name="x_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkHBox" id="end_date_hbox">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <placeholder/>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="left_attach">2</property>
+                        <property name="right_attach">3</property>
+                        <property name="top_attach">6</property>
+                        <property name="bottom_attach">7</property>
+                        <property name="x_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">3</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="resize">False</property>
+                <property name="shrink">False</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+      </object>
+      <packing>
+        <property name="page_type">progress</property>
+        <property name="title" translatable="yes">Account Selection</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkVBox" id="file_page">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="border_width">12</property>
+        <child>
+          <object class="GtkLabel" id="label4">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">
+Enter file name and location for the Export...
+</property>
+            <property name="wrap">True</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+      </object>
+      <packing>
+        <property name="title" translatable="yes">Choose File Name for Export</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="end_page">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Press Apply to create export file.
+Cancel to abort.</property>
+        <property name="wrap">True</property>
+      </object>
+      <packing>
+        <property name="page_type">confirm</property>
+        <property name="title" translatable="yes">Export Now...</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="summary_page">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Summary</property>
+        <property name="wrap">True</property>
+      </object>
+      <packing>
+        <property name="page_type">summary</property>
+        <property name="title" translatable="yes">Export Summary</property>
+        <property name="complete">True</property>
+      </packing>
+    </child>
+  </object>
+</interface>

Added: gnucash/trunk/src/import-export/csv-export/assistant-csv-export.h
===================================================================
--- gnucash/trunk/src/import-export/csv-export/assistant-csv-export.h	                        (rev 0)
+++ gnucash/trunk/src/import-export/csv-export/assistant-csv-export.h	2012-03-16 20:26:04 UTC (rev 22085)
@@ -0,0 +1,99 @@
+/*******************************************************************\
+ * assistant-csv-export.h -- An assistant for exporting Accounts    *
+ *                            and Transactions to a file            *
+ *                                                                  *
+ * Copyright (C) 2012 Robert Fewell                                 *
+ *                                                                  *
+ * 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, contact:                        *
+ *                                                                  *
+ * Free Software Foundation           Voice:  +1-617-542-5942       *
+ * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
+ * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
+\********************************************************************/
+/** @file assistant-csv-export.h
+    @brief CSV Export Assistant
+    @author Copyright (c) 2012 Robert Fewell
+*/
+#ifndef GNC_ASSISTANT_CSV_EXPORT_H
+#define GNC_ASSISTANT_CSV_EXPORT_H
+
+#include "Account.h"
+
+typedef enum
+{
+    XML_EXPORT_TREE,
+    XML_EXPORT_TRANS
+} CsvExportType;
+
+typedef struct
+{
+    GtkWidget *table;
+    GtkWidget *start_date_choose;
+    GtkWidget *start_date_today;
+    GtkWidget *start_date;
+    GtkWidget *end_date_choose;
+    GtkWidget *end_date_today;
+    GtkWidget *end_date;
+
+    time_t     start_time;
+    time_t     end_time;
+}CsvExportDate;
+
+typedef struct
+{
+    GtkWidget        *paned;
+    GtkWidget        *acct_info;
+    GtkWidget        *expense_radio;
+    GtkWidget        *asset_radio;
+    GtkWidget        *liab_eq_radio;
+    GtkWidget        *account_treeview;
+    GtkWidget        *select_button;
+    GtkWidget        *num_acct_label;
+    GList            *account_list;
+    int               num_accounts;
+    GNCAccountType    account_type;
+}CsvExportAcc;
+
+
+typedef struct
+{
+    CsvExportType export_type;
+    CsvExportDate csvd;
+    CsvExportAcc  csva;
+
+    GtkWidget    *window;
+    GtkWidget    *assistant;
+    GtkWidget    *start_label;
+    GtkWidget    *custom_entry;
+
+    GtkWidget    *file_chooser;
+    GtkWidget    *finish_label;
+    GtkWidget    *summary_label;
+
+    gchar        *starting_dir;
+    gchar        *file_name;
+
+    char         *separator_str;
+    gboolean      use_quotes;
+    gboolean      use_custom;
+    gboolean      failed;
+} CsvExportInfo;
+
+
+/** The gnc_file_csv_export() will let the user export thte 
+ *  account tree or transactions to a deliminated file.
+ */
+void gnc_file_csv_export (CsvExportType export_type);
+
+#endif


Property changes on: gnucash/trunk/src/import-export/csv-export/assistant-csv-export.h
___________________________________________________________________
Added: svn:eol-style
   + LF

Added: gnucash/trunk/src/import-export/csv-export/csv-transactions-export.c
===================================================================
--- gnucash/trunk/src/import-export/csv-export/csv-transactions-export.c	                        (rev 0)
+++ gnucash/trunk/src/import-export/csv-export/csv-transactions-export.c	2012-03-16 20:26:04 UTC (rev 22085)
@@ -0,0 +1,379 @@
+/*******************************************************************\
+ * csv-transactions-export.c -- Export Transactions to a file       *
+ *                                                                  *
+ * Copyright (C) 2012 Robert Fewell                                 *
+ *                                                                  *
+ * 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, contact:                        *
+ *                                                                  *
+ * Free Software Foundation           Voice:  +1-617-542-5942       *
+ * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
+ * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
+\********************************************************************/
+/** @file csv-transactions-export.c
+    @brief CSV Export Transactions
+    @author Copyright (c) 2012 Robert Fewell
+*/
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+#include <glib/gstdio.h>
+
+#include "gnc-commodity.h"
+#include "gnc-ui-util.h"
+#include "Query.h"
+#include "Transaction.h"
+
+#include "csv-transactions-export.h"
+
+/* This static indicates the debugging module that this .o belongs to.  */
+static QofLogModule log_module = GNC_MOD_ASSISTANT;
+
+/*******************************************************************/
+
+/*******************************************************
+ * write_line_to_file
+ *
+ * write a text string to a file pointer, return TRUE if
+ * successfull.
+ *******************************************************/
+static
+gboolean write_line_to_file (FILE *fh, char * line)
+{
+    int len, written;
+    DEBUG("Account String: %s", line);
+
+    /* Write account line */
+    len = strlen( line );
+    written = fwrite( line, 1, len, fh );
+
+    if ( written != len )
+        return FALSE;
+    else
+        return TRUE;
+}
+
+
+/*******************************************************
+ * account_splits
+ *
+ * gather the splits / transactions for an account and
+ * send them to a file
+ *******************************************************/
+static
+void account_splits (CsvExportInfo *info, Account *acc, FILE *fh )
+{
+    Query   *q;
+    GSList  *p1, *p2;
+    GList   *splits, *ptr;
+    QofBook *book;
+
+    gchar   *end_sep;
+    gchar   *mid_sep;
+
+    q = qof_query_create_for(GNC_ID_SPLIT);
+    book = gnc_get_current_book();
+    qof_query_set_book (q, book);
+
+    /* Set up separators */
+    if(info->use_quotes)
+    {
+        end_sep = "\"";
+        mid_sep = g_strconcat ( "\"", info->separator_str, "\"", NULL);
+    }
+    else
+    {
+        end_sep = "";
+        mid_sep = g_strconcat ( info->separator_str, NULL);
+    }
+
+    /* Sort by transaction date */
+    p1 = g_slist_prepend (NULL, TRANS_DATE_POSTED);
+    p1 = g_slist_prepend (p1, SPLIT_TRANS);
+    p2 = g_slist_prepend (NULL, QUERY_DEFAULT_SORT);
+    qof_query_set_sort_order (q, p1, p2, NULL);
+
+    xaccQueryAddSingleAccountMatch (q, acc, QOF_QUERY_AND);
+    xaccQueryAddDateMatchTT (q, TRUE, info->csvd.start_time, TRUE, info->csvd.end_time, QOF_QUERY_AND);
+
+    /* Run the query */
+    for (splits = qof_query_run(q); splits; splits = splits->next)
+    {
+        Split       *split;
+        Transaction *trans;
+        SplitList   *s_list;
+        GList       *node;
+        Split       *t_split;
+        int          nSplits;
+        int          cnt;
+        gchar       *part1;
+        gchar       *part2;
+        gchar       *date;
+        const gchar *currentSel;
+        const gchar *split_amount;
+
+        split = splits->data;
+        trans = xaccSplitGetParent(split);
+        nSplits = xaccTransCountSplits(trans);
+        s_list = xaccTransGetSplitList(trans);
+
+        /* Date */
+        date = qof_print_date ( xaccTransGetDate(trans));
+        part1 = g_strconcat ( end_sep, date, mid_sep, NULL);
+        g_free(date);
+        /* Name */
+        currentSel = xaccAccountGetName(acc);
+        part2 = g_strconcat ( part1, currentSel, mid_sep, NULL);
+        g_free(part1);
+        /* Number */
+        currentSel = xaccTransGetNum(trans);
+        part1 = g_strconcat ( part2, currentSel, mid_sep, NULL);
+        g_free(part2);
+        /* Description */
+        currentSel = xaccTransGetDescription(trans);
+        part2 = g_strconcat ( part1, currentSel, mid_sep, NULL);
+        g_free(part1);
+        /* Notes */
+        currentSel = xaccTransGetNotes(trans);
+        if(currentSel == NULL)
+            part1 = g_strconcat ( part2, mid_sep, NULL);
+        else
+            part1 = g_strconcat ( part2, currentSel, mid_sep, NULL);
+        g_free(part2);
+        /* Memo */
+        currentSel = xaccSplitGetMemo(split);
+        part2 = g_strconcat ( part1, currentSel, mid_sep, NULL);
+        g_free(part1);
+        /* Category */
+        currentSel = xaccSplitGetCorrAccountName(split);
+        part1 = g_strconcat ( part2, currentSel, mid_sep, "T", mid_sep, NULL);
+        g_free(part2);
+        /* Action */
+        currentSel =  xaccSplitGetAction(split);
+        part2 = g_strconcat ( part1, currentSel, mid_sep, NULL);
+        g_free(part1);
+        /* Reconcile */
+        switch (xaccSplitGetReconcile (split))
+        {
+        case NREC:
+            currentSel = "N";
+            break;
+        case CREC:
+            currentSel = "C";
+            break;
+        case YREC:
+            currentSel = "Y";
+            break;
+        case FREC:
+            currentSel = "F";
+            break;
+        case VREC:
+            currentSel = "V";
+            break;
+        default:
+            currentSel = "N";
+        }
+        part1 = g_strconcat ( part2, currentSel, mid_sep, NULL);
+        g_free(part2);
+        /* To with Symbol */
+        split_amount = xaccPrintAmount(xaccSplitGetAmount(split), gnc_split_amount_print_info(split, TRUE));
+        part2 = g_strconcat ( part1, split_amount, mid_sep, NULL);
+        g_free(part1);
+
+        /* From with Symbol */
+        part1 = g_strconcat ( part2, "", mid_sep, NULL);
+        g_free(part2);
+
+        /* To Number Only */
+        split_amount = xaccPrintAmount(xaccSplitGetAmount(split), gnc_split_amount_print_info(split, FALSE));
+        part2 = g_strconcat ( part1, split_amount, mid_sep, NULL);
+        g_free(part1);
+
+        /* From Number Only */
+        part1 = g_strconcat ( part2, "", mid_sep, "", mid_sep, "", end_sep, "\n", NULL);
+        g_free(part2);
+
+        /* Write to file */
+        if (!write_line_to_file(fh, part1))
+        {
+	    info->failed = TRUE;
+            break;
+        }
+        g_free(part1);
+
+        /* Loop through the list of splits for the Transcation */
+        node = s_list;
+        cnt = 0;
+        while ( (cnt < nSplits) && (info->failed == FALSE))
+        {
+            t_split = node->data;
+
+            /* Start of line */
+            part1 = g_strconcat ( end_sep, mid_sep, mid_sep, mid_sep, mid_sep, mid_sep, NULL);
+
+            /* Memo */
+            currentSel = xaccSplitGetMemo(t_split);
+            part2 = g_strconcat ( part1, currentSel, mid_sep, NULL);
+            g_free(part1);
+
+            /* Account */
+            currentSel = xaccAccountGetName( xaccSplitGetAccount(t_split));
+            part1 = g_strconcat ( part2, currentSel, mid_sep, "S", mid_sep, NULL);
+            g_free(part2);
+
+            /* Action */
+            currentSel = xaccSplitGetAction(t_split);
+            part2 = g_strconcat ( part1, currentSel, mid_sep, NULL);
+            g_free(part1);
+
+            /* Reconcile */
+            switch (xaccSplitGetReconcile (split))
+            {
+            case NREC:
+                currentSel = "N";
+                break;
+            case CREC:
+                currentSel = "C";
+                break;
+            case YREC:
+                currentSel = "Y";
+                break;
+            case FREC:
+                currentSel = "F";
+                break;
+            case VREC:
+                currentSel = "V";
+                break;
+            default:
+                currentSel = "N";
+            }
+            part1 = g_strconcat ( part2, currentSel, mid_sep, NULL);
+            g_free(part2);
+
+            /* From / To with Symbol */
+            split_amount = xaccPrintAmount(xaccSplitGetAmount(t_split), gnc_split_amount_print_info(t_split, TRUE));
+            if(xaccSplitGetAccount(t_split) == acc)
+                part2 = g_strconcat ( part1,  split_amount, mid_sep, mid_sep, NULL);
+            else
+                part2 = g_strconcat ( part1, mid_sep, split_amount, mid_sep, NULL);
+            g_free(part1);
+
+            /* From / To Numbers only */
+            split_amount = xaccPrintAmount(xaccSplitGetAmount(t_split), gnc_split_amount_print_info(t_split, FALSE));
+            if(xaccSplitGetAccount(t_split) == acc)
+                part1 = g_strconcat ( part2,  split_amount, mid_sep, mid_sep, NULL);
+            else
+                part1 = g_strconcat ( part2, mid_sep, split_amount, mid_sep, NULL);
+            g_free(part2);
+
+            /* From / To - Share Price / Conversion factor */
+            split_amount = xaccPrintAmount(xaccSplitGetSharePrice(t_split), gnc_split_amount_print_info(t_split, FALSE));
+            if(xaccSplitGetAccount(t_split) == acc)
+                part2 = g_strconcat ( part1,  split_amount, mid_sep, end_sep, "\n", NULL);
+            else
+                part2 = g_strconcat ( part1, mid_sep, split_amount, end_sep, "\n", NULL);
+            g_free(part1);
+
+            if (!write_line_to_file(fh, part2))
+	        info->failed = TRUE;
+
+            g_free(part2);
+            cnt++;
+            node = node->next;
+        }
+    }
+    g_free(mid_sep);
+    qof_query_destroy (q);
+    g_list_free( splits );
+}
+
+
+/*******************************************************
+ * csv_transactions_export
+ *
+ * write a list of transactions to a text file
+ *******************************************************/
+void csv_transactions_export (CsvExportInfo *info)
+{
+    FILE    *fh;
+    Account *root;
+    Account *acc;
+    GList   *ptr;
+
+    ENTER("");
+    DEBUG("File name is : %s", info->file_name);
+
+    info->failed = FALSE;
+
+    /* Open File for writing */
+    fh = g_fopen( info->file_name, "w" );
+    if ( fh != NULL )
+    {
+        gchar *header;
+        gchar *end_sep;
+        gchar *mid_sep;
+        int i;
+
+        /* Set up separators */
+        if(info->use_quotes)
+        {
+            end_sep = "\"";
+            mid_sep = g_strconcat ( "\"", info->separator_str, "\"", NULL);
+        }
+        else
+        {
+            end_sep = "";
+            mid_sep = g_strconcat ( info->separator_str, NULL);
+        }
+
+        /* Header string */
+        header = g_strconcat ( end_sep, _("Date"), mid_sep, _("Account Name"), mid_sep,
+                            _("Number"), mid_sep, _("Description"), mid_sep,
+                            _("Notes"), mid_sep, _("Memo"), mid_sep, _("Category"), mid_sep,
+                            _("Type"), mid_sep, _("Action"), mid_sep, _("Reconcile"), mid_sep,
+                            _("To With Sym"), mid_sep, _("From With Sym"), mid_sep,
+                            _("To Num."), mid_sep, _("From Num."), mid_sep,
+                            _("To Factor/Price"), mid_sep, _("From Factor/Price"), end_sep, "\n", NULL);
+        DEBUG("Header String: %s", header);
+
+        /* Write header line */
+        if (!write_line_to_file(fh, header))
+        {
+	    info->failed = TRUE;
+            g_free(mid_sep);
+            g_free(header);
+            return;
+        }
+        g_free(mid_sep);
+        g_free(header);
+
+        /* Go through list of accounts */
+        for (ptr = info->csva.account_list, i = 0; ptr; ptr = g_list_next(ptr), i++)
+        {
+            acc = ptr->data;
+            DEBUG("Account being processed is : %s", xaccAccountGetName(acc));
+            account_splits (info, acc, fh);
+        }
+    }
+    else
+        info->failed = TRUE;
+    if(fh)
+        fclose (fh);
+    LEAVE("");
+}
+
+
+
+
+


Property changes on: gnucash/trunk/src/import-export/csv-export/csv-transactions-export.c
___________________________________________________________________
Added: svn:eol-style
   + LF

Added: gnucash/trunk/src/import-export/csv-export/csv-transactions-export.h
===================================================================
--- gnucash/trunk/src/import-export/csv-export/csv-transactions-export.h	                        (rev 0)
+++ gnucash/trunk/src/import-export/csv-export/csv-transactions-export.h	2012-03-16 20:26:04 UTC (rev 22085)
@@ -0,0 +1,39 @@
+/*******************************************************************\
+ * csv-transactions-export.h -- Export Transactions to a file       *
+ *                                                                  *
+ * Copyright (C) 2012 Robert Fewell                                 *
+ *                                                                  *
+ * 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, contact:                        *
+ *                                                                  *
+ * Free Software Foundation           Voice:  +1-617-542-5942       *
+ * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
+ * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
+\********************************************************************/
+/** @file csv-transactions-export.h
+    @brief CSV Export Transactions
+    @author Copyright (c) 2012 Robert Fewell
+*/
+
+#ifndef CSV_TRANSACTIONS_EXPORT
+#define CSV_TRANSACTIONS_EXPORT
+
+#include "assistant-csv-export.h"
+
+/** The csv_transactions_export() will let the user export the  
+ *  transactions to a deliminated file.
+ */
+void csv_transactions_export (CsvExportInfo *info);
+
+#endif
+


Property changes on: gnucash/trunk/src/import-export/csv-export/csv-transactions-export.h
___________________________________________________________________
Added: svn:eol-style
   + LF

Added: gnucash/trunk/src/import-export/csv-export/csv-tree-export.c
===================================================================
--- gnucash/trunk/src/import-export/csv-export/csv-tree-export.c	                        (rev 0)
+++ gnucash/trunk/src/import-export/csv-export/csv-tree-export.c	2012-03-16 20:26:04 UTC (rev 22085)
@@ -0,0 +1,217 @@
+/*******************************************************************\
+ * csv-tree-export.c -- Export Account Tree to a file               *
+ *                                                                  *
+ * Copyright (C) 2012 Robert Fewell                                 *
+ *                                                                  *
+ * 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, contact:                        *
+ *                                                                  *
+ * Free Software Foundation           Voice:  +1-617-542-5942       *
+ * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
+ * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
+\********************************************************************/
+/** @file csv-tree-export.c
+    @brief CSV Export Account Tree
+    @author Copyright (c) 2012 Robert Fewell
+*/
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+#include <glib/gstdio.h>
+
+#include "gnc-commodity.h"
+#include "gnc-ui-util.h"
+
+#include "csv-tree-export.h"
+
+/* This static indicates the debugging module that this .o belongs to.  */
+static QofLogModule log_module = GNC_MOD_ASSISTANT;
+
+/******************************************************************/
+
+/*******************************************************
+ * write_line_to_file
+ *
+ * write a text string to a file pointer, return TRUE if
+ * successfull.
+ *******************************************************/
+static
+gboolean write_line_to_file ( FILE *fh, char * line)
+{
+    int len, written;
+    DEBUG("Account String: %s", line);
+
+    /* Write account line */
+    len = strlen( line );
+    written = fwrite( line, 1, len, fh );
+
+    if ( written != len )
+        return FALSE;
+    else
+        return TRUE;
+}
+
+
+/*******************************************************
+ * csv_tree_export
+ *
+ * write a list of accounts settings to a text file
+ *******************************************************/
+void csv_tree_export (CsvExportInfo *info)
+{
+    FILE    *fh;
+    Account *root;
+    Account *acc;
+    GList   *accts, *ptr;
+
+    ENTER("");
+    DEBUG("File name is : %s", info->file_name);
+
+    /* Get list of Accounts */
+    root = gnc_book_get_root_account( gnc_get_current_book() );
+    accts = gnc_account_get_descendants_sorted( root );
+    info->failed = FALSE;
+
+    /* Open File for writing */
+    fh = g_fopen( info->file_name, "w" );
+    if ( fh != NULL )
+    {
+        gchar *header;
+        gchar *part1;
+        gchar *part2;
+        const gchar *currentSel;
+        gchar *end_sep;
+        gchar *mid_sep;
+        int i;
+
+
+        /* Set up separators */
+        if(info->use_quotes)
+        {
+            end_sep = "\"";
+            mid_sep = g_strconcat ( "\"", info->separator_str, "\"", NULL);
+        }
+        else
+        {
+            end_sep = "";
+            mid_sep = g_strconcat ( info->separator_str, NULL);
+        }
+
+        /* Header string */
+        header = g_strconcat ( end_sep, _("type"), mid_sep, _("fullname"), mid_sep,
+                            _("name"), mid_sep, _("code"), mid_sep,
+                            _("description"), mid_sep, _("color"), mid_sep, _("notes"), mid_sep,
+                            _("commoditym"), mid_sep, _("commodityn"), mid_sep,
+                            _("hidden"), mid_sep, _("tax"), mid_sep, _("placeholder"), end_sep, "\n", NULL);
+        DEBUG("Header String: %s", header);
+
+        /* Write header line */
+        if (!write_line_to_file(fh, header))
+        {
+	    info->failed = TRUE;
+            g_free(mid_sep);
+            g_free(header);
+            return;
+        }
+        g_free(header);
+
+        /* Go through list of accounts */
+        for (ptr = accts, i = 0; ptr; ptr = g_list_next(ptr), i++)
+        {
+            gchar *fullname = NULL;
+            gchar *notes_out = NULL;
+            acc = ptr->data;
+            DEBUG("Account being processed is : %s", xaccAccountGetName(acc));
+            /* Type */
+            currentSel = xaccAccountTypeEnumAsString( xaccAccountGetType (acc));
+            part1 = g_strconcat ( end_sep, currentSel, mid_sep, NULL);
+            /* Full Name */
+            fullname = gnc_account_get_full_name(acc);
+            part2 = g_strconcat ( part1, fullname, mid_sep, NULL);
+            g_free(fullname);
+            g_free(part1);
+            /* Name */
+            currentSel = xaccAccountGetName(acc);
+            part1 = g_strconcat ( part2, currentSel, mid_sep, NULL);
+            g_free(part2);
+            /* Code */
+            currentSel = xaccAccountGetCode(acc) ? xaccAccountGetCode(acc) : "" ;
+            part2 = g_strconcat ( part1, currentSel, mid_sep, NULL);
+            g_free(part1);
+            /* Description */
+            currentSel = xaccAccountGetDescription(acc) ? xaccAccountGetDescription(acc) : "" ;
+            part1 = g_strconcat ( part2, currentSel, mid_sep, NULL);
+            g_free(part2);
+            /* Color */
+            currentSel = xaccAccountGetColor(acc) ? xaccAccountGetColor(acc) : "" ;
+            part2 = g_strconcat ( part1, currentSel, mid_sep, NULL);
+            g_free(part1);
+            /* Notes */
+            currentSel = xaccAccountGetNotes(acc) ? xaccAccountGetNotes(acc) : "" ;
+            if(!g_strcmp0(currentSel, "") == 0)
+            {
+                /* Check for multiple lines */
+                gchar **parts;
+                parts = g_strsplit(currentSel, "\n", -1);
+                notes_out = g_strjoinv("\\n", parts);
+                currentSel = notes_out;
+                g_strfreev(parts);
+            }
+            part1 = g_strconcat ( part2, currentSel, mid_sep, NULL);
+            g_free(part2);
+            g_free(notes_out);
+            /* Commodity Mnemonic */
+            currentSel = gnc_commodity_get_mnemonic(xaccAccountGetCommodity (acc));
+            part2 = g_strconcat ( part1, currentSel, mid_sep, NULL);
+            g_free(part1);
+            /* Commodity Namespace */
+            currentSel = gnc_commodity_get_namespace(xaccAccountGetCommodity (acc));
+            part1 = g_strconcat ( part2, currentSel, mid_sep, NULL);
+            g_free(part2);
+            /* Hidden */
+            currentSel = xaccAccountGetHidden(acc) ? "T" : "F" ;
+            part2 = g_strconcat ( part1, currentSel, mid_sep, NULL);
+            g_free(part1);
+            /* Tax */
+            currentSel = xaccAccountGetTaxRelated(acc) ? "T" : "F" ;
+            part1 = g_strconcat ( part2, currentSel, mid_sep, NULL);
+            g_free(part2);
+            /* Place Holder */
+            currentSel = xaccAccountGetPlaceholder(acc) ? "T" : "F" ;
+            part2 = g_strconcat ( part1, currentSel, end_sep, "\n", NULL);
+            g_free(part1);
+
+            DEBUG("Account String: %s", part2);
+
+            /* Write to file */
+            if (!write_line_to_file(fh, part2))
+            {
+	        info->failed = TRUE;
+                break;
+            }
+            g_free(part2);
+        }
+        g_free(mid_sep);
+    }
+    else
+        info->failed = TRUE;
+    if(fh)
+        fclose (fh);
+
+    g_list_free( accts );
+    LEAVE("");
+}
+
+
+


Property changes on: gnucash/trunk/src/import-export/csv-export/csv-tree-export.c
___________________________________________________________________
Added: svn:eol-style
   + LF

Added: gnucash/trunk/src/import-export/csv-export/csv-tree-export.h
===================================================================
--- gnucash/trunk/src/import-export/csv-export/csv-tree-export.h	                        (rev 0)
+++ gnucash/trunk/src/import-export/csv-export/csv-tree-export.h	2012-03-16 20:26:04 UTC (rev 22085)
@@ -0,0 +1,38 @@
+/*******************************************************************\
+ * csv-tree-export.h -- Export Account Tree to a file               *
+ *                                                                  *
+ * Copyright (C) 2012 Robert Fewell                                 *
+ *                                                                  *
+ * 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, contact:                        *
+ *                                                                  *
+ * Free Software Foundation           Voice:  +1-617-542-5942       *
+ * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
+ * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
+\********************************************************************/
+/** @file csv-tree-export.h
+    @brief CSV Export Account Tree
+    @author Copyright (c) 2012 Robert Fewell
+*/
+#ifndef CSV_TREE_EXPORT
+#define CSV_TREE_EXPORT
+
+#include "assistant-csv-export.h"
+
+/** The csv_tree_export() will let the user export the  
+ *  account tree to a deliminated file.
+ */
+void csv_tree_export (CsvExportInfo *info);
+
+#endif
+


Property changes on: gnucash/trunk/src/import-export/csv-export/csv-tree-export.h
___________________________________________________________________
Added: svn:eol-style
   + LF

Added: gnucash/trunk/src/import-export/csv-export/gnc-plugin-csv-export-ui.xml
===================================================================
--- gnucash/trunk/src/import-export/csv-export/gnc-plugin-csv-export-ui.xml	                        (rev 0)
+++ gnucash/trunk/src/import-export/csv-export/gnc-plugin-csv-export-ui.xml	2012-03-16 20:26:04 UTC (rev 22085)
@@ -0,0 +1,12 @@
+<ui>
+  <menubar>
+    <menu name="File" action="FileAction">
+      <menu name="FileExport" action="FileExportAction">
+      	<placeholder name="FileExportPlaceholder">
+      	   <menuitem name="FileCsvExportTree" action="CsvExportTreeAction"/>
+      	   <menuitem name="FileCsvExportTrans" action="CsvExportTransAction"/>
+      	</placeholder>
+      </menu>
+    </menu>
+  </menubar>
+</ui>

Added: gnucash/trunk/src/import-export/csv-export/gnc-plugin-csv-export.c
===================================================================
--- gnucash/trunk/src/import-export/csv-export/gnc-plugin-csv-export.c	                        (rev 0)
+++ gnucash/trunk/src/import-export/csv-export/gnc-plugin-csv-export.c	2012-03-16 20:26:04 UTC (rev 22085)
@@ -0,0 +1,174 @@
+/*
+ * gnc-plugin-csv-export.c -- csv export plugin
+ * Copyright (C) 2012 Robert Fewell
+ *
+ * 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, contact:
+ *
+ * Free Software Foundation           Voice:  +1-617-542-5942
+ * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652
+ * Boston, MA  02110-1301,  USA       gnu at gnu.org
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+
+#include "gnc-plugin-csv-export.h"
+#include "gnc-plugin-manager.h"
+
+#include "assistant-csv-export.h"
+
+static void gnc_plugin_csv_export_class_init (GncPluginCsvExportClass *klass);
+static void gnc_plugin_csv_export_init (GncPluginCsvExport *plugin);
+static void gnc_plugin_csv_export_finalize (GObject *object);
+
+/* Command callbacks */
+static void gnc_plugin_csv_export_tree_cmd (GtkAction *action, GncMainWindowActionData *data);
+static void gnc_plugin_csv_export_trans_cmd (GtkAction *action, GncMainWindowActionData *data);
+
+#define PLUGIN_ACTIONS_NAME "gnc-plugin-csv-export-actions"
+#define PLUGIN_UI_FILENAME  "gnc-plugin-csv-export-ui.xml"
+
+static GtkActionEntry gnc_plugin_actions [] =
+{
+    {
+        "CsvExportTreeAction", GTK_STOCK_CONVERT, N_("Export Account T_ree to CSV..."), NULL,
+        N_("Export the Account Tree to a CSV file"),
+        G_CALLBACK (gnc_plugin_csv_export_tree_cmd)
+    },
+    {
+        "CsvExportTransAction", GTK_STOCK_CONVERT, N_("Export _Transactions to CSV..."), NULL,
+        N_("Export the Transactions to a CSV file"),
+        G_CALLBACK (gnc_plugin_csv_export_trans_cmd)
+    },
+};
+static guint gnc_plugin_n_actions = G_N_ELEMENTS (gnc_plugin_actions);
+
+typedef struct GncPluginCsvExportPrivate
+{
+    gpointer dummy;
+} GncPluginCsvExportPrivate;
+
+#define GNC_PLUGIN_CSV_EXPORT_GET_PRIVATE(o)  \
+   (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_CSV_EXPORT, GncPluginCsvExportPrivate))
+
+static GObjectClass *parent_class = NULL;
+
+GType
+gnc_plugin_csv_export_get_type (void)
+{
+    static GType gnc_plugin_csv_export_type = 0;
+
+    if (gnc_plugin_csv_export_type == 0)
+    {
+        static const GTypeInfo our_info =
+        {
+            sizeof (GncPluginCsvExportClass),
+            NULL,		/* base_init */
+            NULL,		/* base_finalize */
+            (GClassInitFunc) gnc_plugin_csv_export_class_init,
+            NULL,		/* class_finalize */
+            NULL,		/* class_data */
+            sizeof (GncPluginCsvExport),
+            0,		/* n_preallocs */
+            (GInstanceInitFunc) gnc_plugin_csv_export_init,
+        };
+
+        gnc_plugin_csv_export_type = g_type_register_static (GNC_TYPE_PLUGIN,
+                              "GncPluginCsvExport",
+                              &our_info, 0);
+    }
+
+    return gnc_plugin_csv_export_type;
+}
+
+GncPlugin *
+gnc_plugin_csv_export_new (void)
+{
+    return GNC_PLUGIN (g_object_new (GNC_TYPE_PLUGIN_CSV_EXPORT, NULL));
+}
+
+static void
+gnc_plugin_csv_export_class_init (GncPluginCsvExportClass *klass)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS (klass);
+    GncPluginClass *plugin_class = GNC_PLUGIN_CLASS (klass);
+
+    parent_class = g_type_class_peek_parent (klass);
+
+    object_class->finalize = gnc_plugin_csv_export_finalize;
+
+    /* plugin info */
+    plugin_class->plugin_name  = GNC_PLUGIN_CSV_EXPORT_NAME;
+
+    /* widget addition/removal */
+    plugin_class->actions_name = PLUGIN_ACTIONS_NAME;
+    plugin_class->actions      = gnc_plugin_actions;
+    plugin_class->n_actions    = gnc_plugin_n_actions;
+    plugin_class->ui_filename  = PLUGIN_UI_FILENAME;
+
+    g_type_class_add_private(klass, sizeof(GncPluginCsvExportPrivate));
+}
+
+static void
+gnc_plugin_csv_export_init (GncPluginCsvExport *plugin)
+{
+}
+
+static void
+gnc_plugin_csv_export_finalize (GObject *object)
+{
+    GncPluginCsvExport *plugin;
+    GncPluginCsvExportPrivate *priv;
+
+    g_return_if_fail (GNC_IS_PLUGIN_CSV_EXPORT (object));
+
+    plugin = GNC_PLUGIN_CSV_EXPORT (object);
+    priv = GNC_PLUGIN_CSV_EXPORT_GET_PRIVATE(plugin);
+
+    G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+/************************************************************
+ *              Plugin Function Implementation              *
+ ************************************************************/
+
+/************************************************************
+ *                    Command Callbacks                     *
+ ************************************************************/
+static void
+gnc_plugin_csv_export_tree_cmd (GtkAction *action,
+                           GncMainWindowActionData *data)
+{
+   gnc_file_csv_export(XML_EXPORT_TREE);
+}
+
+static void
+gnc_plugin_csv_export_trans_cmd (GtkAction *action,
+                           GncMainWindowActionData *data)
+{
+   gnc_file_csv_export(XML_EXPORT_TRANS);
+}
+
+/************************************************************
+ *                    Plugin Bootstrapping                   *
+ ************************************************************/
+void
+gnc_plugin_csv_export_create_plugin (void)
+{
+    GncPlugin *plugin = gnc_plugin_csv_export_new ();
+
+    gnc_plugin_manager_add_plugin (gnc_plugin_manager_get (), plugin);
+}


Property changes on: gnucash/trunk/src/import-export/csv-export/gnc-plugin-csv-export.c
___________________________________________________________________
Added: svn:eol-style
   + LF

Added: gnucash/trunk/src/import-export/csv-export/gnc-plugin-csv-export.h
===================================================================
--- gnucash/trunk/src/import-export/csv-export/gnc-plugin-csv-export.h	                        (rev 0)
+++ gnucash/trunk/src/import-export/csv-export/gnc-plugin-csv-export.h	2012-03-16 20:26:04 UTC (rev 22085)
@@ -0,0 +1,62 @@
+/*
+ * gnc-plugin-csv-export.h -- csv export plugin
+ * Copyright (C) 2012 Robert Fewell
+ *
+ * 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, contact:
+ *
+ * Free Software Foundation           Voice:  +1-617-542-5942
+ * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652
+ * Boston, MA  02110-1301,  USA       gnu at gnu.org
+ */
+
+#ifndef __GNC_PLUGIN_CSV_EXPORT_H
+#define __GNC_PLUGIN_CSV_EXPORT_H
+
+#include <gtk/gtk.h>
+
+#include "gnc-plugin.h"
+
+G_BEGIN_DECLS
+
+/* type macros */
+#define GNC_TYPE_PLUGIN_CSV_EXPORT            (gnc_plugin_csv_export_get_type ())
+#define GNC_PLUGIN_CSV_EXPORT(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_PLUGIN_CSV_EXPORT, GncPluginCsvExport))
+#define GNC_PLUGIN_CSV_EXPORT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_PLUGIN_CSV_EXPORT, GncPluginCsvExportClass))
+#define GNC_IS_PLUGIN_CSV_EXPORT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_PLUGIN_CSV_EXPORT))
+#define GNC_IS_PLUGIN_CSV_EXPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_PLUGIN_CSV_EXPORT))
+#define GNC_PLUGIN_CSV_EXPORT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_PLUGIN_CSV_EXPORT, GncPluginCsvExportClass))
+
+#define GNC_PLUGIN_CSV_EXPORT_NAME "gnc-plugin-csv-export"
+
+/* typedefs & structures */
+typedef struct
+{
+    GncPlugin gnc_plugin;
+} GncPluginCsvExport;
+
+typedef struct
+{
+    GncPluginClass gnc_plugin;
+} GncPluginCsvExportClass;
+
+/* function prototypes */
+GType      gnc_plugin_csv_export_get_type (void);
+
+GncPlugin *gnc_plugin_csv_export_new      (void);
+
+void       gnc_plugin_csv_export_create_plugin (void);
+
+G_END_DECLS
+
+#endif /* __GNC_PLUGIN_CSV_EXPORT_H */


Property changes on: gnucash/trunk/src/import-export/csv-export/gnc-plugin-csv-export.h
___________________________________________________________________
Added: svn:eol-style
   + LF

Added: gnucash/trunk/src/import-export/csv-export/gncmod-csv-export.c
===================================================================
--- gnucash/trunk/src/import-export/csv-export/gncmod-csv-export.c	                        (rev 0)
+++ gnucash/trunk/src/import-export/csv-export/gncmod-csv-export.c	2012-03-16 20:26:04 UTC (rev 22085)
@@ -0,0 +1,90 @@
+/********************************************************************\
+ * 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, contact:                        *
+ *                                                                  *
+ * Free Software Foundation           Voice:  +1-617-542-5942       *
+ * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
+ * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
+\********************************************************************/
+/** @addtogroup Import_Export
+    @{ */
+/**@internal
+ at file gncmod-csv-export.c
+ at brief module definition/initialization for the csv exporter
+ at author Copyright (c) 2012 Robert Fewell
+*/
+#include "config.h"
+
+#include <gmodule.h>
+
+#include "gnc-module.h"
+#include "gnc-module-api.h"
+#include "gnc-plugin-csv-export.h"
+
+GNC_MODULE_API_DECL(libgncmod_csv_export)
+
+/* version of the gnc module system interface we require */
+int libgncmod_csv_export_gnc_module_system_interface = 0;
+
+/* module versioning uses libtool semantics. */
+int libgncmod_csv_export_gnc_module_current  = 0;
+int libgncmod_csv_export_gnc_module_revision = 0;
+int libgncmod_csv_export_gnc_module_age      = 0;
+
+//static GNCModule bus_core;
+//static GNCModule file;
+
+char *
+libgncmod_csv_export_gnc_module_path(void)
+{
+    return g_strdup("gnucash/import-export/csv-export");
+}
+
+char *
+libgncmod_csv_export_gnc_module_description(void)
+{
+    return g_strdup("Gnome GUI and C code for CSV exporter.");
+}
+
+int
+libgncmod_csv_export_gnc_module_init(int refcount)
+{
+    if (!gnc_module_load("gnucash/engine", 0))
+    {
+        return FALSE;
+    }
+    if (!gnc_module_load("gnucash/app-utils", 0))
+    {
+        return FALSE;
+    }
+    if (!gnc_module_load("gnucash/gnome-utils", 0))
+    {
+        return FALSE;
+    }
+    if (!gnc_module_load("gnucash/import-export", 0))
+    {
+        return FALSE;
+    }
+
+    /* Add menu items with C callbacks */
+    gnc_plugin_csv_export_create_plugin();
+
+    return TRUE;
+}
+
+int
+libgncmod_csv_export_gnc_module_end(int refcount)
+{
+    return TRUE;
+}
+/** @}*/


Property changes on: gnucash/trunk/src/import-export/csv-export/gncmod-csv-export.c
___________________________________________________________________
Added: svn:eol-style
   + LF

Added: gnucash/trunk/src/import-export/csv-export/schemas/Makefile.am
===================================================================
--- gnucash/trunk/src/import-export/csv-export/schemas/Makefile.am	                        (rev 0)
+++ gnucash/trunk/src/import-export/csv-export/schemas/Makefile.am	2012-03-16 20:26:04 UTC (rev 22085)
@@ -0,0 +1,21 @@
+schemadir   = @GCONF_SCHEMA_FILE_DIR@
+schemas_in_files = \
+  apps_gnucash_dialog_export_csv.schemas.in
+schema_DATA = $(schemas_in_files:.schemas.in=.schemas)
+
+ at INTLTOOL_SCHEMAS_RULE@
+
+EXTRA_DIST = $(schemas_in_files)
+
+CLEANFILES = $(schema_DATA)
+
+install-data-local:
+if GCONF_SCHEMAS_INSTALL
+	-mkdir -p $(DESTDIR)$(GCONF_SCHEMA_CONFIG_SOURCE_DIRONLY)
+	GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(schema_DATA)
+endif
+
+uninstall-local:
+if GCONF_SCHEMAS_INSTALL
+	GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-uninstall-rule $(schema_DATA)
+endif

Added: gnucash/trunk/src/import-export/csv-export/schemas/apps_gnucash_dialog_export_csv.schemas.in
===================================================================
--- gnucash/trunk/src/import-export/csv-export/schemas/apps_gnucash_dialog_export_csv.schemas.in	                        (rev 0)
+++ gnucash/trunk/src/import-export/csv-export/schemas/apps_gnucash_dialog_export_csv.schemas.in	2012-03-16 20:26:04 UTC (rev 22085)
@@ -0,0 +1,63 @@
+<?xml version="1.0"?>
+<gconfschemafile>
+  <schemalist>
+
+    <schema>
+      <key>/schemas/apps/gnucash/dialogs/export/csv/position</key>
+      <applyto>/apps/gnucash/dialogs/export/csv/window_position</applyto>
+      <owner>gnucash</owner>
+      <type>list</type>
+      <list_type>int</list_type>
+      <locale name="C">
+        <short>Window position</short>
+        <long>
+          The X,Y coordinates of the top left corner of the window
+          when it was last closed.
+        </long>
+      </locale>
+    </schema>
+
+    <schema>
+      <key>/schemas/apps/gnucash/dialogs/export/csv/geometry</key>
+      <applyto>/apps/gnucash/dialogs/export/csv/window_geometry</applyto>
+      <owner>gnucash</owner>
+      <type>list</type>
+      <list_type>int</list_type>
+      <locale name="C">
+        <short>Window geometry</short>
+        <long>
+          The width and size of the window when it was last closed.
+        </long>
+      </locale>
+    </schema>
+
+    <schema>
+      <key>/schemas/apps/gnucash/dialogs/export/csv/paned_position</key>
+      <applyto>/apps/gnucash/dialogs/export/csv/paned_position</applyto>
+      <owner>gnucash</owner>
+      <type>int</type>
+      <locale name="C">
+        <short>Window geometry</short>
+        <long>
+          The position of paned window when it was last closed.
+        </long>
+      </locale>
+    </schema>
+
+    <schema>
+      <key>/schemas/apps/gnucash/dialogs/export/csv/last_path</key>
+      <applyto>/apps/gnucash/dialogs/export/csv/last_path</applyto>
+      <owner>gnucash</owner>
+      <type>string</type>
+      <locale name="C">
+        <short>Last pathname used</short>
+        <long>
+          This field contains the last pathname used by this window.
+          It will be used as the initial filename/pathname the next
+          time this window is opened.
+        </long>
+      </locale>
+    </schema>
+
+  </schemalist>
+</gconfschemafile>



More information about the gnucash-changes mailing list