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
@ -153,7 +153,7 @@ static void
|
||||
gnc_table_slist_free( GSList *table_list )
|
||||
{
|
||||
GSList *list;
|
||||
for ( list = table_list; list !=NULL; list = g_slist_next( list ))
|
||||
for ( list = table_list; list != NULL; list = g_slist_next( list ))
|
||||
{
|
||||
g_free( list->data );
|
||||
}
|
||||
@ -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))
|
||||
{
|
||||
|
@ -494,9 +494,9 @@ gnc_entry_ledger_auto_completion (GncEntryLedger *ledger,
|
||||
auto_entry =
|
||||
/* Use this for book-wide auto-completion of the invoice entries */
|
||||
find_entry_in_book_by_desc(ledger, desc);
|
||||
/* #else */
|
||||
/* gnc_find_entry_in_reg_by_desc(ledger, desc); */
|
||||
/* #endif */
|
||||
/* #else */
|
||||
/* gnc_find_entry_in_reg_by_desc(ledger, desc); */
|
||||
/* #endif */
|
||||
|
||||
if (auto_entry == NULL)
|
||||
return FALSE;
|
||||
|
@ -55,8 +55,8 @@ listen_for_gncentry_events(QofInstance *entity, QofEventId event_type,
|
||||
if (0 == (event_type & (QOF_EVENT_MODIFY | QOF_EVENT_DESTROY)))
|
||||
return;
|
||||
|
||||
/* g_warning("entity %p, entity type %s, event type %s, user data %p, ecent data %p", */
|
||||
/* entity, entity->e_type, qofeventid_to_string(event_type), user_data, event_data); */
|
||||
/* g_warning("entity %p, entity type %s, event type %s, user data %p, ecent data %p", */
|
||||
/* entity, entity->e_type, qofeventid_to_string(event_type), user_data, event_data); */
|
||||
|
||||
desc = gncEntryGetDescription(GNC_ENTRY(entity));
|
||||
if (event_type & QOF_EVENT_MODIFY)
|
||||
@ -124,7 +124,7 @@ static EntryQF* build_shared_quickfill (QofBook *book, const char * key, gboolea
|
||||
QofQuery *query = new_query_for_entrys(book);
|
||||
GList *entries = qof_query_run(query);
|
||||
|
||||
/* g_warning("Found %d GncEntry items", g_list_length (entries)); */
|
||||
/* g_warning("Found %d GncEntry items", g_list_length (entries)); */
|
||||
|
||||
result = g_new0(EntryQF, 1);
|
||||
|
||||
|
@ -328,12 +328,12 @@ gnc_plugin_ab_account_selected(GncPluginPage *plugin_page, Account *account,
|
||||
(account && bankcode && *bankcode
|
||||
&& accountid && *accountid));
|
||||
gnc_plugin_update_actions(action_group, need_account_actions,
|
||||
"visible",TRUE);
|
||||
"visible", TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gnc_plugin_update_actions(action_group, need_account_actions,
|
||||
"sensitive",FALSE);
|
||||
"sensitive", FALSE);
|
||||
gnc_plugin_update_actions(action_group, need_account_actions,
|
||||
"visible", FALSE);
|
||||
}
|
||||
|
@ -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';
|
||||
}
|
||||
|
@ -655,7 +655,7 @@ floordiv(int a, int b)
|
||||
}
|
||||
else
|
||||
{
|
||||
return - ((-a-1) / b) - 1;
|
||||
return - ((-a - 1) / b) - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ static void
|
||||
test_session_safe_save( Fixture *fixture, gconstpointer pData )
|
||||
{
|
||||
qof_session_safe_save( fixture->session, percentage_fn );
|
||||
g_assert_cmpint( ERR_BACKEND_DATA_CORRUPT, ==,
|
||||
g_assert_cmpint( ERR_BACKEND_DATA_CORRUPT, == ,
|
||||
qof_session_get_error( fixture->session ));
|
||||
g_assert( NULL == qof_session_get_url( fixture->session ));
|
||||
}
|
||||
|
@ -485,7 +485,7 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
|
||||
gnc_numeric n;
|
||||
GncOwner *owner;
|
||||
Account *acc;
|
||||
enum update{YES = GTK_RESPONSE_YES, NO = GTK_RESPONSE_NO}update;
|
||||
enum update {YES = GTK_RESPONSE_YES, NO = GTK_RESPONSE_NO} update;
|
||||
GtkWidget *dialog;
|
||||
Timespec today;
|
||||
|
||||
@ -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,9 +93,10 @@ 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);
|
||||
gui = g_list_nth_data (glist, 0);
|
||||
g_list_free (glist);
|
||||
gtk_window_present (GTK_WINDOW(gui->dialog));
|
||||
return gui;
|
||||
@ -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);
|
||||
@ -207,13 +210,15 @@ gnc_bi_import_gui_ok_cb (GtkWidget *widget, gpointer data)
|
||||
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);
|
||||
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,8 +327,9 @@ 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) {
|
||||
g_string_assign (gui->regexp,temp);
|
||||
if (temp)
|
||||
{
|
||||
g_string_assign (gui->regexp, temp);
|
||||
g_free (temp);
|
||||
gnc_bi_import_gui_filenameChanged_cb (gui->entryFilename, gui);
|
||||
}
|
||||
@ -336,8 +343,8 @@ void gnc_import_gui_type(GtkWidget *widget, gpointer data)
|
||||
BillImportGui *gui = data;
|
||||
if (!gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(widget) ))
|
||||
return;
|
||||
if (g_ascii_strcasecmp(widget->name,"radiobuttonInvoice") == 0)gui->type="INVOICE";
|
||||
else if (g_ascii_strcasecmp(widget->name,"radiobuttonBill") == 0)gui->type="BILL";
|
||||
if (g_ascii_strcasecmp(widget->name, "radiobuttonInvoice") == 0)gui->type = "INVOICE";
|
||||
else if (g_ascii_strcasecmp(widget->name, "radiobuttonBill") == 0)gui->type = "BILL";
|
||||
//printf ("TYPE set to, %s\n",gui->type);
|
||||
|
||||
}
|
||||
@ -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,
|
||||
@ -435,7 +443,7 @@ gnc_info2_dialog (GtkWidget *parent, const gchar *title, const gchar *msg)
|
||||
GtkTextBuffer *buffer;
|
||||
gchar *user_input;
|
||||
GtkTextIter start, end;
|
||||
gint width,height;
|
||||
gint width, height;
|
||||
|
||||
/* Create the widgets */
|
||||
dialog = gtk_dialog_new_with_buttons (title, GTK_WINDOW (parent),
|
||||
@ -449,7 +457,7 @@ gnc_info2_dialog (GtkWidget *parent, const gchar *title, const gchar *msg)
|
||||
#endif
|
||||
|
||||
// add a scroll area
|
||||
scrolledwindow = gtk_scrolled_window_new (NULL,NULL);
|
||||
scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_container_add (GTK_CONTAINER (content_area), scrolledwindow);
|
||||
|
||||
// add a textview
|
||||
@ -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