X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fhomebank;a=blobdiff_plain;f=src%2Fhb-hbfile.c;fp=src%2Fhb-hbfile.c;h=e534eadb44f61cffe078e79580e80ba91470c349;hp=b376d370d6f7e4c91c94b79adaba2192184d9c93;hb=cd13d9691c46c2b2d6d459e9e6a76bed1c21b7a6;hpb=b84403141a4c3a32a594800eb3fcabdc856461f8 diff --git a/src/hb-hbfile.c b/src/hb-hbfile.c index b376d37..e534ead 100644 --- a/src/hb-hbfile.c +++ b/src/hb-hbfile.c @@ -1,5 +1,5 @@ /* HomeBank -- Free, easy, personal accounting for everyone. - * Copyright (C) 1995-2017 Maxime DOYEN + * Copyright (C) 1995-2018 Maxime DOYEN * * This file is part of HomeBank. * @@ -22,6 +22,7 @@ #include "hb-archive.h" #include "hb-transaction.h" + /****************************************************************************/ /* Debug macros */ /****************************************************************************/ @@ -41,11 +42,20 @@ extern struct Preferences *PREFS; /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/ +gboolean hbfile_file_isbackup(gchar *filepath) +{ + return g_str_has_suffix(filepath, "xhb~"); +} + + + + + gboolean hbfile_file_hasbackup(gchar *filepath) { gchar *bakfilepath; - bakfilepath = hb_util_filename_new_with_extension(GLOBALS->xhb_filepath, "xhb~"); + bakfilepath = hb_filename_new_with_extension(GLOBALS->xhb_filepath, "xhb~"); GLOBALS->xhb_hasbak = g_file_test(bakfilepath, G_FILE_TEST_EXISTS); g_free(bakfilepath); //todo check here if need to return something @@ -53,6 +63,16 @@ gchar *bakfilepath; } +void hbfile_file_default(void) +{ + //todo: maybe translate this also + hbfile_change_filepath(g_build_filename(PREFS->path_hbfile, "untitled.xhb", NULL)); + GLOBALS->hbfile_is_new = TRUE; + GLOBALS->hbfile_is_bak = FALSE; + + DB( g_print("- path_hbfile is '%s'\n", PREFS->path_hbfile) ); + DB( g_print("- xhb_filepath is '%s'\n", GLOBALS->xhb_filepath) ); +} @@ -149,7 +169,9 @@ GList *list; { Account *acc = lnk_acc->data; - if( (acc->flags & (AF_CLOSED|AF_NOREPORT)) ) + //#1674045 ony rely on nosummary + //if( (acc->flags & (AF_CLOSED|AF_NOREPORT)) ) + if( (acc->flags & (AF_NOREPORT)) ) goto next_acc; lnk_txn = g_queue_peek_head_link(acc->txn_queue); @@ -215,13 +237,17 @@ GQueue *txn_queue; GQueue *hbfile_transaction_get_partial(guint32 minjulian, guint32 maxjulian) { - return hbfile_transaction_get_partial_internal(minjulian, maxjulian, (AF_CLOSED|AF_NOREPORT)); + //#1674045 ony rely on nosummary + //return hbfile_transaction_get_partial_internal(minjulian, maxjulian, (AF_CLOSED|AF_NOREPORT)); + return hbfile_transaction_get_partial_internal(minjulian, maxjulian, (AF_NOREPORT)); } GQueue *hbfile_transaction_get_partial_budget(guint32 minjulian, guint32 maxjulian) { - return hbfile_transaction_get_partial_internal(minjulian, maxjulian, (AF_CLOSED|AF_NOREPORT|AF_NOBUDGET)); + //#1674045 ony rely on nosummary + //return hbfile_transaction_get_partial_internal(minjulian, maxjulian, (AF_CLOSED|AF_NOREPORT|AF_NOBUDGET)); + return hbfile_transaction_get_partial_internal(minjulian, maxjulian, (AF_NOREPORT|AF_NOBUDGET)); } @@ -407,8 +433,8 @@ guint cnt, i; { Archive *item = list->data; - g_free(item->wording); - item->wording = g_strdup_printf("archive %d", cnt++); + g_free(item->memo); + item->memo = g_strdup_printf("archive %d", cnt++); GLOBALS->changes_count++; //later split anonymize also @@ -431,8 +457,8 @@ guint cnt, i; g_free(item->info); item->info = NULL; - g_free(item->wording); - item->wording = g_strdup_printf("memo %d", item->date); + g_free(item->memo); + item->memo = g_strdup_printf("memo %d", item->date); GLOBALS->changes_count++; if(item->flags & OF_SPLIT)