Revise overall SX logging: define G_LOG_DOMAIN in a fine-grained manner, switch to g_mumble calls, cleanup some formatting.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15543 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Joshua Sled 2007-02-10 00:25:16 +00:00
parent 524620bee0
commit 140db6d1d9
15 changed files with 215 additions and 245 deletions

View File

@ -41,7 +41,10 @@
#include "gnc-ui-util.h" #include "gnc-ui-util.h"
#include "qof.h" #include "qof.h"
static QofLogModule log_module = GNC_MOD_SX; #define LOG_MOD "gnc.app-util.sx"
static QofLogModule log_module = LOG_MOD;
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN LOG_MOD
static GObjectClass *parent_class = NULL; static GObjectClass *parent_class = NULL;
@ -671,7 +674,7 @@ _gnc_sx_instance_event_handler(QofEntity *ent, QofEventId event_type, gpointer u
} }
else if (instances->include_disabled) else if (instances->include_disabled)
{ {
PWARN("Could not remove instances that do not exist in the model"); g_warning("could not remove instances that do not exist in the model");
} }
} }
else if (event_type & GNC_EVENT_ITEM_ADDED) else if (event_type & GNC_EVENT_ITEM_ADDED)
@ -685,7 +688,7 @@ _gnc_sx_instance_event_handler(QofEntity *ent, QofEventId event_type, gpointer u
g_signal_emit_by_name(instances, "added", (gpointer)sx); g_signal_emit_by_name(instances, "added", (gpointer)sx);
} }
} }
/* else { printf("unsupported event type [%d]\n", event_type); } */ /* else { g_critical("unsupported event type [%d]\n", event_type); } */
} }
} }
@ -698,8 +701,7 @@ gnc_sx_instance_model_update_sx_instances(GncSxInstanceModel *model, SchedXactio
link = g_list_find_custom(model->sx_instance_list, sx, (GCompareFunc)_gnc_sx_instance_find_by_sx); link = g_list_find_custom(model->sx_instance_list, sx, (GCompareFunc)_gnc_sx_instance_find_by_sx);
if (link == NULL) if (link == NULL)
{ {
// @fixme: log/error g_critical("couldn't find sx [%p]\n", sx);
printf("couldn't find sx [%p]\n", sx);
return; return;
} }
@ -766,8 +768,7 @@ gnc_sx_instance_model_remove_sx_instances(GncSxInstanceModel *model, SchedXactio
instance_link = g_list_find_custom(model->sx_instance_list, sx, (GCompareFunc)_gnc_sx_instance_find_by_sx); instance_link = g_list_find_custom(model->sx_instance_list, sx, (GCompareFunc)_gnc_sx_instance_find_by_sx);
if (instance_link == NULL) if (instance_link == NULL)
{ {
// @fixme: warn g_warning("instance not found!\n");
// printf("instance not found!\n");
return; return;
} }
@ -918,7 +919,8 @@ create_each_transaction_helper(Transaction *template_txn, void *user_data)
txn_splits = xaccTransGetSplitList(new_txn); txn_splits = xaccTransGetSplitList(new_txn);
if ((template_splits == NULL) || (txn_splits == NULL)) if ((template_splits == NULL) || (txn_splits == NULL))
{ {
PERR("\tseen transaction w/o splits. :("); g_critical("transaction w/o splits for sx [%s]",
xaccSchedXactionGetName(creation_data->instance->parent->sx));
xaccTransDestroy(new_txn); xaccTransDestroy(new_txn);
xaccTransCommitEdit(new_txn); xaccTransCommitEdit(new_txn);
return FALSE; return FALSE;
@ -1041,7 +1043,8 @@ create_each_transaction_helper(Transaction *template_txn, void *user_data)
if (err_flag) if (err_flag)
{ {
PERR("Some error in new transaction creation..."); g_critical("new transaction creation sx [%s]",
xaccSchedXactionGetName(creation_data->instance->parent->sx));
xaccTransDestroy(new_txn); xaccTransDestroy(new_txn);
xaccTransCommitEdit(new_txn); xaccTransCommitEdit(new_txn);
return FALSE; return FALSE;
@ -1318,9 +1321,9 @@ gnc_sx_instance_model_summarize(GncSxInstanceModel *model, GncSxSummary *summary
void void
gnc_sx_summary_print(GncSxSummary *summary) gnc_sx_summary_print(GncSxSummary *summary)
{ {
printf("num_instances: %d\n", summary->num_instances); g_message("num_instances: %d", summary->num_instances);
printf("num_to_create: %d\n", summary->num_to_create_instances); g_message("num_to_create: %d", summary->num_to_create_instances);
printf("num_auto_create_instances: %d\n", summary->num_auto_create_instances); g_message("num_auto_create_instances: %d", summary->num_auto_create_instances);
printf("num_auto_create_no_notify_instances: %d\n", summary->num_auto_create_no_notify_instances); g_message("num_auto_create_no_notify_instances: %d", summary->num_auto_create_no_notify_instances);
printf("need dialog? %s\n", summary->need_dialog ? "true" : "false"); g_message("need dialog? %s", summary->need_dialog ? "true" : "false");
} }

View File

@ -21,11 +21,11 @@ TODO
---------- ----------
- meta - meta
- [x] move files around
- [ ] GncSxListTreeModelAdapter: s/real/adapted/ - [ ] GncSxListTreeModelAdapter: s/real/adapted/
- [ ] generic tree model adapter setup code - [ ] generic tree model adapter setup code
- [ ] move documentation into doxygen comments, here and in sources. - [ ] move documentation into doxygen comments, here and in sources.
- [ ] printf -> logging - [x] move files around
- [x] printf -> logging
- core - core
- [x] sx list -> qof collection - [x] sx list -> qof collection

View File

@ -87,11 +87,14 @@
#include "FreqSpecP.h" #include "FreqSpecP.h"
static QofLogModule log_module = GNC_MOD_SX; #define LOG_MOD "gnc.engine.freqspec"
static QofLogModule log_module = LOG_MOD;
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN LOG_MOD
/* /*
* FIXME: should be in a header file * FIXME: should be in a header file
*/ */
#ifdef HAVE_LANGINFO_D_FMT #ifdef HAVE_LANGINFO_D_FMT
# define GNC_D_FMT (nl_langinfo (D_FMT)) # define GNC_D_FMT (nl_langinfo (D_FMT))
#else #else
@ -753,10 +756,10 @@ xaccFreqSpecGetFreqStr( FreqSpec *fs, GString *str )
{ {
FreqSpec *subFS; FreqSpec *subFS;
if ( g_list_length( fs->s.composites.subSpecs ) != 5 ) { if ( g_list_length( fs->s.composites.subSpecs ) != 5 ) {
PERR( "Invalid Daily[M-F] structure." ); g_critical("Invalid Daily[M-F] structure");
snprintf( freqStrBuf, MAX_FREQ_STR_SIZE, snprintf( freqStrBuf, MAX_FREQ_STR_SIZE,
"Daily[M-F]: error" ); "Daily[M-F]: error" );
return; return;
} }
/* We assume that all of the weekly FreqSpecs that make up /* We assume that all of the weekly FreqSpecs that make up
the Daily[M-F] FreqSpec have the same interval. */ the Daily[M-F] FreqSpec have the same interval. */
@ -925,9 +928,9 @@ xaccFreqSpecGetFreqStr( FreqSpec *fs, GString *str )
case UIFREQ_SEMI_YEARLY: case UIFREQ_SEMI_YEARLY:
if ( fs->s.monthly.interval_months != 6 ) { if ( fs->s.monthly.interval_months != 6 ) {
if ( (fs->s.monthly.interval_months % 6) != 0 ) { if ( (fs->s.monthly.interval_months % 6) != 0 ) {
PERR( "ERROR: FreqSpec Semi-Yearly month-interval " g_critical( "FreqSpec Semi-Yearly month-interval "
"is not a multiple of 6 [%d]", "is not a multiple of 6 [%d]",
fs->s.monthly.interval_months ); fs->s.monthly.interval_months );
} }
snprintf( freqStrBuf, MAX_FREQ_STR_SIZE, snprintf( freqStrBuf, MAX_FREQ_STR_SIZE,
/* %u is the number of intervals; %u /* %u is the number of intervals; %u
@ -948,9 +951,9 @@ xaccFreqSpecGetFreqStr( FreqSpec *fs, GString *str )
case UIFREQ_YEARLY: case UIFREQ_YEARLY:
if ( fs->s.monthly.interval_months != 12 ) { if ( fs->s.monthly.interval_months != 12 ) {
if ( (fs->s.monthly.interval_months % 12) != 0 ) { if ( (fs->s.monthly.interval_months % 12) != 0 ) {
PERR( "ERROR: \"Yearly\" FreqSpec month-interval " g_critical( "Yearly FreqSpec month-interval "
"is not a multiple of 12 [%d]", "is not a multiple of 12 [%d]",
fs->s.monthly.interval_months ); fs->s.monthly.interval_months );
} }
snprintf( freqStrBuf, MAX_FREQ_STR_SIZE, snprintf( freqStrBuf, MAX_FREQ_STR_SIZE,
@ -1096,18 +1099,15 @@ gnc_freq_spec_compare( FreqSpec *a, FreqSpec *b )
b->s.monthly.day_of_month ); b->s.monthly.day_of_month );
break; break;
case MONTH_RELATIVE: case MONTH_RELATIVE:
DEBUG( "MONTH-RELATIVE dates not supported." ); g_error( "MONTH-RELATIVE dates not supported." );
g_assert( FALSE );
break; break;
case COMPOSITE: case COMPOSITE:
/* We shouldn't see a composite after doing the /* We shouldn't see a composite after doing the
* composite-reduction above. */ * composite-reduction above. */
DEBUG( "This code should not be reached." ); g_error( "This code should not be reached." );
g_assert( FALSE );
break; break;
default: default:
DEBUG( "Unknown freqspec type %d", fta ); g_error( "Unknown freqspec type %d", fta );
g_assert( FALSE );
break; break;
} }
return 0; return 0;

View File

@ -93,8 +93,8 @@ gnc_book_set_template_group (QofBook *book, AccountGroup *templateGroup)
if (templateGroup && templateGroup->book != book) if (templateGroup && templateGroup->book != book)
{ {
PERR ("cannot mix and match books freely!"); g_critical("cannot mix and match books freely!");
return; return;
} }
col = qof_book_get_collection (book, GNC_ID_SXTG); col = qof_book_get_collection (book, GNC_ID_SXTG);

View File

@ -41,7 +41,10 @@
#include "Transaction.h" #include "Transaction.h"
#include "gnc-engine.h" #include "gnc-engine.h"
static QofLogModule log_module = GNC_MOD_SX; #define LOG_MOD "gnc.engine.sx"
static QofLogModule log_module = LOG_MOD;
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN LOG_MOD
/* Local Prototypes *****/ /* Local Prototypes *****/
@ -190,7 +193,7 @@ gnc_sx_begin_edit (SchedXaction *sx)
static void commit_err (QofInstance *inst, QofBackendError errcode) static void commit_err (QofInstance *inst, QofBackendError errcode)
{ {
PERR ("Failed to commit: %d", errcode); g_critical("Failed to commit: %d", errcode);
} }
static void commit_done(QofInstance *inst) static void commit_done(QofInstance *inst)
@ -491,14 +494,14 @@ xaccSchedXactionGetNextInstance( SchedXaction *sx, void *stateData )
if ( xaccSchedXactionHasEndDate( sx ) ) { if ( xaccSchedXactionHasEndDate( sx ) ) {
GDate *end_date = xaccSchedXactionGetEndDate( sx ); GDate *end_date = xaccSchedXactionGetEndDate( sx );
if ( g_date_compare( &next_occur, end_date ) > 0 ) { if ( g_date_compare( &next_occur, end_date ) > 0 ) {
PINFO( "next_occur past end date" ); g_debug("next_occur past end date");
g_date_clear( &next_occur, 1 ); g_date_clear( &next_occur, 1 );
} }
} else if ( xaccSchedXactionHasOccurDef( sx ) ) { } else if ( xaccSchedXactionHasOccurDef( sx ) ) {
if ( stateData ) { if ( stateData ) {
temporalStateData *tsd = (temporalStateData*)stateData; temporalStateData *tsd = (temporalStateData*)stateData;
if ( tsd->num_occur_rem == 0 ) { if ( tsd->num_occur_rem == 0 ) {
PINFO( "no more occurances remain" ); g_debug("no more occurances remain");
g_date_clear( &next_occur, 1 ); g_date_clear( &next_occur, 1 );
} }
} else { } else {

View File

@ -55,6 +55,7 @@
#define GNC_MOD_IO "gnc.io" #define GNC_MOD_IO "gnc.io"
#define GNC_MOD_BOOK "gnc.book-period" #define GNC_MOD_BOOK "gnc.book-period"
#define GNC_MOD_GUI "gnc.gui" #define GNC_MOD_GUI "gnc.gui"
#define GNC_MOD_GUI_SX "gnc.gui.sx"
#define GNC_MOD_GUILE "gnc.guile" #define GNC_MOD_GUILE "gnc.guile"
#define GNC_MOD_LEDGER "gnc.ledger" #define GNC_MOD_LEDGER "gnc.ledger"
#define GNC_MOD_REGISTER "gnc.register" #define GNC_MOD_REGISTER "gnc.register"

View File

@ -52,7 +52,7 @@ test_once (void)
"once off" ); "once off" );
} }
} }
fprintf (stdout, " FreqSpec: Single test OK, continuing . . . \r"); fprintf(stdout, " FreqSpec: Single test OK, continuing . . . \r");
fflush(stdout); fflush(stdout);
xaccFreqSpecFree(fs); xaccFreqSpecFree(fs);
} }

View File

@ -92,13 +92,13 @@ static void test_querynew (void)
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
qof_init(); qof_init();
if(cashobjects_register()) { if(cashobjects_register()) {
test_query_core(); test_query_core();
test_class(); test_class();
test_querynew(); test_querynew();
} }
qof_close(); qof_close();
print_test_results(); print_test_results();
return get_rv(); return get_rv();
} }

View File

@ -73,6 +73,8 @@ static const gchar* MONTH_THAT_COLOR = "SlateGray1";
static const gchar* MARK_COLOR = "Yellow"; static const gchar* MARK_COLOR = "Yellow";
static QofLogModule log_module = GNC_MOD_SX; static QofLogModule log_module = GNC_MOD_SX;
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "gnc.gui.dense-cal"
static void gnc_dense_cal_class_init(GncDenseCalClass *class); static void gnc_dense_cal_class_init(GncDenseCalClass *class);
static void gnc_dense_cal_init(GncDenseCal *dcal); static void gnc_dense_cal_init(GncDenseCal *dcal);
@ -280,8 +282,7 @@ gnc_dense_cal_init(GncDenseCal *dcal)
MAX_COLORS, TRUE, TRUE, MAX_COLORS, TRUE, TRUE,
&colorAllocSuccess) > 0) &colorAllocSuccess) > 0)
{ {
/* FIXME : handle [more] properly */ g_error("error allocating colors");
PERR("Error allocating colors\n");
} }
/* Deal with the various label sizes. */ /* Deal with the various label sizes. */
@ -574,7 +575,7 @@ gnc_dense_cal_size_request(GtkWidget *widget,
GncDenseCal *dcal = GNC_DENSE_CAL(widget); GncDenseCal *dcal = GNC_DENSE_CAL(widget);
if (!dcal->initialized) if (!dcal->initialized)
{ {
PERR("Uninitialized size request\n"); g_warning("Uninitialized size request\n");
requisition->width = DENSE_CAL_DEFAULT_WIDTH; requisition->width = DENSE_CAL_DEFAULT_WIDTH;
requisition->height = DENSE_CAL_DEFAULT_HEIGHT; requisition->height = DENSE_CAL_DEFAULT_HEIGHT;
return; return;
@ -1411,30 +1412,21 @@ wheres_this(GncDenseCal *dcal, int x, int y)
if ((x < 0) || (y < 0)) if ((x < 0) || (y < 0))
{ {
/* DEBUG("x(%d) or y(%d) < 0", x, y); */
return -1; return -1;
} }
if ((x >= GTK_WIDGET(dcal)->allocation.width) if ((x >= GTK_WIDGET(dcal)->allocation.width)
|| (y >= GTK_WIDGET(dcal)->allocation.height)) || (y >= GTK_WIDGET(dcal)->allocation.height))
{ {
/*DEBUG("x(%d) > allocation.width(%d) or y(%d) > allocation->height(%d)",
x, y,
GTK_WIDGET(dcal)->allocation.width,
GTK_WIDGET(dcal)->allocation.height);*/
return -1; return -1;
} }
/* "outside of displayed table" check */ /* "outside of displayed table" check */
if (x >= (num_cols(dcal) * (col_width(dcal) + COL_BORDER_SIZE))) if (x >= (num_cols(dcal) * (col_width(dcal) + COL_BORDER_SIZE)))
{ {
/*DEBUG("x(%d) > (col_width(%d) * num_cols(%d))",
x, col_width(dcal), num_cols(dcal));*/
return -1; return -1;
} }
if (y >= col_height(dcal)) if (y >= col_height(dcal))
{ {
/*DEBUG("y(%d) > col_height(%d)",
y, col_height(dcal));*/
return -1; return -1;
} }
@ -1445,19 +1437,16 @@ wheres_this(GncDenseCal *dcal, int x, int y)
x -= dcal->label_width; x -= dcal->label_width;
if (x < 0) if (x < 0)
{ {
/* DEBUG("X is over the label.");*/
return -1; return -1;
} }
if (x >= day_width(dcal) * 7) if (x >= day_width(dcal) * 7)
{ {
/*DEBUG("X is in the col_border space.");*/
return -1; return -1;
} }
y -= dcal->dayLabelHeight; y -= dcal->dayLabelHeight;
if (y < 0) if (y < 0)
{ {
/*DEBUG("Y is over the label.");*/
return -1; return -1;
} }
@ -1472,7 +1461,6 @@ wheres_this(GncDenseCal *dcal, int x, int y)
{ {
if (dayCol < 0) if (dayCol < 0)
{ {
/*DEBUG("Before the beginning of the first month.");*/
return -1; return -1;
} }
} }
@ -1485,8 +1473,6 @@ wheres_this(GncDenseCal *dcal, int x, int y)
g_date_add_months(&ccd, (colNum+1) * dcal->monthsPerCol); g_date_add_months(&ccd, (colNum+1) * dcal->monthsPerCol);
if (g_date_get_julian(&d) >= g_date_get_julian(&ccd)) if (g_date_get_julian(&d) >= g_date_get_julian(&ccd))
{ {
/*DEBUG("%d outside of column range [%d]",
g_date_get_julian(&d), g_date_get_julian(&ccd));*/
return -1; return -1;
} }
} }
@ -1498,7 +1484,7 @@ wheres_this(GncDenseCal *dcal, int x, int y)
if (g_date_get_julian(&d) >= g_date_get_julian(&startD)) if (g_date_get_julian(&d) >= g_date_get_julian(&startD))
{ {
/* we're past the end of the displayed calendar, thus -1 */ /* we're past the end of the displayed calendar, thus -1 */
DEBUG("%d >= %d", g_date_get_julian(&d), g_date_get_julian(&startD)); g_debug("%d >= %d", g_date_get_julian(&d), g_date_get_julian(&startD));
return -1; return -1;
} }
@ -1587,7 +1573,7 @@ static void
gdc_model_added_cb(GncDenseCalModel *model, guint added_tag, gpointer user_data) gdc_model_added_cb(GncDenseCalModel *model, guint added_tag, gpointer user_data)
{ {
GncDenseCal *cal = GNC_DENSE_CAL(user_data); GncDenseCal *cal = GNC_DENSE_CAL(user_data);
printf("gdc_model_added_cb update\n"); g_debug("gdc_model_added_cb update\n");
gdc_add_tag_markings(cal, added_tag); gdc_add_tag_markings(cal, added_tag);
} }
@ -1595,7 +1581,7 @@ static void
gdc_model_update_cb(GncDenseCalModel *model, guint update_tag, gpointer user_data) gdc_model_update_cb(GncDenseCalModel *model, guint update_tag, gpointer user_data)
{ {
GncDenseCal *cal = GNC_DENSE_CAL(user_data); GncDenseCal *cal = GNC_DENSE_CAL(user_data);
printf("gdc_model_update_cb update for tag [%d]\n", update_tag); g_debug("gdc_model_update_cb update for tag [%d]\n", update_tag);
gdc_mark_remove(cal, update_tag); gdc_mark_remove(cal, update_tag);
gdc_add_tag_markings(cal, update_tag); gdc_add_tag_markings(cal, update_tag);
} }
@ -1604,7 +1590,7 @@ static void
gdc_model_removing_cb(GncDenseCalModel *model, guint remove_tag, gpointer user_data) gdc_model_removing_cb(GncDenseCalModel *model, guint remove_tag, gpointer user_data)
{ {
GncDenseCal *cal = GNC_DENSE_CAL(user_data); GncDenseCal *cal = GNC_DENSE_CAL(user_data);
printf("gdc_model_removing_cb update [%d]\n", remove_tag); g_debug("gdc_model_removing_cb update [%d]\n", remove_tag);
gdc_mark_remove(cal, remove_tag); gdc_mark_remove(cal, remove_tag);
} }
@ -1644,7 +1630,7 @@ gdc_mark_add(GncDenseCal *dcal,
if (size == 0) if (size == 0)
{ {
PERR("0 size not allowed\n"); g_error("0 size not allowed\n");
return; return;
} }
@ -1657,7 +1643,7 @@ gdc_mark_add(GncDenseCal *dcal,
newMark->info = g_strdup(info); newMark->info = g_strdup(info);
newMark->tag = tag; newMark->tag = tag;
newMark->ourMarks = NULL; newMark->ourMarks = NULL;
printf("saving mark with tag [%d]\n", newMark->tag); g_debug("saving mark with tag [%d]\n", newMark->tag);
for (i=0; i<size; i++) for (i=0; i<size; i++)
{ {
@ -1690,7 +1676,7 @@ gdc_mark_remove(GncDenseCal *dcal, guint mark_to_remove)
/* Ignore non-realistic marks */ /* Ignore non-realistic marks */
if ((gint)mark_to_remove == -1) if ((gint)mark_to_remove == -1)
{ {
DEBUG("mark_to_remove = -1"); g_debug("mark_to_remove = -1");
return; return;
} }
@ -1703,12 +1689,12 @@ gdc_mark_remove(GncDenseCal *dcal, guint mark_to_remove)
} }
if (iter == NULL) if (iter == NULL)
{ {
DEBUG("couldn't find tag [%d]", mark_to_remove); g_warning("couldn't find tag [%d]", mark_to_remove);
return; return;
} }
if (mark_data == NULL) if (mark_data == NULL)
{ {
DEBUG("mark_data == null"); g_debug("mark_data == null");
return; return;
} }

View File

@ -38,7 +38,10 @@
#include "gnc-frequency.h" #include "gnc-frequency.h"
#include "gnc-ui-util.h" #include "gnc-ui-util.h"
static QofLogModule log_module = GNC_MOD_SX; #define LOG_MOD "gnc.gui.frequency"
static QofLogModule log_module = LOG_MOD;
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN LOG_MOD
/** Private Defs ********************/ /** Private Defs ********************/
@ -291,10 +294,9 @@ do_frequency_setup( GNCFrequency *gf, FreqSpec *fs, time_t *secs)
struct tm stm; struct tm stm;
/* set the date */ /* set the date */
if ( xaccFreqSpecGetOnce( fs, &theDate ) < 0 ) { if ( xaccFreqSpecGetOnce( fs, &theDate ) < 0 ) {
PERR( "Inappropriate FreqSpec type " g_warning("Inappropriate FreqSpec type [gnc-frequency: %d vs. FreqSpec: %d]",
"[gnc-frequency: %d vs. FreqSpec: %d]\n", uift, xaccFreqSpecGetUIType( fs ));
uift, xaccFreqSpecGetUIType( fs ) ); return;
return;
} }
g_date_to_struct_tm( &theDate, &stm ); g_date_to_struct_tm( &theDate, &stm );
gnc_date_edit_set_time( gf->startDate, mktime(&stm) ); gnc_date_edit_set_time( gf->startDate, mktime(&stm) );
@ -305,10 +307,9 @@ do_frequency_setup( GNCFrequency *gf, FreqSpec *fs, time_t *secs)
GtkWidget *o; GtkWidget *o;
int dailyMult = -1; int dailyMult = -1;
if ( xaccFreqSpecGetDaily( fs, &dailyMult ) < 0 ) { if ( xaccFreqSpecGetDaily( fs, &dailyMult ) < 0 ) {
PERR( "Inappropriate FreqSpec type " g_warning("Inappropriate FreqSpec type [gnc-frequency: %d vs. FreqSpec: %d]",
"[gnc-frequency: %d vs. FreqSpec: %d]\n", uift, xaccFreqSpecGetUIType( fs ) );
uift, xaccFreqSpecGetUIType( fs ) ); return;
return;
} }
o = glade_xml_get_widget( gf->gxml, "daily_spin" ); o = glade_xml_get_widget( gf->gxml, "daily_spin" );
gtk_spin_button_set_value( GTK_SPIN_BUTTON( o ), dailyMult ); gtk_spin_button_set_value( GTK_SPIN_BUTTON( o ), dailyMult );
@ -324,15 +325,14 @@ do_frequency_setup( GNCFrequency *gf, FreqSpec *fs, time_t *secs)
/* set the mult */ /* set the mult */
fsList = xaccFreqSpecCompositeGet( fs ); fsList = xaccFreqSpecCompositeGet( fs );
if ( g_list_length( fsList ) != 5 ) { if ( g_list_length( fsList ) != 5 ) {
PERR( "Invalid Daily[M-F] FreqSpec" ); g_warning("Invalid Daily[M-F] FreqSpec");
return; return;
} }
subFS = (FreqSpec*)fsList->data; subFS = (FreqSpec*)fsList->data;
if ( xaccFreqSpecGetWeekly( subFS, &weekMult, &dayOfWeek ) < 0 ) { if ( xaccFreqSpecGetWeekly( subFS, &weekMult, &dayOfWeek ) < 0 ) {
PERR( "Inappropriate FreqSpec type " g_warning("Inappropriate FreqSpec type [gnc-frequency: %d vs. FreqSpec: %d]",
"[gnc-frequency: %d vs. FreqSpec: %d]\n", uift, xaccFreqSpecGetUIType( fs ) );
uift, xaccFreqSpecGetUIType( fs ) ); return;
return;
} }
o = glade_xml_get_widget( gf->gxml, "dailymf_spin" ); o = glade_xml_get_widget( gf->gxml, "dailymf_spin" );
gtk_spin_button_set_value( GTK_SPIN_BUTTON(o), weekMult ); gtk_spin_button_set_value( GTK_SPIN_BUTTON(o), weekMult );
@ -352,43 +352,39 @@ do_frequency_setup( GNCFrequency *gf, FreqSpec *fs, time_t *secs)
subFS = (FreqSpec*)(list->data); subFS = (FreqSpec*)(list->data);
if ( weeklyMult == -1 ) { if ( weeklyMult == -1 ) {
if ( subFS == NULL ) { if ( subFS == NULL ) {
PERR( "subFS is null\n" ); g_critical("subFS is null");
return; return;
} }
if ( xaccFreqSpecGetWeekly( subFS, if ( xaccFreqSpecGetWeekly( subFS,
&weeklyMult, &weeklyMult,
&dayOfWeek ) < 0 ) { &dayOfWeek ) < 0 ) {
PERR( "Inappropriate FreqSpec type " g_warning("Inappropriate FreqSpec type [gnc-frequency: %d, FreqSpec: %d]",
"[gnc-frequency: %d, FreqSpec: %d]\n", uift, xaccFreqSpecGetUIType( fs ) );
uift, xaccFreqSpecGetUIType( fs ) ); return;
return;
} }
} else { } else {
int otherWeeklyMult = -1; int otherWeeklyMult = -1;
if ( subFS == NULL ) { if ( subFS == NULL ) {
PERR( "subFS is null\n" ); g_critical("subFS is null");
return; return;
} }
if ( xaccFreqSpecGetWeekly( subFS, if ( xaccFreqSpecGetWeekly( subFS,
&otherWeeklyMult, &otherWeeklyMult,
&dayOfWeek ) < 0 ) { &dayOfWeek ) < 0 ) {
PERR( "Inappropriate FreqSpec type " g_warning("Inappropriate FreqSpec type [gnc-frequency: %d, FreqSpec: %d]",
"[gnc-frequency: %d, FreqSpec: %d]\n", uift, xaccFreqSpecGetUIType( fs ) );
uift, xaccFreqSpecGetUIType( fs ) ); return;
return;
} }
if ( weeklyMult != otherWeeklyMult ) { if ( weeklyMult != otherWeeklyMult ) {
PERR( "Inconsistent weekly FreqSpec " g_warning("Inconsistent weekly FreqSpec multipliers seen [first: %d vs. other: %d]",
"multipliers seen " weeklyMult, otherWeeklyMult );
"[first: %d vs. other: %d]\n", return;
weeklyMult, otherWeeklyMult );
return;
} }
} }
if ( dayOfWeek > 6 ) { if ( dayOfWeek > 6 ) {
PERR( "dayOfWeek > 6 [%d]", dayOfWeek ); g_warning( "dayOfWeek > 6 [%d]", dayOfWeek );
return; return;
} }
str = CHECKBOX_NAMES[dayOfWeek]; str = CHECKBOX_NAMES[dayOfWeek];
o = glade_xml_get_widget( gf->gxml, str ); o = glade_xml_get_widget( gf->gxml, str );
@ -415,10 +411,9 @@ do_frequency_setup( GNCFrequency *gf, FreqSpec *fs, time_t *secs)
subFS = (FreqSpec*)(g_list_nth( list, 0 )->data); subFS = (FreqSpec*)(g_list_nth( list, 0 )->data);
if ( xaccFreqSpecGetMonthly( subFS, &monthlyMult, if ( xaccFreqSpecGetMonthly( subFS, &monthlyMult,
&firstDayOfMonth, &monthOffset ) < 0 ) { &firstDayOfMonth, &monthOffset ) < 0 ) {
PERR( "Inappropriate FreqSpec type " g_warning("Inappropriate FreqSpec type [gnc-frequency: %d, FreqSpec: %d]",
"[gnc-frequency: %d, FreqSpec: %d]\n", uift, xaccFreqSpecGetUIType( fs ) );
uift, xaccFreqSpecGetUIType( fs ) ); return;
return;
} }
gtk_spin_button_set_value( GTK_SPIN_BUTTON(o), monthlyMult ); gtk_spin_button_set_value( GTK_SPIN_BUTTON(o), monthlyMult );
/* first date */ /* first date */
@ -429,8 +424,8 @@ do_frequency_setup( GNCFrequency *gf, FreqSpec *fs, time_t *secs)
o = glade_xml_get_widget( gf->gxml, "semimonthly_second" ); o = glade_xml_get_widget( gf->gxml, "semimonthly_second" );
if ( xaccFreqSpecGetMonthly( subFS, &monthlyMult, if ( xaccFreqSpecGetMonthly( subFS, &monthlyMult,
&secondDayOfMonth, &monthOffset ) < 0 ) { &secondDayOfMonth, &monthOffset ) < 0 ) {
PERR( "Inappropriate FreqSpec type\n" ); g_warning( "Inappropriate FreqSpec type" );
return; return;
} }
gtk_combo_box_set_active( GTK_COMBO_BOX(o), secondDayOfMonth-1 ); gtk_combo_box_set_active( GTK_COMBO_BOX(o), secondDayOfMonth-1 );
} }
@ -442,10 +437,9 @@ do_frequency_setup( GNCFrequency *gf, FreqSpec *fs, time_t *secs)
if ( xaccFreqSpecGetMonthly( fs, &monthlyMult, if ( xaccFreqSpecGetMonthly( fs, &monthlyMult,
&dayOfMonth, &monthOffset ) < 0 ) { &dayOfMonth, &monthOffset ) < 0 ) {
PERR( "Inappropriate FreqSpec type " g_warning("Inappropriate FreqSpec type [gnc-frequency: %d, FreqSpec: %d]",
"[gnc-frequency: %d, FreqSpec: %d]\n", uift, xaccFreqSpecGetUIType( fs ) );
uift, xaccFreqSpecGetUIType( fs ) ); return;
return;
} }
o = glade_xml_get_widget( gf->gxml, "monthly_spin" ); o = glade_xml_get_widget( gf->gxml, "monthly_spin" );
gtk_spin_button_set_value( GTK_SPIN_BUTTON(o), monthlyMult ); gtk_spin_button_set_value( GTK_SPIN_BUTTON(o), monthlyMult );
@ -460,14 +454,13 @@ do_frequency_setup( GNCFrequency *gf, FreqSpec *fs, time_t *secs)
if ( xaccFreqSpecGetMonthly( fs, &monthlyMult, if ( xaccFreqSpecGetMonthly( fs, &monthlyMult,
&dayOfMonth, &monthOffset ) < 0 ) { &dayOfMonth, &monthOffset ) < 0 ) {
PERR( "Inappropriate FreqSpec type " g_warning("Inappropriate FreqSpec type [gnc-frequency: %d, FreqSpec: %d]",
"[gnc-frequency: %d, FreqSpec: %d]\n", uift, xaccFreqSpecGetUIType( fs ) );
uift, xaccFreqSpecGetUIType( fs ) ); return;
return;
} }
if ( monthlyMult != 3 ) { if ( monthlyMult != 3 ) {
PERR( "monthly multiplier != 3 [=%d]", monthlyMult ); g_warning("monthly multiplier != 3 [=%d]", monthlyMult);
return; return;
} }
year_range_menu_helper( glade_xml_get_widget( gf->gxml, year_range_menu_helper( glade_xml_get_widget( gf->gxml,
"quarterly_day" ), "quarterly_day" ),
@ -482,14 +475,13 @@ do_frequency_setup( GNCFrequency *gf, FreqSpec *fs, time_t *secs)
if ( xaccFreqSpecGetMonthly( fs, &monthlyMult, if ( xaccFreqSpecGetMonthly( fs, &monthlyMult,
&dayOfMonth, &monthOffset ) < 0 ) { &dayOfMonth, &monthOffset ) < 0 ) {
PERR( "Inappropriate FreqSpec type " g_warning("Inappropriate FreqSpec type [gnc-frequency: %d, FreqSpec: %d]",
"[gnc-frequency: %d, FreqSpec: %d]\n", uift, xaccFreqSpecGetUIType( fs ) );
uift, xaccFreqSpecGetUIType( fs ) ); return;
return;
} }
if ( monthlyMult != 4 ) { if ( monthlyMult != 4 ) {
PERR( "Month-multiplier != 4 [=%d]", monthlyMult ); g_warning("Month-multiplier != 4 [=%d]", monthlyMult);
return; return;
} }
year_range_menu_helper( glade_xml_get_widget( gf->gxml, year_range_menu_helper( glade_xml_get_widget( gf->gxml,
"triyearly_day" ), "triyearly_day" ),
@ -504,14 +496,13 @@ do_frequency_setup( GNCFrequency *gf, FreqSpec *fs, time_t *secs)
if ( xaccFreqSpecGetMonthly( fs, &monthlyMult, if ( xaccFreqSpecGetMonthly( fs, &monthlyMult,
&dayOfMonth, &monthOffset ) < 0 ) { &dayOfMonth, &monthOffset ) < 0 ) {
PERR( "Inappropriate FreqSpec type " g_warning("Inappropriate FreqSpec type [gnc-frequency: %d, FreqSpec: %d]",
"[gnc-frequency: %d, FreqSpec: %d]\n", uift, xaccFreqSpecGetUIType( fs ) );
uift, xaccFreqSpecGetUIType( fs ) ); return;
return;
} }
if ( monthlyMult != 6 ) { if ( monthlyMult != 6 ) {
PERR( "month-mult != 6 [=%d]", monthlyMult ); g_warning( "month-mult != 6 [=%d]", monthlyMult );
return; return;
} }
year_range_menu_helper( glade_xml_get_widget( gf->gxml, year_range_menu_helper( glade_xml_get_widget( gf->gxml,
"semiyearly_day" ), "semiyearly_day" ),
@ -527,14 +518,13 @@ do_frequency_setup( GNCFrequency *gf, FreqSpec *fs, time_t *secs)
if ( xaccFreqSpecGetMonthly( fs, &monthlyMult, if ( xaccFreqSpecGetMonthly( fs, &monthlyMult,
&dayOfMonth, &monthOffset ) < 0 ) { &dayOfMonth, &monthOffset ) < 0 ) {
PERR( "Inappropriate FreqSpec type " g_warning("Inappropriate FreqSpec type [gnc-frequency: %d, FreqSpec: %d]",
"[gnc-frequency: %d, FreqSpec: %d]\n", uift, xaccFreqSpecGetUIType( fs ) );
uift, xaccFreqSpecGetUIType( fs ) ); return;
return;
} }
if ( (monthlyMult % 12) != 0) { if ( (monthlyMult % 12) != 0) {
PERR( "monthly-mult %% 12 != 0 [=%d]", ( monthlyMult % 12 ) ); g_warning( "monthly-mult %% 12 != 0 [=%d]", ( monthlyMult % 12 ) );
return; return;
} }
/* set the mult */ /* set the mult */
@ -548,9 +538,8 @@ do_frequency_setup( GNCFrequency *gf, FreqSpec *fs, time_t *secs)
} }
break; break;
default: default:
PERR( "unknown ui freq type %d [%d, %s]\n", g_critical( "unknown ui freq type %d", uift);
uift, __LINE__, __FILE__ ); break;
break;
} }
g_signal_emit_by_name( gf, "changed" ); g_signal_emit_by_name( gf, "changed" );
@ -801,7 +790,7 @@ gnc_frequency_save_state( GNCFrequency *gf, FreqSpec *fs, GDate *outDate )
{ {
gchar buf[128]; gchar buf[128];
g_date_strftime(buf, 127, "%c", &gd); g_date_strftime(buf, 127, "%c", &gd);
printf("monthly date [%s]\n", buf); g_debug("monthly date [%s]\n", buf);
} }
xaccFreqSpecSetMonthly( fs, &gd, tmpInt ); xaccFreqSpecSetMonthly( fs, &gd, tmpInt );
xaccFreqSpecSetUIType( fs, uift ); xaccFreqSpecSetUIType( fs, uift );
@ -826,9 +815,8 @@ gnc_frequency_save_state( GNCFrequency *gf, FreqSpec *fs, GDate *outDate )
xaccFreqSpecSetUIType( fs, uift ); xaccFreqSpecSetUIType( fs, uift );
break; break;
default: default:
PERR( "Unknown UIFreqType %d [%d, %s]\n", g_critical("Unknown UIFreqType %d", uift);
uift, __LINE__, __FILE__ ); break;
break;
} }
gnc_resume_gui_refresh(); gnc_resume_gui_refresh();
} }
@ -1179,8 +1167,8 @@ start_date_changed( GNCDateEdit *gde, gpointer d )
tmpTm->tm_mday-1 ); tmpTm->tm_mday-1 );
break; break;
default: default:
PERR( "unknown uift value %d\n", uift ); g_critical("unknown uift value %d", uift);
break; break;
} }
g_signal_emit_by_name( gf, "changed" ); g_signal_emit_by_name( gf, "changed" );
} }

View File

@ -25,6 +25,9 @@
#include "gnc-sx-instance-dense-cal-adapter.h" #include "gnc-sx-instance-dense-cal-adapter.h"
#include "gnc-dense-cal.h" #include "gnc-dense-cal.h"
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "gnc.gui.sx.adapter.sx-dense-cal"
static void gnc_sx_instance_dense_cal_adapter_dispose(GObject *obj); static void gnc_sx_instance_dense_cal_adapter_dispose(GObject *obj);
static void gnc_sx_instance_dense_cal_adapter_finalize(GObject *obj); static void gnc_sx_instance_dense_cal_adapter_finalize(GObject *obj);
@ -81,7 +84,7 @@ static void
gsidca_instances_added_cb(GncSxInstanceModel *model, SchedXaction *sx_added, gpointer user_data) gsidca_instances_added_cb(GncSxInstanceModel *model, SchedXaction *sx_added, gpointer user_data)
{ {
GncSxInstanceDenseCalAdapter *adapter = GNC_SX_INSTANCE_DENSE_CAL_ADAPTER(user_data); GncSxInstanceDenseCalAdapter *adapter = GNC_SX_INSTANCE_DENSE_CAL_ADAPTER(user_data);
printf("instance added\n"); g_debug("instance added\n");
if (xaccSchedXactionGetEnabled(sx_added)) if (xaccSchedXactionGetEnabled(sx_added))
{ {
g_signal_emit_by_name(adapter, "added", GPOINTER_TO_UINT(sx_added)); g_signal_emit_by_name(adapter, "added", GPOINTER_TO_UINT(sx_added));
@ -93,7 +96,7 @@ gsidca_instances_updated_cb(GncSxInstanceModel *model, SchedXaction *sx_updated,
{ {
GncSxInstanceDenseCalAdapter *adapter = GNC_SX_INSTANCE_DENSE_CAL_ADAPTER(user_data); GncSxInstanceDenseCalAdapter *adapter = GNC_SX_INSTANCE_DENSE_CAL_ADAPTER(user_data);
gnc_sx_instance_model_update_sx_instances(model, sx_updated); gnc_sx_instance_model_update_sx_instances(model, sx_updated);
printf("instances updated\n"); g_debug("instances updated\n");
if (xaccSchedXactionGetEnabled(sx_updated)) if (xaccSchedXactionGetEnabled(sx_updated))
{ {
g_signal_emit_by_name(adapter, "update", GPOINTER_TO_UINT((gpointer)sx_updated)); g_signal_emit_by_name(adapter, "update", GPOINTER_TO_UINT((gpointer)sx_updated));
@ -108,7 +111,7 @@ static void
gsidca_instances_removing_cb(GncSxInstanceModel *model, SchedXaction *sx_to_be_removed, gpointer user_data) gsidca_instances_removing_cb(GncSxInstanceModel *model, SchedXaction *sx_to_be_removed, gpointer user_data)
{ {
GncSxInstanceDenseCalAdapter *adapter = GNC_SX_INSTANCE_DENSE_CAL_ADAPTER(user_data); GncSxInstanceDenseCalAdapter *adapter = GNC_SX_INSTANCE_DENSE_CAL_ADAPTER(user_data);
printf("removing instance...\n"); g_debug("removing instance...\n");
g_signal_emit_by_name(adapter, "removing", GPOINTER_TO_UINT(sx_to_be_removed)); g_signal_emit_by_name(adapter, "removing", GPOINTER_TO_UINT(sx_to_be_removed));
gnc_sx_instance_model_remove_sx_instances(model, sx_to_be_removed); gnc_sx_instance_model_remove_sx_instances(model, sx_to_be_removed);
} }

View File

@ -64,7 +64,10 @@
#include <langinfo.h> #include <langinfo.h>
#endif #endif
static QofLogModule log_module = GNC_MOD_SX; #define LOG_MOD "gnc.gui.sx.editor"
static QofLogModule log_module = LOG_MOD;
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN LOG_MOD
static gint _sx_engine_event_handler_id = -1; static gint _sx_engine_event_handler_id = -1;
@ -480,25 +483,23 @@ check_credit_debit_balance( gpointer key,
*unbalanced |= !(gnc_numeric_zero_p( *unbalanced |= !(gnc_numeric_zero_p(
gnc_numeric_sub_fixed( tcds->debitSum, gnc_numeric_sub_fixed( tcds->debitSum,
tcds->creditSum ) )); tcds->creditSum ) ));
#if GNC_DEBUG
if ( gnc_numeric_zero_p( gnc_numeric_sub_fixed( tcds->debitSum, if ( gnc_numeric_zero_p( gnc_numeric_sub_fixed( tcds->debitSum,
tcds->creditSum ) ) ) { tcds->creditSum ) ) ) {
DEBUG( "%.8x | true [%s - %s = %s]", g_debug( "%.8x | true [%s - %s = %s]",
(unsigned int)key, (unsigned int)key,
gnc_numeric_to_string( tcds->debitSum ), gnc_numeric_to_string( tcds->debitSum ),
gnc_numeric_to_string( tcds->creditSum ), gnc_numeric_to_string( tcds->creditSum ),
gnc_numeric_to_string(gnc_numeric_sub_fixed( tcds->debitSum, gnc_numeric_to_string(gnc_numeric_sub_fixed( tcds->debitSum,
tcds->creditSum )) ); tcds->creditSum )) );
} else { } else {
DEBUG( "%.8x | false [%s - %s = %s]", g_debug( "%.8x | false [%s - %s = %s]",
(unsigned int)key, (unsigned int)key,
gnc_numeric_to_string( tcds->debitSum ), gnc_numeric_to_string( tcds->debitSum ),
gnc_numeric_to_string( tcds->creditSum ), gnc_numeric_to_string( tcds->creditSum ),
gnc_numeric_to_string(gnc_numeric_sub_fixed( tcds->debitSum, gnc_numeric_to_string(gnc_numeric_sub_fixed( tcds->debitSum,
tcds->creditSum )) ); tcds->creditSum )) );
} }
#endif /* GNC_DEBUG */
} }
/** /**
@ -920,7 +921,7 @@ gnc_sxed_save_sx( GncSxEditorDialog *sxed )
g_date_clear( &gdate, 1 ); g_date_clear( &gdate, 1 );
xaccSchedXactionSetEndDate( sxed->sx, &gdate ); xaccSchedXactionSetEndDate( sxed->sx, &gdate );
} else { } else {
PERR( "No valid end specified\n" ); g_critical("no valid end specified\n");
} }
} }
@ -975,7 +976,7 @@ gnc_sxed_save_sx( GncSxEditorDialog *sxed )
str = g_string_new( "" ); str = g_string_new( "" );
xaccFreqSpecGetFreqStr( fs, str ); xaccFreqSpecGetFreqStr( fs, str );
DEBUG( "fs: %s", str->str ); g_debug("fs: %s", str->str);
/* now that we have it, set the start date */ /* now that we have it, set the start date */
xaccSchedXactionSetStartDate( sxed->sx, &gdate ); xaccSchedXactionSetStartDate( sxed->sx, &gdate );
@ -1008,8 +1009,8 @@ advance_toggle( GtkButton *o, GncSxEditorDialog *sxed )
spinName = (gchar*)g_object_get_data( G_OBJECT(o), "whichOneAmI" ); spinName = (gchar*)g_object_get_data( G_OBJECT(o), "whichOneAmI" );
spin = glade_xml_get_widget( sxed->gxml, spinName ); spin = glade_xml_get_widget( sxed->gxml, spinName );
if ( !spin ) { if ( !spin ) {
PERR( "Error getting widget with name \"%s\"", spinName ); g_critical("Error getting widget with name \"%s\"", spinName);
return; return;
} }
gtk_widget_set_sensitive( spin, gtk_widget_set_sensitive( spin,
gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(o) ) ); gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(o) ) );
@ -1151,7 +1152,7 @@ gnc_ui_scheduled_xaction_editor_dialog_create(SchedXaction *sx,
editor_component_sx_equality, editor_component_sx_equality,
sx ); sx );
if ( dlgExists != NULL ) { if ( dlgExists != NULL ) {
DEBUG( "dialog already exists; using that one." ); g_debug( "dialog already exists; using that one." );
sxed = (GncSxEditorDialog*)dlgExists->data; sxed = (GncSxEditorDialog*)dlgExists->data;
gtk_window_present( GTK_WINDOW(sxed->dialog) ); gtk_window_present( GTK_WINDOW(sxed->dialog) );
g_list_free( dlgExists ); g_list_free( dlgExists );
@ -1477,7 +1478,7 @@ endgroup_rb_toggled( GtkButton *b, gpointer d )
set_endgroup_toggle_states( sxed, END_OCCUR ); set_endgroup_toggle_states( sxed, END_OCCUR );
break; break;
default: default:
g_error( "Unknown id %d", id ); g_critical( "Unknown id %d", id );
break; break;
} }

View File

@ -70,7 +70,10 @@
#define SXFTD_RESPONSE_ADVANCED 100 /* 'Advanced' button response code */ #define SXFTD_RESPONSE_ADVANCED 100 /* 'Advanced' button response code */
static QofLogModule log_module = GNC_MOD_SX; static QofLogModule log_module = GNC_MOD_GUI_SX;
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN GNC_MOD_GUI_SX
static void sxftd_freq_combo_changed( GtkWidget *w, gpointer user_data ); static void sxftd_freq_combo_changed( GtkWidget *w, gpointer user_data );
static void gnc_sx_trans_window_response_cb(GtkDialog *dialog, gint response, gpointer data); static void gnc_sx_trans_window_response_cb(GtkDialog *dialog, gint response, gpointer data);
@ -326,9 +329,8 @@ sxftd_update_fs( SXFromTransInfo *sxfti, GDate *date, FreqSpec *fs )
break; break;
default: default:
PERR("Nonexistent frequency selected. This is a bug."); g_critical("nonexistent frequency selected");
g_assert( FALSE ); break;
break;
} }
} }
@ -366,7 +368,7 @@ sxftd_init( SXFromTransInfo *sxfti )
g_object_ref(G_OBJECT(sxfti->example_cal)); g_object_ref(G_OBJECT(sxfti->example_cal));
gtk_object_sink(GTK_OBJECT(sxfti->example_cal)); gtk_object_sink(GTK_OBJECT(sxfti->example_cal));
g_assert( sxfti->example_cal ); g_assert(sxfti->example_cal);
gnc_dense_cal_set_num_months( sxfti->example_cal, SXFTD_EXCAL_NUM_MONTHS ); gnc_dense_cal_set_num_months( sxfti->example_cal, SXFTD_EXCAL_NUM_MONTHS );
gnc_dense_cal_set_months_per_col( sxfti->example_cal, SXFTD_EXCAL_MONTHS_PER_COL ); gnc_dense_cal_set_months_per_col( sxfti->example_cal, SXFTD_EXCAL_MONTHS_PER_COL );
gtk_container_add( GTK_CONTAINER(w), GTK_WIDGET(sxfti->example_cal) ); gtk_container_add( GTK_CONTAINER(w), GTK_WIDGET(sxfti->example_cal) );
@ -541,10 +543,12 @@ sxftd_ok_clicked(SXFromTransInfo *sxfti)
guint sx_error = sxftd_compute_sx(sxfti); guint sx_error = sxftd_compute_sx(sxfti);
if (sx_error != 0 if (sx_error != 0
&& sx_error != SXFTD_ERRNO_UNBALANCED_XACTION) { && sx_error != SXFTD_ERRNO_UNBALANCED_XACTION)
PERR( "Error in sxftd_compute_sx after ok_clicked [%d]", sx_error ); {
g_critical("sxftd_compute_sx after ok_clicked [%d]", sx_error);
} }
else { else
{
if ( sx_error == SXFTD_ERRNO_UNBALANCED_XACTION ) { if ( sx_error == SXFTD_ERRNO_UNBALANCED_XACTION ) {
gnc_error_dialog( gnc_ui_get_toplevel(), gnc_error_dialog( gnc_ui_get_toplevel(),
_( "The Scheduled Transaction is unbalanced. " _( "The Scheduled Transaction is unbalanced. "
@ -600,10 +604,10 @@ sxftd_advanced_clicked(SXFromTransInfo *sxfti)
if ( sx_error != 0 if ( sx_error != 0
&& sx_error != SXFTD_ERRNO_UNBALANCED_XACTION ) && sx_error != SXFTD_ERRNO_UNBALANCED_XACTION )
{ {
// unbalanced-xaction is "okay", since this is also checked for by // unbalanced-xaction is "okay", since this is also checked for by
// the advanced editor. // the advanced editor.
PWARN( "something bad happened in sxftd_compute_sx [%d]", sx_error ); g_warning("something bad happened in sxftd_compute_sx [%d]", sx_error);
return; return;
} }
gtk_widget_hide( sxfti->dialog ); gtk_widget_hide( sxfti->dialog );
/* force a gui update. */ /* force a gui update. */
@ -644,20 +648,20 @@ gnc_sx_trans_window_response_cb (GtkDialog *dialog,
SXFromTransInfo *sxfti = (SXFromTransInfo *)data; SXFromTransInfo *sxfti = (SXFromTransInfo *)data;
ENTER(" dialog %p, response %d, sx %p", dialog, response, sxfti); ENTER(" dialog %p, response %d, sx %p", dialog, response, sxfti);
switch (response) { switch (response) {
case GTK_RESPONSE_OK: case GTK_RESPONSE_OK:
DEBUG(" OK"); g_debug(" OK");
sxftd_ok_clicked(sxfti); sxftd_ok_clicked(sxfti);
break; break;
case SXFTD_RESPONSE_ADVANCED: case SXFTD_RESPONSE_ADVANCED:
DEBUG(" ADVANCED"); g_debug(" ADVANCED");
sxftd_advanced_clicked(sxfti); sxftd_advanced_clicked(sxfti);
break; break;
case GTK_RESPONSE_CANCEL: case GTK_RESPONSE_CANCEL:
default: default:
DEBUG(" CANCEL"); g_debug(" CANCEL");
sxftd_close(sxfti, TRUE); sxftd_close(sxfti, TRUE);
break; break;
} }
LEAVE(" "); LEAVE(" ");
@ -708,7 +712,7 @@ sxftd_update_example_cal( SXFromTransInfo *sxfti )
gnc_dense_cal_store_update_count_end(sxfti->dense_cal_model, &startDate, fs, get.n_occurrences); gnc_dense_cal_store_update_count_end(sxfti->dense_cal_model, &startDate, fs, get.n_occurrences);
break; break;
default: default:
printf("unknown get.type [%d]\n", get.type); g_warning("unknown get.type [%d]\n", get.type);
break; break;
} }
@ -760,7 +764,7 @@ gnc_sx_create_from_trans( Transaction *trans )
} }
else else
{ {
PERR( "Error in sxftd_init: %d", errno ); g_error("sxftd_init: %d", errno);
} }
} }

View File

@ -40,7 +40,8 @@
#include "gnc-gconf-utils.h" #include "gnc-gconf-utils.h"
#include "gnc-gui-query.h" #include "gnc-gui-query.h"
// static QofLogModule log_module = GNC_MOD_GUI; #undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "gnc.gui.sx.slr"
#define GCONF_SECTION "dialogs/scheduled_trans/since_last_run" #define GCONF_SECTION "dialogs/scheduled_trans/since_last_run"
@ -853,21 +854,21 @@ instance_state_changed_cb(GtkCellRendererText *cell,
} }
if (i == SX_INSTANCE_STATE_CREATED) if (i == SX_INSTANCE_STATE_CREATED)
{ {
printf("unknown value [%s]\n", value); g_warning("unknown value [%s]", value);
return; return;
} }
new_state = i; new_state = i;
if (!gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(dialog->editing_model), &tree_iter, path)) if (!gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(dialog->editing_model), &tree_iter, path))
{ {
printf("unknown path [%s]\n", path); g_warning("unknown path [%s]", path);
return; return;
} }
inst = gnc_sx_slr_model_get_instance(dialog->editing_model, &tree_iter); inst = gnc_sx_slr_model_get_instance(dialog->editing_model, &tree_iter);
if (inst == NULL) if (inst == NULL)
{ {
printf("invalid path [%s]\n", path); g_warning("invalid path [%s]", path);
return; return;
} }
@ -886,23 +887,23 @@ variable_value_changed_cb(GtkCellRendererText *cell,
gnc_numeric parsed_num; gnc_numeric parsed_num;
char *endStr = NULL; char *endStr = NULL;
printf("variable to [%s] at path [%s]\n", value, path); g_debug("variable to [%s] at path [%s]", value, path);
if (!gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(dialog->editing_model), &tree_iter, path)) if (!gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(dialog->editing_model), &tree_iter, path))
{ {
printf("invalid path [%s]\n", path); g_warning("invalid path [%s]", path);
return; return;
} }
if (!gnc_sx_slr_model_get_instance_and_variable(dialog->editing_model, &tree_iter, &inst, &var)) if (!gnc_sx_slr_model_get_instance_and_variable(dialog->editing_model, &tree_iter, &inst, &var))
{ {
printf("path [%s] doesn't correspond to a valid variable\n", path); g_critical("path [%s] doesn't correspond to a valid variable", path);
return; return;
} }
if (!xaccParseAmount(value, TRUE, &parsed_num, &endStr) if (!xaccParseAmount(value, TRUE, &parsed_num, &endStr)
|| gnc_numeric_check(parsed_num) != GNC_ERROR_OK) || gnc_numeric_check(parsed_num) != GNC_ERROR_OK)
{ {
printf("@@fixme: better parse error handling\n"); g_critical("@@fixme: better parse error handling");
// @fixme: set location (back) to "(need value)" // @fixme: set location (back) to "(need value)"
return; return;
} }
@ -1041,7 +1042,7 @@ dialog_response_cb(GtkDialog *dialog, gint response_id, GncSxSinceLastRunDialog
{ {
GList *unbound_variables; GList *unbound_variables;
unbound_variables = gnc_sx_slr_model_check_variables(app_dialog->editing_model); unbound_variables = gnc_sx_slr_model_check_variables(app_dialog->editing_model);
printf("%d variables unbound\n", g_list_length(unbound_variables)); g_message("%d variables unbound", g_list_length(unbound_variables));
if (g_list_length(unbound_variables) > 0) if (g_list_length(unbound_variables) > 0)
{ {
// focus first variable // focus first variable
@ -1081,8 +1082,7 @@ dialog_response_cb(GtkDialog *dialog, gint response_id, GncSxSinceLastRunDialog
app_dialog->editing_model = NULL; app_dialog->editing_model = NULL;
break; break;
default: default:
printf("unknown response id [%d]\n", response_id); g_error("unknown response id [%d]", response_id);
g_assert_not_reached();
break; break;
} }
} }

View File

@ -57,7 +57,10 @@
#include "dialog-sx-editor.h" #include "dialog-sx-editor.h"
/* This static indicates the debugging module that this .o belongs to. */ /* This static indicates the debugging module that this .o belongs to. */
static QofLogModule log_module = GNC_MOD_GUI; static QofLogModule log_module = "gnc.gui.plugin-page";
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "gnc.gui.plugin-page.sx-list"
#define PLUGIN_PAGE_SX_LIST_CM_CLASS "plugin-page-sx-list" #define PLUGIN_PAGE_SX_LIST_CM_CLASS "plugin-page-sx-list"
#define GCONF_SECTION "window/pages/sx_list" #define GCONF_SECTION "window/pages/sx_list"
@ -180,7 +183,6 @@ gnc_plugin_page_sx_list_init (GncPluginPageSxList *plugin_page)
GncPluginPageSxListPrivate *priv; GncPluginPageSxListPrivate *priv;
GncPluginPage *parent; GncPluginPage *parent;
ENTER("page %p", plugin_page);
priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(plugin_page); priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(plugin_page);
/* Init parent declared variables */ /* Init parent declared variables */
@ -203,9 +205,6 @@ gnc_plugin_page_sx_list_init (GncPluginPageSxList *plugin_page)
gnc_plugin_page_sx_list_n_actions, gnc_plugin_page_sx_list_n_actions,
plugin_page); plugin_page);
/* gnc_plugin_init_short_names (action_group, toolbar_labels); */ /* gnc_plugin_init_short_names (action_group, toolbar_labels); */
LEAVE("page %p, priv %p, action group %p",
plugin_page, priv, action_group);
} }
static void static void
@ -214,8 +213,6 @@ gnc_plugin_page_sx_list_dispose(GObject *object)
GncPluginPageSxList *page; GncPluginPageSxList *page;
GncPluginPageSxListPrivate *priv; GncPluginPageSxListPrivate *priv;
ENTER("object %p", object);
page = GNC_PLUGIN_PAGE_SX_LIST (object); page = GNC_PLUGIN_PAGE_SX_LIST (object);
g_return_if_fail(GNC_IS_PLUGIN_PAGE_SX_LIST (page)); g_return_if_fail(GNC_IS_PLUGIN_PAGE_SX_LIST (page));
priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(page); priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(page);
@ -234,7 +231,6 @@ gnc_plugin_page_sx_list_dispose(GObject *object)
priv->instances = NULL; priv->instances = NULL;
G_OBJECT_CLASS (parent_class)->dispose(object); G_OBJECT_CLASS (parent_class)->dispose(object);
LEAVE(" ");
} }
static void static void
@ -243,8 +239,6 @@ gnc_plugin_page_sx_list_finalize (GObject *object)
GncPluginPageSxList *page; GncPluginPageSxList *page;
GncPluginPageSxListPrivate *priv; GncPluginPageSxListPrivate *priv;
ENTER("object %p", object);
page = GNC_PLUGIN_PAGE_SX_LIST (object); page = GNC_PLUGIN_PAGE_SX_LIST (object);
g_return_if_fail(GNC_IS_PLUGIN_PAGE_SX_LIST (page)); g_return_if_fail(GNC_IS_PLUGIN_PAGE_SX_LIST (page));
priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(page); priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(page);
@ -254,7 +248,6 @@ gnc_plugin_page_sx_list_finalize (GObject *object)
// data get freed somewhere else? // data get freed somewhere else?
G_OBJECT_CLASS (parent_class)->finalize (object); G_OBJECT_CLASS (parent_class)->finalize (object);
LEAVE(" ");
} }
/* Virtual Functions */ /* Virtual Functions */
@ -309,13 +302,10 @@ gnc_plugin_page_sx_list_create_widget (GncPluginPage *plugin_page)
GncPluginPageSxList *page; GncPluginPageSxList *page;
GncPluginPageSxListPrivate *priv; GncPluginPageSxListPrivate *priv;
ENTER("page %p", plugin_page);
page = GNC_PLUGIN_PAGE_SX_LIST(plugin_page); page = GNC_PLUGIN_PAGE_SX_LIST(plugin_page);
priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(page); priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(page);
if (priv->widget != NULL) { if (priv->widget != NULL)
LEAVE("widget = %p", priv->widget);
return priv->widget; return priv->widget;
}
priv->gxml = gnc_glade_xml_new("sched-xact.glade", "sx-list-vbox"); priv->gxml = gnc_glade_xml_new("sched-xact.glade", "sx-list-vbox");
priv->widget = glade_xml_get_widget(priv->gxml, "sx-list-vbox"); priv->widget = glade_xml_get_widget(priv->gxml, "sx-list-vbox");
@ -418,7 +408,6 @@ gnc_plugin_page_sx_list_destroy_widget (GncPluginPage *plugin_page)
GncPluginPageSxList *page; GncPluginPageSxList *page;
GncPluginPageSxListPrivate *priv; GncPluginPageSxListPrivate *priv;
ENTER("page %p", plugin_page);
page = GNC_PLUGIN_PAGE_SX_LIST (plugin_page); page = GNC_PLUGIN_PAGE_SX_LIST (plugin_page);
priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(page); priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(page);
@ -431,8 +420,6 @@ gnc_plugin_page_sx_list_destroy_widget (GncPluginPage *plugin_page)
gnc_unregister_gui_component(priv->gnc_component_id); gnc_unregister_gui_component(priv->gnc_component_id);
priv->gnc_component_id = 0; priv->gnc_component_id = 0;
} }
LEAVE("widget destroyed");
} }
/** /**
@ -455,9 +442,6 @@ gnc_plugin_page_sx_list_save_page (GncPluginPage *plugin_page,
g_return_if_fail(key_file != NULL); g_return_if_fail(key_file != NULL);
g_return_if_fail(group_name != NULL); g_return_if_fail(group_name != NULL);
ENTER("page %p, key_file %p, group_name %s", plugin_page, key_file,
group_name);
page = GNC_PLUGIN_PAGE_SX_LIST(plugin_page); page = GNC_PLUGIN_PAGE_SX_LIST(plugin_page);
priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(page); priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(page);
@ -465,7 +449,6 @@ gnc_plugin_page_sx_list_save_page (GncPluginPage *plugin_page,
gnc_tree_view_account_save(GNC_TREE_VIEW_ACCOUNT(priv->tree_view), gnc_tree_view_account_save(GNC_TREE_VIEW_ACCOUNT(priv->tree_view),
&priv->fd, key_file, group_name); &priv->fd, key_file, group_name);
#endif /* 0 */ #endif /* 0 */
LEAVE(" ");
} }
/** /**
@ -486,7 +469,6 @@ gnc_plugin_page_sx_list_recreate_page (GtkWidget *window,
g_return_val_if_fail(key_file, NULL); g_return_val_if_fail(key_file, NULL);
g_return_val_if_fail(group_name, NULL); g_return_val_if_fail(group_name, NULL);
ENTER("key_file %p, group_name %s", key_file, group_name);
/* Create the new page. */ /* Create the new page. */
page = GNC_PLUGIN_PAGE_SX_LIST(gnc_plugin_page_sx_list_new()); page = GNC_PLUGIN_PAGE_SX_LIST(gnc_plugin_page_sx_list_new());
@ -499,7 +481,6 @@ gnc_plugin_page_sx_list_recreate_page (GtkWidget *window,
gnc_tree_view_account_restore(GNC_TREE_VIEW_ACCOUNT(priv->tree_view), gnc_tree_view_account_restore(GNC_TREE_VIEW_ACCOUNT(priv->tree_view),
&priv->fd, key_file, group_name); &priv->fd, key_file, group_name);
#endif /* 0 */ #endif /* 0 */
LEAVE(" ");
return GNC_PLUGIN_PAGE(page); return GNC_PLUGIN_PAGE(page);
} }
@ -554,7 +535,7 @@ gnc_plugin_page_sx_list_cmd_edit(GtkAction *action, GncPluginPageSxList *page)
selected_paths = gtk_tree_selection_get_selected_rows(selection, &model); selected_paths = gtk_tree_selection_get_selected_rows(selection, &model);
if (g_list_length(selected_paths) == 0) if (g_list_length(selected_paths) == 0)
{ {
PERR("no selection edit."); g_warning("no selection edit.");
return; return;
} }
@ -604,7 +585,7 @@ gnc_plugin_page_sx_list_cmd_delete(GtkAction *action, GncPluginPageSxList *page)
selected_paths = gtk_tree_selection_get_selected_rows(selection, &model); selected_paths = gtk_tree_selection_get_selected_rows(selection, &model);
if (g_list_length(selected_paths) == 0) if (g_list_length(selected_paths) == 0)
{ {
PERR("no selection for delete."); g_warning("no selection for delete.");
return; return;
} }
@ -613,7 +594,7 @@ gnc_plugin_page_sx_list_cmd_delete(GtkAction *action, GncPluginPageSxList *page)
GList *list; GList *list;
for (list = to_delete; list != NULL; list = list->next) for (list = to_delete; list != NULL; list = list->next)
{ {
DEBUG("to-delete [%s]\n", xaccSchedXactionGetName((SchedXaction*)list->data)); g_debug("to-delete [%s]\n", xaccSchedXactionGetName((SchedXaction*)list->data));
} }
} }
g_list_foreach(to_delete, (GFunc)_destroy_sx, NULL); g_list_foreach(to_delete, (GFunc)_destroy_sx, NULL);