~sjrct/homebank/resize-xfer-window

« back to all changes in this revision

Viewing changes to src/hub-reptime.c

  • Committer: Maxime Doyen
  • Date: 2023-12-09 09:48:49 UTC
  • Revision ID: homebank@free.fr-20231209094849-rdoz0pmsutvxh1r4
5.7.3 release

Show diffs side-by-side

added added

removed removed

Lines of Context:
126
126
                        title = _("Account Balance");
127
127
                        showmono = FALSE;
128
128
                        break;
 
129
                case HUB_TIM_VIEW_GRPBALANCE:
 
130
                        title = _("Account Group Balance");
 
131
                        showmono = FALSE;
 
132
                        break;
129
133
                case HUB_TIM_VIEW_ALLBALANCE:
130
134
                        title = _("Global Balance");
131
135
                        break;
180
184
                case HUB_TIM_VIEW_ACCBALANCE:
181
185
                        tmpsrc = REPORT_SRC_ACCOUNT;
182
186
                        break;
 
187
                case HUB_TIM_VIEW_GRPBALANCE:
 
188
                        tmpsrc = REPORT_SRC_ACCGROUP;
 
189
                        break;
183
190
                case HUB_TIM_VIEW_ALLBALANCE:
184
191
                        tmpsrc = REPORT_SRC_NONE;
185
192
                        break;
223
230
        {
224
231
                data->hubtim_dt = dt;
225
232
 
226
 
                DB( g_print("\n -- populate time listview : %d rows --\n", dt->nbrows) );
 
233
                DB( g_print(" rows=%d\n", dt->nbrows) );
227
234
 
228
235
                // clear and detach our model
229
236
                g_object_ref(model); // Make sure the model stays with us after the tree view unrefs it
240
247
                        reskey = dt->keylist[i];
241
248
                        dr = report_data_get_row(dt, reskey);
242
249
 
243
 
                        DB( g_printf(" time eval item %4d:'%s' %.2f\n", i, dr->label, dr->rowexp + dr->rowinc ) );
 
250
                        DB( g_printf(" eval %d: %d '%s' %.2f\n", i, reskey, dr->label, dr->rowexp + dr->rowinc ) );
244
251
 
245
252
                        //#2024940 test on exp/inc individually
246
253
                        if( hb_amount_equal(dr->rowexp, 0.0) && hb_amount_equal(dr->rowinc, 0.0))
247
254
                        {
248
 
                                DB( g_printf("  hide because no data\n") );
 
255
                                DB( g_printf("  >skip: no data\n") );
249
256
                                continue;
250
257
                        }
251
258
 
254
261
 
255
262
                        n_inserted++;
256
263
 
257
 
                        DB( g_printf(" --> insert\n") );
 
264
                        DB( g_printf("  >insert\n") );
258
265
 
259
266
                        gtk_tree_store_insert_with_values(GTK_TREE_STORE(model), &iter, NULL, -1,
260
267
                                LST_REPTIME_POS, n_inserted,
287
294
                g_object_unref(model);
288
295
 
289
296
                gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(model), LST_REPTIME_POS, GTK_SORT_DESCENDING);
 
297
 
 
298
                //5.7.3 update chart and widgets
 
299
                {
 
300
                gchar *daterange;
 
301
 
 
302
                        //data->hubtim_total = total;
 
303
                        ui_hub_reptime_update(widget, data);
 
304
                        
 
305
                        daterange = filter_daterange_text_get(data->hubtim_filter);
 
306
                        gtk_widget_set_tooltip_markup(GTK_WIDGET(data->CY_hubtim_range), daterange);
 
307
                        g_free(daterange);
 
308
                }
 
309
 
 
310
                //we don't free dt here as it it used by graph
290
311
        }
291
 
 
292
 
        //dont forget to dispose dt !!
293
 
        ui_hub_reptime_update(widget, data);
294
 
 
295
312
}
296
313
 
297
314
 
316
333
        if( !strcmp("accbal", g_variant_get_string(new_state, NULL)) )
317
334
                PREFS->hub_tim_view = HUB_TIM_VIEW_ACCBALANCE;
318
335
        else
 
336
        if( !strcmp("grpbal", g_variant_get_string(new_state, NULL)) )
 
337
                PREFS->hub_tim_view = HUB_TIM_VIEW_GRPBALANCE;
 
338
        else
319
339
        if( !strcmp("allbal", g_variant_get_string(new_state, NULL)) )
320
340
                PREFS->hub_tim_view = HUB_TIM_VIEW_ALLBALANCE;
321
341
 
356
376
                {
357
377
                        case HUB_TIM_VIEW_SPENDING  : value = "expmon"; break;
358
378
                        case HUB_TIM_VIEW_ACCBALANCE: value = "accbal"; break;
 
379
                        case HUB_TIM_VIEW_GRPBALANCE: value = "grpbal"; break;
359
380
                        case HUB_TIM_VIEW_ALLBALANCE: value = "allbal"; break;
360
381
                }
361
382
                
443
464
 
444
465
        menu = g_menu_new ();
445
466
        section = g_menu_new ();
 
467
        g_menu_append_section(menu, NULL, G_MENU_MODEL(section));
446
468
        g_menu_append (section, _("Spending/Month")  , "actions.view::expmon");
447
 
        g_menu_append (section, _("Account Balance") , "actions.view::accbal");
448
 
        g_menu_append (section, _("Global Balance")  , "actions.view::allbal");
449
 
        g_menu_append_section(menu, NULL, G_MENU_MODEL(section));
 
469
        g_object_unref (section);
 
470
        
 
471
        section = g_menu_new ();
 
472
        g_menu_append_section(menu, _("Balance"), G_MENU_MODEL(section));
 
473
        g_menu_append (section, _("Account")      , "actions.view::accbal");
 
474
        g_menu_append (section, _("Account group"), "actions.view::grpbal");
 
475
        g_menu_append (section, _("Global")       , "actions.view::allbal");
450
476
        g_object_unref (section);
451
477
 
452
478
        GSimpleActionGroup *group = g_simple_action_group_new ();