124
124
switch( PREFS->hub_tot_view )
126
case HUB_TOT_VIEW_CATEGORY:
126
case HUB_TOT_VIEW_TOPCAT:
127
127
title = g_strdup_printf(_("Top %d Spending / Category"), PREFS->rep_maxspenditems);
129
case HUB_TOT_VIEW_PAYEE:
129
case HUB_TOT_VIEW_TOPPAY:
130
130
title = g_strdup_printf(_("Top %d Spending / Payee"), PREFS->rep_maxspenditems);
132
case HUB_TOT_VIEW_ACCOUNT:
132
case HUB_TOT_VIEW_TOPACC:
133
133
title = g_strdup_printf(_("Top %d Spending / Account"), PREFS->rep_maxspenditems);
135
case HUB_TOT_VIEW_BALANCE:
135
case HUB_TOT_VIEW_ACCBAL:
136
136
title = g_strdup_printf(_("Account Balance"));
138
case HUB_TOT_VIEW_GRPBAL:
139
title = g_strdup_printf(_("Account Group Balance"));
140
143
gtk_chart_set_color_scheme(GTK_CHART(data->RE_hubtot_chart), PREFS->report_color_scheme);
190
193
switch( PREFS->hub_tot_view )
192
case HUB_TOT_VIEW_CATEGORY: tmpsrc = REPORT_SRC_CATEGORY; break;
193
case HUB_TOT_VIEW_PAYEE : tmpsrc = REPORT_SRC_PAYEE; break;
194
case HUB_TOT_VIEW_ACCOUNT : tmpsrc = REPORT_SRC_ACCOUNT; break;
195
case HUB_TOT_VIEW_BALANCE :
195
case HUB_TOT_VIEW_TOPCAT: tmpsrc = REPORT_SRC_CATEGORY; break;
196
case HUB_TOT_VIEW_TOPPAY: tmpsrc = REPORT_SRC_PAYEE; break;
197
case HUB_TOT_VIEW_TOPACC: tmpsrc = REPORT_SRC_ACCOUNT; break;
198
case HUB_TOT_VIEW_ACCBAL:
196
199
tmpsrc = REPORT_SRC_ACCOUNT;
197
200
tmpaccbal = TRUE;
202
case HUB_TOT_VIEW_GRPBAL:
203
tmpsrc = REPORT_SRC_ACCGROUP;
201
208
//type = hbtk_radio_button_get_active(GTK_CONTAINER(data->RA_type));
239
246
g_object_ref(model); /* Make sure the model stays with us after the tree view unrefs it */
240
247
gtk_tree_view_set_model(GTK_TREE_VIEW(data->LV_hubtot), NULL); /* Detach model from view */
242
DB( g_print("\n -- populate total listview %d rows --\n", dt->nbrows) );
249
DB( g_print(" rows=%d\n", dt->nbrows) );
244
251
// insert into the treeview
245
252
for(i=0 ; i<dt->nbrows ; i++)
252
259
reskey = dt->keylist[i];
253
260
dr = report_data_get_row(dt, reskey);
262
DB( g_printf(" eval %d: %d '%s' %.2f\n", i, reskey, dr->label, dr->rowexp + dr->rowinc ) );
255
264
//if( tmptype == REPORT_TYPE_EXPENSE && !dr->expense[0] ) continue;
256
265
//if( tmptype == REPORT_TYPE_INCOME && !dr->income[1] ) continue;
257
266
if( !dr->rowexp && !dr->rowinc )
259
DB( g_print(" - %d : %s k='%d' %.2f %.2f, skipped no data\n", i, dr->label, reskey, dr->rowexp, dr->rowinc) );
268
DB( g_printf(" >skip: no data\n") );
308
317
//LST_TOPSPEND_RATE, (gint)(((ABS(value)*100)/ABS(total)) + 0.5),
311
DB( g_print(" - %d : %s k='%d' v='%f' %f %f, added\n", i, dr->label, reskey, value, dr->rowexp, dr->rowinc) );
320
DB( g_printf(" >insert\n") );
315
DB( g_print(" - %d : %s k='%d' v='%f' %f %f, skipped\n", i, dr->label, reskey, value, dr->rowexp, dr->rowinc) );
324
DB( g_printf(" >skip: no data balance mode\n") );
420
429
PREFS->hub_tot_view = HUB_TOT_VIEW_NONE;
422
if( !strcmp("cat", g_variant_get_string(new_state, NULL)) )
423
PREFS->hub_tot_view = HUB_TOT_VIEW_CATEGORY;
431
if( !strcmp("topcat", g_variant_get_string(new_state, NULL)) )
432
PREFS->hub_tot_view = HUB_TOT_VIEW_TOPCAT;
425
if( !strcmp("pay", g_variant_get_string(new_state, NULL)) )
426
PREFS->hub_tot_view = HUB_TOT_VIEW_PAYEE;
428
if( !strcmp("acc", g_variant_get_string(new_state, NULL)) )
429
PREFS->hub_tot_view = HUB_TOT_VIEW_ACCOUNT;
431
if( !strcmp("bal", g_variant_get_string(new_state, NULL)) )
432
PREFS->hub_tot_view = HUB_TOT_VIEW_BALANCE;
434
if( !strcmp("toppay", g_variant_get_string(new_state, NULL)) )
435
PREFS->hub_tot_view = HUB_TOT_VIEW_TOPPAY;
437
if( !strcmp("topacc", g_variant_get_string(new_state, NULL)) )
438
PREFS->hub_tot_view = HUB_TOT_VIEW_TOPACC;
440
if( !strcmp("accbal", g_variant_get_string(new_state, NULL)) )
441
PREFS->hub_tot_view = HUB_TOT_VIEW_ACCBAL;
443
if( !strcmp("grpbal", g_variant_get_string(new_state, NULL)) )
444
PREFS->hub_tot_view = HUB_TOT_VIEW_GRPBAL;
434
446
g_simple_action_set_state (action, new_state);
435
447
g_variant_unref (old_state);
441
453
static const GActionEntry actions[] = {
442
454
// name, function(), type, state,
443
{ "view", ui_hub_reptotal_activate_radio , "s", "'cat'", NULL, {0,0,0} }
455
{ "view", ui_hub_reptotal_activate_radio , "s", "'topcat'", NULL, {0,0,0} }
471
483
switch( PREFS->hub_tot_view )
473
case HUB_TOT_VIEW_CATEGORY: value = "cat"; break;
474
case HUB_TOT_VIEW_PAYEE: value = "pay"; break;
475
case HUB_TOT_VIEW_ACCOUNT: value = "acc"; break;
476
case HUB_TOT_VIEW_BALANCE: value = "bal"; break;
485
case HUB_TOT_VIEW_TOPCAT: value = "topcat"; break;
486
case HUB_TOT_VIEW_TOPPAY: value = "toppay"; break;
487
case HUB_TOT_VIEW_TOPACC: value = "topacc"; break;
488
case HUB_TOT_VIEW_ACCBAL: value = "accbal"; break;
489
case HUB_TOT_VIEW_GRPBAL: value = "grpbal"; break;
479
492
new_state = g_variant_new_string (value);
559
572
GMenu *menu, *section;
561
574
menu = g_menu_new ();
562
section = g_menu_new ();
563
g_menu_append (section, _("Category") , "actions.view::cat");
564
g_menu_append (section, _("Payee") , "actions.view::pay");
565
g_menu_append (section, _("Account") , "actions.view::acc");
566
g_menu_append (section, _("Balance") , "actions.view::bal");
567
g_menu_append_section(menu, NULL, G_MENU_MODEL(section));
576
section = g_menu_new ();
577
g_menu_append_section(menu, _("Top by"), G_MENU_MODEL(section));
578
g_menu_append (section, _("Category") , "actions.view::topcat");
579
g_menu_append (section, _("Payee") , "actions.view::toppay");
580
g_menu_append (section, _("Account") , "actions.view::topacc");
581
g_object_unref (section);
583
section = g_menu_new ();
584
g_menu_append_section (menu, _("Balance"), G_MENU_MODEL(section));
585
g_menu_append (section, _("Account"), "actions.view::accbal");
586
g_menu_append (section, _("Account group"), "actions.view::grpbal");
568
587
g_object_unref (section);
570
589
gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (widget), G_MENU_MODEL (menu));