mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Re-indentation of source code.
This 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@20163 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
bd17b5fa41
commit
c8f1244fff
@ -314,11 +314,13 @@ gnc_dbi_sqlite3_session_begin( QofBackend *qbe, QofSession *session,
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if ( !conn_test_dbi_library( be->conn ) ) {
|
||||
if ( !conn_test_dbi_library( be->conn ) )
|
||||
{
|
||||
qof_backend_set_error( qbe, ERR_SQL_BAD_DBI );
|
||||
qof_backend_set_message( qbe, "DBI library fails large number test" );
|
||||
if ( create && !file_exists ) /* File didn't exist before, but it */
|
||||
{ /* does now, and we don't want to */
|
||||
{
|
||||
/* does now, and we don't want to */
|
||||
dbi_conn_close( be->conn );/* leave it lying around. */
|
||||
be->conn = NULL;
|
||||
g_unlink( filepath );
|
||||
@ -761,7 +763,8 @@ gnc_dbi_mysql_session_begin( QofBackend* qbe, QofSession *session,
|
||||
result = dbi_conn_connect( be->conn );
|
||||
if ( result == 0 )
|
||||
{
|
||||
if ( !conn_test_dbi_library( be->conn ) ) {
|
||||
if ( !conn_test_dbi_library( be->conn ) )
|
||||
{
|
||||
qof_backend_set_error( qbe, ERR_SQL_BAD_DBI );
|
||||
qof_backend_set_message( qbe,
|
||||
"DBI library fails large number test" );
|
||||
@ -833,7 +836,8 @@ gnc_dbi_mysql_session_begin( QofBackend* qbe, QofSession *session,
|
||||
qof_backend_set_error( qbe, ERR_BACKEND_SERVER_ERR );
|
||||
goto exit;
|
||||
}
|
||||
if ( !conn_test_dbi_library( be->conn ) ) {
|
||||
if ( !conn_test_dbi_library( be->conn ) )
|
||||
{
|
||||
qof_backend_set_error( qbe, ERR_SQL_BAD_DBI );
|
||||
qof_backend_set_message( qbe,
|
||||
"DBI library fails large number test" );
|
||||
@ -1027,7 +1031,8 @@ gnc_dbi_postgres_session_begin( QofBackend *qbe, QofSession *session,
|
||||
result = dbi_conn_connect( be->conn );
|
||||
if ( result == 0 )
|
||||
{
|
||||
if ( !conn_test_dbi_library( be->conn ) ) {
|
||||
if ( !conn_test_dbi_library( be->conn ) )
|
||||
{
|
||||
qof_backend_set_error( qbe, ERR_SQL_BAD_DBI );
|
||||
qof_backend_set_message( qbe,
|
||||
"DBI library fails large number test" );
|
||||
@ -1100,7 +1105,8 @@ gnc_dbi_postgres_session_begin( QofBackend *qbe, QofSession *session,
|
||||
qof_backend_set_error( qbe, ERR_BACKEND_SERVER_ERR );
|
||||
goto exit;
|
||||
}
|
||||
if ( !conn_test_dbi_library( be->conn ) ) {
|
||||
if ( !conn_test_dbi_library( be->conn ) )
|
||||
{
|
||||
qof_backend_set_error( qbe, ERR_SQL_BAD_DBI );
|
||||
qof_backend_set_message( qbe,
|
||||
"DBI library fails large number test" );
|
||||
@ -1345,7 +1351,8 @@ conn_table_operation( GncSqlConnection *sql_conn, GSList *table_name_list,
|
||||
do
|
||||
{
|
||||
gnc_dbi_init_error( conn );
|
||||
switch( op ) {
|
||||
switch ( op )
|
||||
{
|
||||
case rollback:
|
||||
if (g_slist_find(full_table_name_list, table_name))
|
||||
{
|
||||
|
@ -3246,11 +3246,14 @@ get_preferences(QIFImportWindow *wind)
|
||||
g_error_free(err);
|
||||
g_warning("QIF import: Couldn't get %s setting from gconf.",
|
||||
GCONF_NAME_DEFAULT_TRANSACTION_STATUS);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g_strcmp0(status_pref, "cleared") == 0)
|
||||
{
|
||||
tmp_transaction_status = 'c';
|
||||
} else if (g_strcmp0(status_pref, "reconciled") == 0)
|
||||
}
|
||||
else if (g_strcmp0(status_pref, "reconciled") == 0)
|
||||
{
|
||||
tmp_transaction_status = 'y';
|
||||
}
|
||||
|
@ -621,7 +621,9 @@ qof_book_validate_counter_format(const gchar *p)
|
||||
if (tmp == NULL)
|
||||
{
|
||||
return g_strdup_printf("Invalid length modifier and/or conversion specifier ('%.2s'), it should be: " G_GINT64_FORMAT, p);
|
||||
} else if (tmp != p) {
|
||||
}
|
||||
else if (tmp != p)
|
||||
{
|
||||
return g_strdup_printf("Garbage before length modifier and/or conversion specifier: '%*s'", (int)(tmp - p), p);
|
||||
}
|
||||
|
||||
|
@ -599,13 +599,30 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
|
||||
update = gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
gtk_widget_destroy (dialog);
|
||||
if (update == NO)
|
||||
{ // Cleanup and leave
|
||||
g_free (id); g_free (date_opened); g_free (owner_id); g_free (biing_id);
|
||||
g_free (notes); g_free (date); g_free (desc); g_free (action);
|
||||
g_free (account); g_free (quantity); g_free (price); g_free (disc_type);
|
||||
g_free (disc_how); g_free (discount); g_free (taxable); g_free (taxincluded);
|
||||
g_free (tax_table); g_free (date_posted); g_free (due_date); g_free (account_posted);
|
||||
g_free (memo_posted); g_free (accumulatesplits);
|
||||
{
|
||||
// Cleanup and leave
|
||||
g_free (id);
|
||||
g_free (date_opened);
|
||||
g_free (owner_id);
|
||||
g_free (biing_id);
|
||||
g_free (notes);
|
||||
g_free (date);
|
||||
g_free (desc);
|
||||
g_free (action);
|
||||
g_free (account);
|
||||
g_free (quantity);
|
||||
g_free (price);
|
||||
g_free (disc_type);
|
||||
g_free (disc_how);
|
||||
g_free (discount);
|
||||
g_free (taxable);
|
||||
g_free (taxincluded);
|
||||
g_free (tax_table);
|
||||
g_free (date_posted);
|
||||
g_free (due_date);
|
||||
g_free (account_posted);
|
||||
g_free (memo_posted);
|
||||
g_free (accumulatesplits);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -37,21 +37,24 @@
|
||||
G_BEGIN_DECLS
|
||||
|
||||
// model
|
||||
enum bi_import_model_columns {
|
||||
enum bi_import_model_columns
|
||||
{
|
||||
ID, DATE_OPENED, OWNER_ID, BILLING_ID, NOTES, // invoice settings
|
||||
DATE, DESC, ACTION, ACCOUNT, QUANTITY, PRICE, DISC_TYPE, DISC_HOW, DISCOUNT, TAXABLE, TAXINCLUDED, TAX_TABLE, // entry settings
|
||||
DATE_POSTED, DUE_DATE, ACCOUNT_POSTED, MEMO_POSTED, ACCU_SPLITS, // autopost settings
|
||||
N_COLUMNS
|
||||
};
|
||||
|
||||
enum _bi_import_result {
|
||||
enum _bi_import_result
|
||||
{
|
||||
RESULT_OK,
|
||||
RESULT_OPEN_FAILED,
|
||||
RESULT_ERROR_IN_REGEXP,
|
||||
};
|
||||
typedef enum _bi_import_result bi_import_result;
|
||||
|
||||
struct _bi_import_stats {
|
||||
struct _bi_import_stats
|
||||
{
|
||||
int n_imported, n_ignored;
|
||||
GString *ignored_lines;
|
||||
};
|
||||
|
@ -51,7 +51,8 @@ static void gnc_plugin_bi_import_cmd_test (GtkAction *action, GncMainWindowActio
|
||||
#define PLUGIN_ACTIONS_NAME "gnc-plugin-bi_import-actions"
|
||||
#define PLUGIN_UI_FILENAME "gnc-plugin-bi_import-ui.xml"
|
||||
|
||||
static GtkActionEntry gnc_plugin_actions [] = {
|
||||
static GtkActionEntry gnc_plugin_actions [] =
|
||||
{
|
||||
/* Menu Items */
|
||||
{ "ImportMenuAction", NULL, N_("_Import"), NULL, NULL, NULL },
|
||||
{ "bi_importAction", NULL, N_("Import Bills & Invoices..."), NULL, N_("bi_import tooltip"), G_CALLBACK(gnc_plugin_bi_import_cmd_test) },
|
||||
|
@ -47,11 +47,13 @@ G_BEGIN_DECLS
|
||||
#define GNC_PLUGIN_bi_import_NAME "gnc-plugin-bi_import"
|
||||
|
||||
/* typedefs & structures */
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
GncPlugin gnc_plugin;
|
||||
} GncPluginbi_import;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
GncPluginClass gnc_plugin;
|
||||
} GncPluginbi_importClass;
|
||||
|
||||
|
@ -66,20 +66,25 @@ libgncmod_bi_import_gnc_module_description (void)
|
||||
int
|
||||
libgncmod_bi_import_gnc_module_init (int refcount)
|
||||
{
|
||||
if (!gnc_module_load ("gnucash/app-utils", 0)) {
|
||||
if (!gnc_module_load ("gnucash/app-utils", 0))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if (!gnc_module_load ("gnucash/gnome-utils", 0)) {
|
||||
if (!gnc_module_load ("gnucash/gnome-utils", 0))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if (!gnc_module_load ("gnucash/business-core", 0)) {
|
||||
if (!gnc_module_load ("gnucash/business-core", 0))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if (!gnc_module_load ("gnucash/engine", 0)) {
|
||||
if (!gnc_module_load ("gnucash/engine", 0))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (refcount == 0) {
|
||||
if (refcount == 0)
|
||||
{
|
||||
/* this is the first time the module is loaded */
|
||||
|
||||
gnc_plugin_manager_add_plugin ( gnc_plugin_manager_get (),
|
||||
@ -92,7 +97,8 @@ libgncmod_bi_import_gnc_module_init (int refcount)
|
||||
int
|
||||
libgncmod_bi_import_gnc_module_end (int refcount)
|
||||
{
|
||||
if (refcount == 0) {
|
||||
if (refcount == 0)
|
||||
{
|
||||
/* this is the last time the module is unloaded */
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,8 @@
|
||||
#include "bi_import.h"
|
||||
#include "gui.h"
|
||||
|
||||
struct _bi_import_gui {
|
||||
struct _bi_import_gui
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *tree_view;
|
||||
GtkWidget *entryFilename;
|
||||
@ -92,7 +93,8 @@ gnc_plugin_bi_import_showGUI(void)
|
||||
|
||||
// if window exists already, activate it
|
||||
glist = gnc_find_gui_components ("dialog-bi_import_gui", NULL, NULL);
|
||||
if (glist) {
|
||||
if (glist)
|
||||
{
|
||||
// window found
|
||||
gui = g_list_nth_data (glist, 0);
|
||||
g_list_free (glist);
|
||||
@ -196,7 +198,8 @@ gnc_bi_import_gui_ok_cb (GtkWidget *widget, gpointer data)
|
||||
|
||||
gtk_list_store_clear (gui->store);
|
||||
res = gnc_bi_import_read_file (filename, gui->regexp->str, gui->store, 0, &stats);
|
||||
if (res == RESULT_OK) {
|
||||
if (res == RESULT_OK)
|
||||
{
|
||||
gnc_bi_import_fix_bis (gui->store, &n_fixed, &n_deleted, info);
|
||||
if (info->len > 0)
|
||||
gnc_info_dialog (gui->dialog, "%s", info->str);
|
||||
@ -209,11 +212,13 @@ gnc_bi_import_gui_ok_cb (GtkWidget *widget, gpointer data)
|
||||
|
||||
g_string_free (stats.ignored_lines, TRUE);
|
||||
gnc_close_gui_component (gui->component_id);
|
||||
} else
|
||||
if (res == RESULT_OPEN_FAILED) {
|
||||
}
|
||||
else if (res == RESULT_OPEN_FAILED)
|
||||
{
|
||||
gnc_error_dialog (gui->dialog, _("The input file can not be opened."));
|
||||
} else
|
||||
if (res == RESULT_ERROR_IN_REGEXP) {
|
||||
}
|
||||
else if (res == RESULT_ERROR_IN_REGEXP)
|
||||
{
|
||||
//gnc_error_dialog (gui->dialog, "The regular expression is faulty:\n\n%s", stats.err->str);
|
||||
}
|
||||
}
|
||||
@ -262,7 +267,8 @@ void gnc_bi_import_gui_buttonOpen_cb (GtkWidget *widget, gpointer data)
|
||||
BillImportGui *gui = data;
|
||||
|
||||
filename = gnc_plugin_bi_import_getFilename();
|
||||
if (filename) {
|
||||
if (filename)
|
||||
{
|
||||
//printf("Setting filename"); // debug
|
||||
gtk_entry_set_text( GTK_ENTRY(gui->entryFilename), filename );
|
||||
//printf("Set filename"); // debug
|
||||
@ -321,7 +327,8 @@ void gnc_bi_import_gui_option5_cb (GtkWidget *widget, gpointer data)
|
||||
if (!gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(widget) ))
|
||||
return;
|
||||
temp = gnc_input_dialog (0, _("Adjust regular expression used for import"), _("This regular expression is used to parse the import file. Modify according to your needs.\n"), gui->regexp->str);
|
||||
if (temp) {
|
||||
if (temp)
|
||||
{
|
||||
g_string_assign (gui->regexp, temp);
|
||||
g_free (temp);
|
||||
gnc_bi_import_gui_filenameChanged_cb (gui->entryFilename, gui);
|
||||
@ -403,7 +410,8 @@ gnc_input_dialog (GtkWidget *parent, const gchar *title, const gchar *msg, const
|
||||
|
||||
if (result == GTK_RESPONSE_REJECT)
|
||||
user_input = 0;
|
||||
else {
|
||||
else
|
||||
{
|
||||
gtk_text_buffer_get_start_iter (buffer, &start);
|
||||
gtk_text_buffer_get_end_iter (buffer, &end);
|
||||
user_input = gtk_text_buffer_get_text (buffer,
|
||||
@ -461,7 +469,8 @@ gnc_info2_dialog (GtkWidget *parent, const gchar *title, const gchar *msg)
|
||||
gtk_container_add (GTK_CONTAINER (scrolledwindow), view);
|
||||
|
||||
// run the dialog
|
||||
if (parent) {
|
||||
if (parent)
|
||||
{
|
||||
gtk_window_get_size (GTK_WINDOW(parent), &width, &height);
|
||||
gtk_window_set_default_size (GTK_WINDOW(dialog), width, height);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user