mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Re-indentation of source code.
As usual, re-indentation was done using astyle-1.24 using the following options: astyle --indent=spaces=4 --brackets=break --pad-oper --pad-header --suffix=none git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22089 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
df611e433d
commit
43b51df596
@ -1682,8 +1682,8 @@ init_sql_backend( GncDbiBackend* dbi_be )
|
||||
be->events_pending = NULL;
|
||||
be->process_events = NULL;
|
||||
|
||||
/* The SQL/DBI backend doesn't need to be synced until it is
|
||||
* configured for multiuser access. */
|
||||
/* The SQL/DBI backend doesn't need to be synced until it is
|
||||
* configured for multiuser access. */
|
||||
be->sync = gnc_dbi_safe_sync_all;
|
||||
be->safe_sync = gnc_dbi_safe_sync_all;
|
||||
be->load_config = NULL;
|
||||
|
@ -177,9 +177,9 @@ test_dirty_cb (QofBook* book, gboolean dirty, gpointer data)
|
||||
{
|
||||
g_assert (data != NULL);
|
||||
if (dirty)
|
||||
++*(guint*)data;
|
||||
++*(guint*)data;
|
||||
else if (*(guint*)data)
|
||||
--*(guint*)data;
|
||||
--*(guint*)data;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -206,7 +206,7 @@ test_gnc_sql_commit_edit (void)
|
||||
test_add_error (&check1);
|
||||
test_add_error (&check2);
|
||||
hdlr1 = g_log_set_handler (logdomain, loglevel,
|
||||
(GLogFunc)test_list_handler, NULL);
|
||||
(GLogFunc)test_list_handler, NULL);
|
||||
g_test_log_set_fatal_handler ((GTestLogFatalFunc)test_list_handler, NULL);
|
||||
|
||||
qof_object_initialize ();
|
||||
@ -224,31 +224,31 @@ test_gnc_sql_commit_edit (void)
|
||||
|
||||
g_assert (qof_instance_get_dirty_flag (inst));
|
||||
g_assert (qof_book_session_not_saved (be.book));
|
||||
g_assert_cmpint (dirty_called, ==, 1);
|
||||
g_assert_cmpint (dirty_called, == , 1);
|
||||
gnc_sql_commit_edit (&be, inst);
|
||||
g_assert (!qof_instance_get_dirty_flag (inst));
|
||||
g_assert (!qof_book_session_not_saved (be.book));
|
||||
g_assert_cmpint (dirty_called, ==, 0);
|
||||
g_assert_cmpint (dirty_called, == , 0);
|
||||
|
||||
qof_book_mark_session_dirty (be.book);
|
||||
|
||||
g_assert (!qof_instance_get_dirty_flag (QOF_INSTANCE (be.book)));
|
||||
g_assert (qof_book_session_not_saved (be.book));
|
||||
g_assert_cmpint (dirty_called, ==, 1);
|
||||
g_assert_cmpint (dirty_called, == , 1);
|
||||
gnc_sql_commit_edit (&be, QOF_INSTANCE (be.book));
|
||||
g_assert (!qof_instance_get_dirty_flag (QOF_INSTANCE (be.book)));
|
||||
g_assert (qof_book_session_not_saved (be.book));
|
||||
g_assert_cmpint (dirty_called, ==, 1);
|
||||
g_assert_cmpint (dirty_called, == , 1);
|
||||
|
||||
qof_instance_set_dirty_flag (QOF_INSTANCE (be.book), TRUE);
|
||||
|
||||
g_assert (qof_instance_get_dirty_flag (QOF_INSTANCE (be.book)));
|
||||
g_assert (qof_book_session_not_saved (be.book));
|
||||
g_assert_cmpint (dirty_called, ==, 1);
|
||||
g_assert_cmpint (dirty_called, == , 1);
|
||||
gnc_sql_commit_edit (&be, QOF_INSTANCE (be.book));
|
||||
g_assert (!qof_instance_get_dirty_flag (QOF_INSTANCE (be.book)));
|
||||
g_assert (!qof_book_session_not_saved (be.book));
|
||||
g_assert_cmpint (dirty_called, ==, 0);
|
||||
g_assert_cmpint (dirty_called, == , 0);
|
||||
|
||||
g_log_remove_handler (logdomain, hdlr1);
|
||||
g_object_unref (inst);
|
||||
|
@ -165,11 +165,11 @@ gnc_xml_be_get_file_lock (FileBackend *be)
|
||||
strcpy (pathbuf, be->lockfile);
|
||||
path = strrchr (pathbuf, '.');
|
||||
while (snprintf (path, pathbuf_size - (path - pathbuf), ".%lx.%d.LNK", gethostid(), getpid())
|
||||
>= pathbuf_size - (path - pathbuf))
|
||||
{
|
||||
>= pathbuf_size - (path - pathbuf))
|
||||
{
|
||||
pathbuf_size += 100;
|
||||
pathbuf = (char *) realloc (pathbuf, pathbuf_size);
|
||||
}
|
||||
}
|
||||
|
||||
rc = link (be->lockfile, pathbuf);
|
||||
if (rc)
|
||||
@ -620,8 +620,8 @@ gnc_determine_file_type (const char *uri)
|
||||
}
|
||||
xml_type = gnc_is_xml_data_file_v2(filename, NULL);
|
||||
if ((xml_type == GNC_BOOK_XML2_FILE) ||
|
||||
(xml_type == GNC_BOOK_XML1_FILE) ||
|
||||
(xml_type == GNC_BOOK_POST_XML2_0_0_FILE))
|
||||
(xml_type == GNC_BOOK_XML1_FILE) ||
|
||||
(xml_type == GNC_BOOK_POST_XML2_0_0_FILE))
|
||||
{
|
||||
result = TRUE;
|
||||
goto det_exit;
|
||||
|
@ -830,7 +830,7 @@ bail:
|
||||
|
||||
gboolean
|
||||
qof_session_load_from_xml_file_v2(FileBackend *fbe, QofBook *book,
|
||||
QofBookFileType type)
|
||||
QofBookFileType type)
|
||||
{
|
||||
return qof_session_load_from_xml_file_v2_full(fbe, book, NULL, NULL, type);
|
||||
}
|
||||
|
@ -927,7 +927,7 @@ gnc_is_our_first_xml_chunk(char *chunk, gboolean *with_encoding)
|
||||
tag_compare2 = g_strdup_printf("<%s\r\n", gnc_v2_xml_version_string);
|
||||
|
||||
if ((strncmp(cursor, tag_compare1, strlen(tag_compare1)) == 0)
|
||||
|| (strncmp(cursor, tag_compare2, strlen(tag_compare2)) == 0))
|
||||
|| (strncmp(cursor, tag_compare2, strlen(tag_compare2)) == 0))
|
||||
{
|
||||
if (with_encoding)
|
||||
{
|
||||
|
@ -210,7 +210,7 @@ gboolean sixtp_add_sub_parser(sixtp *parser, const gchar* tag,
|
||||
sixtp *sub_parser);
|
||||
|
||||
QofBookFileType gnc_is_our_xml_file(const char *filename,
|
||||
gboolean *with_encoding);
|
||||
gboolean *with_encoding);
|
||||
|
||||
QofBookFileType gnc_is_our_first_xml_chunk(char *chunk, gboolean *with_encoding);
|
||||
|
||||
|
@ -174,7 +174,7 @@ static gnc_numeric
|
||||
gnc_payment_dialog_calculate_selected_total (PaymentWindow *pw)
|
||||
{
|
||||
GtkTreeSelection *selection;
|
||||
GList *list=NULL, *node;
|
||||
GList *list = NULL, *node;
|
||||
gnc_numeric val = gnc_numeric_zero();
|
||||
|
||||
if (!pw->docs_list_tree_view || !GTK_IS_TREE_VIEW(pw->docs_list_tree_view))
|
||||
@ -235,7 +235,7 @@ static void
|
||||
gnc_payment_window_fill_docs_list (PaymentWindow *pw)
|
||||
{
|
||||
GtkListStore *store;
|
||||
GList *list=NULL, *node;
|
||||
GList *list = NULL, *node;
|
||||
|
||||
g_return_if_fail (pw->docs_list_tree_view && GTK_IS_TREE_VIEW(pw->docs_list_tree_view));
|
||||
|
||||
|
@ -32,16 +32,17 @@
|
||||
#include "libqof/qof/qof.h"
|
||||
#include "gnc-features.h"
|
||||
|
||||
typedef struct {
|
||||
const gchar *key;
|
||||
const gchar *desc;
|
||||
typedef struct
|
||||
{
|
||||
const gchar *key;
|
||||
const gchar *desc;
|
||||
} gncFeature;
|
||||
|
||||
static GHashTable *features_table = NULL;
|
||||
static gncFeature known_features[] =
|
||||
{
|
||||
{ GNC_FEATURE_CREDIT_NOTES, "Customer and vendor credit notes (requires at least GnuCash 2.5.0)" },
|
||||
{ NULL },
|
||||
{ GNC_FEATURE_CREDIT_NOTES, "Customer and vendor credit notes (requires at least GnuCash 2.5.0)" },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
/* This static indicates the debugging module that this .o belongs to. */
|
||||
|
@ -146,14 +146,14 @@ gnc_employee_get_property (GObject *object,
|
||||
g_value_set_object(value, emp->addr);
|
||||
break;
|
||||
case PROP_WORKDAY:
|
||||
g_value_set_boxed(value, &emp->workday);
|
||||
break;
|
||||
g_value_set_boxed(value, &emp->workday);
|
||||
break;
|
||||
case PROP_RATE:
|
||||
g_value_set_boxed(value, &emp->rate);
|
||||
break;
|
||||
g_value_set_boxed(value, &emp->rate);
|
||||
break;
|
||||
case PROP_CCARD:
|
||||
g_value_set_object(value, emp->ccard_acc);
|
||||
break;
|
||||
g_value_set_object(value, emp->ccard_acc);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||
break;
|
||||
@ -195,14 +195,14 @@ gnc_employee_set_property (GObject *object,
|
||||
qofEmployeeSetAddr(emp, g_value_get_object(value));
|
||||
break;
|
||||
case PROP_WORKDAY:
|
||||
gncEmployeeSetWorkday(emp, *(gnc_numeric*)g_value_get_boxed(value));
|
||||
break;
|
||||
gncEmployeeSetWorkday(emp, *(gnc_numeric*)g_value_get_boxed(value));
|
||||
break;
|
||||
case PROP_RATE:
|
||||
gncEmployeeSetRate(emp, *(gnc_numeric*)g_value_get_boxed(value));
|
||||
break;
|
||||
gncEmployeeSetRate(emp, *(gnc_numeric*)g_value_get_boxed(value));
|
||||
break;
|
||||
case PROP_CCARD:
|
||||
gncEmployeeSetCCard(emp, g_value_get_object(value));
|
||||
break;
|
||||
gncEmployeeSetCCard(emp, g_value_get_object(value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -111,15 +111,15 @@ gncEntryDiscountHowToString (GncDiscountHow how)
|
||||
{
|
||||
switch (how)
|
||||
{
|
||||
case (GNC_DISC_PRETAX):
|
||||
return "PRETAX";
|
||||
case (GNC_DISC_SAMETIME):
|
||||
return "SAMETIME";
|
||||
case (GNC_DISC_POSTTAX):
|
||||
return "POSTTAX";
|
||||
default:
|
||||
g_warning ("asked to translate unknown discount-how %d.\n", how);
|
||||
break;
|
||||
case (GNC_DISC_PRETAX):
|
||||
return "PRETAX";
|
||||
case (GNC_DISC_SAMETIME):
|
||||
return "SAMETIME";
|
||||
case (GNC_DISC_POSTTAX):
|
||||
return "POSTTAX";
|
||||
default:
|
||||
g_warning ("asked to translate unknown discount-how %d.\n", how);
|
||||
break;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@ -128,17 +128,17 @@ gncEntryDiscountHowToString (GncDiscountHow how)
|
||||
* KEEP THIS FUNCTION IN SYNC with the one above! */
|
||||
gboolean gncEntryDiscountStringToHow (const char *str, GncDiscountHow *how)
|
||||
{
|
||||
if(g_strcmp0 ("PRETAX", str) == 0)
|
||||
if (g_strcmp0 ("PRETAX", str) == 0)
|
||||
{
|
||||
*how = GNC_DISC_PRETAX;
|
||||
return TRUE;
|
||||
}
|
||||
if(g_strcmp0 ("SAMETIME", str) == 0)
|
||||
if (g_strcmp0 ("SAMETIME", str) == 0)
|
||||
{
|
||||
*how = GNC_DISC_SAMETIME;
|
||||
return TRUE;
|
||||
}
|
||||
if(g_strcmp0 ("POSTTAX", str) == 0)
|
||||
if (g_strcmp0 ("POSTTAX", str) == 0)
|
||||
{
|
||||
*how = GNC_DISC_POSTTAX;
|
||||
return TRUE;
|
||||
@ -155,10 +155,10 @@ const char * gncEntryPaymentTypeToString (GncEntryPaymentType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case (GNC_PAYMENT_CASH):
|
||||
return "CASH";
|
||||
case (GNC_PAYMENT_CARD):
|
||||
return "CARD";
|
||||
case (GNC_PAYMENT_CASH):
|
||||
return "CASH";
|
||||
case (GNC_PAYMENT_CARD):
|
||||
return "CARD";
|
||||
default:
|
||||
g_warning ("asked to translate unknown payment type %d.\n", type);
|
||||
break;
|
||||
@ -170,12 +170,12 @@ const char * gncEntryPaymentTypeToString (GncEntryPaymentType type)
|
||||
* KEEP THIS FUNCTION IN SYNC with the one above! */
|
||||
gboolean gncEntryPaymentStringToType (const char *str, GncEntryPaymentType *type)
|
||||
{
|
||||
if(g_strcmp0 ("CASH", str) == 0)
|
||||
if (g_strcmp0 ("CASH", str) == 0)
|
||||
{
|
||||
*type = GNC_PAYMENT_CASH;
|
||||
return TRUE;
|
||||
}
|
||||
if(g_strcmp0 ("CARD", str) == 0)
|
||||
if (g_strcmp0 ("CARD", str) == 0)
|
||||
{
|
||||
*type = GNC_PAYMENT_CARD;
|
||||
return TRUE;
|
||||
@ -1425,7 +1425,7 @@ AccountValueList * gncEntryGetDocTaxValues (GncEntry *entry, gboolean is_cust_do
|
||||
GncAccountValue *acct_val = node->data;
|
||||
values = gncAccountValueAdd (values, acct_val->account,
|
||||
(is_cn ? gnc_numeric_neg (acct_val->value)
|
||||
: acct_val->value));
|
||||
: acct_val->value));
|
||||
}
|
||||
|
||||
return values;
|
||||
@ -1461,7 +1461,7 @@ AccountValueList * gncEntryGetBalTaxValues (GncEntry *entry, gboolean is_cust_do
|
||||
GncAccountValue *acct_val = node->data;
|
||||
values = gncAccountValueAdd (values, acct_val->account,
|
||||
(is_cust_doc ? gnc_numeric_neg (acct_val->value)
|
||||
: acct_val->value));
|
||||
: acct_val->value));
|
||||
}
|
||||
|
||||
return values;
|
||||
|
@ -83,7 +83,7 @@ static void * search(QofBook * book, const gchar *id, void * object, QofIdType t
|
||||
g_return_val_if_fail (type, NULL);
|
||||
g_return_val_if_fail (id, NULL);
|
||||
g_return_val_if_fail (book, NULL);
|
||||
|
||||
|
||||
// Build the query
|
||||
q = qof_query_create_for (type);
|
||||
qof_query_set_book (q, book);
|
||||
@ -105,8 +105,8 @@ static void * search(QofBook * book, const gchar *id, void * object, QofIdType t
|
||||
GncVendor *c = NULL;
|
||||
qof_query_add_term (q, qof_query_build_param_list("VENDOR_ID"), string_pred_data, QOF_QUERY_AND);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Run the query
|
||||
result = qof_query_run (q);
|
||||
|
||||
@ -134,7 +134,7 @@ static void * search(QofBook * book, const gchar *id, void * object, QofIdType t
|
||||
{
|
||||
object = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
result = g_list_next (result);
|
||||
}
|
||||
}
|
||||
|
@ -1180,12 +1180,12 @@ gboolean gncInvoiceAmountPositive (const GncInvoice *invoice)
|
||||
}
|
||||
|
||||
static gboolean gncInvoicePostAddSplit (QofBook *book,
|
||||
Account *acc,
|
||||
Transaction *txn,
|
||||
gnc_numeric value,
|
||||
const gchar *memo,
|
||||
const gchar *type,
|
||||
GncInvoice *invoice)
|
||||
Account *acc,
|
||||
Transaction *txn,
|
||||
gnc_numeric value,
|
||||
const gchar *memo,
|
||||
const gchar *type,
|
||||
GncInvoice *invoice)
|
||||
{
|
||||
Split *split;
|
||||
|
||||
@ -1357,8 +1357,8 @@ Transaction * gncInvoicePostToAccount (GncInvoice *invoice, Account *acc,
|
||||
if (accumulatesplits)
|
||||
splitinfo = gncAccountValueAdd (splitinfo, this_acc, value);
|
||||
else if (!gncInvoicePostAddSplit (book, this_acc, txn, value,
|
||||
gncEntryGetDescription (entry),
|
||||
type, invoice))
|
||||
gncEntryGetDescription (entry),
|
||||
type, invoice))
|
||||
{
|
||||
/*This is an error, which shouldn't even be able to happen.
|
||||
We can't really do anything sensible about it, and this is
|
||||
@ -1437,7 +1437,7 @@ Transaction * gncInvoicePostToAccount (GncInvoice *invoice, Account *acc,
|
||||
/* To charge amount is stored in document value. We need balance value here
|
||||
* so convert if necessary. */
|
||||
gnc_numeric to_charge_bal_amount = (is_cn ? gnc_numeric_neg (invoice->to_charge_amount)
|
||||
: invoice->to_charge_amount);
|
||||
: invoice->to_charge_amount);
|
||||
|
||||
/* Set memo. action? */
|
||||
xaccSplitSetMemo (split, _("Extra to Charge Card"));
|
||||
|
@ -165,8 +165,8 @@ gnc_vendor_get_property (GObject *object,
|
||||
g_value_set_int(value, vendor->taxincluded);
|
||||
break;
|
||||
case PROP_TAX_INCLUDED_STR:
|
||||
g_value_set_string(value, qofVendorGetTaxIncluded(vendor));
|
||||
break;
|
||||
g_value_set_string(value, qofVendorGetTaxIncluded(vendor));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||
break;
|
||||
@ -219,7 +219,7 @@ gnc_vendor_set_property (GObject *object,
|
||||
case PROP_TAX_INCLUDED_STR:
|
||||
qofVendorSetTaxIncluded(vendor, g_value_get_string(value));
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
@ -369,21 +369,21 @@ gnc_vendor_class_init (GncVendorClass *klass)
|
||||
(gobject_class,
|
||||
PROP_TAX_INCLUDED,
|
||||
g_param_spec_int ("tax-included",
|
||||
"Tax included",
|
||||
"The tax-included property contains the information about tax calculation this vendor.",
|
||||
GNC_TAXINCLUDED_YES, /* min */
|
||||
GNC_TAXINCLUDED_USEGLOBAL, /* max */
|
||||
GNC_TAXINCLUDED_USEGLOBAL, /* default */
|
||||
G_PARAM_READWRITE));
|
||||
"Tax included",
|
||||
"The tax-included property contains the information about tax calculation this vendor.",
|
||||
GNC_TAXINCLUDED_YES, /* min */
|
||||
GNC_TAXINCLUDED_USEGLOBAL, /* max */
|
||||
GNC_TAXINCLUDED_USEGLOBAL, /* default */
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property
|
||||
(gobject_class,
|
||||
PROP_TAX_INCLUDED_STR,
|
||||
g_param_spec_string("tax-included-string",
|
||||
"Tax included string",
|
||||
"The tax-included-string property contains a character version of tax-included.",
|
||||
FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
"Tax included string",
|
||||
"The tax-included-string property contains a character version of tax-included.",
|
||||
FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
/* Create/Destroy Functions */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -229,7 +229,7 @@ static guint n_system_encodings = G_N_ELEMENTS (system_encodings);
|
||||
|
||||
|
||||
void gxi_prepare_cb (GtkAssistant *assistant, GtkWidget *page,
|
||||
GncXmlImportData *data)
|
||||
GncXmlImportData *data)
|
||||
{
|
||||
gint currentpage = gtk_assistant_get_current_page(assistant);
|
||||
|
||||
@ -260,7 +260,7 @@ gxi_update_conversion_forward (GncXmlImportData *data)
|
||||
GtkWidget *page = gtk_assistant_get_nth_page (assistant, num);
|
||||
|
||||
if (data->n_unassigned || data->n_impossible)
|
||||
gtk_assistant_set_page_complete (assistant, page, FALSE);
|
||||
gtk_assistant_set_page_complete (assistant, page, FALSE);
|
||||
else
|
||||
gtk_assistant_set_page_complete (assistant, page, TRUE);
|
||||
}
|
||||
@ -313,31 +313,31 @@ gnc_xml_convert_single_file (const gchar *filename)
|
||||
|
||||
/* Enable buttons on all pages. */
|
||||
gtk_assistant_set_page_complete (GTK_ASSISTANT (data->assistant),
|
||||
GTK_WIDGET(gtk_builder_get_object(builder, "start_page")),
|
||||
TRUE);
|
||||
GTK_WIDGET(gtk_builder_get_object(builder, "start_page")),
|
||||
TRUE);
|
||||
gtk_assistant_set_page_complete (GTK_ASSISTANT (data->assistant),
|
||||
GTK_WIDGET(gtk_builder_get_object(builder, "conversion_page")),
|
||||
TRUE);
|
||||
GTK_WIDGET(gtk_builder_get_object(builder, "conversion_page")),
|
||||
TRUE);
|
||||
gtk_assistant_set_page_complete (GTK_ASSISTANT (data->assistant),
|
||||
GTK_WIDGET(gtk_builder_get_object(builder, "end_page")),
|
||||
TRUE);
|
||||
GTK_WIDGET(gtk_builder_get_object(builder, "end_page")),
|
||||
TRUE);
|
||||
|
||||
/* start page, explanations */
|
||||
gtk_assistant_set_page_title (GTK_ASSISTANT(data->assistant),
|
||||
gtk_assistant_get_nth_page (GTK_ASSISTANT(data->assistant),0),
|
||||
gettext(encodings_doc_page_title));
|
||||
gtk_assistant_set_page_title (GTK_ASSISTANT(data->assistant),
|
||||
gtk_assistant_get_nth_page (GTK_ASSISTANT(data->assistant), 0),
|
||||
gettext(encodings_doc_page_title));
|
||||
|
||||
widget = GTK_WIDGET(gtk_builder_get_object (builder, "start_page"));
|
||||
gtk_label_set_text (GTK_LABEL(widget), gettext (encodings_doc_string));
|
||||
widget = GTK_WIDGET(gtk_builder_get_object (builder, "start_page"));
|
||||
gtk_label_set_text (GTK_LABEL(widget), gettext (encodings_doc_string));
|
||||
|
||||
/* conversion page */
|
||||
data->default_encoding_hbox = GTK_WIDGET(gtk_builder_get_object (builder, "default_enc_box"));
|
||||
data->string_box_container = GTK_WIDGET(gtk_builder_get_object (builder, "string_box_container"));
|
||||
data->impossible_label = GTK_WIDGET(gtk_builder_get_object (builder, "impossible_label"));
|
||||
data->default_encoding_hbox = GTK_WIDGET(gtk_builder_get_object (builder, "default_enc_box"));
|
||||
data->string_box_container = GTK_WIDGET(gtk_builder_get_object (builder, "string_box_container"));
|
||||
data->impossible_label = GTK_WIDGET(gtk_builder_get_object (builder, "impossible_label"));
|
||||
|
||||
/* finish page */
|
||||
widget = GTK_WIDGET(gtk_builder_get_object(builder, "end_page"));
|
||||
gtk_label_set_text (GTK_LABEL(widget), gettext (finish_convert_string));
|
||||
gtk_label_set_text (GTK_LABEL(widget), gettext (finish_convert_string));
|
||||
|
||||
gtk_builder_connect_signals(builder, data);
|
||||
|
||||
@ -351,10 +351,10 @@ gnc_xml_convert_single_file (const gchar *filename)
|
||||
/* This won't return until the assistant is finished */
|
||||
gtk_main();
|
||||
|
||||
if (data->canceled)
|
||||
success = FALSE;
|
||||
else
|
||||
success = gxi_save_file (data);
|
||||
if (data->canceled)
|
||||
success = FALSE;
|
||||
else
|
||||
success = gxi_save_file (data);
|
||||
}
|
||||
|
||||
/* destroy all the data variables */
|
||||
|
@ -506,8 +506,8 @@ categories_tree_selection_changed (GtkTreeSelection *selection,
|
||||
g_free(text);
|
||||
buffer = gtk_text_view_get_buffer(data->category_description);
|
||||
gtk_text_buffer_set_text(buffer, gea->long_description ?
|
||||
gea->long_description :
|
||||
_("No description provided."), -1);
|
||||
gea->long_description :
|
||||
_("No description provided."), -1);
|
||||
|
||||
tree_view = gnc_tree_view_account_new_with_root (gea->root, FALSE);
|
||||
/* Override the normal fixed (user settable) sizing */
|
||||
|
@ -336,9 +336,9 @@ static void update_inactive_actions(GncPluginPage *plugin_page)
|
||||
/* Set the action's sensitivity */
|
||||
gnc_plugin_update_actions (action_group, readonly_inactive_actions,
|
||||
"sensitive", is_readwrite);
|
||||
/* FileSaveAction needs to be set separately because it has *two* conditions */
|
||||
/* FileSaveAction needs to be set separately because it has *two* conditions */
|
||||
file_save_action = gtk_action_group_get_action (action_group,
|
||||
"FileSaveAction");
|
||||
"FileSaveAction");
|
||||
gtk_action_set_sensitive (file_save_action, is_readwrite && is_dirty);
|
||||
}
|
||||
|
||||
|
@ -1155,7 +1155,7 @@ impl_webkit_print( GncHtml* self, const gchar* jobname, gboolean export_pdf )
|
||||
if (!export_dirname && gtk_print_settings_has_key(print_settings, GNC_GTK_PRINT_SETTINGS_EXPORT_DIR))
|
||||
{
|
||||
const char* tmp_dirname = gtk_print_settings_get(print_settings,
|
||||
GNC_GTK_PRINT_SETTINGS_EXPORT_DIR);
|
||||
GNC_GTK_PRINT_SETTINGS_EXPORT_DIR);
|
||||
// Only use the directory subsequently if it exists.
|
||||
if (g_file_test(tmp_dirname, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))
|
||||
{
|
||||
|
@ -76,7 +76,7 @@ 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. */
|
||||
/* 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");
|
||||
@ -89,9 +89,9 @@ static const gchar *finish_trans_string = N_(
|
||||
" 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");
|
||||
"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"
|
||||
@ -119,14 +119,14 @@ csv_export_file_chooser_confirm_cb (GtkWidget *button, CsvExportInfo *info)
|
||||
|
||||
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 (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;
|
||||
/* 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);
|
||||
@ -141,7 +141,7 @@ csv_export_file_chooser_confirm_cb (GtkWidget *button, CsvExportInfo *info)
|
||||
g_free ( filedir );
|
||||
g_free ( filepath );
|
||||
}
|
||||
g_free(file_name);
|
||||
g_free(file_name);
|
||||
|
||||
DEBUG("file_name selected is %s", info->file_name);
|
||||
DEBUG("starting directory is %s", info->starting_dir);
|
||||
@ -303,16 +303,16 @@ show_acct_type_accounts (CsvExportInfo *info)
|
||||
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));
|
||||
(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));
|
||||
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;
|
||||
}
|
||||
@ -388,7 +388,7 @@ update_accounts_tree (CsvExportInfo *info)
|
||||
*******************************************************/
|
||||
static void
|
||||
csv_export_account_changed_cb (GtkTreeSelection *selection,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
CsvExportInfo *info = user_data;
|
||||
GtkAssistant *assistant = GTK_ASSISTANT(info->window);
|
||||
@ -402,7 +402,7 @@ csv_export_account_changed_cb (GtkTreeSelection *selection,
|
||||
info->csva.num_accounts = update_accounts_tree (info);
|
||||
|
||||
/* Enable the Forward Assistant Button if we have accounts */
|
||||
if(info->csva.num_accounts > 0)
|
||||
if (info->csva.num_accounts > 0)
|
||||
gtk_assistant_set_page_complete (assistant, page, TRUE);
|
||||
else
|
||||
gtk_assistant_set_page_complete (assistant, page, FALSE);
|
||||
@ -660,7 +660,7 @@ get_earliest_in_book (QofBook *book)
|
||||
*******************************************************/
|
||||
void
|
||||
csv_export_assistant_start_page_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
CsvExportInfo *info = user_data;
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
@ -668,9 +668,9 @@ csv_export_assistant_start_page_prepare (GtkAssistant *assistant,
|
||||
|
||||
/* Set Start page text */
|
||||
if (info->export_type == XML_EXPORT_TREE)
|
||||
gtk_label_set_text (GTK_LABEL(info->start_label), start_tree_string);
|
||||
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);
|
||||
gtk_label_set_text (GTK_LABEL(info->start_label), start_trans_string);
|
||||
|
||||
/* Enable the Assistant Buttons */
|
||||
gtk_assistant_set_page_complete (assistant, page, TRUE);
|
||||
@ -679,7 +679,7 @@ csv_export_assistant_start_page_prepare (GtkAssistant *assistant,
|
||||
|
||||
void
|
||||
csv_export_assistant_account_page_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
CsvExportInfo *info = user_data;
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
@ -690,7 +690,7 @@ csv_export_assistant_account_page_prepare (GtkAssistant *assistant,
|
||||
gtk_assistant_set_current_page (assistant, num + 1 );
|
||||
|
||||
/* Enable the Forward Assistant Button if we have accounts */
|
||||
if(info->csva.num_accounts > 0)
|
||||
if (info->csva.num_accounts > 0)
|
||||
gtk_assistant_set_page_complete (assistant, page, TRUE);
|
||||
else
|
||||
gtk_assistant_set_page_complete (assistant, page, FALSE);
|
||||
@ -699,7 +699,7 @@ csv_export_assistant_account_page_prepare (GtkAssistant *assistant,
|
||||
|
||||
void
|
||||
csv_export_assistant_file_page_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
CsvExportInfo *info = user_data;
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
@ -717,7 +717,7 @@ csv_export_assistant_file_page_prepare (GtkAssistant *assistant,
|
||||
|
||||
void
|
||||
csv_export_assistant_finish_page_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
CsvExportInfo *info = user_data;
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
@ -740,25 +740,25 @@ csv_export_assistant_finish_page_prepare (GtkAssistant *assistant,
|
||||
|
||||
void
|
||||
csv_export_assistant_summary_page_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
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);
|
||||
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");
|
||||
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");
|
||||
text = _("File exported successfully!\n");
|
||||
|
||||
mtext = g_strdup_printf("<span size=\"medium\"><b>%s</b></span>",text);
|
||||
mtext = g_strdup_printf("<span size=\"medium\"><b>%s</b></span>", text);
|
||||
|
||||
gtk_label_set_markup(GTK_LABEL(info->summary_label), mtext);
|
||||
|
||||
@ -768,7 +768,7 @@ csv_export_assistant_summary_page_prepare (GtkAssistant *assistant,
|
||||
|
||||
void
|
||||
csv_export_assistant_prepare (GtkAssistant *assistant, GtkWidget *page,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
CsvExportInfo *info = user_data;
|
||||
gint currentpage = gtk_assistant_get_current_page(assistant);
|
||||
@ -830,7 +830,7 @@ csv_export_assistant_finish (GtkAssistant *assistant, gpointer user_data)
|
||||
CsvExportInfo *info = user_data;
|
||||
|
||||
if (info->export_type == XML_EXPORT_TREE)
|
||||
csv_tree_export (info);
|
||||
csv_tree_export (info);
|
||||
else
|
||||
csv_transactions_export (info);
|
||||
}
|
||||
@ -963,7 +963,7 @@ csv_export_assistant_create (CsvExportInfo *info)
|
||||
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);
|
||||
G_CALLBACK (csv_export_date_changed_cb), info);
|
||||
|
||||
/* End date info */
|
||||
info->csvd.end_date = gnc_date_edit_new (time (NULL), FALSE, FALSE);
|
||||
@ -972,7 +972,7 @@ csv_export_assistant_create (CsvExportInfo *info)
|
||||
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);
|
||||
G_CALLBACK (csv_export_date_changed_cb), info);
|
||||
|
||||
/* Load Accounts */
|
||||
show_acct_type_accounts (info);
|
||||
@ -984,7 +984,7 @@ csv_export_assistant_create (CsvExportInfo *info)
|
||||
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);
|
||||
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);
|
||||
|
@ -48,7 +48,7 @@ typedef struct
|
||||
|
||||
time_t start_time;
|
||||
time_t end_time;
|
||||
}CsvExportDate;
|
||||
} CsvExportDate;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -63,7 +63,7 @@ typedef struct
|
||||
GList *account_list;
|
||||
int num_accounts;
|
||||
GNCAccountType account_type;
|
||||
}CsvExportAcc;
|
||||
} CsvExportAcc;
|
||||
|
||||
|
||||
typedef struct
|
||||
@ -91,7 +91,7 @@ typedef struct
|
||||
} CsvExportInfo;
|
||||
|
||||
|
||||
/** The gnc_file_csv_export() will let the user export thte
|
||||
/** 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);
|
||||
|
@ -87,7 +87,7 @@ void account_splits (CsvExportInfo *info, Account *acc, FILE *fh )
|
||||
qof_query_set_book (q, book);
|
||||
|
||||
/* Set up separators */
|
||||
if(info->use_quotes)
|
||||
if (info->use_quotes)
|
||||
{
|
||||
end_sep = "\"";
|
||||
mid_sep = g_strconcat ( "\"", info->separator_str, "\"", NULL);
|
||||
@ -146,7 +146,7 @@ void account_splits (CsvExportInfo *info, Account *acc, FILE *fh )
|
||||
g_free(part1);
|
||||
/* Notes */
|
||||
currentSel = xaccTransGetNotes(trans);
|
||||
if(currentSel == NULL)
|
||||
if (currentSel == NULL)
|
||||
part1 = g_strconcat ( part2, mid_sep, NULL);
|
||||
else
|
||||
part1 = g_strconcat ( part2, currentSel, mid_sep, NULL);
|
||||
@ -207,7 +207,7 @@ void account_splits (CsvExportInfo *info, Account *acc, FILE *fh )
|
||||
/* Write to file */
|
||||
if (!write_line_to_file(fh, part1))
|
||||
{
|
||||
info->failed = TRUE;
|
||||
info->failed = TRUE;
|
||||
break;
|
||||
}
|
||||
g_free(part1);
|
||||
@ -263,7 +263,7 @@ void account_splits (CsvExportInfo *info, Account *acc, FILE *fh )
|
||||
|
||||
/* From / To with Symbol */
|
||||
split_amount = xaccPrintAmount(xaccSplitGetAmount(t_split), gnc_split_amount_print_info(t_split, TRUE));
|
||||
if(xaccSplitGetAccount(t_split) == acc)
|
||||
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);
|
||||
@ -271,7 +271,7 @@ void account_splits (CsvExportInfo *info, Account *acc, FILE *fh )
|
||||
|
||||
/* From / To Numbers only */
|
||||
split_amount = xaccPrintAmount(xaccSplitGetAmount(t_split), gnc_split_amount_print_info(t_split, FALSE));
|
||||
if(xaccSplitGetAccount(t_split) == acc)
|
||||
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);
|
||||
@ -279,14 +279,14 @@ void account_splits (CsvExportInfo *info, Account *acc, FILE *fh )
|
||||
|
||||
/* 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)
|
||||
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;
|
||||
info->failed = TRUE;
|
||||
|
||||
g_free(part2);
|
||||
cnt++;
|
||||
@ -326,7 +326,7 @@ void csv_transactions_export (CsvExportInfo *info)
|
||||
int i;
|
||||
|
||||
/* Set up separators */
|
||||
if(info->use_quotes)
|
||||
if (info->use_quotes)
|
||||
{
|
||||
end_sep = "\"";
|
||||
mid_sep = g_strconcat ( "\"", info->separator_str, "\"", NULL);
|
||||
@ -339,18 +339,18 @@ void csv_transactions_export (CsvExportInfo *info)
|
||||
|
||||
/* 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);
|
||||
_("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;
|
||||
info->failed = TRUE;
|
||||
g_free(mid_sep);
|
||||
g_free(header);
|
||||
return;
|
||||
@ -368,7 +368,7 @@ void csv_transactions_export (CsvExportInfo *info)
|
||||
}
|
||||
else
|
||||
info->failed = TRUE;
|
||||
if(fh)
|
||||
if (fh)
|
||||
fclose (fh);
|
||||
LEAVE("");
|
||||
}
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
#include "assistant-csv-export.h"
|
||||
|
||||
/** The csv_transactions_export() will let the user export the
|
||||
/** The csv_transactions_export() will let the user export the
|
||||
* transactions to a deliminated file.
|
||||
*/
|
||||
void csv_transactions_export (CsvExportInfo *info);
|
||||
|
@ -97,7 +97,7 @@ void csv_tree_export (CsvExportInfo *info)
|
||||
|
||||
|
||||
/* Set up separators */
|
||||
if(info->use_quotes)
|
||||
if (info->use_quotes)
|
||||
{
|
||||
end_sep = "\"";
|
||||
mid_sep = g_strconcat ( "\"", info->separator_str, "\"", NULL);
|
||||
@ -110,16 +110,16 @@ void csv_tree_export (CsvExportInfo *info)
|
||||
|
||||
/* 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);
|
||||
_("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;
|
||||
info->failed = TRUE;
|
||||
g_free(mid_sep);
|
||||
g_free(header);
|
||||
return;
|
||||
@ -159,7 +159,7 @@ void csv_tree_export (CsvExportInfo *info)
|
||||
g_free(part1);
|
||||
/* Notes */
|
||||
currentSel = xaccAccountGetNotes(acc) ? xaccAccountGetNotes(acc) : "" ;
|
||||
if(!g_strcmp0(currentSel, "") == 0)
|
||||
if (!g_strcmp0(currentSel, "") == 0)
|
||||
{
|
||||
/* Check for multiple lines */
|
||||
gchar **parts;
|
||||
@ -197,7 +197,7 @@ void csv_tree_export (CsvExportInfo *info)
|
||||
/* Write to file */
|
||||
if (!write_line_to_file(fh, part2))
|
||||
{
|
||||
info->failed = TRUE;
|
||||
info->failed = TRUE;
|
||||
break;
|
||||
}
|
||||
g_free(part2);
|
||||
@ -206,7 +206,7 @@ void csv_tree_export (CsvExportInfo *info)
|
||||
}
|
||||
else
|
||||
info->failed = TRUE;
|
||||
if(fh)
|
||||
if (fh)
|
||||
fclose (fh);
|
||||
|
||||
g_list_free( accts );
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
#include "assistant-csv-export.h"
|
||||
|
||||
/** The csv_tree_export() will let the user export the
|
||||
/** The csv_tree_export() will let the user export the
|
||||
* account tree to a deliminated file.
|
||||
*/
|
||||
void csv_tree_export (CsvExportInfo *info);
|
||||
|
@ -87,8 +87,8 @@ gnc_plugin_csv_export_get_type (void)
|
||||
};
|
||||
|
||||
gnc_plugin_csv_export_type = g_type_register_static (GNC_TYPE_PLUGIN,
|
||||
"GncPluginCsvExport",
|
||||
&our_info, 0);
|
||||
"GncPluginCsvExport",
|
||||
&our_info, 0);
|
||||
}
|
||||
|
||||
return gnc_plugin_csv_export_type;
|
||||
@ -150,16 +150,16 @@ gnc_plugin_csv_export_finalize (GObject *object)
|
||||
************************************************************/
|
||||
static void
|
||||
gnc_plugin_csv_export_tree_cmd (GtkAction *action,
|
||||
GncMainWindowActionData *data)
|
||||
GncMainWindowActionData *data)
|
||||
{
|
||||
gnc_file_csv_export(XML_EXPORT_TREE);
|
||||
gnc_file_csv_export(XML_EXPORT_TREE);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_plugin_csv_export_trans_cmd (GtkAction *action,
|
||||
GncMainWindowActionData *data)
|
||||
GncMainWindowActionData *data)
|
||||
{
|
||||
gnc_file_csv_export(XML_EXPORT_TRANS);
|
||||
gnc_file_csv_export(XML_EXPORT_TRANS);
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
|
@ -140,21 +140,21 @@ void csv_import_hrows_cb (GtkWidget *spin, gpointer user_data )
|
||||
num_rows = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(info->store), NULL);
|
||||
|
||||
/* Modify background color for header rows */
|
||||
if(info->header_rows == 0)
|
||||
if (info->header_rows == 0)
|
||||
{
|
||||
valid = gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(info->store), &iter, NULL, 0 );
|
||||
if(valid)
|
||||
if (valid)
|
||||
gtk_list_store_set (info->store, &iter, ROW_COLOR, NULL, -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (info->header_rows - 1 < num_rows)
|
||||
if (info->header_rows - 1 < num_rows)
|
||||
{
|
||||
valid = gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(info->store), &iter, NULL, info->header_rows - 1 );
|
||||
if(valid)
|
||||
if (valid)
|
||||
gtk_list_store_set (info->store, &iter, ROW_COLOR, "pink", -1);
|
||||
valid = gtk_tree_model_iter_next (GTK_TREE_MODEL(info->store), &iter);
|
||||
if(valid)
|
||||
if (valid)
|
||||
gtk_list_store_set (info->store, &iter, ROW_COLOR, NULL, -1);
|
||||
}
|
||||
}
|
||||
@ -205,7 +205,7 @@ void csv_import_sep_cb (GtkWidget *radio, gpointer user_data )
|
||||
/* Generate preview */
|
||||
gtk_list_store_clear (info->store);
|
||||
|
||||
if(csv_import_read_file (info->file_name, info->regexp->str, info->store, 11 ) == MATCH_FOUND)
|
||||
if (csv_import_read_file (info->file_name, info->regexp->str, info->store, 11 ) == MATCH_FOUND)
|
||||
gtk_widget_set_sensitive (info->header_row_spin, TRUE);
|
||||
else
|
||||
gtk_widget_set_sensitive (info->header_row_spin, FALSE);
|
||||
@ -309,7 +309,7 @@ gnc_input_dialog (GtkWidget *parent, const gchar *title, const gchar *msg, const
|
||||
*******************************************************/
|
||||
void
|
||||
csv_import_assistant_start_page_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
CsvImportInfo *info = user_data;
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
@ -322,7 +322,7 @@ csv_import_assistant_start_page_prepare (GtkAssistant *assistant,
|
||||
|
||||
void
|
||||
csv_import_assistant_file_page_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
CsvImportInfo *info = user_data;
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
@ -339,7 +339,7 @@ csv_import_assistant_file_page_prepare (GtkAssistant *assistant,
|
||||
|
||||
void
|
||||
csv_import_assistant_account_page_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
CsvImportInfo *info = user_data;
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
@ -347,7 +347,7 @@ csv_import_assistant_account_page_prepare (GtkAssistant *assistant,
|
||||
|
||||
gtk_list_store_clear (info->store);
|
||||
|
||||
if(csv_import_read_file (info->file_name, info->regexp->str, info->store, 11 ) == MATCH_FOUND)
|
||||
if (csv_import_read_file (info->file_name, info->regexp->str, info->store, 11 ) == MATCH_FOUND)
|
||||
gtk_widget_set_sensitive (info->header_row_spin, TRUE);
|
||||
else
|
||||
gtk_widget_set_sensitive (info->header_row_spin, FALSE);
|
||||
@ -356,7 +356,7 @@ csv_import_assistant_account_page_prepare (GtkAssistant *assistant,
|
||||
|
||||
void
|
||||
csv_import_assistant_finish_page_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
CsvImportInfo *info = user_data;
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
@ -379,23 +379,23 @@ csv_import_assistant_finish_page_prepare (GtkAssistant *assistant,
|
||||
|
||||
void
|
||||
csv_import_assistant_summary_page_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
CsvImportInfo *info = user_data;
|
||||
gchar *text, *errtext, *mtext;
|
||||
|
||||
if(!g_strcmp0(info->error,"") == 0)
|
||||
if (!g_strcmp0(info->error, "") == 0)
|
||||
{
|
||||
text = g_strdup_printf(gettext ("Import completed but with errors!\n\nThe number of Accounts added was %u and "
|
||||
"updated was %u.\n\nSee below for errors..." ), info->num_new, info->num_updates );
|
||||
text = g_strdup_printf(gettext ("Import completed but with errors!\n\nThe number of Accounts added was %u and "
|
||||
"updated was %u.\n\nSee below for errors..." ), info->num_new, info->num_updates );
|
||||
errtext = g_strdup_printf ( "%s", info->error);
|
||||
gtk_label_set_text (GTK_LABEL(info->summary_error), errtext);
|
||||
g_free(errtext);
|
||||
g_free(info->error);
|
||||
}
|
||||
else
|
||||
text = g_strdup_printf(gettext ("Import completed successfully!\n\nThe number of Accounts added was %u and "
|
||||
"updated was %u.\n" ), info->num_new, info->num_updates );
|
||||
text = g_strdup_printf(gettext ("Import completed successfully!\n\nThe number of Accounts added was %u and "
|
||||
"updated was %u.\n" ), info->num_new, info->num_updates );
|
||||
|
||||
mtext = g_strdup_printf("<span size=\"medium\"><b>%s</b></span>", text);
|
||||
gtk_label_set_markup(GTK_LABEL(info->summary_label), mtext);
|
||||
@ -407,7 +407,7 @@ csv_import_assistant_summary_page_prepare (GtkAssistant *assistant,
|
||||
|
||||
void
|
||||
csv_import_assistant_prepare (GtkAssistant *assistant, GtkWidget *page,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
CsvImportInfo *info = user_data;
|
||||
gint currentpage = gtk_assistant_get_current_page(assistant);
|
||||
@ -470,7 +470,7 @@ csv_import_assistant_finish (GtkAssistant *assistant, gpointer user_data)
|
||||
|
||||
gtk_list_store_clear (info->store);
|
||||
csv_import_read_file (info->file_name, info->regexp->str, info->store, 0 );
|
||||
csv_account_import (info);
|
||||
csv_account_import (info);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -519,7 +519,7 @@ csv_import_assistant_create (CsvImportInfo *info)
|
||||
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_import_file_chooser_confirm_cb), info);
|
||||
G_CALLBACK (csv_import_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);
|
||||
@ -533,8 +533,8 @@ csv_import_assistant_create (CsvImportInfo *info)
|
||||
|
||||
/* create model and bind to view */
|
||||
info->store = gtk_list_store_new (N_COLUMNS,
|
||||
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
|
||||
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
|
||||
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
|
||||
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
|
||||
gtk_tree_view_set_model( GTK_TREE_VIEW(info->tree_view), GTK_TREE_MODEL(info->store) );
|
||||
#define CREATE_COLUMN(description,column_id) \
|
||||
renderer = gtk_cell_renderer_text_new (); \
|
||||
|
@ -80,7 +80,7 @@ typedef struct
|
||||
GOCharmapSel *encselector; /**< The widget for selecting the encoding */
|
||||
GtkCheckButton *sep_buttons[SEP_NUM_OF_TYPES]; /**< Checkbuttons for common separators */
|
||||
GtkCheckButton *custom_cbutton; /**< The checkbutton for a custom separator */
|
||||
GtkEntry *custom_entry; /**< The entry for custom separators */
|
||||
GtkEntry *custom_entry; /**< The entry for custom separators */
|
||||
GtkComboBox *date_format_combo; /**< The widget for selecting the date format */
|
||||
GtkComboBox *currency_format_combo; /**< The widget for selecting the currency format */
|
||||
GtkTreeView *treeview; /**< The treeview containing the data */
|
||||
@ -231,43 +231,43 @@ void row_selection_update (CsvImportTrans* info)
|
||||
|
||||
store = GTK_LIST_STORE( gtk_tree_view_get_model(info->treeview));
|
||||
|
||||
for( i = 0; i <= info->start_row; i++)
|
||||
for ( i = 0; i <= info->start_row; i++)
|
||||
{
|
||||
/* Modify background color of rows less than start row */
|
||||
if(info->start_row == i)
|
||||
if (info->start_row == i)
|
||||
{
|
||||
valid = gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, i );
|
||||
if(valid)
|
||||
if (valid)
|
||||
gtk_list_store_set (store, &iter, 0, NULL, -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
valid = gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, i );
|
||||
if(valid)
|
||||
if (valid)
|
||||
gtk_list_store_set (store, &iter, 0, "pink", -1);
|
||||
valid = gtk_tree_model_iter_next (GTK_TREE_MODEL(store), &iter);
|
||||
if(valid)
|
||||
if (valid)
|
||||
gtk_list_store_set (store, &iter, 0, NULL, -1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for( i = info->num_of_rows - 1; i >= info->end_row; i--)
|
||||
for ( i = info->num_of_rows - 1; i >= info->end_row; i--)
|
||||
{
|
||||
/* Modify background color of rows more than end row */
|
||||
if( i == info->end_row )
|
||||
if ( i == info->end_row )
|
||||
{
|
||||
valid = gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, i );
|
||||
if(valid)
|
||||
if (valid)
|
||||
gtk_list_store_set (store, &iter, 0, NULL, -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
valid = gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, i );
|
||||
if(valid)
|
||||
if (valid)
|
||||
gtk_list_store_set (store, &iter, 0, "pink", -1);
|
||||
valid = gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, i - 1 );
|
||||
if(valid)
|
||||
if (valid)
|
||||
gtk_list_store_set (store, &iter, 0, NULL, -1);
|
||||
}
|
||||
}
|
||||
@ -331,14 +331,14 @@ void csv_import_trans_auto_cb (GtkWidget *cb, gpointer user_data )
|
||||
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cb)))
|
||||
{
|
||||
if(info->previewing_errors == TRUE)
|
||||
if (info->previewing_errors == TRUE)
|
||||
info->approved = TRUE;
|
||||
else
|
||||
info->account_picker->auto_create = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(info->previewing_errors == TRUE)
|
||||
if (info->previewing_errors == TRUE)
|
||||
info->approved = FALSE;
|
||||
else
|
||||
info->account_picker->auto_create = FALSE;
|
||||
@ -945,7 +945,7 @@ static void header_button_press_handler(GtkWidget* button, GdkEventButton* event
|
||||
}
|
||||
|
||||
|
||||
/* Test for the required minimum number of coloumns selected and
|
||||
/* Test for the required minimum number of coloumns selected and
|
||||
* a valid date format.
|
||||
* Returns TRUE if we do or FALSE if we don't.
|
||||
*
|
||||
@ -997,8 +997,8 @@ gboolean preview_settings_valid (CsvImportTrans* info)
|
||||
weight = weight + 1000;
|
||||
gtk_tree_model_get(datastore, &iter2, i + 1, &prevstr, -1);
|
||||
|
||||
if(parse_date(prevstr, info->parse_data->date_format) == -1)
|
||||
valid = FALSE;
|
||||
if (parse_date(prevstr, info->parse_data->date_format) == -1)
|
||||
valid = FALSE;
|
||||
break;
|
||||
|
||||
case GNC_CSV_DESCRIPTION:
|
||||
@ -1028,10 +1028,10 @@ gboolean preview_settings_valid (CsvImportTrans* info)
|
||||
g_free(prevstr);
|
||||
g_free(accstr);
|
||||
}
|
||||
if(weight < 1109 || valid == FALSE)
|
||||
return FALSE;
|
||||
if (weight < 1109 || valid == FALSE)
|
||||
return FALSE;
|
||||
else
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@ -1273,7 +1273,7 @@ void load_settings (CsvImportTrans *info)
|
||||
*******************************************************/
|
||||
void
|
||||
csv_import_trans_assistant_start_page_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
CsvImportTrans *info = user_data;
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
@ -1286,7 +1286,7 @@ csv_import_trans_assistant_start_page_prepare (GtkAssistant *assistant,
|
||||
|
||||
void
|
||||
csv_import_trans_assistant_file_page_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
CsvImportTrans *info = user_data;
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
@ -1307,7 +1307,7 @@ csv_import_trans_assistant_file_page_prepare (GtkAssistant *assistant,
|
||||
|
||||
void
|
||||
csv_import_trans_assistant_preview_page_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
CsvImportTrans *info = user_data;
|
||||
GtkAdjustment *adj;
|
||||
@ -1317,7 +1317,7 @@ csv_import_trans_assistant_preview_page_prepare (GtkAssistant *assistant,
|
||||
g_signal_connect(G_OBJECT(info->treeview), "size-allocate",
|
||||
G_CALLBACK(treeview_resized), (gpointer)info);
|
||||
|
||||
if(info->previewing_errors == TRUE)
|
||||
if (info->previewing_errors == TRUE)
|
||||
{
|
||||
gchar* name;
|
||||
GtkIconSize size;
|
||||
@ -1329,7 +1329,7 @@ csv_import_trans_assistant_preview_page_prepare (GtkAssistant *assistant,
|
||||
gtk_image_get_stock(info->instructions_image, &name, &size);
|
||||
gtk_image_set_from_stock(info->instructions_image, GTK_STOCK_DIALOG_ERROR, size);
|
||||
gtk_label_set_text(info->instructions_label,
|
||||
_("The rows displayed below had errors which are in the last column. You can attempt to correct them by changing the configuration."));
|
||||
_("The rows displayed below had errors which are in the last column. You can attempt to correct them by changing the configuration."));
|
||||
gtk_widget_show(GTK_WIDGET(info->instructions_image));
|
||||
gtk_widget_show(GTK_WIDGET(info->instructions_label));
|
||||
|
||||
@ -1347,7 +1347,7 @@ csv_import_trans_assistant_preview_page_prepare (GtkAssistant *assistant,
|
||||
|
||||
/* Set the upper limit of spin button to number of rows */
|
||||
adj = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(info->end_row_spin));
|
||||
if(gtk_adjustment_get_upper(adj) != info->num_of_rows)
|
||||
if (gtk_adjustment_get_upper(adj) != info->num_of_rows)
|
||||
{
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON(info->end_row_spin), info->num_of_rows);
|
||||
gtk_adjustment_set_upper(adj, info->num_of_rows);
|
||||
@ -1360,7 +1360,7 @@ csv_import_trans_assistant_preview_page_prepare (GtkAssistant *assistant,
|
||||
|
||||
void
|
||||
csv_import_trans_assistant_account_page_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
CsvImportTrans *info = user_data;
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
@ -1368,11 +1368,11 @@ csv_import_trans_assistant_account_page_prepare (GtkAssistant *assistant,
|
||||
gchar *text, *mtext;
|
||||
Account * account = NULL;
|
||||
|
||||
if(!preview_settings_valid(info) && (info->approved == FALSE))
|
||||
if (!preview_settings_valid(info) && (info->approved == FALSE))
|
||||
{
|
||||
text = g_strdup_printf(gettext ("There are problems with the import settings!\nThe date format could be wrong "
|
||||
"or there are not enough columns set..."));
|
||||
mtext = g_strdup_printf("<span size=\"medium\" color=\"red\"><b>%s</b></span>",text);
|
||||
text = g_strdup_printf(gettext ("There are problems with the import settings!\nThe date format could be wrong "
|
||||
"or there are not enough columns set..."));
|
||||
mtext = g_strdup_printf("<span size=\"medium\" color=\"red\"><b>%s</b></span>", text);
|
||||
gtk_label_set_markup(GTK_LABEL(info->account_label), mtext);
|
||||
g_free(mtext);
|
||||
g_free(text);
|
||||
@ -1387,18 +1387,18 @@ csv_import_trans_assistant_account_page_prepare (GtkAssistant *assistant,
|
||||
g_free(mtext);
|
||||
g_free(text);
|
||||
|
||||
gtk_widget_set_sensitive (info->account_page, TRUE);
|
||||
gtk_widget_set_sensitive (info->account_page, TRUE);
|
||||
|
||||
/* Let the user select an account to put the transactions in. */
|
||||
account = gnc_import_account_assist_update (info->account_picker);
|
||||
|
||||
/* If we have a valid account and auto_create is TRUE, move on to matcher */
|
||||
if(!(account == NULL) && (info->account_picker->auto_create == TRUE))
|
||||
if (!(account == NULL) && (info->account_picker->auto_create == TRUE))
|
||||
gtk_assistant_set_current_page (assistant, num + 1);
|
||||
}
|
||||
|
||||
/* Enable the Forward Assistant Button */
|
||||
if(account == NULL)
|
||||
if (account == NULL)
|
||||
gtk_assistant_set_page_complete (assistant, page, FALSE);
|
||||
else
|
||||
gtk_assistant_set_page_complete (assistant, page, TRUE);
|
||||
@ -1407,20 +1407,20 @@ csv_import_trans_assistant_account_page_prepare (GtkAssistant *assistant,
|
||||
|
||||
void
|
||||
csv_import_trans_assistant_doc_page_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
CsvImportTrans *info = user_data;
|
||||
|
||||
/* Block going back */
|
||||
gtk_assistant_commit (GTK_ASSISTANT(info->window));
|
||||
|
||||
if( info->match_parse_run == FALSE)
|
||||
if ( info->match_parse_run == FALSE)
|
||||
{
|
||||
/* Add the Cancel button for the matcher */
|
||||
info->cancel_button = gtk_button_new_with_mnemonic (_("_Cancel"));
|
||||
gtk_assistant_add_action_widget (assistant, info->cancel_button);
|
||||
g_signal_connect(info->cancel_button, "clicked",
|
||||
G_CALLBACK(csv_import_trans_assistant_cancel), info);
|
||||
G_CALLBACK(csv_import_trans_assistant_cancel), info);
|
||||
gtk_widget_show(GTK_WIDGET(info->cancel_button));
|
||||
}
|
||||
}
|
||||
@ -1428,7 +1428,7 @@ csv_import_trans_assistant_doc_page_prepare (GtkAssistant *assistant,
|
||||
|
||||
void
|
||||
csv_import_trans_assistant_match_page_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
CsvImportTrans *info = user_data;
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
@ -1440,7 +1440,7 @@ csv_import_trans_assistant_match_page_prepare (GtkAssistant *assistant,
|
||||
|
||||
/* Create transactions from the parsed data, first time with FALSE
|
||||
Subsequent times with TRUE */
|
||||
if( info->match_parse_run == FALSE)
|
||||
if ( info->match_parse_run == FALSE)
|
||||
{
|
||||
gnc_csv_parse_to_trans(info->parse_data, info->account_picker->retAccount, FALSE);
|
||||
}
|
||||
@ -1449,13 +1449,13 @@ csv_import_trans_assistant_match_page_prepare (GtkAssistant *assistant,
|
||||
info->match_parse_run = TRUE;
|
||||
|
||||
/* if there are errors, we jump back to preview to correct */
|
||||
if(!(info->parse_data->error_lines == NULL) && (info->approved == FALSE) )
|
||||
if (!(info->parse_data->error_lines == NULL) && (info->approved == FALSE) )
|
||||
{
|
||||
info->previewing_errors = TRUE; /* We're looking at errors. */
|
||||
gtk_assistant_set_current_page (assistant, 2);
|
||||
}
|
||||
|
||||
if((info->parse_data->error_lines == NULL) || (info->approved == TRUE) )
|
||||
if ((info->parse_data->error_lines == NULL) || (info->approved == TRUE) )
|
||||
{
|
||||
GList* transactions; /* A list of the transactions we create */
|
||||
|
||||
@ -1464,17 +1464,17 @@ csv_import_trans_assistant_match_page_prepare (GtkAssistant *assistant,
|
||||
gtk_label_set_markup(GTK_LABEL(info->match_label), mtext);
|
||||
g_free(mtext);
|
||||
|
||||
if(info->gnc_csv_importer_gui == NULL)
|
||||
if (info->gnc_csv_importer_gui == NULL)
|
||||
{
|
||||
/* Create the genereic transaction importer GUI. */
|
||||
info->gnc_csv_importer_gui = gnc_gen_trans_assist_new (info->match_page, NULL, FALSE, 42);
|
||||
|
||||
/* Add the help button for the matcher */
|
||||
info->help_button = gtk_button_new_with_mnemonic (_("_Help"));
|
||||
gtk_assistant_add_action_widget (assistant, info->help_button);
|
||||
g_signal_connect(info->help_button, "clicked",
|
||||
G_CALLBACK(on_matcher_help_clicked), info->gnc_csv_importer_gui);
|
||||
gtk_widget_show(GTK_WIDGET(info->help_button));
|
||||
/* Add the help button for the matcher */
|
||||
info->help_button = gtk_button_new_with_mnemonic (_("_Help"));
|
||||
gtk_assistant_add_action_widget (assistant, info->help_button);
|
||||
g_signal_connect(info->help_button, "clicked",
|
||||
G_CALLBACK(on_matcher_help_clicked), info->gnc_csv_importer_gui);
|
||||
gtk_widget_show(GTK_WIDGET(info->help_button));
|
||||
|
||||
/* Get the list of the transactions that were created. */
|
||||
transactions = info->parse_data->transactions;
|
||||
@ -1495,7 +1495,7 @@ csv_import_trans_assistant_match_page_prepare (GtkAssistant *assistant,
|
||||
|
||||
void
|
||||
csv_import_trans_assistant_summary_page_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
CsvImportTrans *info = user_data;
|
||||
gchar *text, *mtext;
|
||||
@ -1518,7 +1518,7 @@ csv_import_trans_assistant_summary_page_prepare (GtkAssistant *assistant,
|
||||
|
||||
void
|
||||
csv_import_trans_assistant_prepare (GtkAssistant *assistant, GtkWidget *page,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
CsvImportTrans *info = user_data;
|
||||
gint currentpage = gtk_assistant_get_current_page(assistant);
|
||||
@ -1603,13 +1603,13 @@ csv_import_trans_close_handler (gpointer user_data)
|
||||
g_free(info->starting_dir);
|
||||
|
||||
/* Free the memory we allocated. */
|
||||
if(!(info->parse_data == NULL))
|
||||
if (!(info->parse_data == NULL))
|
||||
gnc_csv_parse_data_free(info->parse_data);
|
||||
|
||||
if(!(info->account_picker == NULL))
|
||||
if (!(info->account_picker == NULL))
|
||||
info->account_picker = NULL;
|
||||
|
||||
if(!(info->gnc_csv_importer_gui == NULL))
|
||||
if (!(info->gnc_csv_importer_gui == NULL))
|
||||
info->gnc_csv_importer_gui = NULL;
|
||||
|
||||
gtk_widget_destroy (info->window);
|
||||
@ -1673,7 +1673,7 @@ csv_import_trans_assistant_create (CsvImportTrans *info)
|
||||
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_import_trans_file_chooser_confirm_cb), info);
|
||||
G_CALLBACK (csv_import_trans_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);
|
||||
@ -1681,114 +1681,114 @@ csv_import_trans_assistant_create (CsvImportTrans *info)
|
||||
|
||||
/* Preview Settings Page */
|
||||
{
|
||||
char* sep_button_names[] = {"space_cbutton",
|
||||
"tab_cbutton",
|
||||
"comma_cbutton",
|
||||
"colon_cbutton",
|
||||
"semicolon_cbutton",
|
||||
"hyphen_cbutton"
|
||||
};
|
||||
GtkContainer *date_format_container, *currency_format_container;
|
||||
int i;
|
||||
char* sep_button_names[] = {"space_cbutton",
|
||||
"tab_cbutton",
|
||||
"comma_cbutton",
|
||||
"colon_cbutton",
|
||||
"semicolon_cbutton",
|
||||
"hyphen_cbutton"
|
||||
};
|
||||
GtkContainer *date_format_container, *currency_format_container;
|
||||
int i;
|
||||
|
||||
/* The table containing info->encselector and the separator configuration widgets */
|
||||
GtkTable* enctable;
|
||||
PangoContext* context; /* Used to set a monotype font on info->treeview */
|
||||
/* The table containing info->encselector and the separator configuration widgets */
|
||||
GtkTable* enctable;
|
||||
PangoContext* context; /* Used to set a monotype font on info->treeview */
|
||||
|
||||
info->start_row_spin = GTK_WIDGET(gtk_builder_get_object (builder, "start_row"));
|
||||
info->end_row_spin = GTK_WIDGET(gtk_builder_get_object (builder, "end_row"));
|
||||
info->check_label = GTK_WIDGET(gtk_builder_get_object (builder, "check_label"));
|
||||
info->check_butt = GTK_WIDGET(gtk_builder_get_object (builder, "check_butt"));
|
||||
info->start_row_spin = GTK_WIDGET(gtk_builder_get_object (builder, "start_row"));
|
||||
info->end_row_spin = GTK_WIDGET(gtk_builder_get_object (builder, "end_row"));
|
||||
info->check_label = GTK_WIDGET(gtk_builder_get_object (builder, "check_label"));
|
||||
info->check_butt = GTK_WIDGET(gtk_builder_get_object (builder, "check_butt"));
|
||||
|
||||
info->encselector = GO_CHARMAP_SEL(go_charmap_sel_new(GO_CHARMAP_SEL_TO_UTF8));
|
||||
/* Connect the selector to the encoding_selected event handler. */
|
||||
g_signal_connect(G_OBJECT(info->encselector), "charmap_changed",
|
||||
G_CALLBACK(encoding_selected), (gpointer)info);
|
||||
info->encselector = GO_CHARMAP_SEL(go_charmap_sel_new(GO_CHARMAP_SEL_TO_UTF8));
|
||||
/* Connect the selector to the encoding_selected event handler. */
|
||||
g_signal_connect(G_OBJECT(info->encselector), "charmap_changed",
|
||||
G_CALLBACK(encoding_selected), (gpointer)info);
|
||||
|
||||
/* Load the separator buttons from the glade builder file into the
|
||||
* info->sep_buttons array. */
|
||||
for (i = 0; i < SEP_NUM_OF_TYPES; i++)
|
||||
{
|
||||
info->sep_buttons[i]
|
||||
= (GtkCheckButton*)GTK_WIDGET(gtk_builder_get_object (builder, sep_button_names[i]));
|
||||
/* Connect them to the sep_button_clicked event handler. */
|
||||
g_signal_connect(G_OBJECT(info->sep_buttons[i]), "toggled",
|
||||
/* Load the separator buttons from the glade builder file into the
|
||||
* info->sep_buttons array. */
|
||||
for (i = 0; i < SEP_NUM_OF_TYPES; i++)
|
||||
{
|
||||
info->sep_buttons[i]
|
||||
= (GtkCheckButton*)GTK_WIDGET(gtk_builder_get_object (builder, sep_button_names[i]));
|
||||
/* Connect them to the sep_button_clicked event handler. */
|
||||
g_signal_connect(G_OBJECT(info->sep_buttons[i]), "toggled",
|
||||
G_CALLBACK(sep_button_clicked), (gpointer)info);
|
||||
}
|
||||
|
||||
/* Load and connect the custom separator checkbutton in the same way
|
||||
* as the other separator buttons. */
|
||||
info->custom_cbutton
|
||||
= (GtkCheckButton*)GTK_WIDGET(gtk_builder_get_object (builder, "custom_cbutton"));
|
||||
g_signal_connect(G_OBJECT(info->custom_cbutton), "clicked",
|
||||
G_CALLBACK(sep_button_clicked), (gpointer)info);
|
||||
}
|
||||
|
||||
/* Load and connect the custom separator checkbutton in the same way
|
||||
* as the other separator buttons. */
|
||||
info->custom_cbutton
|
||||
= (GtkCheckButton*)GTK_WIDGET(gtk_builder_get_object (builder, "custom_cbutton"));
|
||||
g_signal_connect(G_OBJECT(info->custom_cbutton), "clicked",
|
||||
G_CALLBACK(sep_button_clicked), (gpointer)info);
|
||||
/* Load the entry for the custom separator entry. Connect it to the
|
||||
* sep_button_clicked event handler as well. */
|
||||
info->custom_entry = (GtkEntry*)GTK_WIDGET(gtk_builder_get_object (builder, "custom_entry"));
|
||||
g_signal_connect(G_OBJECT(info->custom_entry), "changed",
|
||||
G_CALLBACK(sep_button_clicked), (gpointer)info);
|
||||
|
||||
/* Load the entry for the custom separator entry. Connect it to the
|
||||
* sep_button_clicked event handler as well. */
|
||||
info->custom_entry = (GtkEntry*)GTK_WIDGET(gtk_builder_get_object (builder, "custom_entry"));
|
||||
g_signal_connect(G_OBJECT(info->custom_entry), "changed",
|
||||
G_CALLBACK(sep_button_clicked), (gpointer)info);
|
||||
/* Get the table from the Glade builder file. */
|
||||
enctable = GTK_TABLE(gtk_builder_get_object (builder, "enctable"));
|
||||
/* Put the selector in at the top. */
|
||||
gtk_table_attach_defaults(enctable, GTK_WIDGET(info->encselector), 1, 2, 0, 1);
|
||||
/* Show the table in all its glory. */
|
||||
gtk_widget_show_all(GTK_WIDGET(enctable));
|
||||
|
||||
/* Get the table from the Glade builder file. */
|
||||
enctable = GTK_TABLE(gtk_builder_get_object (builder, "enctable"));
|
||||
/* Put the selector in at the top. */
|
||||
gtk_table_attach_defaults(enctable, GTK_WIDGET(info->encselector), 1, 2, 0, 1);
|
||||
/* Show the table in all its glory. */
|
||||
gtk_widget_show_all(GTK_WIDGET(enctable));
|
||||
/* The instructions label and image */
|
||||
info->instructions_label = GTK_LABEL(gtk_builder_get_object (builder, "instructions_label"));
|
||||
info->instructions_image = GTK_IMAGE(gtk_builder_get_object (builder, "instructions_image"));
|
||||
|
||||
/* The instructions label and image */
|
||||
info->instructions_label = GTK_LABEL(gtk_builder_get_object (builder, "instructions_label"));
|
||||
info->instructions_image = GTK_IMAGE(gtk_builder_get_object (builder, "instructions_image"));
|
||||
/* Add in the date format combo box and hook it up to an event handler. */
|
||||
info->date_format_combo = GTK_COMBO_BOX(gtk_combo_box_new_text());
|
||||
for (i = 0; i < num_date_formats; i++)
|
||||
{
|
||||
gtk_combo_box_append_text(info->date_format_combo, _(date_format_user[i]));
|
||||
}
|
||||
gtk_combo_box_set_active(info->date_format_combo, 0);
|
||||
g_signal_connect(G_OBJECT(info->date_format_combo), "changed",
|
||||
G_CALLBACK(date_format_selected), (gpointer)info);
|
||||
|
||||
/* Add in the date format combo box and hook it up to an event handler. */
|
||||
info->date_format_combo = GTK_COMBO_BOX(gtk_combo_box_new_text());
|
||||
for (i = 0; i < num_date_formats; i++)
|
||||
{
|
||||
gtk_combo_box_append_text(info->date_format_combo, _(date_format_user[i]));
|
||||
}
|
||||
gtk_combo_box_set_active(info->date_format_combo, 0);
|
||||
g_signal_connect(G_OBJECT(info->date_format_combo), "changed",
|
||||
G_CALLBACK(date_format_selected), (gpointer)info);
|
||||
/* Add it to the assistant. */
|
||||
date_format_container = GTK_CONTAINER(gtk_builder_get_object (builder, "date_format_container"));
|
||||
gtk_container_add(date_format_container, GTK_WIDGET(info->date_format_combo));
|
||||
gtk_widget_show_all(GTK_WIDGET(date_format_container));
|
||||
|
||||
/* Add it to the assistant. */
|
||||
date_format_container = GTK_CONTAINER(gtk_builder_get_object (builder, "date_format_container"));
|
||||
gtk_container_add(date_format_container, GTK_WIDGET(info->date_format_combo));
|
||||
gtk_widget_show_all(GTK_WIDGET(date_format_container));
|
||||
/* Add in the currency format combo box and hook it up to an event handler. */
|
||||
info->currency_format_combo = GTK_COMBO_BOX(gtk_combo_box_new_text());
|
||||
for (i = 0; i < num_currency_formats; i++)
|
||||
{
|
||||
gtk_combo_box_append_text(info->currency_format_combo, _(currency_format_user[i]));
|
||||
}
|
||||
/* Default will the locale */
|
||||
gtk_combo_box_set_active(info->currency_format_combo, 0);
|
||||
g_signal_connect(G_OBJECT(info->currency_format_combo), "changed",
|
||||
G_CALLBACK(currency_format_selected), (gpointer)info);
|
||||
|
||||
/* Add in the currency format combo box and hook it up to an event handler. */
|
||||
info->currency_format_combo = GTK_COMBO_BOX(gtk_combo_box_new_text());
|
||||
for (i = 0; i < num_currency_formats; i++)
|
||||
{
|
||||
gtk_combo_box_append_text(info->currency_format_combo, _(currency_format_user[i]));
|
||||
}
|
||||
/* Default will the locale */
|
||||
gtk_combo_box_set_active(info->currency_format_combo, 0);
|
||||
g_signal_connect(G_OBJECT(info->currency_format_combo), "changed",
|
||||
G_CALLBACK(currency_format_selected), (gpointer)info);
|
||||
/* Add it to the assistant. */
|
||||
currency_format_container = GTK_CONTAINER(gtk_builder_get_object (builder, "currency_format_container"));
|
||||
gtk_container_add(currency_format_container, GTK_WIDGET(info->currency_format_combo));
|
||||
gtk_widget_show_all(GTK_WIDGET(currency_format_container));
|
||||
|
||||
/* Add it to the assistant. */
|
||||
currency_format_container = GTK_CONTAINER(gtk_builder_get_object (builder, "currency_format_container"));
|
||||
gtk_container_add(currency_format_container, GTK_WIDGET(info->currency_format_combo));
|
||||
gtk_widget_show_all(GTK_WIDGET(currency_format_container));
|
||||
/* Connect the CSV/Fixed-Width radio button event handler. */
|
||||
csv_button = GTK_WIDGET(gtk_builder_get_object (builder, "csv_button"));
|
||||
g_signal_connect(csv_button, "toggled",
|
||||
G_CALLBACK(separated_or_fixed_selected), (gpointer)info);
|
||||
|
||||
/* Connect the CSV/Fixed-Width radio button event handler. */
|
||||
csv_button = GTK_WIDGET(gtk_builder_get_object (builder, "csv_button"));
|
||||
g_signal_connect(csv_button, "toggled",
|
||||
G_CALLBACK(separated_or_fixed_selected), (gpointer)info);
|
||||
/* Load the data treeview and connect it to its resizing event handler. */
|
||||
info->treeview = (GtkTreeView*)GTK_WIDGET(gtk_builder_get_object (builder, "treeview"));
|
||||
context = gtk_widget_create_pango_context(GTK_WIDGET(info->treeview));
|
||||
|
||||
/* Load the data treeview and connect it to its resizing event handler. */
|
||||
info->treeview = (GtkTreeView*)GTK_WIDGET(gtk_builder_get_object (builder, "treeview"));
|
||||
context = gtk_widget_create_pango_context(GTK_WIDGET(info->treeview));
|
||||
/* Load the column type treeview. */
|
||||
info->ctreeview = (GtkTreeView*)GTK_WIDGET(gtk_builder_get_object (builder, "ctreeview"));
|
||||
|
||||
/* Load the column type treeview. */
|
||||
info->ctreeview = (GtkTreeView*)GTK_WIDGET(gtk_builder_get_object (builder, "ctreeview"));
|
||||
/* This is TRUE only after encoding_selected is called, so we must
|
||||
* set it initially to FALSE. */
|
||||
info->encoding_selected_called = FALSE;
|
||||
|
||||
/* This is TRUE only after encoding_selected is called, so we must
|
||||
* set it initially to FALSE. */
|
||||
info->encoding_selected_called = FALSE;
|
||||
|
||||
/* It is empty at first. */
|
||||
info->not_empty = FALSE;
|
||||
/* It is empty at first. */
|
||||
info->not_empty = FALSE;
|
||||
}
|
||||
|
||||
/* Account page */
|
||||
|
@ -29,7 +29,7 @@
|
||||
#define GNC_ASSISTANT_CSV_IMPORT_TRANS_H
|
||||
|
||||
|
||||
/** The gnc_file_csv_trans_import() will let the user import thte
|
||||
/** The gnc_file_csv_trans_import() will let the user import thte
|
||||
* account tree or transactions to a deliminated file.
|
||||
*/
|
||||
void gnc_file_csv_trans_import (void);
|
||||
|
@ -58,7 +58,7 @@ static QofLogModule log_module = GNC_MOD_ASSISTANT;
|
||||
*******************************************************/
|
||||
csv_import_result
|
||||
csv_import_read_file (const gchar *filename, const gchar *parser_regexp,
|
||||
GtkListStore *store, guint max_rows )
|
||||
GtkListStore *store, guint max_rows )
|
||||
{
|
||||
FILE *f;
|
||||
char *line;
|
||||
@ -113,8 +113,8 @@ csv_import_read_file (const gchar *filename, const gchar *parser_regexp,
|
||||
{
|
||||
int l;
|
||||
row++;
|
||||
if(row == max_rows)
|
||||
break;
|
||||
if (row == max_rows)
|
||||
break;
|
||||
// read one line
|
||||
if (!fgets (line, buffer_size, f))
|
||||
break; // eof
|
||||
@ -159,7 +159,7 @@ csv_import_read_file (const gchar *filename, const gchar *parser_regexp,
|
||||
g_regex_unref (regexpat);
|
||||
regexpat = 0;
|
||||
fclose (f);
|
||||
if(match_found == TRUE)
|
||||
if (match_found == TRUE)
|
||||
return MATCH_FOUND;
|
||||
else
|
||||
return RESULT_OK;
|
||||
@ -198,10 +198,10 @@ csv_account_import (CsvImportInfo *info)
|
||||
/* Walk through the list, reading each row */
|
||||
gtk_tree_model_get (GTK_TREE_MODEL (info->store), &iter,
|
||||
TYPE, &type,
|
||||
FULL_NAME, &full_name,
|
||||
NAME, &name,
|
||||
CODE, &code,
|
||||
DESCRIPTION, &description,
|
||||
FULL_NAME, &full_name,
|
||||
NAME, &name,
|
||||
CODE, &code,
|
||||
DESCRIPTION, &description,
|
||||
COLOR, &color,
|
||||
NOTES, ¬es,
|
||||
COMMODITYM, &commoditym,
|
||||
@ -227,28 +227,28 @@ csv_account_import (CsvImportInfo *info)
|
||||
/* Get full name of parent account, allow for separator */
|
||||
string_position = strlen(full_name) - strlen(name) - 1;
|
||||
|
||||
if(string_position == -1)
|
||||
if (string_position == -1)
|
||||
full_parent = g_strdup(full_name);
|
||||
else
|
||||
full_parent = g_strndup(full_name, string_position);
|
||||
|
||||
parent = gnc_account_lookup_by_full_name(root, full_parent);
|
||||
g_free (full_parent);
|
||||
|
||||
|
||||
if (parent == NULL && string_position != -1)
|
||||
{
|
||||
gchar *text = g_strdup_printf( gettext("Row %u, path to account %s not found, added as top level\n"), row +1, name );
|
||||
gchar *text = g_strdup_printf( gettext("Row %u, path to account %s not found, added as top level\n"), row + 1, name );
|
||||
info->error = g_strconcat(info->error, text, NULL);
|
||||
g_free(text);
|
||||
PINFO("Unable to import Row %u for account %s, path not found!", row, name);
|
||||
}
|
||||
|
||||
if (parent == NULL)
|
||||
parent = root;
|
||||
parent = root;
|
||||
|
||||
/* Do we have a valid commodity */
|
||||
table = gnc_commodity_table_get_table (book);
|
||||
commodity = gnc_commodity_table_lookup( table, commodityn, commoditym);
|
||||
commodity = gnc_commodity_table_lookup( table, commodityn, commoditym);
|
||||
|
||||
if (commodity)
|
||||
{
|
||||
@ -256,39 +256,39 @@ csv_account_import (CsvImportInfo *info)
|
||||
info->num_new = info->num_new + 1;
|
||||
gnc_suspend_gui_refresh ();
|
||||
acc = xaccMallocAccount (book);
|
||||
xaccAccountBeginEdit (acc);
|
||||
xaccAccountBeginEdit (acc);
|
||||
xaccAccountSetName (acc, name);
|
||||
xaccAccountSetType(acc, xaccAccountStringToEnum (type));
|
||||
|
||||
if(!g_strcmp0(notes, "") == 0)
|
||||
xaccAccountSetNotes (acc, notes);
|
||||
if(!g_strcmp0(description, "") == 0)
|
||||
if (!g_strcmp0(notes, "") == 0)
|
||||
xaccAccountSetNotes (acc, notes);
|
||||
if (!g_strcmp0(description, "") == 0)
|
||||
xaccAccountSetDescription (acc, description);
|
||||
if(!g_strcmp0(code, "") == 0)
|
||||
xaccAccountSetCode (acc, code);
|
||||
if (!g_strcmp0(code, "") == 0)
|
||||
xaccAccountSetCode (acc, code);
|
||||
|
||||
if(!g_strcmp0(color, "") == 0)
|
||||
{
|
||||
if (!g_strcmp0(color, "") == 0)
|
||||
{
|
||||
if (gdk_color_parse(color, &testcolor))
|
||||
xaccAccountSetColor (acc, color);
|
||||
}
|
||||
xaccAccountSetColor (acc, color);
|
||||
}
|
||||
|
||||
if(g_strcmp0(hidden, "T") == 0)
|
||||
if (g_strcmp0(hidden, "T") == 0)
|
||||
xaccAccountSetHidden (acc, TRUE);
|
||||
if(g_strcmp0(place_holder, "T") == 0)
|
||||
if (g_strcmp0(place_holder, "T") == 0)
|
||||
xaccAccountSetPlaceholder (acc, TRUE);
|
||||
|
||||
xaccAccountSetCommodity(acc, commodity);
|
||||
xaccAccountBeginEdit (parent);
|
||||
gnc_account_append_child (parent, acc);
|
||||
xaccAccountCommitEdit (parent);
|
||||
xaccAccountCommitEdit (acc);
|
||||
xaccAccountCommitEdit (acc);
|
||||
gnc_resume_gui_refresh ();
|
||||
}
|
||||
else
|
||||
{
|
||||
gchar *err_string = g_strdup_printf( gettext("Row %u, commodity %s / %s not found\n"), row +1,
|
||||
commoditym, commodityn);
|
||||
gchar *err_string = g_strdup_printf( gettext("Row %u, commodity %s / %s not found\n"), row + 1,
|
||||
commoditym, commodityn);
|
||||
info->error = g_strconcat(info->error, err_string, NULL);
|
||||
g_free(err_string);
|
||||
PINFO("Unable to import Row %u for account %s, commodity!", row, full_name);
|
||||
@ -296,7 +296,7 @@ csv_account_import (CsvImportInfo *info)
|
||||
}
|
||||
else
|
||||
{
|
||||
gchar *err_string = g_strdup_printf( gettext("Row %u, account %s not in %s\n"), row +1, name, full_name);
|
||||
gchar *err_string = g_strdup_printf( gettext("Row %u, account %s not in %s\n"), row + 1, name, full_name);
|
||||
info->error = g_strconcat(info->error, err_string, NULL);
|
||||
g_free(err_string);
|
||||
PINFO("Unable to import Row %u for account %s, name!", row, full_name);
|
||||
@ -306,14 +306,14 @@ csv_account_import (CsvImportInfo *info)
|
||||
{
|
||||
/* Lets try and update the color, notes, description, code entries */
|
||||
DEBUG("Existing account, will try and update account %s", full_name);
|
||||
info->num_updates = info->num_updates +1;
|
||||
if(!g_strcmp0(color, "") == 0)
|
||||
{
|
||||
info->num_updates = info->num_updates + 1;
|
||||
if (!g_strcmp0(color, "") == 0)
|
||||
{
|
||||
if (gdk_color_parse(color, &testcolor))
|
||||
xaccAccountSetColor (acc, color);
|
||||
}
|
||||
xaccAccountSetColor (acc, color);
|
||||
}
|
||||
|
||||
if(!g_strcmp0(notes, "") == 0)
|
||||
if (!g_strcmp0(notes, "") == 0)
|
||||
{
|
||||
/* Check for multiple lines */
|
||||
gchar **parts;
|
||||
@ -323,11 +323,11 @@ csv_account_import (CsvImportInfo *info)
|
||||
}
|
||||
xaccAccountSetNotes (acc, notes);
|
||||
|
||||
if(!g_strcmp0(description, "") == 0)
|
||||
if (!g_strcmp0(description, "") == 0)
|
||||
xaccAccountSetDescription (acc, description);
|
||||
if(!g_strcmp0(code, "") == 0)
|
||||
xaccAccountSetCode (acc, code);
|
||||
}
|
||||
if (!g_strcmp0(code, "") == 0)
|
||||
xaccAccountSetCode (acc, code);
|
||||
}
|
||||
valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (info->store), &iter);
|
||||
row++;
|
||||
|
||||
|
@ -40,9 +40,9 @@ const gchar* date_format_user[] = {N_("y-m-d"),
|
||||
|
||||
const int num_currency_formats = 3;
|
||||
const gchar* currency_format_user[] = {N_("Locale"),
|
||||
N_("Period: 123,456.78"),
|
||||
N_("Comma: 123.456,78")
|
||||
};
|
||||
N_("Period: 123,456.78"),
|
||||
N_("Comma: 123.456,78")
|
||||
};
|
||||
|
||||
/* This array contains all of the different strings for different column types. */
|
||||
gchar* gnc_csv_column_type_strs[GNC_CSV_NUM_COL_TYPES] = {N_("None"),
|
||||
@ -462,7 +462,7 @@ GError** error)
|
||||
parse_data->raw_str.end = parse_data->raw_str.begin + g_mapped_file_get_length(parse_data->raw_mapping);
|
||||
|
||||
/* Make a guess at the encoding of the data. */
|
||||
if(!g_mapped_file_get_length(parse_data->raw_mapping) == 0)
|
||||
if (!g_mapped_file_get_length(parse_data->raw_mapping) == 0)
|
||||
guess_enc = go_guess_encoding((const char*)(parse_data->raw_str.begin),
|
||||
(size_t)(parse_data->raw_str.end - parse_data->raw_str.begin),
|
||||
"UTF-8", NULL);
|
||||
@ -524,7 +524,7 @@ int gnc_csv_parse(GncCsvParseData* parse_data, gboolean guessColTypes, GError**
|
||||
g_array_free(parse_data->orig_row_lengths, FALSE);
|
||||
|
||||
parse_data->orig_row_lengths =
|
||||
g_array_sized_new(FALSE, FALSE, sizeof(int), parse_data->orig_lines->len);
|
||||
g_array_sized_new(FALSE, FALSE, sizeof(int), parse_data->orig_lines->len);
|
||||
|
||||
g_array_set_size(parse_data->orig_row_lengths, parse_data->orig_lines->len);
|
||||
parse_data->orig_max_row = 0;
|
||||
@ -691,7 +691,7 @@ static gboolean trans_property_set(TransProperty* prop, char* str)
|
||||
{
|
||||
case 0:
|
||||
/* Currancy locale */
|
||||
if(!(xaccParseAmount(str_dupe, TRUE, &val, &endptr)))
|
||||
if (!(xaccParseAmount(str_dupe, TRUE, &val, &endptr)))
|
||||
{
|
||||
g_free(str_dupe);
|
||||
return FALSE;
|
||||
@ -699,7 +699,7 @@ static gboolean trans_property_set(TransProperty* prop, char* str)
|
||||
break;
|
||||
case 1:
|
||||
/* Currancy decimal period */
|
||||
if(!(xaccParseAmountExtended(str_dupe, TRUE, '-', '.', ',', "\003\003", "$+", &val, &endptr)))
|
||||
if (!(xaccParseAmountExtended(str_dupe, TRUE, '-', '.', ',', "\003\003", "$+", &val, &endptr)))
|
||||
{
|
||||
g_free(str_dupe);
|
||||
return FALSE;
|
||||
@ -707,7 +707,7 @@ static gboolean trans_property_set(TransProperty* prop, char* str)
|
||||
break;
|
||||
case 2:
|
||||
/* Currancy decimal comma */
|
||||
if(!(xaccParseAmountExtended(str_dupe, TRUE, '-', ',', '.', "\003\003", "$+", &val, &endptr)))
|
||||
if (!(xaccParseAmountExtended(str_dupe, TRUE, '-', ',', '.', "\003\003", "$+", &val, &endptr)))
|
||||
{
|
||||
g_free(str_dupe);
|
||||
return FALSE;
|
||||
@ -1047,7 +1047,7 @@ int gnc_csv_parse_to_trans(GncCsvParseData* parse_data, Account* account,
|
||||
}
|
||||
|
||||
/* set parse_data->end_row to number of lines */
|
||||
if(parse_data->end_row > parse_data->orig_lines->len)
|
||||
if (parse_data->end_row > parse_data->orig_lines->len)
|
||||
parse_data->end_row = parse_data->orig_lines->len;
|
||||
|
||||
while (i < parse_data->end_row)
|
||||
|
@ -96,8 +96,8 @@ gnc_plugin_csv_import_get_type (void)
|
||||
};
|
||||
|
||||
gnc_plugin_csv_import_type = g_type_register_static (GNC_TYPE_PLUGIN,
|
||||
"GncPluginCsvImport",
|
||||
&our_info, 0);
|
||||
"GncPluginCsvImport",
|
||||
&our_info, 0);
|
||||
}
|
||||
|
||||
return gnc_plugin_csv_import_type;
|
||||
@ -159,21 +159,21 @@ gnc_plugin_csv_import_finalize (GObject *object)
|
||||
************************************************************/
|
||||
static void
|
||||
gnc_plugin_csv_import_tree_cmd (GtkAction *action,
|
||||
GncMainWindowActionData *data)
|
||||
GncMainWindowActionData *data)
|
||||
{
|
||||
gnc_file_csv_account_import ();
|
||||
gnc_file_csv_account_import ();
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_plugin_csv_import_trans_cmd (GtkAction *action,
|
||||
GncMainWindowActionData *data)
|
||||
GncMainWindowActionData *data)
|
||||
{
|
||||
gnc_file_csv_trans_import ();
|
||||
gnc_file_csv_trans_import ();
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_plugin_csv_import_transx_cmd (GtkAction *action,
|
||||
GncMainWindowActionData *data)
|
||||
GncMainWindowActionData *data)
|
||||
{
|
||||
gnc_file_csv_import();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/********************************************************************\
|
||||
* import-account-matcher.c - flexible account picker/matcher *
|
||||
* *
|
||||
* *
|
||||
* Copyright (C) 2002 Benoit Grégoire <bock@step.polymtl.ca> *
|
||||
* Copyright (C) 2012 Robert Fewell *
|
||||
* *
|
||||
@ -68,7 +68,7 @@ static AccountPickerDialog* gnc_import_new_account_picker(void)
|
||||
picker->new_account_default_commodity = NULL;
|
||||
picker->new_account_default_type = 0;
|
||||
picker->default_account = NULL;
|
||||
picker->retAccount =NULL;
|
||||
picker->retAccount = NULL;
|
||||
return picker;
|
||||
}
|
||||
|
||||
@ -170,7 +170,7 @@ account_tree_row_activated_cb(GtkTreeView *view, GtkTreePath *path,
|
||||
Account *old_id_acc;
|
||||
|
||||
/* See if we have a dialog, if not we are an assistant */
|
||||
if(picker->dialog == NULL)
|
||||
if (picker->dialog == NULL)
|
||||
{
|
||||
GtkAssistant *assistant = GTK_ASSISTANT(picker->assistant);
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
@ -187,20 +187,20 @@ account_tree_row_activated_cb(GtkTreeView *view, GtkTreePath *path,
|
||||
if (picker->retAccount && xaccAccountGetPlaceholder (picker->retAccount))
|
||||
{
|
||||
gnc_error_dialog (picker->dialog,
|
||||
_("The account %s is a placeholder account and does not allow "
|
||||
"transactions. Please choose a different account."),
|
||||
retval_name);
|
||||
_("The account %s is a placeholder account and does not allow "
|
||||
"transactions. Please choose a different account."),
|
||||
retval_name);
|
||||
}
|
||||
else if ( picker->account_online_id_value != NULL)
|
||||
{
|
||||
/* find the old account for this on line id value and reset it */
|
||||
old_id_acc =
|
||||
gnc_account_foreach_descendant_until(gnc_get_current_root_account (),
|
||||
test_acct_online_id_match,
|
||||
/* This argument will only be used as a "const char*" */
|
||||
(void*)picker->account_online_id_value);
|
||||
test_acct_online_id_match,
|
||||
/* This argument will only be used as a "const char*" */
|
||||
(void*)picker->account_online_id_value);
|
||||
|
||||
if(old_id_acc != NULL)
|
||||
if (old_id_acc != NULL)
|
||||
gnc_import_set_acc_online_id(old_id_acc, "");
|
||||
|
||||
gnc_import_set_acc_online_id(picker->retAccount, picker->account_online_id_value);
|
||||
@ -262,8 +262,8 @@ Account * gnc_import_select_account(GtkWidget *parent,
|
||||
{
|
||||
/* load the interface */
|
||||
builder = gtk_builder_new();
|
||||
gnc_builder_add_from_file (builder,"dialog-import.glade", "account_picker");
|
||||
gnc_builder_add_from_file (builder,"dialog-import.glade", "account_picker_content");
|
||||
gnc_builder_add_from_file (builder, "dialog-import.glade", "account_picker");
|
||||
gnc_builder_add_from_file (builder, "dialog-import.glade", "account_picker_content");
|
||||
/* connect the signals in the interface */
|
||||
if (builder == NULL)
|
||||
{
|
||||
@ -277,7 +277,7 @@ Account * gnc_import_select_account(GtkWidget *parent,
|
||||
/* Pack the content into the dialog vbox */
|
||||
pbox = GTK_WIDGET(gtk_builder_get_object (builder, "account_picker_vbox"));
|
||||
box = GTK_WIDGET(gtk_builder_get_object (builder, "account_picker_content"));
|
||||
gtk_box_pack_start( GTK_BOX(pbox), box, TRUE, TRUE,0);
|
||||
gtk_box_pack_start( GTK_BOX(pbox), box, TRUE, TRUE, 0);
|
||||
|
||||
picker->account_tree_sw = GTK_WIDGET(gtk_builder_get_object (builder, "account_tree_sw"));
|
||||
online_id_label = GTK_WIDGET(gtk_builder_get_object (builder, "online_id_label"));
|
||||
@ -391,7 +391,7 @@ AccountPickerDialog* gnc_import_account_assist_setup(GtkWidget *parent)
|
||||
|
||||
/* load the interface */
|
||||
builder = gtk_builder_new();
|
||||
gnc_builder_add_from_file (builder,"dialog-import.glade", "account_picker_content");
|
||||
gnc_builder_add_from_file (builder, "dialog-import.glade", "account_picker_content");
|
||||
/* connect the signals in the interface */
|
||||
if (builder == NULL)
|
||||
{
|
||||
@ -412,12 +412,12 @@ AccountPickerDialog* gnc_import_account_assist_setup(GtkWidget *parent)
|
||||
gtk_button_set_use_stock (GTK_BUTTON(button), TRUE);
|
||||
gtk_widget_show (button);
|
||||
g_signal_connect(button, "clicked",
|
||||
G_CALLBACK(gnc_import_add_account), picker);
|
||||
G_CALLBACK(gnc_import_add_account), picker);
|
||||
|
||||
build_acct_tree(picker);
|
||||
|
||||
g_signal_connect(picker->account_tree, "row-activated",
|
||||
G_CALLBACK(account_tree_row_activated_cb), picker);
|
||||
G_CALLBACK(account_tree_row_activated_cb), picker);
|
||||
|
||||
g_object_unref(G_OBJECT(builder));
|
||||
return picker;
|
||||
@ -452,22 +452,22 @@ Account * gnc_import_account_assist_update (AccountPickerDialog *picker)
|
||||
if (picker->account_human_description != NULL)
|
||||
{
|
||||
strncat(account_description_text, picker->account_human_description,
|
||||
ACCOUNT_DESCRIPTION_MAX_SIZE - strlen(account_description_text));
|
||||
ACCOUNT_DESCRIPTION_MAX_SIZE - strlen(account_description_text));
|
||||
strncat(account_description_text, "\n",
|
||||
ACCOUNT_DESCRIPTION_MAX_SIZE - strlen(account_description_text));
|
||||
ACCOUNT_DESCRIPTION_MAX_SIZE - strlen(account_description_text));
|
||||
}
|
||||
if (picker->account_online_id_value != NULL)
|
||||
{
|
||||
strncat(account_description_text, _("(Full account ID: "),
|
||||
ACCOUNT_DESCRIPTION_MAX_SIZE - strlen(account_description_text));
|
||||
ACCOUNT_DESCRIPTION_MAX_SIZE - strlen(account_description_text));
|
||||
strncat(account_description_text, picker->account_online_id_value,
|
||||
ACCOUNT_DESCRIPTION_MAX_SIZE - strlen(account_description_text));
|
||||
ACCOUNT_DESCRIPTION_MAX_SIZE - strlen(account_description_text));
|
||||
strncat(account_description_text, ")",
|
||||
ACCOUNT_DESCRIPTION_MAX_SIZE - strlen(account_description_text));
|
||||
ACCOUNT_DESCRIPTION_MAX_SIZE - strlen(account_description_text));
|
||||
}
|
||||
gtk_label_set_text(GTK_LABEL( picker->account_online_id_label), account_description_text);
|
||||
|
||||
if(picker->default_account == NULL)
|
||||
|
||||
if (picker->default_account == NULL)
|
||||
gnc_tree_view_account_set_selected_account(picker->account_tree, picker->retAccount);
|
||||
else
|
||||
gnc_tree_view_account_set_selected_account(picker->account_tree, picker->default_account);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/********************************************************************\
|
||||
* import-account-matcher.h - flexible account picker/matcher *
|
||||
* *
|
||||
* *
|
||||
* Copyright (C) 2002 Benoit Grégoire <bock@step.polymtl.ca> *
|
||||
* Copyright (C) 2012 Robert Fewell *
|
||||
* *
|
||||
@ -49,7 +49,7 @@ typedef struct
|
||||
GNCAccountType new_account_default_type; /* new account default type, incoming */
|
||||
Account *default_account; /* default account for selection, incoming */
|
||||
Account *retAccount; /* Account value returned to caller */
|
||||
}AccountPickerDialog;
|
||||
} AccountPickerDialog;
|
||||
|
||||
/** Must be called with a string containing a unique identifier for the
|
||||
account. If an account with a matching online_id kvp_frame is
|
||||
@ -123,10 +123,10 @@ Account * gnc_import_select_account(GtkWidget *parent,
|
||||
);
|
||||
|
||||
|
||||
/** Must be called with the parent widget, ie. a vbox that the
|
||||
/** Must be called with the parent widget, ie. a vbox that the
|
||||
account picker dialog will be packed into. The data structure
|
||||
AccountPickerDialog is initialised and default values populated.
|
||||
|
||||
|
||||
@param parent The parent widget. This is the place the account picker dialog will
|
||||
be packed into.
|
||||
|
||||
@ -136,8 +136,8 @@ AccountPickerDialog * gnc_import_account_assist_setup (GtkWidget *parent);
|
||||
|
||||
|
||||
/** Must be called with an AccountPickerDialog structure allready setup.
|
||||
If an account with a matching online_id kvp_frame is found, which is
|
||||
allready present in the dialog structure, the function returns with a
|
||||
If an account with a matching online_id kvp_frame is found, which is
|
||||
allready present in the dialog structure, the function returns with a
|
||||
pointer to that account or NULL if not found.
|
||||
|
||||
@param Account picker Dialog structure, AccountPickerDialog
|
||||
|
@ -143,7 +143,7 @@ gnc_import_choose_fmt(const char* msg, GncImportFormat fmts, gpointer data)
|
||||
}
|
||||
/* Open the Glade Builder file */
|
||||
builder = gtk_builder_new();
|
||||
gnc_builder_add_from_file (builder,"dialog-import.glade", "format_picker");
|
||||
gnc_builder_add_from_file (builder, "dialog-import.glade", "format_picker");
|
||||
dialog = GTK_WIDGET(gtk_builder_get_object (builder, "format_picker"));
|
||||
widget = GTK_WIDGET(gtk_builder_get_object (builder, "msg_label"));
|
||||
gtk_label_set_text(GTK_LABEL(widget), msg);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/********************************************************************\
|
||||
* import-main-matcher.c - Transaction matcher main window *
|
||||
* *
|
||||
* *
|
||||
* Copyright (C) 2002 Benoit Grégoire <bock@step.polymtl.ca> *
|
||||
* Copyright (C) 2002 Christian Stimming *
|
||||
* Copyright (c) 2006 David Hampton <hampton@employees.org> *
|
||||
@ -134,7 +134,7 @@ void gnc_gen_trans_list_delete (GNCImportMainMatcher *info)
|
||||
}
|
||||
|
||||
|
||||
if(!(info->dialog == NULL))
|
||||
if (!(info->dialog == NULL))
|
||||
{
|
||||
gnc_save_window_size(GCONF_SECTION, GTK_WINDOW(info->dialog));
|
||||
gnc_import_Settings_delete (info->user_settings);
|
||||
@ -566,7 +566,7 @@ GNCImportMainMatcher *gnc_gen_trans_list_new (GtkWidget *parent,
|
||||
/* Pack the content into the dialog vbox */
|
||||
pbox = GTK_WIDGET(gtk_builder_get_object (builder, "transaction_matcher_vbox"));
|
||||
box = GTK_WIDGET(gtk_builder_get_object (builder, "transaction_matcher_content"));
|
||||
gtk_box_pack_start( GTK_BOX(pbox), box, TRUE, TRUE,0);
|
||||
gtk_box_pack_start( GTK_BOX(pbox), box, TRUE, TRUE, 0);
|
||||
|
||||
/* Get the view */
|
||||
info->view = GTK_TREE_VIEW(gtk_builder_get_object (builder, "downloaded_view"));
|
||||
@ -659,7 +659,7 @@ GNCImportMainMatcher * gnc_gen_trans_assist_new (GtkWidget *parent,
|
||||
g_object_unref(G_OBJECT(builder));
|
||||
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
||||
void gnc_gen_trans_assist_start (GNCImportMainMatcher *info)
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
/********************************************************************\
|
||||
* import-main-matcher.h - Transaction matcher main window *
|
||||
* *
|
||||
* *
|
||||
* Copyright (C) 2002 Benoit Grégoire <bock@step.polymtl.ca> *
|
||||
* Copyright (C) 2002 Christian Stimming *
|
||||
* Copyright (C) 2012 Robert Fewell *
|
||||
@ -72,7 +72,7 @@ GNCImportMainMatcher *gnc_gen_trans_list_new (GtkWidget *parent,
|
||||
|
||||
|
||||
/** Add the Transaction matcher to an existing page of an assistant.
|
||||
* Must be called with the parent widget, ie. a vbox that the
|
||||
* Must be called with the parent widget, ie. a vbox that the
|
||||
* transaction matcher will be packed into. The data structure
|
||||
* GNCImportMainMatcher is returned.
|
||||
*
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include "dialog-commodity.h"
|
||||
#include "dialog-progress.h"
|
||||
#include "dialog-utils.h"
|
||||
#include "dialog-file-access.h"
|
||||
#include "dialog-file-access.h"
|
||||
#include "assistant-qif-import.h"
|
||||
#include "assistant-utils.h"
|
||||
#include "gnc-component-manager.h"
|
||||
@ -96,7 +96,7 @@ struct _qifimportwindow
|
||||
{
|
||||
GtkWidget * window;
|
||||
GtkWidget * assistant;
|
||||
|
||||
|
||||
/* Widgets on the file selection page. */
|
||||
GtkWidget * filename_entry;
|
||||
|
||||
@ -938,7 +938,7 @@ new_security_page(SCM security_hash_key, gnc_commodity *comm, QIFImportWindow *w
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), retval->namespace_combo,
|
||||
1, 2, 2, 3);
|
||||
|
||||
gtk_container_set_border_width(GTK_CONTAINER(page),12);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(page), 12);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(page), table, FALSE, FALSE, 12);
|
||||
|
||||
@ -1338,7 +1338,7 @@ gnc_ui_qif_import_close_cb(GtkAssistant *gtkassistant, gpointer user_data)
|
||||
QIFImportWindow *wind = user_data;
|
||||
|
||||
/* If We did not have an account tree, lets save it */
|
||||
if(!wind->acct_tree_found)
|
||||
if (!wind->acct_tree_found)
|
||||
gnc_ui_file_access_for_save_as();
|
||||
|
||||
gnc_close_gui_component_by_data( ASSISTANT_QIF_IMPORT_CM_CLASS, wind );
|
||||
@ -1486,7 +1486,7 @@ initialize_scheme(QIFImportWindow *wind)
|
||||
|
||||
|
||||
/*****************************************
|
||||
* Page 0 - Intro Page Page
|
||||
* Page 0 - Intro Page Page
|
||||
****************************************/
|
||||
|
||||
/********************************************************************
|
||||
@ -1531,7 +1531,7 @@ gnc_ui_qif_import_intro_prepare (GtkAssistant *assistant, gpointer user_data)
|
||||
********************************************************************/
|
||||
static gboolean
|
||||
gnc_ui_qif_import_load_file_complete (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
QIFImportWindow * wind = user_data;
|
||||
const gchar * path_to_load;
|
||||
@ -1659,7 +1659,7 @@ gnc_ui_qif_import_select_file_cb(GtkButton * button,
|
||||
********************************************************************/
|
||||
void
|
||||
gnc_ui_qif_import_load_progress_pause_cb(GtkButton * button,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
QIFImportWindow *wind = user_data;
|
||||
SCM toggle_pause = scm_c_eval_string("qif-import:toggle-pause");
|
||||
@ -1699,7 +1699,7 @@ gnc_ui_qif_import_load_progress_pause_cb(GtkButton * button,
|
||||
********************************************************************/
|
||||
void
|
||||
gnc_ui_qif_import_load_progress_start_cb(GtkButton * button,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
QIFImportWindow *wind = user_data;
|
||||
gint num = gtk_assistant_get_current_page (GTK_ASSISTANT(wind->window));
|
||||
@ -1938,7 +1938,7 @@ gnc_ui_qif_import_load_progress_start_cb(GtkButton * button,
|
||||
gtk_widget_set_sensitive(wind->load_pause, FALSE);
|
||||
gtk_widget_set_sensitive(wind->load_start, FALSE);
|
||||
|
||||
if(wind->load_stop == FALSE)
|
||||
if (wind->load_stop == FALSE)
|
||||
{
|
||||
/* The file was loaded successfully. */
|
||||
gnc_progress_dialog_set_sub(wind->load_progress, _("Loading completed"));
|
||||
@ -1952,7 +1952,7 @@ gnc_ui_qif_import_load_progress_start_cb(GtkButton * button,
|
||||
wind->busy = FALSE;
|
||||
|
||||
/* Auto step to next page */
|
||||
gtk_assistant_set_current_page (GTK_ASSISTANT(wind->window), num + 1);
|
||||
gtk_assistant_set_current_page (GTK_ASSISTANT(wind->window), num + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2103,7 +2103,7 @@ gnc_ui_qif_import_account_prepare (GtkAssistant *assistant, gpointer user_data)
|
||||
********************************************************************/
|
||||
void
|
||||
gnc_ui_qif_import_acct_valid_cb(GtkWidget * widget,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
QIFImportWindow * wind = user_data;
|
||||
|
||||
@ -2115,13 +2115,13 @@ gnc_ui_qif_import_acct_valid_cb(GtkWidget * widget,
|
||||
|
||||
if (!acct_name || acct_name[0] == 0)
|
||||
{
|
||||
/* Disable the assistant Buttons */
|
||||
gtk_assistant_set_page_complete (assistant, page, FALSE);
|
||||
/* Disable the assistant Buttons */
|
||||
gtk_assistant_set_page_complete (assistant, page, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Enable the assistant Buttons */
|
||||
gtk_assistant_set_page_complete (assistant, page, TRUE);
|
||||
/* Enable the assistant Buttons */
|
||||
gtk_assistant_set_page_complete (assistant, page, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2137,7 +2137,7 @@ gnc_ui_qif_import_acct_valid_cb(GtkWidget * widget,
|
||||
********************************************************************/
|
||||
void
|
||||
gnc_ui_qif_import_loaded_files_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
QIFImportWindow * wind = user_data;
|
||||
|
||||
@ -2284,7 +2284,7 @@ update_file_page(QIFImportWindow * wind)
|
||||
********************************************************************/
|
||||
void
|
||||
gnc_ui_qif_import_account_doc_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
QIFImportWindow * wind = user_data;
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
@ -2298,11 +2298,11 @@ gnc_ui_qif_import_account_doc_prepare (GtkAssistant *assistant,
|
||||
gtk_assistant_set_page_complete (assistant, page, TRUE);
|
||||
|
||||
/* Jump to Summary page if load_stop TRUE */
|
||||
if(wind->load_stop)
|
||||
if (wind->load_stop)
|
||||
gtk_assistant_set_current_page (assistant, total - 1 );
|
||||
|
||||
/* Jump over doc page if show_doc_pages FALSE */
|
||||
if(!wind->show_doc_pages)
|
||||
if (!wind->show_doc_pages)
|
||||
gtk_assistant_set_current_page (assistant, num + 1 );
|
||||
}
|
||||
|
||||
@ -2318,7 +2318,7 @@ gnc_ui_qif_import_account_doc_prepare (GtkAssistant *assistant,
|
||||
********************************************************************/
|
||||
void
|
||||
gnc_ui_qif_import_account_match_prepare(GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
QIFImportWindow * wind = user_data;
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
@ -2367,7 +2367,7 @@ gnc_ui_qif_import_account_rematch_cb(GtkButton *button, gpointer user_data)
|
||||
********************************************************************/
|
||||
void
|
||||
gnc_ui_qif_import_catagory_doc_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
QIFImportWindow * wind = user_data;
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
@ -2381,11 +2381,11 @@ gnc_ui_qif_import_catagory_doc_prepare (GtkAssistant *assistant,
|
||||
gtk_assistant_set_page_complete (assistant, page, TRUE);
|
||||
|
||||
/* Jump to Summary page if load_stop TRUE */
|
||||
if(wind->load_stop)
|
||||
if (wind->load_stop)
|
||||
gtk_assistant_set_current_page (assistant, total - 1 );
|
||||
|
||||
/* Jump over doc page if show_doc_pages FALSE */
|
||||
if(!wind->show_doc_pages)
|
||||
if (!wind->show_doc_pages)
|
||||
gtk_assistant_set_current_page (assistant, num + 1 );
|
||||
|
||||
/* If there are no category mappings, jump the doc page. */
|
||||
@ -2406,7 +2406,7 @@ gnc_ui_qif_import_catagory_doc_prepare (GtkAssistant *assistant,
|
||||
****************************************************************/
|
||||
void
|
||||
gnc_ui_qif_import_catagory_match_prepare(GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
QIFImportWindow * wind = user_data;
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
@ -2452,7 +2452,7 @@ gnc_ui_qif_import_category_rematch_cb(GtkButton *button, gpointer user_data)
|
||||
********************************************************************/
|
||||
void
|
||||
gnc_ui_qif_import_memo_doc_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
QIFImportWindow * wind = user_data;
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
@ -2466,11 +2466,11 @@ gnc_ui_qif_import_memo_doc_prepare (GtkAssistant *assistant,
|
||||
gtk_assistant_set_page_complete (assistant, page, TRUE);
|
||||
|
||||
/* Jump to Summary page if load_stop TRUE */
|
||||
if(wind->load_stop)
|
||||
if (wind->load_stop)
|
||||
gtk_assistant_set_current_page (assistant, total - 1 );
|
||||
|
||||
/* Jump over doc page if show_doc_pages FALSE */
|
||||
if(!wind->show_doc_pages)
|
||||
if (!wind->show_doc_pages)
|
||||
gtk_assistant_set_current_page (assistant, num + 1 );
|
||||
|
||||
/* If there are no memo mappings, jump the doc page. */
|
||||
@ -2491,7 +2491,7 @@ gnc_ui_qif_import_memo_doc_prepare (GtkAssistant *assistant,
|
||||
****************************************************************/
|
||||
void
|
||||
gnc_ui_qif_import_memo_match_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
QIFImportWindow * wind = user_data;
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
@ -2540,7 +2540,7 @@ gnc_ui_qif_import_memo_rematch_cb(GtkButton *button, gpointer user_data)
|
||||
****************************************************************/
|
||||
void
|
||||
gnc_ui_qif_import_currency_prepare(GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
QIFImportWindow * wind = user_data;
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
@ -2602,7 +2602,7 @@ gnc_ui_qif_import_new_securities(QIFImportWindow * wind)
|
||||
********************************************************************/
|
||||
void
|
||||
gnc_ui_qif_import_commodity_doc_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
QIFImportWindow * wind = user_data;
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
@ -2616,7 +2616,7 @@ gnc_ui_qif_import_commodity_doc_prepare (GtkAssistant *assistant,
|
||||
gtk_assistant_set_page_complete (assistant, page, TRUE);
|
||||
|
||||
/* Jump to Summary page if load_stop TRUE */
|
||||
if(wind->load_stop)
|
||||
if (wind->load_stop)
|
||||
gtk_assistant_set_current_page (assistant, total - 1 );
|
||||
|
||||
/* If there are new securities, prepare the security pages. */
|
||||
@ -2627,7 +2627,7 @@ gnc_ui_qif_import_commodity_doc_prepare (GtkAssistant *assistant,
|
||||
gtk_assistant_set_current_page (assistant, num + 1 );
|
||||
|
||||
/* Jump over doc page if show_doc_pages FALSE */
|
||||
if(!wind->show_doc_pages)
|
||||
if (!wind->show_doc_pages)
|
||||
gtk_assistant_set_current_page (assistant, num + 1 );
|
||||
}
|
||||
|
||||
@ -2641,7 +2641,7 @@ gnc_ui_qif_import_commodity_doc_prepare (GtkAssistant *assistant,
|
||||
*******************************************/
|
||||
void
|
||||
gnc_ui_qif_import_commodity_new_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
QIFImportWindow *wind = user_data;
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
@ -2671,7 +2671,7 @@ gnc_ui_qif_import_commodity_new_prepare (GtkAssistant *assistant,
|
||||
********************************/
|
||||
static gboolean
|
||||
gnc_ui_qif_import_comm_valid (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
QIFImportWindow *wind = user_data;
|
||||
gint num = gtk_assistant_get_current_page (GTK_ASSISTANT(wind->window));
|
||||
@ -2779,7 +2779,7 @@ gnc_ui_qif_import_comm_changed_cb (GtkWidget *widget, gpointer user_data)
|
||||
********************************************************************/
|
||||
void
|
||||
gnc_ui_qif_import_convert_progress_pause_cb(GtkButton * button,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
QIFImportWindow *wind = user_data;
|
||||
SCM toggle_pause = scm_c_eval_string("qif-import:toggle-pause");
|
||||
@ -2819,7 +2819,7 @@ gnc_ui_qif_import_convert_progress_pause_cb(GtkButton * button,
|
||||
********************************************************************/
|
||||
void
|
||||
gnc_ui_qif_import_convert_progress_start_cb(GtkButton * button,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
QIFImportWindow *wind = user_data;
|
||||
gint num = gtk_assistant_get_current_page (GTK_ASSISTANT(wind->window));
|
||||
@ -2991,11 +2991,11 @@ gnc_ui_qif_import_convert_progress_start_cb(GtkButton * button,
|
||||
gtk_widget_set_sensitive(wind->convert_pause, FALSE);
|
||||
gtk_widget_set_sensitive(wind->convert_start, FALSE);
|
||||
|
||||
if(wind->load_stop == FALSE)
|
||||
if (wind->load_stop == FALSE)
|
||||
{
|
||||
/* The conversion completed successfully. */
|
||||
gnc_progress_dialog_set_sub(wind->convert_progress,
|
||||
_("Conversion completed"));
|
||||
_("Conversion completed"));
|
||||
gnc_progress_dialog_set_value(wind->convert_progress, 1);
|
||||
|
||||
gtk_widget_set_sensitive(wind->convert_pause, FALSE);
|
||||
@ -3050,7 +3050,7 @@ gnc_ui_qif_import_convert_progress_prepare(GtkAssistant *assistant,
|
||||
********************************************************************/
|
||||
void
|
||||
gnc_ui_qif_import_duplicates_doc_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
QIFImportWindow * wind = user_data;
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
@ -3064,15 +3064,15 @@ gnc_ui_qif_import_duplicates_doc_prepare (GtkAssistant *assistant,
|
||||
gtk_assistant_set_page_complete (assistant, page, TRUE);
|
||||
|
||||
/* Jump to Summary page if load_stop TRUE */
|
||||
if(wind->load_stop)
|
||||
if (wind->load_stop)
|
||||
gtk_assistant_set_current_page (assistant, total - 1 );
|
||||
|
||||
/* Jump over doc page if show_doc_pages FALSE */
|
||||
if(!wind->show_doc_pages)
|
||||
if (!wind->show_doc_pages)
|
||||
gtk_assistant_set_current_page (assistant, num + 1 );
|
||||
|
||||
/* Don't show doc page if there are no duplicates */
|
||||
if(scm_is_null(wind->match_transactions))
|
||||
if (scm_is_null(wind->match_transactions))
|
||||
gtk_assistant_set_current_page (assistant, num + 1 );
|
||||
}
|
||||
|
||||
@ -3086,7 +3086,7 @@ gnc_ui_qif_import_duplicates_doc_prepare (GtkAssistant *assistant,
|
||||
********************************************************************/
|
||||
void
|
||||
gnc_ui_qif_import_duplicates_match_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
QIFImportWindow * wind = user_data;
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
@ -3104,7 +3104,7 @@ gnc_ui_qif_import_duplicates_match_prepare (GtkAssistant *assistant,
|
||||
const gchar *amount_str;
|
||||
int rownum = 0;
|
||||
|
||||
if(!scm_is_null(wind->match_transactions))
|
||||
if (!scm_is_null(wind->match_transactions))
|
||||
{
|
||||
view = GTK_TREE_VIEW(wind->new_transaction_view);
|
||||
store = GTK_LIST_STORE(gtk_tree_view_get_model(view));
|
||||
@ -3129,18 +3129,18 @@ gnc_ui_qif_import_duplicates_match_prepare (GtkAssistant *assistant,
|
||||
gnc_split = xaccTransGetSplit(gnc_xtn, 0);
|
||||
amount_str =
|
||||
xaccPrintAmount(gnc_numeric_abs(xaccSplitGetValue(gnc_split)),
|
||||
gnc_account_print_info
|
||||
(xaccSplitGetAccount(gnc_split), TRUE));
|
||||
gnc_account_print_info
|
||||
(xaccSplitGetAccount(gnc_split), TRUE));
|
||||
}
|
||||
gtk_list_store_append(store, &iter);
|
||||
gtk_list_store_set
|
||||
(store, &iter,
|
||||
QIF_TRANS_COL_INDEX, rownum++,
|
||||
QIF_TRANS_COL_DATE,
|
||||
gnc_print_date(xaccTransRetDatePostedTS(gnc_xtn)),
|
||||
QIF_TRANS_COL_DESCRIPTION, xaccTransGetDescription(gnc_xtn),
|
||||
QIF_TRANS_COL_AMOUNT, amount_str,
|
||||
-1);
|
||||
(store, &iter,
|
||||
QIF_TRANS_COL_INDEX, rownum++,
|
||||
QIF_TRANS_COL_DATE,
|
||||
gnc_print_date(xaccTransRetDatePostedTS(gnc_xtn)),
|
||||
QIF_TRANS_COL_DESCRIPTION, xaccTransGetDescription(gnc_xtn),
|
||||
QIF_TRANS_COL_AMOUNT, amount_str,
|
||||
-1);
|
||||
|
||||
duplicates = SCM_CDR(duplicates);
|
||||
}
|
||||
@ -3166,7 +3166,7 @@ gnc_ui_qif_import_duplicates_match_prepare (GtkAssistant *assistant,
|
||||
********************************************************************/
|
||||
void
|
||||
gnc_ui_qif_import_end_page_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
QIFImportWindow * wind = user_data;
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
@ -3184,7 +3184,7 @@ gnc_ui_qif_import_end_page_prepare (GtkAssistant *assistant,
|
||||
********************************************************************/
|
||||
void
|
||||
gnc_ui_qif_import_finish_cb (GtkAssistant *gtkassistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
QIFImportWindow * wind = user_data;
|
||||
|
||||
@ -3243,7 +3243,7 @@ gnc_ui_qif_import_finish_cb (GtkAssistant *gtkassistant,
|
||||
********************************************************************/
|
||||
void
|
||||
gnc_ui_qif_import_summary_page_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
QIFImportWindow * wind = user_data;
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
@ -3251,12 +3251,12 @@ gnc_ui_qif_import_summary_page_prepare (GtkAssistant *assistant,
|
||||
|
||||
gchar *text;
|
||||
|
||||
if(wind->load_stop)
|
||||
text = g_strdup_printf(_("There was a problem with the import."));
|
||||
if (wind->load_stop)
|
||||
text = g_strdup_printf(_("There was a problem with the import."));
|
||||
else
|
||||
text = g_strdup_printf(_("QIF Import Completed."));
|
||||
text = g_strdup_printf(_("QIF Import Completed."));
|
||||
|
||||
gtk_label_set_markup(GTK_LABEL(wind->summary_text), g_strdup_printf("<span size=\"large\"><b>%s</b></span>",text));
|
||||
gtk_label_set_markup(GTK_LABEL(wind->summary_text), g_strdup_printf("<span size=\"large\"><b>%s</b></span>", text));
|
||||
|
||||
g_free(text);
|
||||
|
||||
@ -3269,7 +3269,7 @@ gnc_ui_qif_import_summary_page_prepare (GtkAssistant *assistant,
|
||||
* Prepare callback for assistant pages.
|
||||
********************************************************************/
|
||||
void gnc_ui_qif_import_prepare_cb (GtkAssistant *assistant, GtkWidget *page,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
QIFImportWindow *wind = user_data;
|
||||
gint currentpage = gtk_assistant_get_current_page(assistant);
|
||||
@ -3282,83 +3282,103 @@ void gnc_ui_qif_import_prepare_cb (GtkAssistant *assistant, GtkWidget *page,
|
||||
{
|
||||
/* Current page is Intro page */
|
||||
gnc_ui_qif_import_intro_prepare (assistant, user_data);
|
||||
}else if (!g_strcmp0 (pagename, "load_file_page"))
|
||||
}
|
||||
else if (!g_strcmp0 (pagename, "load_file_page"))
|
||||
{
|
||||
/* Current page is File Load */
|
||||
gnc_ui_qif_import_load_file_prepare (assistant, user_data);
|
||||
}else if (!g_strcmp0 (pagename, "load_progress_page"))
|
||||
}
|
||||
else if (!g_strcmp0 (pagename, "load_progress_page"))
|
||||
{
|
||||
/* Current page is Load Progress */
|
||||
gnc_ui_qif_import_load_progress_prepare (assistant, user_data);
|
||||
}else if (!g_strcmp0 (pagename, "date_format_page"))
|
||||
}
|
||||
else if (!g_strcmp0 (pagename, "date_format_page"))
|
||||
{
|
||||
/* Current page is date page */
|
||||
gnc_ui_qif_import_date_format_prepare (assistant, user_data);
|
||||
}else if (!g_strcmp0 (pagename, "account_name_page"))
|
||||
}
|
||||
else if (!g_strcmp0 (pagename, "account_name_page"))
|
||||
{
|
||||
/* Current page is account page */
|
||||
gnc_ui_qif_import_account_prepare (assistant, user_data);
|
||||
}else if (!g_strcmp0 (pagename, "loaded_files_page"))
|
||||
}
|
||||
else if (!g_strcmp0 (pagename, "loaded_files_page"))
|
||||
{
|
||||
/* Current page is loaded files page */
|
||||
gnc_ui_qif_import_loaded_files_prepare (assistant, user_data);
|
||||
}else if (!g_strcmp0 (pagename, "account_doc_page"))
|
||||
}
|
||||
else if (!g_strcmp0 (pagename, "account_doc_page"))
|
||||
{
|
||||
/* Current page is Account Doc. page */
|
||||
gnc_ui_qif_import_account_doc_prepare (assistant, user_data);
|
||||
}else if (!g_strcmp0 (pagename, "account_match_page"))
|
||||
}
|
||||
else if (!g_strcmp0 (pagename, "account_match_page"))
|
||||
{
|
||||
/* Current page is Account Match page */
|
||||
gnc_ui_qif_import_account_match_prepare (assistant, user_data);
|
||||
}else if (!g_strcmp0 (pagename, "category_doc_page"))
|
||||
}
|
||||
else if (!g_strcmp0 (pagename, "category_doc_page"))
|
||||
{
|
||||
/* Current page is Catagory Doc. page */
|
||||
gnc_ui_qif_import_catagory_doc_prepare (assistant, user_data);
|
||||
}else if (!g_strcmp0 (pagename, "category_match_page"))
|
||||
}
|
||||
else if (!g_strcmp0 (pagename, "category_match_page"))
|
||||
{
|
||||
/* Current page is Catagory Match page */
|
||||
gnc_ui_qif_import_catagory_match_prepare (assistant, user_data);
|
||||
}else if (!g_strcmp0 (pagename, "memo_doc_page"))
|
||||
}
|
||||
else if (!g_strcmp0 (pagename, "memo_doc_page"))
|
||||
{
|
||||
/* Current page is Memo Doc. page */
|
||||
gnc_ui_qif_import_memo_doc_prepare (assistant, user_data);
|
||||
}else if (!g_strcmp0 (pagename, "memo_match_page"))
|
||||
}
|
||||
else if (!g_strcmp0 (pagename, "memo_match_page"))
|
||||
{
|
||||
/* Current page is Memo Match page */
|
||||
gnc_ui_qif_import_memo_match_prepare (assistant, user_data);
|
||||
}else if (!g_strcmp0 (pagename, "currency_page"))
|
||||
}
|
||||
else if (!g_strcmp0 (pagename, "currency_page"))
|
||||
{
|
||||
/* Current page is Currency page */
|
||||
gnc_ui_qif_import_currency_prepare (assistant, user_data);
|
||||
}else if (!g_strcmp0 (pagename, "commodity_doc_page"))
|
||||
}
|
||||
else if (!g_strcmp0 (pagename, "commodity_doc_page"))
|
||||
{
|
||||
/* Current page is Commodity Doc. page */
|
||||
gnc_ui_qif_import_commodity_doc_prepare (assistant, user_data);
|
||||
}else if (!g_strcmp0 (pagename, "commodity_page"))
|
||||
}
|
||||
else if (!g_strcmp0 (pagename, "commodity_page"))
|
||||
{
|
||||
/* Current page is Commodity page */
|
||||
/* gnc_ui_qif_import_commodity_prepare (assistant, user_data); */
|
||||
}else if (!g_strcmp0 (pagename, "convert_progress_page"))
|
||||
}
|
||||
else if (!g_strcmp0 (pagename, "convert_progress_page"))
|
||||
{
|
||||
/* Current page is Conversion progress page */
|
||||
gnc_ui_qif_import_convert_progress_prepare (assistant, user_data);
|
||||
}else if (!g_strcmp0 (pagename, "duplicates_doc_page"))
|
||||
}
|
||||
else if (!g_strcmp0 (pagename, "duplicates_doc_page"))
|
||||
{
|
||||
/* Current page is Duplicates Doc page */
|
||||
gnc_ui_qif_import_duplicates_doc_prepare (assistant, user_data);
|
||||
}else if (!g_strcmp0 (pagename, "duplicates_match_page"))
|
||||
}
|
||||
else if (!g_strcmp0 (pagename, "duplicates_match_page"))
|
||||
{
|
||||
/* Current page is Duplicates Match page */
|
||||
gnc_ui_qif_import_duplicates_match_prepare (assistant, user_data);
|
||||
}else if (!g_strcmp0 (pagename, "end_page"))
|
||||
}
|
||||
else if (!g_strcmp0 (pagename, "end_page"))
|
||||
{
|
||||
/* Current page is the end page */
|
||||
gnc_ui_qif_import_end_page_prepare (assistant, user_data);
|
||||
}else if (!g_strcmp0 (pagename, "summary_page"))
|
||||
}
|
||||
else if (!g_strcmp0 (pagename, "summary_page"))
|
||||
{
|
||||
/* Current page is the summary page */
|
||||
gnc_ui_qif_import_summary_page_prepare (assistant, user_data);
|
||||
}else
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Current page is a new commodity page */
|
||||
gnc_ui_qif_import_commodity_new_prepare (assistant, user_data);
|
||||
@ -3383,11 +3403,11 @@ get_assistant_widgets(QIFImportWindow *wind, GtkBuilder *builder)
|
||||
wind->load_start = GTK_WIDGET(gtk_builder_get_object (builder, "load_progress_start"));
|
||||
wind->load_log = GTK_WIDGET(gtk_builder_get_object (builder, "load_progress_log"));
|
||||
wind->load_progress = gnc_progress_dialog_custom(
|
||||
GTK_LABEL(gtk_builder_get_object (builder, "load_progress_primary")),
|
||||
GTK_LABEL(gtk_builder_get_object (builder, "load_progress_secondary")),
|
||||
GTK_PROGRESS_BAR(gtk_builder_get_object (builder, "load_progress_bar")),
|
||||
GTK_LABEL(gtk_builder_get_object (builder, "load_progress_sub")),
|
||||
GTK_TEXT_VIEW(wind->load_log));
|
||||
GTK_LABEL(gtk_builder_get_object (builder, "load_progress_primary")),
|
||||
GTK_LABEL(gtk_builder_get_object (builder, "load_progress_secondary")),
|
||||
GTK_PROGRESS_BAR(gtk_builder_get_object (builder, "load_progress_bar")),
|
||||
GTK_LABEL(gtk_builder_get_object (builder, "load_progress_sub")),
|
||||
GTK_TEXT_VIEW(wind->load_log));
|
||||
wind->acct_entry = GTK_WIDGET(gtk_builder_get_object (builder, "qif_account_entry"));
|
||||
wind->date_format_combo = GTK_WIDGET(gtk_builder_get_object (builder, "date_format_combobox"));
|
||||
wind->selected_file_view = GTK_WIDGET(gtk_builder_get_object (builder, "selected_file_view"));
|
||||
@ -3406,11 +3426,11 @@ get_assistant_widgets(QIFImportWindow *wind, GtkBuilder *builder)
|
||||
wind->convert_start = GTK_WIDGET(gtk_builder_get_object (builder, "convert_progress_start"));
|
||||
wind->convert_log = GTK_WIDGET(gtk_builder_get_object (builder, "convert_progress_log"));
|
||||
wind->convert_progress = gnc_progress_dialog_custom(
|
||||
GTK_LABEL(gtk_builder_get_object (builder, "convert_progress_primary")),
|
||||
GTK_LABEL(gtk_builder_get_object (builder, "convert_progress_secondary")),
|
||||
GTK_PROGRESS_BAR(gtk_builder_get_object (builder, "convert_progress_bar")),
|
||||
GTK_LABEL(gtk_builder_get_object (builder, "convert_progress_sub")),
|
||||
GTK_TEXT_VIEW(wind->convert_log));
|
||||
GTK_LABEL(gtk_builder_get_object (builder, "convert_progress_primary")),
|
||||
GTK_LABEL(gtk_builder_get_object (builder, "convert_progress_secondary")),
|
||||
GTK_PROGRESS_BAR(gtk_builder_get_object (builder, "convert_progress_bar")),
|
||||
GTK_LABEL(gtk_builder_get_object (builder, "convert_progress_sub")),
|
||||
GTK_TEXT_VIEW(wind->convert_log));
|
||||
wind->summary_text = GTK_WIDGET(gtk_builder_get_object (builder, "summary_page"));
|
||||
|
||||
wind->new_transaction_view =
|
||||
@ -3564,16 +3584,16 @@ build_views(QIFImportWindow *wind)
|
||||
*
|
||||
* Build a new QIF import assistant.
|
||||
********************************************************************/
|
||||
static GtkWidget *
|
||||
static GtkWidget *
|
||||
gnc_ui_qif_import_assistant_make(QIFImportWindow *qif_win)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GtkWidget *box;
|
||||
|
||||
builder = gtk_builder_new();
|
||||
gnc_builder_add_from_file (builder,"assistant-qif-import.glade", "currency_liststore");
|
||||
gnc_builder_add_from_file (builder,"assistant-qif-import.glade", "date_format_liststore");
|
||||
gnc_builder_add_from_file (builder,"assistant-qif-import.glade", "QIF Import Assistant");
|
||||
gnc_builder_add_from_file (builder, "assistant-qif-import.glade", "currency_liststore");
|
||||
gnc_builder_add_from_file (builder, "assistant-qif-import.glade", "date_format_liststore");
|
||||
gnc_builder_add_from_file (builder, "assistant-qif-import.glade", "QIF Import Assistant");
|
||||
|
||||
qif_win->new_namespaces = NULL;
|
||||
qif_win->selected_transaction = 0;
|
||||
|
@ -148,7 +148,7 @@ static void
|
||||
gnc_plugin_qif_import_cmd_new_qif_import (GtkAction *action,
|
||||
GncMainWindowActionData *data)
|
||||
{
|
||||
gnc_file_qif_import();
|
||||
gnc_file_qif_import();
|
||||
}
|
||||
|
||||
|
||||
|
@ -170,8 +170,8 @@ qof_book_mark_session_saved (QofBook *book)
|
||||
book->dirty_time = 0;
|
||||
if (book->session_dirty)
|
||||
{
|
||||
/* Set the session clean upfront, because the callback will check. */
|
||||
book->session_dirty = FALSE;
|
||||
/* Set the session clean upfront, because the callback will check. */
|
||||
book->session_dirty = FALSE;
|
||||
if (book->dirty_cb)
|
||||
book->dirty_cb(book, FALSE, book->dirty_data);
|
||||
}
|
||||
@ -182,8 +182,8 @@ void qof_book_mark_session_dirty (QofBook *book)
|
||||
if (!book) return;
|
||||
if (!book->session_dirty)
|
||||
{
|
||||
/* Set the session dirty upfront, because the callback will check. */
|
||||
book->session_dirty = TRUE;
|
||||
/* Set the session dirty upfront, because the callback will check. */
|
||||
book->session_dirty = TRUE;
|
||||
book->dirty_time = time(NULL);
|
||||
if (book->dirty_cb)
|
||||
book->dirty_cb(book, TRUE, book->dirty_data);
|
||||
|
@ -68,22 +68,31 @@ gboolean get_qof_providers_initialized (void );
|
||||
void unregister_all_providers (void );
|
||||
|
||||
GHookList*
|
||||
get_session_closed_hooks (void) { return session_closed_hooks; }
|
||||
get_session_closed_hooks (void)
|
||||
{
|
||||
return session_closed_hooks;
|
||||
}
|
||||
|
||||
GSList*
|
||||
get_provider_list (void) { return provider_list; }
|
||||
get_provider_list (void)
|
||||
{
|
||||
return provider_list;
|
||||
}
|
||||
|
||||
gboolean
|
||||
get_qof_providers_initialized (void) { return qof_providers_initialized; }
|
||||
get_qof_providers_initialized (void)
|
||||
{
|
||||
return qof_providers_initialized;
|
||||
}
|
||||
|
||||
void
|
||||
unregister_all_providers (void)
|
||||
{
|
||||
if (provider_list)
|
||||
{
|
||||
g_slist_foreach (provider_list, (GFunc) g_free, NULL);
|
||||
g_slist_free (provider_list);
|
||||
provider_list = NULL;
|
||||
g_slist_foreach (provider_list, (GFunc) g_free, NULL);
|
||||
g_slist_free (provider_list);
|
||||
provider_list = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -388,7 +397,7 @@ col_ref_cb (QofInstance* ref_ent, gpointer user_data)
|
||||
ref->ref_guid = g_new (GncGUID, 1);
|
||||
ref->ent_guid = qof_instance_get_guid (ent);
|
||||
ref->param = qof_class_get_parameter (ent->e_type,
|
||||
qecd->param->param_name);
|
||||
qecd->param->param_name);
|
||||
cm_guid = qof_entity_get_guid (ref_ent);
|
||||
guid_to_string_buff (cm_guid, cm_sa);
|
||||
cm_string = g_strdup (cm_sa);
|
||||
@ -467,7 +476,7 @@ qof_instance_foreach_copy (gpointer data, gpointer user_data)
|
||||
registered_type = TRUE;
|
||||
}
|
||||
if ((safe_strcmp (cm_param->param_type, QOF_TYPE_NUMERIC) == 0) ||
|
||||
(safe_strcmp (cm_param->param_type, QOF_TYPE_DEBCRED) == 0))
|
||||
(safe_strcmp (cm_param->param_type, QOF_TYPE_DEBCRED) == 0))
|
||||
{
|
||||
numeric_getter = (gnc_numeric (*)(QofInstance*, QofParam*))cm_param->param_getfcn;
|
||||
cm_numeric = numeric_getter (importEnt, cm_param);
|
||||
@ -784,7 +793,7 @@ qof_instance_copy_coll (QofSession *new_session, QofCollection *entity_coll)
|
||||
qof_book_set_partial (qof_session_get_book (qecd.new_session));
|
||||
qof_collection_foreach (entity_coll, qof_instance_coll_foreach, &qecd);
|
||||
qof_class_param_foreach (qof_collection_get_type (entity_coll),
|
||||
qof_instance_param_cb, &qecd);
|
||||
qof_instance_param_cb, &qecd);
|
||||
qof_collection_foreach (entity_coll, qof_instance_coll_copy, &qecd);
|
||||
if (qecd.param_list != NULL)
|
||||
{
|
||||
|
@ -86,15 +86,15 @@ test_qof_session_new_destroy (void)
|
||||
g_test_message ("Test session initialization");
|
||||
session = qof_session_new ();
|
||||
g_assert (session);
|
||||
g_assert_cmpstr (session->entity.e_type, ==, QOF_ID_SESSION);
|
||||
g_assert_cmpstr (session->entity.e_type, == , QOF_ID_SESSION);
|
||||
g_assert (session->book);
|
||||
book = (QofBook*) session->book;
|
||||
g_assert (book);
|
||||
g_assert (QOF_IS_BOOK (book));
|
||||
g_assert (!session->book_id);
|
||||
g_assert (!session->backend);
|
||||
g_assert_cmpint (session->lock, ==, 1);
|
||||
g_assert_cmpint (qof_session_get_error (session), ==, ERR_BACKEND_NO_ERR);
|
||||
g_assert_cmpint (session->lock, == , 1);
|
||||
g_assert_cmpint (qof_session_get_error (session), == , ERR_BACKEND_NO_ERR);
|
||||
|
||||
g_test_message ("Test session destroy");
|
||||
qof_session_destroy (session);
|
||||
@ -126,7 +126,7 @@ static gboolean
|
||||
mock_check_data_type (const char* book_id)
|
||||
{
|
||||
g_assert (book_id);
|
||||
g_assert_cmpstr (book_id, ==, "my book");
|
||||
g_assert_cmpstr (book_id, == , "my book");
|
||||
load_backend_struct.check_data_type_called = TRUE;
|
||||
return load_backend_struct.data_compatible;
|
||||
}
|
||||
@ -157,18 +157,18 @@ test_qof_session_load_backend (Fixture *fixture, gconstpointer pData)
|
||||
g_assert (get_provider_list () == NULL);
|
||||
p_qof_session_load_backend (fixture->session, "file");
|
||||
g_assert (get_qof_providers_initialized ());
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), ==, ERR_BACKEND_NO_HANDLER);
|
||||
g_assert_cmpstr (qof_session_get_error_message (fixture->session), ==, "failed to load 'file' using access_method");
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), == , ERR_BACKEND_NO_HANDLER);
|
||||
g_assert_cmpstr (qof_session_get_error_message (fixture->session), == , "failed to load 'file' using access_method");
|
||||
p_qof_session_clear_error (fixture->session);
|
||||
|
||||
g_test_message ("Test with provider registered but access method not supported");
|
||||
prov->access_method = "unsupported";
|
||||
qof_backend_register_provider (prov);
|
||||
g_assert (get_provider_list ());
|
||||
g_assert_cmpint (g_slist_length (get_provider_list ()), ==, 1);
|
||||
g_assert_cmpint (g_slist_length (get_provider_list ()), == , 1);
|
||||
p_qof_session_load_backend (fixture->session, "file");
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), ==, ERR_BACKEND_NO_HANDLER);
|
||||
g_assert_cmpstr (qof_session_get_error_message (fixture->session), ==, "failed to load 'file' using access_method");
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), == , ERR_BACKEND_NO_HANDLER);
|
||||
g_assert_cmpstr (qof_session_get_error_message (fixture->session), == , "failed to load 'file' using access_method");
|
||||
p_qof_session_clear_error (fixture->session);
|
||||
|
||||
g_test_message ("Test with access method supported but type incompatible");
|
||||
@ -179,8 +179,8 @@ test_qof_session_load_backend (Fixture *fixture, gconstpointer pData)
|
||||
fixture->session->book_id = g_strdup ("my book");
|
||||
p_qof_session_load_backend (fixture->session, "file");
|
||||
g_assert (load_backend_struct.check_data_type_called);
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), ==, ERR_BACKEND_NO_HANDLER);
|
||||
g_assert_cmpstr (qof_session_get_error_message (fixture->session), ==, "failed to load 'file' using access_method");
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), == , ERR_BACKEND_NO_HANDLER);
|
||||
g_assert_cmpstr (qof_session_get_error_message (fixture->session), == , "failed to load 'file' using access_method");
|
||||
p_qof_session_clear_error (fixture->session);
|
||||
|
||||
g_test_message ("Test with type compatible but backend_new not set");
|
||||
@ -189,8 +189,8 @@ test_qof_session_load_backend (Fixture *fixture, gconstpointer pData)
|
||||
load_backend_struct.check_data_type_called = FALSE;
|
||||
p_qof_session_load_backend (fixture->session, "file");
|
||||
g_assert (load_backend_struct.check_data_type_called);
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), ==, ERR_BACKEND_NO_HANDLER);
|
||||
g_assert_cmpstr (qof_session_get_error_message (fixture->session), ==, "failed to load 'file' using access_method");
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), == , ERR_BACKEND_NO_HANDLER);
|
||||
g_assert_cmpstr (qof_session_get_error_message (fixture->session), == , "failed to load 'file' using access_method");
|
||||
p_qof_session_clear_error (fixture->session);
|
||||
|
||||
g_test_message ("Test with type compatible backend_new set");
|
||||
@ -210,10 +210,10 @@ test_qof_session_load_backend (Fixture *fixture, gconstpointer pData)
|
||||
g_assert (load_backend_struct.be == fixture->session->backend);
|
||||
g_assert (prov == fixture->session->backend->provider);
|
||||
g_assert (qof_book_get_backend (book) == load_backend_struct.be);
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), ==, ERR_BACKEND_NO_ERR);
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), == , ERR_BACKEND_NO_ERR);
|
||||
|
||||
unregister_all_providers ();
|
||||
g_assert_cmpint (g_slist_length (get_provider_list ()), ==, 0);
|
||||
g_assert_cmpint (g_slist_length (get_provider_list ()), == , 0);
|
||||
}
|
||||
|
||||
static struct
|
||||
@ -233,7 +233,7 @@ mock_load (QofBackend *be, QofBook *book, QofBackendLoadType type)
|
||||
g_assert (book != load_session_struct.oldbook);
|
||||
g_assert (qof_book_get_backend (book) == be);
|
||||
if (load_session_struct.error)
|
||||
qof_backend_set_error (be, ERR_BACKEND_DATA_CORRUPT); /* just any valid error */
|
||||
qof_backend_set_error (be, ERR_BACKEND_DATA_CORRUPT); /* just any valid error */
|
||||
load_session_struct.load_called = TRUE;
|
||||
}
|
||||
|
||||
@ -299,14 +299,14 @@ mock_session_begin (QofBackend *be, QofSession *session, const char *book_id,
|
||||
g_assert (session);
|
||||
g_assert (session == session_begin_struct.session);
|
||||
g_assert (book_id);
|
||||
g_assert_cmpstr (book_id, ==, session_begin_struct.book_id);
|
||||
g_assert_cmpstr (book_id, == , session_begin_struct.book_id);
|
||||
g_assert (ignore_lock);
|
||||
g_assert (!create);
|
||||
g_assert (force);
|
||||
if (session_begin_struct.produce_error)
|
||||
{
|
||||
qof_backend_set_error (be, ERR_BACKEND_DATA_CORRUPT);
|
||||
qof_backend_set_message (be, "push any error");
|
||||
qof_backend_set_error (be, ERR_BACKEND_DATA_CORRUPT);
|
||||
qof_backend_set_message (be, "push any error");
|
||||
}
|
||||
session_begin_struct.session_begin_called = TRUE;
|
||||
}
|
||||
@ -338,7 +338,7 @@ test_qof_session_begin (Fixture *fixture, gconstpointer pData)
|
||||
|
||||
be = g_new0 (QofBackend, 1);
|
||||
g_assert (be);
|
||||
g_assert_cmpint (g_slist_length (get_provider_list ()), ==, 0);
|
||||
g_assert_cmpint (g_slist_length (get_provider_list ()), == , 0);
|
||||
prov = g_new0 (QofBackendProvider, 1);
|
||||
prov->backend_new = mock_backend_new_for_begin;
|
||||
|
||||
@ -363,15 +363,15 @@ test_qof_session_begin (Fixture *fixture, gconstpointer pData)
|
||||
qof_session_begin (fixture->session, "default_should_be_file", ignore_lock, create, force);
|
||||
g_assert (fixture->session->backend == NULL);
|
||||
g_assert (fixture->session->book_id == NULL);
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), ==, ERR_BACKEND_NO_HANDLER);
|
||||
g_assert_cmpstr (qof_session_get_error_message (fixture->session), ==, "failed to load 'file' using access_method");
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), == , ERR_BACKEND_NO_HANDLER);
|
||||
g_assert_cmpstr (qof_session_get_error_message (fixture->session), == , "failed to load 'file' using access_method");
|
||||
|
||||
g_test_message ("Test access_method parsing");
|
||||
qof_session_begin (fixture->session, "postgres://localhost:8080", ignore_lock, create, force);
|
||||
g_assert (fixture->session->backend == NULL);
|
||||
g_assert (fixture->session->book_id == NULL);
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), ==, ERR_BACKEND_NO_HANDLER);
|
||||
g_assert_cmpstr (qof_session_get_error_message (fixture->session), ==, "failed to load 'postgres' using access_method");
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), == , ERR_BACKEND_NO_HANDLER);
|
||||
g_assert_cmpstr (qof_session_get_error_message (fixture->session), == , "failed to load 'postgres' using access_method");
|
||||
|
||||
g_test_message ("Test with valid backend returned and session begin set; error is produced");
|
||||
session_begin_struct.session = fixture->session;
|
||||
@ -387,8 +387,8 @@ test_qof_session_begin (Fixture *fixture, gconstpointer pData)
|
||||
g_assert (session_begin_struct.backend_new_called == TRUE);
|
||||
g_assert (session_begin_struct.session_begin_called == TRUE);
|
||||
g_assert (fixture->session->book_id == NULL);
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), ==, ERR_BACKEND_DATA_CORRUPT);
|
||||
g_assert_cmpstr (qof_session_get_error_message (fixture->session), ==, "push any error");
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), == , ERR_BACKEND_DATA_CORRUPT);
|
||||
g_assert_cmpstr (qof_session_get_error_message (fixture->session), == , "push any error");
|
||||
|
||||
g_test_message ("Test normal session_begin execution");
|
||||
session_begin_struct.backend_new_called = FALSE;
|
||||
@ -400,8 +400,8 @@ test_qof_session_begin (Fixture *fixture, gconstpointer pData)
|
||||
g_assert (session_begin_struct.backend_new_called == TRUE);
|
||||
g_assert (session_begin_struct.session_begin_called == TRUE);
|
||||
g_assert (fixture->session->book_id);
|
||||
g_assert_cmpstr (fixture->session->book_id, ==, "postgres://localhost:8080");
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), ==, ERR_BACKEND_NO_ERR);
|
||||
g_assert_cmpstr (fixture->session->book_id, == , "postgres://localhost:8080");
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), == , ERR_BACKEND_NO_ERR);
|
||||
|
||||
unregister_all_providers ();
|
||||
}
|
||||
@ -429,14 +429,14 @@ mock_sync (QofBackend *be, QofBook *book)
|
||||
|
||||
static void
|
||||
mock_session_begin_for_save (QofBackend *be, QofSession *session, const char *book_id,
|
||||
gboolean ignore_lock, gboolean create, gboolean force)
|
||||
gboolean ignore_lock, gboolean create, gboolean force)
|
||||
{
|
||||
g_assert (be);
|
||||
g_assert (be == session_save_struct.be);
|
||||
g_assert (session);
|
||||
g_assert (session == session_save_struct.session);
|
||||
g_assert (book_id);
|
||||
g_assert_cmpstr (book_id, ==, session_save_struct.book_id);
|
||||
g_assert_cmpstr (book_id, == , session_save_struct.book_id);
|
||||
g_assert (ignore_lock);
|
||||
g_assert (create);
|
||||
g_assert (force);
|
||||
@ -470,18 +470,18 @@ test_qof_session_save (Fixture *fixture, gconstpointer pData)
|
||||
g_assert (book);
|
||||
qof_book_set_data (book, PARTIAL_QOFBOOK, GINT_TO_POINTER (FALSE));
|
||||
qof_session_push_error (fixture->session, ERR_BACKEND_DATA_CORRUPT, "push any error");
|
||||
g_assert_cmpint (fixture->session->lock, ==, 1);
|
||||
g_assert_cmpint (fixture->session->lock, == , 1);
|
||||
qof_session_save (fixture->session, NULL);
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), ==, ERR_BACKEND_NO_HANDLER);
|
||||
g_assert_cmpstr (qof_session_get_error_message (fixture->session), ==, "failed to load backend");
|
||||
g_assert_cmpint (fixture->session->lock, ==, 1);
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), == , ERR_BACKEND_NO_HANDLER);
|
||||
g_assert_cmpstr (qof_session_get_error_message (fixture->session), == , "failed to load backend");
|
||||
g_assert_cmpint (fixture->session->lock, == , 1);
|
||||
|
||||
g_test_message ("Test when book not partial and backend set; imitate error");
|
||||
be = g_new0 (QofBackend, 1);
|
||||
g_assert (be);
|
||||
be->sync = mock_sync;
|
||||
fixture->session->backend = be;
|
||||
g_assert_cmpint (fixture->session->lock, ==, 1);
|
||||
g_assert_cmpint (fixture->session->lock, == , 1);
|
||||
session_save_struct.sync_called = FALSE;
|
||||
session_save_struct.be = be;
|
||||
session_save_struct.book = book;
|
||||
@ -491,19 +491,19 @@ test_qof_session_save (Fixture *fixture, gconstpointer pData)
|
||||
g_assert (qof_book_get_backend (book) == be);
|
||||
g_assert (be->percentage == percentage_fn);
|
||||
g_assert (session_save_struct.sync_called);
|
||||
g_assert_cmpint (fixture->session->lock, ==, 1);
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), ==, ERR_BACKEND_DATA_CORRUPT);
|
||||
g_assert_cmpstr (qof_session_get_error_message (fixture->session), ==, "");
|
||||
g_assert_cmpint (fixture->session->lock, == , 1);
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), == , ERR_BACKEND_DATA_CORRUPT);
|
||||
g_assert_cmpstr (qof_session_get_error_message (fixture->session), == , "");
|
||||
|
||||
g_test_message ("Test when book not partial and backend set; successful save");
|
||||
g_assert_cmpint (fixture->session->lock, ==, 1);
|
||||
g_assert_cmpint (fixture->session->lock, == , 1);
|
||||
session_save_struct.sync_called = FALSE;
|
||||
qof_session_save (fixture->session, percentage_fn);
|
||||
g_assert (qof_book_get_backend (book) == be);
|
||||
g_assert (be->percentage == percentage_fn);
|
||||
g_assert (session_save_struct.sync_called);
|
||||
g_assert_cmpint (fixture->session->lock, ==, 1);
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), ==, ERR_BACKEND_NO_ERR);
|
||||
g_assert_cmpint (fixture->session->lock, == , 1);
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), == , ERR_BACKEND_NO_ERR);
|
||||
|
||||
/* change backend testing
|
||||
* code probably should be moved to separate routine or some existing code can be reused
|
||||
@ -513,7 +513,7 @@ test_qof_session_save (Fixture *fixture, gconstpointer pData)
|
||||
prov = g_new0 (QofBackendProvider, 1);
|
||||
prov->partial_book_supported = TRUE;
|
||||
fixture->session->backend->provider = prov;
|
||||
g_assert_cmpint (fixture->session->lock, ==, 1);
|
||||
g_assert_cmpint (fixture->session->lock, == , 1);
|
||||
qof_book_set_data (book, PARTIAL_QOFBOOK, GINT_TO_POINTER (TRUE));
|
||||
session_save_struct.sync_called = FALSE;
|
||||
qof_session_save (fixture->session, percentage_fn);
|
||||
@ -522,17 +522,17 @@ test_qof_session_save (Fixture *fixture, gconstpointer pData)
|
||||
g_assert (qof_book_get_backend (book) == be);
|
||||
g_assert (be->percentage == percentage_fn);
|
||||
g_assert (session_save_struct.sync_called);
|
||||
g_assert_cmpint (fixture->session->lock, ==, 1);
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), ==, ERR_BACKEND_NO_ERR);
|
||||
g_assert_cmpint (fixture->session->lock, == , 1);
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), == , ERR_BACKEND_NO_ERR);
|
||||
|
||||
g_test_message ("Test when book is partial and current backend does not support it; backend should be changed");
|
||||
prov->partial_book_supported = FALSE;
|
||||
g_assert_cmpint (fixture->session->lock, ==, 1);
|
||||
g_assert_cmpint (fixture->session->lock, == , 1);
|
||||
reg_prov = g_new0 (QofBackendProvider, 1);
|
||||
reg_prov->partial_book_supported = TRUE;
|
||||
reg_prov->backend_new = mock_backend_new_for_save;
|
||||
qof_backend_register_provider (reg_prov);
|
||||
g_assert_cmpint (g_slist_length (get_provider_list ()), ==, 1);
|
||||
g_assert_cmpint (g_slist_length (get_provider_list ()), == , 1);
|
||||
session_save_struct.book = book;
|
||||
session_save_struct.session = fixture->session;
|
||||
fixture->session->book_id = g_strdup ("my book");
|
||||
@ -550,8 +550,8 @@ test_qof_session_save (Fixture *fixture, gconstpointer pData)
|
||||
g_assert (session_save_struct.session_begin_called);
|
||||
g_assert (qof_book_get_backend (book) == session_save_struct.be);
|
||||
g_assert (session_save_struct.sync_called);
|
||||
g_assert_cmpint (fixture->session->lock, ==, 1);
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), ==, ERR_BACKEND_NO_ERR);
|
||||
g_assert_cmpint (fixture->session->lock, == , 1);
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), == , ERR_BACKEND_NO_ERR);
|
||||
|
||||
unregister_all_providers ();
|
||||
g_free (prov);
|
||||
@ -625,7 +625,7 @@ test_qof_session_end (Fixture *fixture, gconstpointer pData)
|
||||
session_end_struct.be = be;
|
||||
qof_session_end (fixture->session);
|
||||
g_assert (session_end_struct.called);
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), ==, ERR_BACKEND_NO_ERR);
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), == , ERR_BACKEND_NO_ERR);
|
||||
g_assert (!fixture->session->book_id);
|
||||
}
|
||||
|
||||
@ -799,7 +799,7 @@ mock_all_data_load (QofBackend *be, QofBook *book, QofBackendLoadType type)
|
||||
g_assert (book);
|
||||
g_assert (be == data_load_struct.be);
|
||||
g_assert (book == data_load_struct.book);
|
||||
g_assert_cmpint (type, ==, LOAD_TYPE_LOAD_ALL);
|
||||
g_assert_cmpint (type, == , LOAD_TYPE_LOAD_ALL);
|
||||
qof_backend_set_error (be, ERR_BACKEND_DATA_CORRUPT);
|
||||
data_load_struct.called = TRUE;
|
||||
}
|
||||
@ -820,8 +820,8 @@ test_qof_session_data_loaded (Fixture *fixture, gconstpointer pData)
|
||||
data_load_struct.called = FALSE;
|
||||
qof_session_ensure_all_data_loaded (fixture->session);
|
||||
g_assert (data_load_struct.called);
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), ==, ERR_BACKEND_DATA_CORRUPT);
|
||||
g_assert_cmpstr (qof_session_get_error_message (fixture->session), ==, "");
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), == , ERR_BACKEND_DATA_CORRUPT);
|
||||
g_assert_cmpstr (qof_session_get_error_message (fixture->session), == , "");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -833,22 +833,22 @@ test_qof_backend_get_access_method_list (Fixture *fixture, gconstpointer pData)
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
QofBackendProvider *prov = g_new0 (QofBackendProvider, 1);
|
||||
g_assert (prov);
|
||||
prov->access_method = access_methods[ i ];
|
||||
qof_backend_register_provider (prov);
|
||||
g_assert_cmpint (g_slist_length (get_provider_list ()), ==, (i + 1));
|
||||
QofBackendProvider *prov = g_new0 (QofBackendProvider, 1);
|
||||
g_assert (prov);
|
||||
prov->access_method = access_methods[ i ];
|
||||
qof_backend_register_provider (prov);
|
||||
g_assert_cmpint (g_slist_length (get_provider_list ()), == , (i + 1));
|
||||
}
|
||||
g_assert_cmpint (g_slist_length (get_provider_list ()), ==, 4);
|
||||
g_assert_cmpint (g_slist_length (get_provider_list ()), == , 4);
|
||||
|
||||
g_test_message ("Test list of access methods is returned");
|
||||
list = qof_backend_get_registered_access_method_list ();
|
||||
g_assert (list);
|
||||
g_assert_cmpint (g_list_length (list), ==, 4);
|
||||
g_assert_cmpstr (g_list_nth_data (list, 0), ==, "file");
|
||||
g_assert_cmpstr (g_list_nth_data (list, 1), ==, "http");
|
||||
g_assert_cmpstr (g_list_nth_data (list, 2), ==, "postgres");
|
||||
g_assert_cmpstr (g_list_nth_data (list, 3), ==, "sqlite");
|
||||
g_assert_cmpint (g_list_length (list), == , 4);
|
||||
g_assert_cmpstr (g_list_nth_data (list, 0), == , "file");
|
||||
g_assert_cmpstr (g_list_nth_data (list, 1), == , "http");
|
||||
g_assert_cmpstr (g_list_nth_data (list, 2), == , "postgres");
|
||||
g_assert_cmpstr (g_list_nth_data (list, 3), == , "sqlite");
|
||||
|
||||
g_list_free (list);
|
||||
unregister_all_providers ();
|
||||
@ -867,7 +867,7 @@ test_qof_session_get_book (Fixture *fixture, gconstpointer pData)
|
||||
g_assert (fixture->session->book);
|
||||
book = qof_session_get_book (fixture->session);
|
||||
g_assert (book);
|
||||
g_assert_cmpuint (book->book_open, ==, 'y');
|
||||
g_assert_cmpuint (book->book_open, == , 'y');
|
||||
|
||||
g_test_message ("Test when book is closed null returned");
|
||||
qof_book_mark_closed (book);
|
||||
@ -881,23 +881,23 @@ test_qof_session_get_error (Fixture *fixture, gconstpointer pData)
|
||||
QofBackend *be = NULL;
|
||||
|
||||
g_test_message ("Test if session is null");
|
||||
g_assert_cmpint (qof_session_get_error (NULL), ==, ERR_BACKEND_NO_BACKEND);
|
||||
g_assert_cmpint (qof_session_get_error (NULL), == , ERR_BACKEND_NO_BACKEND);
|
||||
|
||||
g_test_message ("Test when there is a local error");
|
||||
fixture->session->last_err = ERR_BACKEND_DATA_CORRUPT; /* just any error */
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), ==, ERR_BACKEND_DATA_CORRUPT);
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), == , ERR_BACKEND_DATA_CORRUPT);
|
||||
|
||||
g_test_message ("Test if session backend is null");
|
||||
g_assert (!fixture->session->backend);
|
||||
fixture->session->last_err = ERR_BACKEND_NO_ERR;
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), ==, ERR_BACKEND_NO_ERR);
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), == , ERR_BACKEND_NO_ERR);
|
||||
|
||||
g_test_message ("Test for backend error");
|
||||
be = g_new0 (QofBackend, 1);
|
||||
g_assert (be);
|
||||
qof_backend_set_error (be, ERR_BACKEND_CANT_CONNECT);
|
||||
fixture->session->backend = be;
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), ==, ERR_BACKEND_CANT_CONNECT);
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), == , ERR_BACKEND_CANT_CONNECT);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -913,10 +913,10 @@ test_qof_session_clear_error (Fixture *fixture, gconstpointer pData)
|
||||
fixture->session->backend = be;
|
||||
qof_backend_set_error (be, ERR_BACKEND_CANT_CONNECT);
|
||||
p_qof_session_clear_error (fixture->session);
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), ==, ERR_BACKEND_NO_ERR);
|
||||
g_assert_cmpstr (qof_session_get_error_message (fixture->session), ==, "");
|
||||
g_assert_cmpint (qof_session_get_error (fixture->session), == , ERR_BACKEND_NO_ERR);
|
||||
g_assert_cmpstr (qof_session_get_error_message (fixture->session), == , "");
|
||||
g_assert (!fixture->session->error_message);
|
||||
g_assert_cmpint (qof_backend_get_error (be), ==, ERR_BACKEND_NO_ERR);
|
||||
g_assert_cmpint (qof_backend_get_error (be), == , ERR_BACKEND_NO_ERR);
|
||||
}
|
||||
|
||||
static struct
|
||||
@ -938,11 +938,11 @@ mock_hook_fn (gpointer data, gpointer user_data)
|
||||
session = (QofSession*) data;
|
||||
g_assert (session == hooks_struct.session);
|
||||
if (hooks_struct.call_count == 0)
|
||||
g_assert (hooks_struct.data1 == user_data);
|
||||
g_assert (hooks_struct.data1 == user_data);
|
||||
if (hooks_struct.call_count == 1)
|
||||
g_assert (hooks_struct.data2 == user_data);
|
||||
g_assert (hooks_struct.data2 == user_data);
|
||||
if (hooks_struct.call_count == 2)
|
||||
g_assert (hooks_struct.data3 == user_data);
|
||||
g_assert (hooks_struct.data3 == user_data);
|
||||
hooks_struct.call_count++;
|
||||
}
|
||||
|
||||
@ -968,7 +968,7 @@ test_qof_session_close_hooks (Fixture *fixture, gconstpointer pData)
|
||||
hooks_struct.data3 = (gpointer) &data3;
|
||||
hooks_struct.call_count = 0;
|
||||
qof_session_call_close_hooks (fixture->session);
|
||||
g_assert_cmpuint (hooks_struct.call_count, ==, 3);
|
||||
g_assert_cmpuint (hooks_struct.call_count, == , 3);
|
||||
|
||||
/* currently qofsession does not provide a way to clear hooks list
|
||||
* g_hook_list_clear is used to destroy list and all of it's elements
|
||||
|
@ -105,7 +105,7 @@ gnc_plugin_bi_import_showGUI(void)
|
||||
gui->open_mode = "ALL";
|
||||
|
||||
builder = gtk_builder_new();
|
||||
gnc_builder_add_from_file (builder,"dialog-bi-import-gui.glade", "bi-import Dialog");
|
||||
gnc_builder_add_from_file (builder, "dialog-bi-import-gui.glade", "bi-import Dialog");
|
||||
gui->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "bi-import Dialog"));
|
||||
gui->tree_view = GTK_WIDGET(gtk_builder_get_object (builder, "treeview1"));
|
||||
gui->entryFilename = GTK_WIDGET(gtk_builder_get_object (builder, "entryFilename"));
|
||||
|
@ -462,10 +462,10 @@ gnc_bi_import_fix_bis (GtkListStore * store, guint * fixed, guint * deleted,
|
||||
else if (row_fixed)
|
||||
(*fixed)++;
|
||||
|
||||
if (!row_deleted)
|
||||
if (!row_deleted)
|
||||
valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter);
|
||||
|
||||
row++;
|
||||
row++;
|
||||
}
|
||||
|
||||
// deallocate strings
|
||||
|
@ -84,7 +84,7 @@ gnc_plugin_customer_import_showGUI(void)
|
||||
GtkTreeIter iter;
|
||||
GtkCellRenderer *renderer;
|
||||
GtkTreeViewColumn *column;
|
||||
|
||||
|
||||
// if window exists already, activate it
|
||||
glist = gnc_find_gui_components ("dialog-customer_import_gui", NULL, NULL);
|
||||
if (glist)
|
||||
@ -171,7 +171,7 @@ gnc_plugin_customer_import_getFilename(void)
|
||||
filename = gnc_file_dialog(_("Import Customers from csv"), filters, NULL, GNC_FILE_DIALOG_IMPORT);
|
||||
|
||||
return filename;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gnc_customer_import_gui_ok_cb (GtkWidget *widget, gpointer data)
|
||||
@ -182,11 +182,11 @@ gnc_customer_import_gui_ok_cb (GtkWidget *widget, gpointer data)
|
||||
customer_import_result res;
|
||||
guint n_fixed, n_deleted, n_customers_created, n_customers_updated;
|
||||
gchar *cv_type_text;
|
||||
|
||||
|
||||
// import
|
||||
if (g_ascii_strcasecmp (gui->type, "CUSTOMER") == 0) cv_type_text = _("customers");
|
||||
else cv_type_text = _("vendors");
|
||||
|
||||
|
||||
gtk_list_store_clear (gui->store);
|
||||
res = gnc_customer_import_read_file (filename, gui->regexp->str, gui->store, 0, &stats);
|
||||
if (res == CI_RESULT_OK)
|
||||
@ -194,13 +194,13 @@ gnc_customer_import_gui_ok_cb (GtkWidget *widget, gpointer data)
|
||||
gnc_customer_import_fix_customers (gui->store, &n_fixed, &n_deleted, gui->type);
|
||||
gnc_customer_import_create_customers (gui->store, gui->book, &n_customers_created, &n_customers_updated, gui->type);
|
||||
gnc_info_dialog (gui->dialog, _("Import results:\n%i lines were ignored\n%i lines imported:\n %u %s fixed\n %u %s ignored (not fixable)\n\n %u %s created\n %u %s updated (based on id)"), \
|
||||
stats.n_ignored, stats.n_imported, n_fixed, cv_type_text, n_deleted, cv_type_text, n_customers_created, cv_type_text, n_customers_updated,cv_type_text);
|
||||
stats.n_ignored, stats.n_imported, n_fixed, cv_type_text, n_deleted, cv_type_text, n_customers_created, cv_type_text, n_customers_updated, cv_type_text);
|
||||
|
||||
if (stats.n_ignored > 0)
|
||||
gnc_info2_dialog (gui->dialog, _("These lines were ignored during import"), stats.ignored_lines->str);
|
||||
|
||||
g_string_free (stats.ignored_lines, TRUE);
|
||||
gnc_close_gui_component (gui->component_id);
|
||||
gnc_close_gui_component (gui->component_id);
|
||||
}
|
||||
else if (res == CI_RESULT_OPEN_FAILED)
|
||||
{
|
||||
@ -272,7 +272,7 @@ void gnc_customer_import_gui_filenameChanged_cb (GtkWidget *widget, gpointer dat
|
||||
gtk_list_store_clear (gui->store);
|
||||
gnc_customer_import_read_file (filename, gui->regexp->str, gui->store, 10, NULL);
|
||||
|
||||
g_free( filename );
|
||||
g_free( filename );
|
||||
}
|
||||
// Semicolon separated.
|
||||
void gnc_customer_import_gui_option1_cb (GtkWidget *widget, gpointer data)
|
||||
@ -340,10 +340,10 @@ void gnc_customer_import_gui_type_cb (GtkWidget *widget, gpointer data)
|
||||
if (!gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(widget) ))
|
||||
return;
|
||||
name = gtk_buildable_get_name(GTK_BUILDABLE(widget));
|
||||
if(name)
|
||||
if (name)
|
||||
{
|
||||
if (g_ascii_strcasecmp(name, "radiobutton_customer") == 0)gui->type = "CUSTOMER";
|
||||
else if (g_ascii_strcasecmp(name, "radiobutton_vendor") == 0)gui->type = "VENDOR";
|
||||
if (g_ascii_strcasecmp(name, "radiobutton_customer") == 0)gui->type = "CUSTOMER";
|
||||
else if (g_ascii_strcasecmp(name, "radiobutton_vendor") == 0)gui->type = "VENDOR";
|
||||
}
|
||||
//printf ("TYPE set to, %s\n",gui->type); // DEBUG
|
||||
|
||||
|
@ -349,15 +349,15 @@ gnc_customer_import_create_customers (GtkListStore *store, QofBook *book, guint
|
||||
{
|
||||
if (g_ascii_strcasecmp (type, "CUSTOMER") == 0)
|
||||
{
|
||||
customer = gncCustomerCreate( book );
|
||||
gncCustomerSetCurrency( customer, gnc_default_currency() );
|
||||
customer = gncCustomerCreate( book );
|
||||
gncCustomerSetCurrency( customer, gnc_default_currency() );
|
||||
}
|
||||
else if(g_ascii_strcasecmp (type, "VENDOR") == 0)
|
||||
else if (g_ascii_strcasecmp (type, "VENDOR") == 0)
|
||||
{
|
||||
vendor = gncVendorCreate( book );
|
||||
gncVendorSetCurrency( vendor, gnc_default_currency() );
|
||||
vendor = gncVendorCreate( book );
|
||||
gncVendorSetCurrency( vendor, gnc_default_currency() );
|
||||
}
|
||||
|
||||
|
||||
(*n_customers_created)++;
|
||||
}
|
||||
else
|
||||
|
@ -836,7 +836,7 @@ gnc_item_edit_cut_copy_clipboard (GncItemEdit *item_edit, guint32 time, gboolean
|
||||
return;
|
||||
|
||||
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (editable),
|
||||
clipboard_atom);
|
||||
clipboard_atom);
|
||||
g_return_if_fail (clipboard != NULL);
|
||||
g_return_if_fail (GTK_IS_CLIPBOARD (clipboard));
|
||||
clip = gtk_editable_get_chars (editable, start_sel, end_sel);
|
||||
@ -875,11 +875,11 @@ paste_received (GtkClipboard *clipboard, const gchar *text, gpointer data)
|
||||
gint start_sel, end_sel;
|
||||
|
||||
if (text == NULL)
|
||||
return;
|
||||
return;
|
||||
if (gtk_editable_get_selection_bounds (editable, &start_sel, &end_sel))
|
||||
{
|
||||
reselect = TRUE;
|
||||
gtk_editable_delete_text (editable, start_sel, end_sel);
|
||||
reselect = TRUE;
|
||||
gtk_editable_delete_text (editable, start_sel, end_sel);
|
||||
}
|
||||
|
||||
tmp_pos = old_pos = gtk_editable_get_position (editable);
|
||||
@ -888,23 +888,23 @@ paste_received (GtkClipboard *clipboard, const gchar *text, gpointer data)
|
||||
gtk_editable_set_position (editable, tmp_pos);
|
||||
|
||||
if (!reselect)
|
||||
return;
|
||||
return;
|
||||
|
||||
gtk_editable_select_region (editable, old_pos,
|
||||
gtk_editable_get_position (editable));
|
||||
gtk_editable_get_position (editable));
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
gnc_item_edit_paste_selection (GncItemEdit *item_edit, GdkAtom selection,
|
||||
guint32 time)
|
||||
guint32 time)
|
||||
{
|
||||
GtkClipboard *clipboard;
|
||||
g_return_if_fail(item_edit != NULL);
|
||||
g_return_if_fail(GNC_IS_ITEM_EDIT(item_edit));
|
||||
|
||||
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (item_edit->sheet),
|
||||
selection);
|
||||
selection);
|
||||
|
||||
g_return_if_fail (clipboard != NULL);
|
||||
g_return_if_fail (GTK_IS_CLIPBOARD (clipboard));
|
||||
|
@ -146,7 +146,7 @@ void gnc_item_edit_redraw (GncItemEdit *item_edit);
|
||||
void gnc_item_edit_cut_clipboard (GncItemEdit *item_edit, guint32 time);
|
||||
void gnc_item_edit_copy_clipboard (GncItemEdit *item_edit, guint32 time);
|
||||
void gnc_item_edit_paste_selection (GncItemEdit *item_edit, GdkAtom selection,
|
||||
guint32 time);
|
||||
guint32 time);
|
||||
|
||||
void gnc_item_edit_set_has_selection (GncItemEdit *item_edit, gboolean has_selection);
|
||||
gboolean gnc_item_edit_get_has_selection (GncItemEdit *item_edit);
|
||||
|
@ -1409,8 +1409,8 @@ gnucash_button_press_event (GtkWidget *widget, GdkEventButton *event)
|
||||
if (event->type != GDK_BUTTON_PRESS)
|
||||
return FALSE;
|
||||
gnc_item_edit_paste_selection (GNC_ITEM_EDIT(sheet->item_editor),
|
||||
GDK_SELECTION_PRIMARY,
|
||||
event->time);
|
||||
GDK_SELECTION_PRIMARY,
|
||||
event->time);
|
||||
return TRUE;
|
||||
case 3:
|
||||
do_popup = (sheet->popup != NULL);
|
||||
@ -1449,7 +1449,7 @@ gnucash_button_press_event (GtkWidget *widget, GdkEventButton *event)
|
||||
gtk_grab_add(widget);
|
||||
sheet->grabbed = TRUE;
|
||||
gnc_item_edit_set_has_selection (GNC_ITEM_EDIT(sheet->item_editor),
|
||||
TRUE);
|
||||
TRUE);
|
||||
}
|
||||
|
||||
if (virt_loc_equal (new_virt_loc, cur_virt_loc) && sheet->editing)
|
||||
@ -1553,7 +1553,7 @@ gnucash_register_paste_clipboard (GnucashRegister *reg)
|
||||
item_edit = GNC_ITEM_EDIT(sheet->item_editor);
|
||||
|
||||
gnc_item_edit_paste_selection (item_edit, GDK_SELECTION_CLIPBOARD,
|
||||
GDK_CURRENT_TIME);
|
||||
GDK_CURRENT_TIME);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1615,7 +1615,7 @@ gnucash_sheet_clipboard_event (GnucashSheet *sheet, GdkEventKey *event)
|
||||
if (event->state & GDK_CONTROL_MASK)
|
||||
{
|
||||
gnc_item_edit_paste_selection (item_edit, GDK_SELECTION_CLIPBOARD,
|
||||
time);
|
||||
time);
|
||||
handled = TRUE;
|
||||
}
|
||||
break;
|
||||
@ -1623,7 +1623,7 @@ gnucash_sheet_clipboard_event (GnucashSheet *sheet, GdkEventKey *event)
|
||||
if (event->state & GDK_SHIFT_MASK)
|
||||
{
|
||||
gnc_item_edit_paste_selection (item_edit, GDK_SELECTION_CLIPBOARD,
|
||||
time);
|
||||
time);
|
||||
handled = TRUE;
|
||||
}
|
||||
else if (event->state & GDK_CONTROL_MASK)
|
||||
|
Loading…
Reference in New Issue
Block a user