~mdoyen/homebank/trunk

« back to all changes in this revision

Viewing changes to src/dsp-account.c

  • Committer: Maxime Doyen
  • Date: 2023-01-12 17:58:52 UTC
  • Revision ID: homebank@free.fr-20230112175852-qtqy23vexam04fim
5.6.1 release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*      HomeBank -- Free, easy, personal accounting for everyone.
2
 
 *      Copyright (C) 1995-2022 Maxime DOYEN
 
2
 *      Copyright (C) 1995-2023 Maxime DOYEN
3
3
 *
4
4
 *      This file is part of HomeBank.
5
5
 *
50
50
extern gchar *CYA_FLT_STATUS[];
51
51
 
52
52
 
 
53
static void register_panel_export_csv(GtkWidget *widget, gpointer user_data);
 
54
static void register_panel_edit_multiple(GtkWidget *widget, Transaction *txn, gint column_id, gpointer user_data);
 
55
static void register_panel_make_assignment(GtkWidget *widget, gpointer user_data);
 
56
static void register_panel_make_archive(GtkWidget *widget, gpointer user_data);
53
57
static void register_panel_collect_filtered_txn(GtkWidget *view, gboolean emptysearch);
54
58
static void register_panel_listview_populate(GtkWidget *view);
 
59
static void register_panel_add_after_propagate(struct register_panel_data *data, Transaction *add_txn);
 
60
static void register_panel_add_single_transaction(GtkWindow *window, Transaction *txn);
55
61
static void register_panel_action(GtkWidget *widget, gpointer user_data);
 
62
static void register_panel_selection(GtkTreeSelection *treeselection, gpointer user_data);
56
63
static void register_panel_update(GtkWidget *widget, gpointer user_data);
57
64
 
58
 
static void register_panel_export_csv(GtkWidget *widget, gpointer user_data);
59
 
 
60
 
static void register_panel_make_archive(GtkWidget *widget, gpointer user_data);
61
 
static void register_panel_make_assignment(GtkWidget *widget, gpointer user_data);
62
 
 
63
 
static void status_selected_foreach_func (GtkTreeModel  *model, GtkTreePath      *path, GtkTreeIter      *iter, gpointer userdata);
64
 
 
65
 
static void register_panel_edit_multiple(GtkWidget *widget, Transaction *txn, gint column_id, gpointer user_data);
66
 
 
67
 
static void register_panel_selection(GtkTreeSelection *treeselection, gpointer user_data);
68
 
static void register_panel_onRowActivated (GtkTreeView *treeview, GtkTreePath *path, GtkTreeViewColumn *col, gpointer userdata);
69
 
 
70
 
static void txn_list_add_by_value(GtkTreeView *treeview, Transaction *ope);
71
 
 
72
 
static void register_panel_add_single_transaction(GtkWindow *window, Transaction *txn);
73
 
 
74
 
static void register_panel_add_after_propagate(struct register_panel_data *data, Transaction *add_txn);
75
 
 
76
 
static gint txn_list_get_count_reconciled(GtkTreeView *treeview);
77
65
 
78
66
/* account action functions -------------------- */
79
67
 
141
129
        register_panel_action(data->window, GINT_TO_POINTER(ACTION_ACCOUNT_DELETE));
142
130
}
143
131
 
 
132
 
144
133
static void register_panel_action_find(GtkMenuItem *menuitem, gpointer     user_data)
145
134
{
146
135
struct register_panel_data *data = user_data;
536
525
        if(data->showall)
537
526
                return;
538
527
 
539
 
        DB( g_print("action assign\n") );
 
528
        DB( g_print("\n[register] assign\n") );
540
529
 
541
530
        lockrecon = gtk_switch_get_active (GTK_SWITCH(data->SW_lockreconciled));
542
531
 
571
560
{
572
561
struct register_panel_data *data = user_data;
573
562
 
574
 
        DB( g_print("action close\n") );
 
563
        DB( g_print("\n[register] close\n") );
575
564
 
576
565
        DB( g_print("window %p\n", data->window) );
577
566
 
605
594
        if( ui_dialog_export_csv(GTK_WINDOW(data->window), &filepath, &hassplit, &hasstatus, data->showall) == GTK_RESPONSE_ACCEPT )
606
595
        {
607
596
                DB( g_printf(" filename is '%s'\n", filepath) );
608
 
                DB( g_printf(" detail split %d\n", detailsplit) );
609
 
                DB( g_printf(" status column '%d'\n", statcol) );
610
597
 
611
598
                io = g_io_channel_new_file(filepath, "w", NULL);
612
599
                if(io != NULL)
735
722
 
736
723
                        g_list_foreach(selection, (GFunc)gtk_tree_path_free, NULL);
737
724
                        g_list_free(selection);
 
725
                        
 
726
                        //#2000809 add confirmation
 
727
                        ui_dialog_msg_infoerror(GTK_WINDOW(data->window), GTK_MESSAGE_INFO,
 
728
                                _("Create Assignment"),
 
729
                                _("%d created and prefixed with **PREFILLED**"),
 
730
                                count
 
731
                                );
 
732
 
738
733
                }
739
734
        }
740
735
}
802
797
 
803
798
                        g_list_foreach(selection, (GFunc)gtk_tree_path_free, NULL);
804
799
                        g_list_free(selection);
 
800
 
 
801
                        //#2000809 add confirmation
 
802
                        ui_dialog_msg_infoerror(GTK_WINDOW(data->window), GTK_MESSAGE_INFO,
 
803
                                _("Create Template"),
 
804
                                _("%d created and prefixed with **PREFILLED**"),
 
805
                                count
 
806
                                );
 
807
 
805
808
                }
806
809
        }
807
810
}
901
904
 
902
905
        data = g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW)), "inst_data");
903
906
        
904
 
        DB( g_print(" changes is %d\n", state) );
905
 
        
906
 
        gtk_image_set_from_icon_name(GTK_IMAGE(data->IM_lockreconciled), state == TRUE ? ICONNAME_CHANGES_PREVENT : ICONNAME_CHANGES_ALLOW, GTK_ICON_SIZE_BUTTON);
907
 
 
908
 
        //5.6 add lockreconciled icon
909
 
        list_txn_set_lockreconciled(GTK_TREE_VIEW(data->LV_ope), state);
910
 
        gtk_widget_queue_draw (data->LV_ope);
 
907
        DB( g_print(" state=%d switch=%d\n", state, gtk_switch_get_active (GTK_SWITCH(data->SW_lockreconciled)) ) );
911
908
 
912
909
        register_panel_update(data->LV_ope, GINT_TO_POINTER(FLG_REG_SENSITIVE));
913
910
 
931
928
 
932
929
        data->filter->nbdaysfuture = 0;
933
930
 
934
 
        if(range != FLT_RANGE_OTHER)
935
 
        {
 
931
        //in 5.6 no longer custom open the filter
 
932
        //if(range != FLT_RANGE_OTHER)
 
933
        //{
936
934
                filter_preset_daterange_set(data->filter, range, (data->showall == FALSE) ? data->acc->key : 0);
937
935
                // add eventual x days into future display
938
936
                if( future && (PREFS->date_future_nbdays > 0) )
940
938
                
941
939
                register_panel_collect_filtered_txn(data->LV_ope, FALSE);
942
940
                register_panel_listview_populate(data->LV_ope);
943
 
        }
 
941
        /*}
944
942
        else
945
943
        {
946
944
                if(ui_flt_manage_dialog_new(GTK_WINDOW(data->window), data->filter, data->showall, TRUE) != GTK_RESPONSE_REJECT)
949
947
                        register_panel_listview_populate(data->LV_ope);
950
948
                        register_panel_update(data->LV_ope, GINT_TO_POINTER(FLG_REG_SENSITIVE+FLG_REG_BALANCE));
951
949
                }
952
 
        }
 
950
        }*/
953
951
}
954
952
 
955
953
 
1065
1063
        if(data->showall)
1066
1064
                return;
1067
1065
 
1068
 
        DB( g_print("\n[account %d] balance refresh\n", data->acc != NULL ? (gint)data->acc->key : -1) );
 
1066
        DB( g_print("\n[register] balance refresh kacc=%d\n", data->acc != NULL ? (gint)data->acc->key : -1) );
1069
1067
 
1070
1068
        balance = data->acc->initial;
1071
1069
 
1214
1212
        // ref model to keep it
1215
1213
        //g_object_ref(model);
1216
1214
        //gtk_tree_view_set_model(GTK_TREE_VIEW(data->LV_ope), NULL);
1217
 
        gtk_list_store_clear (GTK_LIST_STORE(model));
 
1215
        gtk_tree_store_clear (GTK_TREE_STORE(model));
1218
1216
 
1219
1217
 
1220
1218
        // perf: if you leave the sort, insert is damned slow
1221
 
        gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE(GTK_LIST_STORE(model)), &sort_column_id, &order);
 
1219
        gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE(GTK_TREE_STORE(model)), &sort_column_id, &order);
1222
1220
        
1223
 
        gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(GTK_LIST_STORE(model)), GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID, PREFS->lst_ope_sort_order);
 
1221
        gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(GTK_TREE_STORE(model)), GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID, PREFS->lst_ope_sort_order);
1224
1222
 
1225
1223
        hastext = (gtk_entry_get_text_length (GTK_ENTRY(data->ST_search)) >= 2) ? TRUE : FALSE;
1226
1224
        needle = (gchar *)gtk_entry_get_text(GTK_ENTRY(data->ST_search));
1249
1247
                {
1250
1248
                        //gtk_list_store_append (GTK_LIST_STORE(model), &iter);
1251
1249
                        //gtk_list_store_set (GTK_LIST_STORE(model), &iter,
1252
 
                        gtk_list_store_insert_with_values(GTK_LIST_STORE(model), &iter, -1,
 
1250
                        gtk_tree_store_insert_with_values(GTK_TREE_STORE(model), &iter, NULL, -1,
1253
1251
                                MODEL_TXN_POINTER, txn,
1254
1252
                                -1);
1255
1253
 
1266
1264
        //g_object_unref(model);
1267
1265
 
1268
1266
        // push back the sort id
1269
 
        gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(GTK_LIST_STORE(model)), sort_column_id, order);
 
1267
        gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(GTK_TREE_STORE(model)), sort_column_id, order);
1270
1268
 
1271
1269
        /* update info range text */
1272
1270
        {
1282
1280
 
1283
1281
}
1284
1282
 
1285
 
static gint txn_list_get_count_reconciled(GtkTreeView *treeview)
 
1283
static gint list_txn_get_count_reconciled(GtkTreeView *treeview)
1286
1284
{
1287
1285
GtkTreeModel *model;
1288
1286
GList *lselection, *list;
1313
1311
}
1314
1312
 
1315
1313
 
1316
 
static void txn_list_add_by_value(GtkTreeView *treeview, Transaction *ope)
 
1314
static void list_txn_add_by_value(GtkTreeView *treeview, Transaction *ope)
1317
1315
{
1318
1316
GtkTreeModel *model;
1319
1317
GtkTreeIter  iter;
1326
1324
        DB( g_print("\n[transaction] add_treeview\n") );
1327
1325
 
1328
1326
        model = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview));
1329
 
        gtk_list_store_append (GTK_LIST_STORE(model), &iter);
1330
 
        gtk_list_store_set (GTK_LIST_STORE(model), &iter,
 
1327
        gtk_tree_store_append (GTK_TREE_STORE(model), &iter, NULL);
 
1328
        gtk_tree_store_set (GTK_TREE_STORE(model), &iter,
1331
1329
                MODEL_TXN_POINTER, ope,
1332
1330
                -1);
1333
1331
 
1344
1342
 
1345
1343
 
1346
1344
/* used to remove a intxfer child from a treeview */
1347
 
static void txn_list_remove_by_value(GtkTreeModel *model, Transaction *txn)
 
1345
static void list_txn_remove_by_value(GtkTreeModel *model, Transaction *txn)
1348
1346
{
1349
1347
GtkTreeIter iter;
1350
1348
gboolean valid;
1365
1363
 
1366
1364
                if( txn == tmp )
1367
1365
                {
1368
 
                        gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
 
1366
                        gtk_tree_store_remove(GTK_TREE_STORE(model), &iter);
1369
1367
                        break;
1370
1368
                }
1371
1369
                valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter);
1374
1372
 
1375
1373
 
1376
1374
// this func to some toggle
1377
 
static void status_selected_foreach_func (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer userdata)
 
1375
static void list_txn_status_selected_foreach_func (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer userdata)
1378
1376
{
1379
1377
gint targetstatus = GPOINTER_TO_INT(userdata);
1380
1378
Transaction *txn;
1443
1441
 
1444
1442
        if((data->showall == TRUE) || ( (data->acc != NULL) && (add_txn->kacc == data->acc->key) ) )
1445
1443
        {
1446
 
                txn_list_add_by_value(GTK_TREE_VIEW(data->LV_ope), add_txn);
 
1444
                list_txn_add_by_value(GTK_TREE_VIEW(data->LV_ope), add_txn);
1447
1445
                //#1716181 also add to the ptr_array (quickfilter)
1448
1446
                g_ptr_array_add(data->gpatxn, (gpointer)add_txn);
1449
1447
 
1467
1465
}
1468
1466
 
1469
1467
 
1470
 
static void remove_active_transaction(GtkTreeView *treeview)
 
1468
static void lst_txn_remove_active_transaction(GtkTreeView *treeview)
1471
1469
{
1472
1470
GtkTreeModel *model;
1473
1471
GList *list;
1480
1478
        GtkTreeIter iter;
1481
1479
 
1482
1480
                gtk_tree_model_get_iter(model, &iter, list->data);
1483
 
                gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
 
1481
                gtk_tree_store_remove(GTK_TREE_STORE(model), &iter);
1484
1482
        }
1485
1483
 
1486
1484
        g_list_foreach(list, (GFunc)gtk_tree_path_free, NULL);
1501
1499
        
1502
1500
        data = g_object_get_data(G_OBJECT(window), "inst_data");
1503
1501
 
1504
 
        txn_list_add_by_value(GTK_TREE_VIEW(data->LV_ope), txn);
 
1502
        list_txn_add_by_value(GTK_TREE_VIEW(data->LV_ope), txn);
1505
1503
}
1506
1504
 
1507
1505
 
1634
1632
                                        {
1635
1633
                                        GtkWindow *accwin = account_window(new_txn->kacc);
1636
1634
                                                
1637
 
                                                remove_active_transaction(GTK_TREE_VIEW(data->LV_ope));
 
1635
                                                lst_txn_remove_active_transaction(GTK_TREE_VIEW(data->LV_ope));
1638
1636
                                                //#1667501 update target account window if open
1639
1637
                                                if(accwin)
1640
1638
                                                {
1710
1708
                                                g_ptr_array_remove(data->gpatxn, (gpointer)rem_txn);
1711
1709
 
1712
1710
                                                // 1) remove visible current and potential xfer
1713
 
                                                gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
 
1711
                                                gtk_tree_store_remove(GTK_TREE_STORE(model), &iter);
1714
1712
 
1715
1713
                                                //manage target open window as well
1716
1714
                                                if((rem_txn->flags & OF_INTXFER))
1720
1718
                                                        {
1721
1719
                                                                if( data->showall )
1722
1720
                                                                {
1723
 
                                                                        txn_list_remove_by_value(model, child);
 
1721
                                                                        list_txn_remove_by_value(model, child);
1724
1722
                                                                        //#1716181 also remove from the ptr_array (quickfilter)                         
1725
1723
                                                                        g_ptr_array_remove(data->gpatxn, (gpointer)child);
1726
1724
                                                                        data->total--;
1755
1753
                GtkTreeSelection *selection;
1756
1754
                gint count, result;
1757
1755
                        
1758
 
                        count = txn_list_get_count_reconciled(GTK_TREE_VIEW(data->LV_ope));
 
1756
                        count = list_txn_get_count_reconciled(GTK_TREE_VIEW(data->LV_ope));
1759
1757
 
1760
1758
                        if(count > 0 )
1761
1759
                        {
1774
1772
                        if( result == GTK_RESPONSE_OK )
1775
1773
                        {
1776
1774
                                selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(data->LV_ope));
1777
 
                                gtk_tree_selection_selected_foreach(selection, (GtkTreeSelectionForeachFunc)status_selected_foreach_func, 
 
1775
                                gtk_tree_selection_selected_foreach(selection, (GtkTreeSelectionForeachFunc)list_txn_status_selected_foreach_func, 
1778
1776
                                        GINT_TO_POINTER(TXN_STATUS_NONE));
1779
1777
 
1780
1778
                                DB( g_print(" - none\n") );
1795
1793
                        GtkTreeSelection *selection;
1796
1794
                        
1797
1795
                        selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(data->LV_ope));
1798
 
                        gtk_tree_selection_selected_foreach(selection, (GtkTreeSelectionForeachFunc)status_selected_foreach_func, 
 
1796
                        gtk_tree_selection_selected_foreach(selection, (GtkTreeSelectionForeachFunc)list_txn_status_selected_foreach_func, 
1799
1797
                                GINT_TO_POINTER(TXN_STATUS_CLEARED));
1800
1798
 
1801
1799
                        DB( g_print(" - clear\n") );
1814
1812
                GtkTreeSelection *selection;
1815
1813
                gint count, result;
1816
1814
                        
1817
 
                        count = txn_list_get_count_reconciled(GTK_TREE_VIEW(data->LV_ope));
 
1815
                        count = list_txn_get_count_reconciled(GTK_TREE_VIEW(data->LV_ope));
1818
1816
 
1819
1817
                        if(count > 0 )
1820
1818
                        {
1833
1831
                        if( result == GTK_RESPONSE_OK )
1834
1832
                        {
1835
1833
                                selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(data->LV_ope));
1836
 
                                gtk_tree_selection_selected_foreach(selection, (GtkTreeSelectionForeachFunc)status_selected_foreach_func, 
 
1834
                                gtk_tree_selection_selected_foreach(selection, (GtkTreeSelectionForeachFunc)list_txn_status_selected_foreach_func, 
1837
1835
                                        GINT_TO_POINTER(TXN_STATUS_RECONCILED));
1838
1836
 
1839
1837
                                DB( g_print(" - reconcile\n") );
1859
1857
                                register_panel_update(data->LV_ope, GINT_TO_POINTER(FLG_REG_SENSITIVE+FLG_REG_BALANCE));
1860
1858
 
1861
1859
                                g_signal_handler_block(data->CY_range, data->handler_id[HID_RANGE]);
1862
 
                                hbtk_combo_box_set_active_id(GTK_COMBO_BOX_TEXT(data->CY_range), FLT_RANGE_OTHER);
 
1860
                                hbtk_combo_box_set_active_id(GTK_COMBO_BOX_TEXT(data->CY_range), FLT_RANGE_MISC_CUSTOM);
1863
1861
                                g_signal_handler_unblock(data->CY_range, data->handler_id[HID_RANGE]);
1864
1862
                        }
1865
1863
 
1929
1927
struct register_panel_data *data;
1930
1928
GtkTreeSelection *selection;
1931
1929
gint flags = GPOINTER_TO_INT(user_data);
1932
 
gboolean visible;
 
1930
gboolean lockrecon, visible;
1933
1931
gint count = 0;
1934
1932
 
1935
1933
        data = g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW)), "inst_data");
1936
1934
        //data = INST_DATA(widget);
1937
1935
 
1938
 
        DB( g_print("\n[account %d] update\n", data->acc != NULL ? (gint)data->acc->key : -1) );
 
1936
        DB( g_print("\n[register] update kacc=%d\n", data->acc != NULL ? (gint)data->acc->key : -1) );
1939
1937
 
1940
1938
        
1941
1939
        GLOBALS->minor = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_minor));
1943
1941
        /* set window title */
1944
1942
        if(flags & FLG_REG_TITLE)
1945
1943
        {
1946
 
                DB( g_print(" - FLG_REG_TITLE\n") );
 
1944
                DB( g_print(" FLG_REG_TITLE\n") );
1947
1945
 
1948
1946
        }
1949
1947
 
1950
1948
        /* update toolbar & list */
1951
1949
        if(flags & FLG_REG_VISUAL)
1952
1950
        {
1953
 
                DB( g_print(" - FLG_REG_VISUAL\n") );
 
1951
        //gboolean visible;
 
1952
                
 
1953
                DB( g_print(" FLG_REG_VISUAL\n") );
1954
1954
 
1955
1955
                if(PREFS->toolbar_style == 0)
1956
1956
                        gtk_toolbar_unset_style(GTK_TOOLBAR(data->TB_bar));
1964
1964
        /* update balances */
1965
1965
        if(flags & FLG_REG_BALANCE)
1966
1966
        {
1967
 
                DB( g_print(" - FLG_REG_BALANCE\n") );
 
1967
                DB( g_print(" FLG_REG_BALANCE\n") );
1968
1968
 
1969
1969
                if(data->showall == FALSE)
1970
1970
                {
2008
2008
        /* update disabled things */
2009
2009
        if(flags & FLG_REG_SENSITIVE)
2010
2010
        {
2011
 
        gboolean lockreconciled, sensitive, psensitive, nsensitive;
 
2011
        gboolean sensitive, psensitive, nsensitive;
2012
2012
        GtkTreeModel *model;
2013
2013
        gint sort_column_id;
2014
2014
        GtkSortType order;
2015
2015
        Transaction *ope;
2016
2016
 
2017
 
                DB( g_print(" - FLG_REG_SENSITIVE\n") );
 
2017
                DB( g_print(" FLG_REG_SENSITIVE\n") );
2018
2018
 
2019
2019
                selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(data->LV_ope));
2020
2020
                count = gtk_tree_selection_count_selected_rows(selection);
2034
2034
                hb_widget_visible(data->MI_chkintxfer, visible);
2035
2035
                //#1873248 Auto. assignments faulty visible on 'All transactions' window
2036
2036
                hb_widget_visible(data->MI_autoassign, visible);
2037
 
                
 
2037
 
2038
2038
                //1909749 lock/unlock reconciled
2039
 
                lockreconciled = !gtk_switch_get_active (GTK_SWITCH(data->SW_lockreconciled));
 
2039
                lockrecon = gtk_switch_get_active (GTK_SWITCH(data->SW_lockreconciled));
2040
2040
                if( ope != NULL )
2041
2041
                {
2042
2042
                        if( (ope->status != TXN_STATUS_RECONCILED) )
2043
 
                                lockreconciled = TRUE;
 
2043
                                lockrecon = FALSE;
2044
2044
 
2045
 
                        DB( g_print(" - lockreconciled = %d (%d %d)\n", lockreconciled, ope->status != TXN_STATUS_RECONCILED, gtk_switch_get_state (GTK_SWITCH(data->SW_lockreconciled)) ) );
 
2045
                        DB( g_print(" - lockrecon = %d (%d %d)\n", lockrecon, ope->status != TXN_STATUS_RECONCILED, gtk_switch_get_state (GTK_SWITCH(data->SW_lockreconciled)) ) );
2046
2046
                }
2047
2047
 
2048
2048
 
2061
2061
                sensitive = (count != 1 ) ? FALSE : TRUE;
2062
2062
                gtk_widget_set_sensitive(data->MI_herit, sensitive);
2063
2063
                gtk_widget_set_sensitive(data->MI_popherit, sensitive);
2064
 
                gtk_widget_set_sensitive(data->MI_edit, lockreconciled ? sensitive : FALSE);
2065
 
                gtk_widget_set_sensitive(data->MI_popedit, lockreconciled ? sensitive : FALSE);
 
2064
                gtk_widget_set_sensitive(data->MI_edit, lockrecon ? FALSE : sensitive);
 
2065
                gtk_widget_set_sensitive(data->MI_popedit, lockrecon ? FALSE : sensitive);
2066
2066
                gtk_widget_set_sensitive(data->BT_herit, sensitive);
2067
 
                gtk_widget_set_sensitive(data->BT_edit, lockreconciled ? sensitive : FALSE);
 
2067
                gtk_widget_set_sensitive(data->BT_edit, lockrecon ? FALSE : sensitive);
2068
2068
                gtk_widget_set_sensitive(data->MI_popcopyamount, sensitive);
2069
2069
 
2070
2070
                //txn have split
2074
2074
                // single: disable multiedit
2075
2075
                sensitive = (count <= 1 ) ? FALSE : TRUE;
2076
2076
                //1909749 lock/unlock reconciled
2077
 
                if( (txn_list_get_count_reconciled(GTK_TREE_VIEW(data->LV_ope)) > 0) && (gtk_switch_get_active (GTK_SWITCH(data->SW_lockreconciled)) == TRUE) )
 
2077
                if( (list_txn_get_count_reconciled(GTK_TREE_VIEW(data->LV_ope)) > 0) && (gtk_switch_get_active (GTK_SWITCH(data->SW_lockreconciled)) == TRUE) )
2078
2078
                        sensitive = FALSE;
2079
2079
                gtk_widget_set_sensitive(data->MI_multiedit   , sensitive);
2080
2080
                gtk_widget_set_sensitive(data->MI_popmultiedit, sensitive);
2083
2083
                // no selection: disable reconcile, delete
2084
2084
                sensitive = (count > 0 ) ? TRUE : FALSE;
2085
2085
                gtk_widget_set_sensitive(data->MI_copy, sensitive);
2086
 
                gtk_widget_set_sensitive(data->ME_menustatus, lockreconciled ? sensitive : FALSE);
2087
 
                gtk_widget_set_sensitive(data->ME_popmenustatus, lockreconciled ? sensitive : FALSE);
2088
 
                gtk_widget_set_sensitive(data->MI_delete, lockreconciled ? sensitive : FALSE);
2089
 
                gtk_widget_set_sensitive(data->MI_popdelete, lockreconciled ? sensitive : FALSE);
 
2086
                gtk_widget_set_sensitive(data->ME_menustatus, lockrecon ? FALSE : sensitive);
 
2087
                gtk_widget_set_sensitive(data->ME_popmenustatus, lockrecon ? FALSE : sensitive);
 
2088
                gtk_widget_set_sensitive(data->MI_delete, lockrecon ? FALSE : sensitive);
 
2089
                gtk_widget_set_sensitive(data->MI_popdelete, lockrecon ? FALSE : sensitive);
2090
2090
                gtk_widget_set_sensitive(data->MI_assign, sensitive);
2091
2091
                gtk_widget_set_sensitive(data->MI_popassign, sensitive);
2092
2092
                gtk_widget_set_sensitive(data->MI_template, sensitive);
2093
2093
                gtk_widget_set_sensitive(data->MI_poptemplate, sensitive);
2094
 
                gtk_widget_set_sensitive(data->BT_delete, lockreconciled ? sensitive : FALSE);
2095
 
                gtk_widget_set_sensitive(data->BT_clear, lockreconciled ? sensitive : FALSE);
2096
 
                gtk_widget_set_sensitive(data->BT_reconcile, lockreconciled ? sensitive : FALSE);
 
2094
                gtk_widget_set_sensitive(data->BT_delete, lockrecon ? FALSE : sensitive);
 
2095
                gtk_widget_set_sensitive(data->BT_clear, lockrecon ? FALSE : sensitive);
 
2096
                gtk_widget_set_sensitive(data->BT_reconcile, lockrecon ? FALSE : sensitive);
2097
2097
                gtk_widget_set_sensitive(data->BT_template, sensitive);
2098
2098
 
2099
2099
                //edit menu
2117
2117
 
2118
2118
                        visible = TRUE;
2119
2119
                        model = gtk_tree_view_get_model(GTK_TREE_VIEW(data->LV_ope));
2120
 
                        gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE(GTK_LIST_STORE(model)), &sort_column_id, &order);
 
2120
                        gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE(GTK_TREE_STORE(model)), &sort_column_id, &order);
2121
2121
                        if( (data->showall == TRUE) || (sort_column_id != LST_DSPOPE_DATE) )
2122
2122
                                visible = FALSE;
2123
2123
 
2234
2234
        gtk_label_set_markup(GTK_LABEL(data->TX_selection), msg);
2235
2235
        g_free (msg);
2236
2236
 
2237
 
        //update lock/unlock 
2238
 
        visible = gtk_switch_get_active (GTK_SWITCH(data->SW_lockreconciled));
 
2237
        //5.6 update lock/unlock
 
2238
        lockrecon = gtk_switch_get_active (GTK_SWITCH(data->SW_lockreconciled));
 
2239
        DB( g_print(" lockrecon=%d\n", lockrecon) );
 
2240
 
 
2241
        list_txn_set_lockreconciled(GTK_TREE_VIEW(data->LV_ope), lockrecon);
 
2242
        gtk_image_set_from_icon_name(GTK_IMAGE(data->IM_lockreconciled), lockrecon == TRUE ? ICONNAME_CHANGES_PREVENT : ICONNAME_CHANGES_ALLOW, GTK_ICON_SIZE_BUTTON);
2239
2243
        gtk_widget_set_tooltip_text (data->SW_lockreconciled, 
2240
 
                visible == TRUE ? _("Locked. Click to unlock") : _("Unlocked. Click to lock"));
2241
 
        
2242
 
        //gtk_label_set_label(GTK_LABEL(data->LB_lockreconciled), visible == TRUE ? _("Reconciled changes is permitted") : _("Change of reconciled is locked"));
 
2244
                lockrecon == TRUE ? _("Locked. Click to unlock") : _("Unlocked. Click to lock"));
 
2245
        gtk_widget_queue_draw (data->LV_ope);
2243
2246
 
2244
2247
}
2245
2248
 
2251
2254
GtkTreeIter iter;
2252
2255
gint col_id, count;
2253
2256
Transaction *ope;
2254
 
gboolean lockreconciled;
 
2257
gboolean lockrecon;
2255
2258
 
2256
2259
        data = g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(GTK_WIDGET(treeview), GTK_TYPE_WINDOW)), "inst_data");
2257
2260
 
2272
2275
        if( count == 1)
2273
2276
        {
2274
2277
                //1909749 lock/unlock reconciled        
2275
 
                lockreconciled = FALSE;
 
2278
                lockrecon = FALSE;
2276
2279
                if( (ope->status == TXN_STATUS_RECONCILED) && (gtk_switch_get_active (GTK_SWITCH(data->SW_lockreconciled)) == TRUE) )
2277
 
                        lockreconciled = TRUE;
 
2280
                        lockrecon = TRUE;
2278
2281
 
2279
 
                if( lockreconciled == FALSE )
 
2282
                if( lockrecon == FALSE )
2280
2283
                {
2281
2284
                        register_panel_action(GTK_WIDGET(treeview), GINT_TO_POINTER(ACTION_ACCOUNT_EDIT));
2282
2285
                }
2468
2471
 
2469
2472
static gint listview_context_cb (GtkWidget *widget, GdkEventButton *event, GtkWidget *menu)
2470
2473
{
2471
 
 
 
2474
struct register_panel_data *data;
 
2475
 
 
2476
        data = g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW)), "inst_data");
 
2477
 
 
2478
        //#1993088 register closed account popmenu should be disabled
 
2479
        if( data->acc != NULL )
 
2480
        {
 
2481
                if( data->acc->flags & AF_CLOSED )
 
2482
                        goto end;
 
2483
        }
2472
2484
        
2473
2485
        if (event->type == GDK_BUTTON_PRESS && event->button == 3)
2474
2486
        {
2475
2487
 
2476
2488
                // check we are not in the header but in bin window
2477
 
                 if (event->window == gtk_tree_view_get_bin_window (GTK_TREE_VIEW (widget)))
 
2489
                if (event->window == gtk_tree_view_get_bin_window (GTK_TREE_VIEW (widget)))
2478
2490
                {
2479
2491
                        #if( (GTK_MAJOR_VERSION == 3) && (GTK_MINOR_VERSION >= 22) )
2480
2492
                                gtk_menu_popup_at_pointer(GTK_MENU(menu), (GdkEvent *)event);
2488
2500
 
2489
2501
                // On indique à l'appelant que l'on n'a pas géré cet événement.
2490
2502
        }
2491
 
                return FALSE;
 
2503
end:
 
2504
        return FALSE;
2492
2505
}
2493
2506
 
2494
2507
 
2625
2638
                        gtk_widget_add_accelerator(menuitem, "activate", accel_group, GDK_KEY_r, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
2626
2639
 
2627
2640
                data->MI_multiedit = hbtk_menu_add_menuitem(menu, _("_Multiple Edit...") );
 
2641
                data->MI_template  = hbtk_menu_add_menuitem(menu, _("Create template...") );
2628
2642
                data->MI_assign    = hbtk_menu_add_menuitem(menu, _("Create assignment..."));
2629
 
                data->MI_template  = hbtk_menu_add_menuitem(menu, _("Create template...") );
2630
2643
                data->MI_delete    = menuitem = hbtk_menu_add_menuitem(menu, _("_Delete...") );
2631
2644
                gtk_widget_add_accelerator (menuitem, "activate", accel_group, GDK_KEY_Delete, (GdkModifierType)0, GTK_ACCEL_VISIBLE);
2632
2645
 
2841
2854
        gtk_grid_attach (GTK_GRID(table), data->CY_status, row, 0, 1, 1);
2842
2855
 
2843
2856
        row++;
 
2857
        widget = make_image_button(ICONNAME_HB_FILTER, _("Open the list filter"));
 
2858
        data->BT_filter = widget;
 
2859
        gtk_grid_attach (GTK_GRID(table), widget, row, 0, 1, 1);
 
2860
 
 
2861
        row++;
 
2862
        widget = make_image_button(ICONNAME_HB_REFRESH, _("Refresh results"));
 
2863
        data->BT_refresh = widget;
 
2864
        gtk_grid_attach (GTK_GRID(table), widget, row, 0, 1, 1);
 
2865
 
 
2866
        row++;
2844
2867
        //widget = gtk_button_new_with_mnemonic (_("Reset _filters"));
2845
2868
        widget = gtk_button_new_with_mnemonic (_("_Reset"));
2846
2869
        data->BT_reset = widget;
2847
2870
        gtk_grid_attach (GTK_GRID(table), widget, row, 0, 1, 1);
2848
2871
 
2849
2872
        row++;
2850
 
        widget = make_image_button(ICONNAME_HB_REFRESH, _("Refresh results"));
2851
 
        data->BT_refresh = widget;
2852
 
        gtk_grid_attach (GTK_GRID(table), widget, row, 0, 1, 1);
2853
 
 
2854
 
        row++;
2855
 
        widget = make_image_button(ICONNAME_HB_FILTER, _("Open the list filter"));
2856
 
        data->BT_filter = widget;
2857
 
        gtk_grid_attach (GTK_GRID(table), widget, row, 0, 1, 1);
2858
 
 
2859
 
        row++;
2860
2873
        //TRANSLATORS: this is for Euro specific users, a toggle to display in 'Minor' currency
2861
2874
        widget = gtk_check_button_new_with_mnemonic (_("Euro _minor"));
2862
2875
        data->CM_minor = widget;
3016
3029
        g_signal_connect (data->MI_statclear , "activate", G_CALLBACK (register_panel_action_clear), (gpointer)data);
3017
3030
        g_signal_connect (data->MI_statrecon , "activate", G_CALLBACK (register_panel_action_reconcile), (gpointer)data);
3018
3031
        g_signal_connect (data->MI_multiedit , "activate", G_CALLBACK (register_panel_action_multiedit), (gpointer)data);
 
3032
        //#2000809 assign menu do nothing
 
3033
        g_signal_connect (data->MI_assign    , "activate", G_CALLBACK (register_panel_action_createassignment), (gpointer)data);
3019
3034
        g_signal_connect (data->MI_template  , "activate", G_CALLBACK (register_panel_action_createtemplate), (gpointer)data);
3020
3035
        g_signal_connect (data->MI_delete    , "activate", G_CALLBACK (register_panel_action_delete), (gpointer)data);
3021
3036
        g_signal_connect (data->MI_find      , "activate", G_CALLBACK (register_panel_action_find), (gpointer)data);