1 /* HomeBank -- Free, easy, personal accounting for everyone.
2 * Copyright (C) 1995-2017 Maxime DOYEN
4 * This file is part of HomeBank.
6 * HomeBank is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * HomeBank is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include "list_operation.h"
25 /****************************************************************************/
27 /****************************************************************************/
36 /* our global datas */
37 extern struct HomeBank
*GLOBALS
;
38 extern struct Preferences
*PREFS
;
42 gchar
*list_txn_column_label
[] = {
61 //extern gboolean minor_active;
63 /* This is not pretty. Of course you can also use a
64 * separate compare function for each sort ID value */
66 static gint
list_txn_sort_iter_compare_strings(gchar
*s1
, gchar
*s2
)
68 return hb_string_utf8_compare(s1
, s2
);
73 list_txn_sort_iter_compare_func (GtkTreeModel
*model
,
78 gint sortcol
= GPOINTER_TO_INT(userdata
);
80 Transaction
*ope1
, *ope2
;
83 gtk_tree_model_get(model
, a
, LST_DSPOPE_DATAS
, &ope1
, -1);
84 gtk_tree_model_get(model
, b
, LST_DSPOPE_DATAS
, &ope2
, -1);
88 case LST_DSPOPE_STATUS
:
89 if(!(retval
= (ope1
->flags
& OF_ADDED
) - (ope2
->flags
& OF_ADDED
) ) )
91 retval
= (ope1
->flags
& OF_CHANGED
) - (ope2
->flags
& OF_CHANGED
);
96 if(! (retval
= ope1
->date
- ope2
->date
) )
98 //g_print("sort on balance d1=%d, d2=%d %f %f\n", ope1->date, ope2->date, ope1->balance , ope2->balance);
100 tmpval
= ope1
->pos
- ope2
->pos
;
101 retval
= tmpval
> 0 ? 1 : -1;
103 //g_print("ret=%d\n", ret);
106 case LST_DSPOPE_ACCOUNT
:
110 a1
= da_acc_get(ope1
->kacc
);
111 a2
= da_acc_get(ope2
->kacc
);
112 if( a1
!= NULL
&& a2
!= NULL
)
114 retval
= list_txn_sort_iter_compare_strings(a1
->name
, a2
->name
);
119 case LST_DSPOPE_INFO
:
120 if(!(retval
= ope1
->paymode
- ope2
->paymode
))
122 retval
= list_txn_sort_iter_compare_strings(ope1
->info
, ope2
->info
);
126 case LST_DSPOPE_PAYEE
:
130 p1
= da_pay_get(ope1
->kpay
);
131 p2
= da_pay_get(ope2
->kpay
);
132 if( p1
!= NULL
&& p2
!= NULL
)
134 retval
= list_txn_sort_iter_compare_strings(p1
->name
, p2
->name
);
139 case LST_DSPOPE_WORDING
:
140 retval
= list_txn_sort_iter_compare_strings(ope1
->wording
, ope2
->wording
);
144 retval
= ope1
->status
- ope2
->status
;
147 case LST_DSPOPE_AMOUNT
:
148 case LST_DSPOPE_EXPENSE
:
149 case LST_DSPOPE_INCOME
:
150 tmpval
= ope1
->amount
- ope2
->amount
;
151 retval
= tmpval
> 0 ? 1 : -1;
154 case LST_DSPOPE_CATEGORY
:
157 gchar
*name1
, *name2
;
159 c1
= da_cat_get(ope1
->kcat
);
160 c2
= da_cat_get(ope2
->kcat
);
161 if( c1
!= NULL
&& c2
!= NULL
)
163 name1
= da_cat_get_fullname(c1
);
164 name2
= da_cat_get_fullname(c2
);
165 retval
= list_txn_sort_iter_compare_strings(name1
, name2
);
172 case LST_DSPOPE_TAGS
:
176 t1
= transaction_tags_tostring(ope1
);
177 t2
= transaction_tags_tostring(ope2
);
178 retval
= list_txn_sort_iter_compare_strings(t1
, t2
);
185 g_return_val_if_reached(0);
191 static void list_txn_eval_future(GtkCellRenderer
*renderer
, Transaction
*txn
)
194 //it seems we are not able to get a valid GdkRGBA
195 //nor to set/use the alpha
197 g_object_get(renderer, "foreground-rgba", &rgba, NULL);
198 g_print("forcol: %p %f %f %f %f\n", rgba, rgba->red, rgba->green, rgba->blue, rgba->alpha);
201 g_object_set(renderer, "foreground-set", TRUE,
202 "foreground-rgba", rgba,
207 if(txn
->date
> GLOBALS
->today
)
209 g_object_set(renderer
,
213 "style", PANGO_STYLE_OBLIQUE
,
218 g_object_set(renderer
, "scale-set", FALSE
, "style-set", FALSE
,
225 ** date cell function
227 static void list_txn_status_cell_data_function (GtkTreeViewColumn
*col
, GtkCellRenderer
*renderer
, GtkTreeModel
*model
, GtkTreeIter
*iter
, gpointer user_data
)
230 gchar
*iconname
= NULL
;
232 gtk_tree_model_get(model
, iter
, LST_DSPOPE_DATAS
, &entry
, -1);
235 stat[0] = ( entry->ope_Flags & OF_ADDED ) ? data->istatus[2] : data->istatus[0];
236 stat[1] = ( entry->ope_Flags & OF_CHANGED) ? data->istatus[3] : data->istatus[0];
237 stat[2] = ( entry->ope_Flags & OF_VALID ) ? data->istatus[4] : data->istatus[0];
238 if( entry->ope_Flags & OF_REMIND ) stat[2] = data->istatus[1];
241 switch(GPOINTER_TO_INT(user_data
))
244 iconname
= ( entry
->flags
& OF_AUTO
) ? ICONNAME_HB_OPE_AUTO
: ( entry
->flags
& OF_ADDED
) ? ICONNAME_NEW
: NULL
;
247 iconname
= ( entry
->flags
& OF_CHANGED
) ? ICONNAME_HB_OPE_EDIT
: NULL
;
250 if( entry->flags & OF_VALID )
251 iconname = ICONNAME_HB_OPE_VALID;
254 if( entry->flags & OF_REMIND )
255 iconname = ICONNAME_HB_OPE_REMIND;
259 g_object_set(renderer
, "icon-name", iconname
, NULL
);
264 ** account cell function
266 static void list_txn_account_cell_data_function (GtkTreeViewColumn
*col
, GtkCellRenderer
*renderer
, GtkTreeModel
*model
, GtkTreeIter
*iter
, gpointer user_data
)
271 gtk_tree_model_get(model
, iter
, LST_DSPOPE_DATAS
, &ope
, -1);
273 acc
= da_acc_get(ope
->kacc
);
276 g_object_set(renderer
, "text", acc
->name
, NULL
);
279 g_object_set(renderer
, "text", "", NULL
);
283 ** date cell function
285 static void list_txn_date_cell_data_function (GtkTreeViewColumn
*col
, GtkCellRenderer
*renderer
, GtkTreeModel
*model
, GtkTreeIter
*iter
, gpointer user_data
)
291 gtk_tree_model_get(model
, iter
, LST_DSPOPE_DATAS
, &ope
, -1);
292 list_txn_eval_future(renderer
, ope
);
296 g_date_set_julian (&date
, ope
->date
);
297 g_date_strftime (buffer
, 256-1, PREFS
->date_format
, &date
);
299 //g_snprintf(buf, sizeof(buf), "%d", ope->ope_Date);
301 g_object_set(renderer
, "text", buffer
, NULL
);
304 g_object_set(renderer
, "text", "????", NULL
);
308 ** info cell function
310 static void list_txn_info_cell_data_function (GtkTreeViewColumn
*col
, GtkCellRenderer
*renderer
, GtkTreeModel
*model
, GtkTreeIter
*iter
, gpointer user_data
)
314 gtk_tree_model_get(model
, iter
, LST_DSPOPE_DATAS
, &ope
, -1);
316 switch(GPOINTER_TO_INT(user_data
))
319 g_object_set(renderer
, "icon-name", get_paymode_icon_name(ope
->paymode
), NULL
);
322 list_txn_eval_future(renderer
, ope
);
323 g_object_set(renderer
, "text", ope
->info
, NULL
);
329 ** payee cell function
331 static void list_txn_payee_cell_data_function (GtkTreeViewColumn
*col
, GtkCellRenderer
*renderer
, GtkTreeModel
*model
, GtkTreeIter
*iter
, gpointer user_data
)
335 gtk_tree_model_get(model
, iter
, LST_DSPOPE_DATAS
, &ope
, -1);
336 list_txn_eval_future(renderer
, ope
);
339 if(ope
->paymode
== PAYMODE_INTXFER
)
341 Account
*acc
= da_acc_get(ope
->kxferacc
);
343 g_object_set(renderer
, "text", (acc
!= NULL
) ? acc
->name
: "", NULL
);
347 Payee
*pay
= da_pay_get(ope
->kpay
);
349 g_object_set(renderer
, "text", pay
!= NULL
? pay
->name
: "", NULL
);
354 ** tags cell function
356 static void list_txn_tags_cell_data_function (GtkTreeViewColumn
*col
, GtkCellRenderer
*renderer
, GtkTreeModel
*model
, GtkTreeIter
*iter
, gpointer user_data
)
361 gtk_tree_model_get(model
, iter
, LST_DSPOPE_DATAS
, &ope
, -1);
362 list_txn_eval_future(renderer
, ope
);
364 if(ope
->tags
!= NULL
)
366 str
= transaction_tags_tostring(ope
);
367 g_object_set(renderer
, "text", str
, NULL
);
371 g_object_set(renderer
, "text", "", NULL
);
378 ** wording cell function
380 static void list_txn_wording_cell_data_function (GtkTreeViewColumn
*col
, GtkCellRenderer
*renderer
, GtkTreeModel
*model
, GtkTreeIter
*iter
, gpointer user_data
)
384 gtk_tree_model_get(model
, iter
, LST_DSPOPE_DATAS
, &ope
, -1);
385 list_txn_eval_future(renderer
, ope
);
387 g_object_set(renderer
, "text", ope
->wording
, NULL
);
394 static void list_txn_clr_cell_data_function (GtkTreeViewColumn
*col
, GtkCellRenderer
*renderer
, GtkTreeModel
*model
, GtkTreeIter
*iter
, gpointer user_data
)
397 gchar
*iconname
= NULL
;
398 //const gchar *c = "";
400 gtk_tree_model_get(model
, iter
, LST_DSPOPE_DATAS
, &ope
, -1);
403 /*case TXN_STATUS_CLEARED: c = "c"; break;
404 case TXN_STATUS_RECONCILED: c = "R"; break;
405 case TXN_STATUS_REMIND: c = "!"; break;*/
406 case TXN_STATUS_CLEARED
: iconname
= ICONNAME_HB_OPE_CLEARED
; break;
407 case TXN_STATUS_RECONCILED
: iconname
= ICONNAME_HB_OPE_RECONCILED
; break;
408 case TXN_STATUS_REMIND
: iconname
= ICONNAME_HB_OPE_REMIND
; break;
412 //g_object_set(renderer, "text", c, NULL);
413 g_object_set(renderer
, "icon-name", iconname
, NULL
);
419 ** amount cell function
421 static void list_txn_amount_cell_data_function (GtkTreeViewColumn
*col
, GtkCellRenderer
*renderer
, GtkTreeModel
*model
, GtkTreeIter
*iter
, gpointer user_data
)
424 gint column
= GPOINTER_TO_INT(user_data
);
425 gchar buf
[G_ASCII_DTOSTR_BUF_SIZE
];
430 // get the transaction
431 gtk_tree_model_get(model
, iter
, LST_DSPOPE_DATAS
, &ope
, -1);
432 list_txn_eval_future(renderer
, ope
);
434 if(column
== LST_DSPOPE_BALANCE
)
435 amount
= ope
->balance
;
437 amount
= ope
->amount
;
439 if(column
== LST_DSPOPE_INCOME
|| column
== LST_DSPOPE_EXPENSE
)
441 type
= (ope
->flags
& OF_INCOME
) ? LST_DSPOPE_INCOME
: LST_DSPOPE_EXPENSE
;
444 g_object_set(renderer
, "markup", NULL
, NULL
);
451 hb_strfmon(buf
, G_ASCII_DTOSTR_BUF_SIZE
-1, amount
, ope
->kcur
, GLOBALS
->minor
);
452 color
= get_normal_color_amount(amount
);
454 g_object_set(renderer
,
465 ** category cell function
467 static void list_txn_category_cell_data_function (GtkTreeViewColumn
*col
, GtkCellRenderer
*renderer
, GtkTreeModel
*model
, GtkTreeIter
*iter
, gpointer user_data
)
473 gtk_tree_model_get(model
, iter
, LST_DSPOPE_DATAS
, &ope
, -1);
474 list_txn_eval_future(renderer
, ope
);
476 if(ope
->flags
& OF_SPLIT
)
478 g_object_set(renderer
, "text", _("- split -"), NULL
);
482 cat
= da_cat_get(ope
->kcat
);
485 fullname
= da_cat_get_fullname(cat
);
486 g_object_set(renderer
, "text", fullname
, NULL
);
490 g_object_set(renderer
, "text", "", NULL
);
497 /* = = = = = = = = = = = = = = = = */
498 gboolean
list_txn_column_id_isvisible(GtkTreeView
*treeview
, gint sort_id
)
500 GtkTreeViewColumn
*column
;
503 for(n
=0; n
< NUM_LST_DSPOPE
-1 ; n
++ ) // -1 cause account not to be processed
505 column
= gtk_tree_view_get_column (treeview
, n
);
509 if( gtk_tree_view_column_get_visible(column
) )
511 id
= gtk_tree_view_column_get_sort_column_id (column
);
521 static GtkTreeViewColumn
*list_txn_get_column(GList
*list
, gint search_id
)
523 GtkTreeViewColumn
*column
= NULL
;
527 tmp
= g_list_first(list
);
530 id
= gtk_tree_view_column_get_sort_column_id(tmp
->data
);
536 tmp
= g_list_next(tmp
);
542 guint
list_txn_get_quicksearch_column_mask(GtkTreeView
*treeview
)
544 GtkTreeViewColumn
*column
;
549 for(n
=0; n
< NUM_LST_DSPOPE
-1 ; n
++ ) // -1 cause account not to be processed
551 column
= gtk_tree_view_get_column (treeview
, n
);
555 if( gtk_tree_view_column_get_visible(column
) )
557 id
= gtk_tree_view_column_get_sort_column_id (column
);
560 case LST_DSPOPE_WORDING
: mask
|= FLT_QSEARCH_MEMO
; break;
561 case LST_DSPOPE_INFO
: mask
|= FLT_QSEARCH_INFO
; break;
562 case LST_DSPOPE_PAYEE
: mask
|= FLT_QSEARCH_PAYEE
; break;
563 case LST_DSPOPE_CATEGORY
: mask
|= FLT_QSEARCH_CATEGORY
; break;
564 case LST_DSPOPE_TAGS
: mask
|= FLT_QSEARCH_TAGS
; break;
573 void list_txn_set_save_column_width(GtkTreeView
*treeview
, gboolean save_column_width
)
575 struct list_txn_data
*data
;
577 data
= g_object_get_data(G_OBJECT(treeview
), "inst_data");
580 data
->save_column_width
= save_column_width
;
585 void list_txn_sort_force(GtkTreeSortable
*sortable
, gpointer user_data
)
590 DB( g_print("list_txn_sort_force\n") );
592 gtk_tree_sortable_get_sort_column_id(sortable
, &sort_column_id
, &order
);
593 DB( g_print(" - id %d order %d\n", sort_column_id
, order
) );
595 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(sortable
), GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID
, order
);
596 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(sortable
), sort_column_id
, order
);
600 static void list_txn_get_columns(GtkTreeView
*treeview
)
602 struct list_txn_data
*data
;
603 GtkTreeViewColumn
*column
;
606 DB( g_print("\n[list_txn] get columns order/width\n") );
608 data
= g_object_get_data(G_OBJECT(treeview
), "inst_data");
610 DB( g_print(" nbcol=%d, nbsortid=%d\n", NUM_LST_DSPOPE
, gtk_tree_view_get_n_columns (treeview
)) );
612 for(i
=0 ; i
< NUM_LST_DSPOPE
-1 ; i
++ ) // -1 'caus: account and blank column
614 column
= gtk_tree_view_get_column(treeview
, i
);
617 col_id
= gtk_tree_view_column_get_sort_column_id (column
);
622 visible
= gtk_tree_view_column_get_visible (column
);
623 if( col_id
== LST_DSPOPE_BALANCE
) //keep initial state of balance
624 visible
= data
->tvc_is_visible
;
627 PREFS
->lst_ope_columns
[i
] = col_id
;
629 PREFS
->lst_ope_columns
[i
] = -col_id
;
631 PREFS
->lst_ope_col_size
[col_id
-1] = gtk_tree_view_column_get_width(column
);
633 DB( g_print(" col-%2d => %2d '%s' w=%d\n", i
, col_id
, gtk_tree_view_column_get_title(column
), PREFS
->lst_ope_col_size
[col_id
-1] ) );
635 else //should not occurs
636 PREFS
->lst_ope_columns
[i
] = 0;
642 static void list_txn_set_columns(GtkTreeView
*treeview
, gint
*col_id
)
644 struct list_txn_data
*data
;
645 GtkTreeViewColumn
*column
, *base
;
651 DB( g_print("\n[list_txn] set columns order/width\n") );
653 data
= g_object_get_data(G_OBJECT(treeview
), "inst_data");
656 DB( g_print("\n debug column sortid\n") );
658 for(i
=0; i
< NUM_LST_DSPOPE
-1 ; i
++ ) // -1 cause account not to be processed
660 DB( g_print(" - pos:%2d sortid:%2d\n", i
, col_id
[i
]) );
665 DB( g_print("\n apply column prefs\n") );
667 list
= gtk_tree_view_get_columns( treeview
);
671 for(i
=0; i
< NUM_LST_DSPOPE
-1 ; i
++ ) // -1 cause account not to be processed
673 /* hidden are stored as col_id negative */
675 column
= list_txn_get_column(list
, id
);
677 //DB( g_print(" - get column %d %p\n", id, column) );
681 DB( g_print(" - pos:%2d sortid:%2d (%s)\n", i
, col_id
[i
], gtk_tree_view_column_get_title(column
)) );
683 gtk_tree_view_move_column_after(treeview
, column
, base
);
686 visible
= col_id
[i
] < 0 ? FALSE
: TRUE
;
688 /* display exception for detail/import list */
689 if(data
->list_type
!= LIST_TXN_TYPE_BOOK
)
691 if( id
== LST_DSPOPE_AMOUNT
)
694 if( id
== LST_DSPOPE_STATUS
|| id
== LST_DSPOPE_EXPENSE
|| id
== LST_DSPOPE_INCOME
)
698 gtk_tree_view_column_set_visible (column
, visible
);
699 if( id
== LST_DSPOPE_BALANCE
)
701 data
->tvc_is_visible
= visible
;
704 if( id
== LST_DSPOPE_INFO
705 || id
== LST_DSPOPE_PAYEE
706 || id
== LST_DSPOPE_WORDING
707 || id
== LST_DSPOPE_CATEGORY
708 || id
== LST_DSPOPE_TAGS
709 || id
== LST_DSPOPE_ACCOUNT
)
711 gtk_tree_view_column_set_fixed_width( column
, PREFS
->lst_ope_col_size
[id
- 1]);
721 static void list_txn_sort_column_changed(GtkTreeSortable
*sortable
, gpointer user_data
)
723 struct list_txn_data
*data
= user_data
;
726 gboolean showBalance
;
728 gtk_tree_sortable_get_sort_column_id(sortable
, &id
, &order
);
730 DB( g_print("list_txn_columns_changed %d %d\n", id
, order
) );
732 //here save the transaction list columnid and sort order
733 PREFS
->lst_ope_sort_id
= id
;
734 PREFS
->lst_ope_sort_order
= order
;
736 //manage visibility of balance column
737 //showBalance = (id == LST_DSPOPE_DATE && order == GTK_SORT_ASCENDING) ? data->tvc_is_visible : FALSE;
738 showBalance
= (id
== LST_DSPOPE_DATE
) ? data
->tvc_is_visible
: FALSE
;
739 gtk_tree_view_column_set_visible (data
->tvc_balance
, showBalance
);
744 list_txn_column_popup_menuitem_on_activate (GtkCheckMenuItem
*checkmenuitem
,
747 GtkTreeViewColumn
*column
= user_data
;
749 DB( g_print("toggled\n") );
751 gtk_tree_view_column_set_visible(column
, gtk_check_menu_item_get_active(checkmenuitem
) );
755 static gboolean
list_txn_column_popup_callback ( GtkWidget
*button
,
759 struct list_txn_data
*data
= user_data
;
760 GtkWidget
*menu
, *menuitem
;
761 GtkTreeViewColumn
*column
;
765 if( ev
->button
== 3 )
767 DB( g_print("should popup\n") );
769 menu
= gtk_menu_new ();
771 //note: deactive this disable any menuitem action
772 g_signal_connect (menu
, "selection-done", G_CALLBACK (gtk_widget_destroy
), NULL
);
774 for(i
=0 ; i
< NUM_LST_DSPOPE
-1 ; i
++ ) // -1 'caus: account and blank column
776 column
= gtk_tree_view_get_column(GTK_TREE_VIEW(data
->treeview
), i
);
779 col_id
= gtk_tree_view_column_get_sort_column_id (column
);
782 || (col_id
== LST_DSPOPE_STATUS
)
783 || (col_id
== LST_DSPOPE_ACCOUNT
)
784 || (col_id
== LST_DSPOPE_DATE
)
785 || (col_id
== LST_DSPOPE_BALANCE
)
788 //if( (data->tvc_is_visible == FALSE) && (col_id == LST_DSPOPE_BALANCE) )
791 if( (data
->list_type
== LIST_TXN_TYPE_DETAIL
) &&
792 ( (col_id
== LST_DSPOPE_AMOUNT
)
793 || (col_id
== LST_DSPOPE_EXPENSE
)
794 || (col_id
== LST_DSPOPE_INCOME
)
799 menuitem
= gtk_check_menu_item_new_with_label ( gtk_tree_view_column_get_title (column
) );
800 gtk_menu_shell_append (GTK_MENU_SHELL (menu
), menuitem
);
801 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem
), gtk_tree_view_column_get_visible (column
) );
802 gtk_widget_show (menuitem
);
804 g_signal_connect (menuitem
, "activate",
805 G_CALLBACK (list_txn_column_popup_menuitem_on_activate
), column
);
810 gtk_menu_attach_to_widget (GTK_MENU (menu
), button
, NULL
);
811 gtk_menu_popup (GTK_MENU (menu
), NULL
, NULL
, NULL
, NULL
,
812 ev
->button
, ev
->time
);
820 static GtkTreeViewColumn
*
821 list_txn_column_amount_create(gint list_type
, gchar
*title
, gint sortcolumnid
, GtkTreeCellDataFunc func
)
823 GtkTreeViewColumn
*column
;
824 GtkCellRenderer
*renderer
;
826 renderer
= gtk_cell_renderer_text_new ();
827 g_object_set(renderer
, "xalign", 1.0, NULL
);
829 column
= gtk_tree_view_column_new_with_attributes(title
, renderer
, NULL
);
831 gtk_tree_view_column_set_alignment (column
, 0.5);
832 //gtk_tree_view_column_set_resizable(column, TRUE);
833 gtk_tree_view_column_set_sort_column_id (column
, sortcolumnid
);
834 if(list_type
== LIST_TXN_TYPE_BOOK
)
836 gtk_tree_view_column_set_reorderable(column
, TRUE
);
838 gtk_tree_view_column_set_cell_data_func(column
, renderer
, func
, GINT_TO_POINTER(sortcolumnid
), NULL
);
844 static GtkTreeViewColumn
*
845 list_txn_column_text_create(gint list_type
, gchar
*title
, gint sortcolumnid
, GtkTreeCellDataFunc func
, gpointer user_data
)
847 GtkTreeViewColumn
*column
;
848 GtkCellRenderer
*renderer
;
850 renderer
= gtk_cell_renderer_text_new ();
851 /*g_object_set(renderer,
852 "ellipsize", PANGO_ELLIPSIZE_END,
853 "ellipsize-set", TRUE,
856 column
= gtk_tree_view_column_new_with_attributes(title
, renderer
, NULL
);
858 gtk_tree_view_column_set_alignment (column
, 0.5);
859 gtk_tree_view_column_set_resizable(column
, TRUE
);
861 gtk_tree_view_column_set_sort_column_id (column
, sortcolumnid
);
862 if(list_type
== LIST_TXN_TYPE_BOOK
)
864 gtk_tree_view_column_set_reorderable(column
, TRUE
);
865 gtk_tree_view_column_set_min_width (column
, HB_MINWIDTH_COLUMN
);
866 gtk_tree_view_column_set_sizing (column
, GTK_TREE_VIEW_COLUMN_FIXED
);
868 gtk_tree_view_column_set_cell_data_func(column
, renderer
, func
, user_data
, NULL
);
874 static GtkTreeViewColumn
*
875 list_txn_column_info_create(gint list_type
)
877 GtkTreeViewColumn
*column
;
878 GtkCellRenderer
*renderer
;
880 column
= gtk_tree_view_column_new();
881 gtk_tree_view_column_set_title(column
, _("Info"));
883 renderer
= gtk_cell_renderer_pixbuf_new ();
884 gtk_tree_view_column_pack_start(column
, renderer
, FALSE
);
885 gtk_tree_view_column_set_cell_data_func(column
, renderer
, list_txn_info_cell_data_function
, GINT_TO_POINTER(1), NULL
);
887 renderer
= gtk_cell_renderer_text_new ();
888 /*g_object_set(renderer,
889 "ellipsize", PANGO_ELLIPSIZE_END,
890 "ellipsize-set", TRUE,
892 gtk_tree_view_column_pack_start(column
, renderer
, TRUE
);
893 gtk_tree_view_column_set_cell_data_func(column
, renderer
, list_txn_info_cell_data_function
, GINT_TO_POINTER(2), NULL
);
895 gtk_tree_view_column_set_alignment (column
, 0.5);
896 gtk_tree_view_column_set_resizable(column
, TRUE
);
897 gtk_tree_view_column_set_sort_column_id (column
, LST_DSPOPE_INFO
);
898 if(list_type
== LIST_TXN_TYPE_BOOK
)
900 gtk_tree_view_column_set_reorderable(column
, TRUE
);
901 gtk_tree_view_column_set_min_width (column
, HB_MINWIDTH_COLUMN
);
902 gtk_tree_view_column_set_sizing (column
, GTK_TREE_VIEW_COLUMN_FIXED
);
909 static void list_txn_destroy( GtkWidget
*widget
, gpointer user_data
)
911 struct list_txn_data
*data
;
913 data
= g_object_get_data(G_OBJECT(widget
), "inst_data");
915 DB( g_print ("\n[list_transaction] destroy event occurred\n") );
917 if( data
->save_column_width
)
919 list_txn_get_columns(GTK_TREE_VIEW(data
->treeview
));
922 DB( g_print(" - view=%p, inst_data=%p\n", widget
, data
) );
927 Transaction
*list_txn_get_active_transaction(GtkTreeView
*treeview
)
935 model
= gtk_tree_view_get_model(treeview
);
936 list
= gtk_tree_selection_get_selected_rows(gtk_tree_view_get_selection(treeview
), &model
);
942 gtk_tree_model_get_iter(model
, &iter
, list
->data
);
943 gtk_tree_model_get(model
, &iter
, LST_DSPOPE_DATAS
, &ope
, -1);
946 g_list_foreach(list
, (GFunc
)gtk_tree_path_free
, NULL
);
954 ** create our transaction list
955 ** Status, Date, Info, Payee, Wording, (Amount), Expense, Income, Category
957 GtkWidget
*create_list_transaction(gint list_type
, gboolean
*pref_columns
)
959 struct list_txn_data
*data
;
962 GtkCellRenderer
*renderer
;
963 GtkTreeViewColumn
*column
, *col_acc
= NULL
, *col_status
= NULL
;
966 data
= g_malloc0(sizeof(struct list_txn_data
));
967 if(!data
) return NULL
;
969 data
->list_type
= list_type
;
970 data
->save_column_width
= FALSE
;
972 /* create list store */
973 store
= gtk_list_store_new(
975 G_TYPE_POINTER
, /*only really used columns, other are fake */
977 G_TYPE_BOOLEAN
, G_TYPE_BOOLEAN
,
978 G_TYPE_BOOLEAN
, G_TYPE_BOOLEAN
,
979 G_TYPE_BOOLEAN
, G_TYPE_BOOLEAN
,
980 G_TYPE_BOOLEAN
, G_TYPE_BOOLEAN
,
981 G_TYPE_BOOLEAN
, G_TYPE_BOOLEAN
,
982 G_TYPE_BOOLEAN
, G_TYPE_BOOLEAN
,
983 G_TYPE_BOOLEAN
, G_TYPE_BOOLEAN
987 treeview
= gtk_tree_view_new_with_model(GTK_TREE_MODEL(store
));
988 data
->treeview
= treeview
;
989 g_object_unref(store
);
991 //store our window private data
992 g_object_set_data(G_OBJECT(treeview
), "inst_data", (gpointer
)data
);
993 DB( g_print(" - treeview=%p, inst_data=%p\n", treeview
, data
) );
995 // connect our dispose function
996 g_signal_connect (treeview
, "destroy", G_CALLBACK (list_txn_destroy
), (gpointer
)data
);
998 gtk_tree_view_set_grid_lines (GTK_TREE_VIEW (treeview
), PREFS
->grid_lines
);
999 //gtk_tree_view_set_search_column (GTK_TREE_VIEW (treeview),
1000 // COLUMN_DESCRIPTION);
1002 if(list_type
== LIST_TXN_TYPE_BOOK
)
1003 gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview
)), GTK_SELECTION_MULTIPLE
);
1005 /* column 1: Changes */
1006 column
= gtk_tree_view_column_new();
1007 //gtk_tree_view_column_set_title(column, _("Status"));
1008 col_status
= column
;
1010 renderer
= gtk_cell_renderer_pixbuf_new ();
1011 //gtk_cell_renderer_set_fixed_size(renderer, GLOBALS->lst_pixbuf_maxwidth, -1);
1012 gtk_tree_view_column_pack_start(column
, renderer
, TRUE
);
1013 gtk_tree_view_column_set_cell_data_func(column
, renderer
, list_txn_status_cell_data_function
, GINT_TO_POINTER(1), NULL
);
1015 renderer
= gtk_cell_renderer_pixbuf_new ();
1016 //gtk_cell_renderer_set_fixed_size(renderer, GLOBALS->lst_pixbuf_maxwidth, -1);
1017 gtk_tree_view_column_pack_start(column
, renderer
, TRUE
);
1018 gtk_tree_view_column_set_cell_data_func(column
, renderer
, list_txn_status_cell_data_function
, GINT_TO_POINTER(2), NULL
);
1020 renderer
= gtk_cell_renderer_pixbuf_new ();
1021 //gtk_cell_renderer_set_fixed_size(renderer, GLOBALS->lst_pixbuf_maxwidth, -1);
1022 gtk_tree_view_column_pack_start(column
, renderer
, TRUE
);
1023 gtk_tree_view_column_set_cell_data_func(column
, renderer
, list_txn_status_cell_data_function
, GINT_TO_POINTER(3), NULL
);
1025 gtk_tree_view_column_set_sort_column_id (column
, LST_DSPOPE_STATUS
);
1026 //gtk_tree_view_column_set_resizable(column, TRUE);
1027 gtk_tree_view_column_set_alignment (column
, 0.5);
1028 gtk_tree_view_append_column (GTK_TREE_VIEW(treeview
), column
);
1030 if(list_type
== LIST_TXN_TYPE_DETAIL
)
1032 column
= list_txn_column_text_create(list_type
, _("Account"), LST_DSPOPE_ACCOUNT
, list_txn_account_cell_data_function
, NULL
);
1033 gtk_tree_view_append_column (GTK_TREE_VIEW(treeview
), column
);
1036 g_signal_connect ( G_OBJECT (gtk_tree_view_column_get_button (column
)),
1037 "button-press-event",
1038 G_CALLBACK ( list_txn_column_popup_callback
),
1042 /* column 2: Date */
1043 column
= gtk_tree_view_column_new();
1044 gtk_tree_view_column_set_title(column
, _("Date"));
1045 renderer
= gtk_cell_renderer_text_new ();
1046 gtk_tree_view_column_pack_start(column
, renderer
, TRUE
);
1047 g_object_set(renderer
, "xalign", 1.0, NULL
);
1048 gtk_tree_view_column_set_cell_data_func(column
, renderer
, list_txn_date_cell_data_function
, NULL
, NULL
);
1049 gtk_tree_view_column_set_sort_column_id (column
, LST_DSPOPE_DATE
);
1050 //gtk_tree_view_column_set_resizable(column, TRUE);
1051 gtk_tree_view_append_column (GTK_TREE_VIEW(treeview
), column
);
1053 g_signal_connect ( G_OBJECT (gtk_tree_view_column_get_button (column
)),
1054 "button-press-event",
1055 G_CALLBACK ( list_txn_column_popup_callback
),
1059 column
= list_txn_column_info_create(list_type
);
1060 gtk_tree_view_append_column (GTK_TREE_VIEW(treeview
), column
);
1062 g_signal_connect ( G_OBJECT (gtk_tree_view_column_get_button (column
)),
1063 "button-press-event",
1064 G_CALLBACK ( list_txn_column_popup_callback
),
1067 column
= list_txn_column_text_create(list_type
, _("Payee"), LST_DSPOPE_PAYEE
, list_txn_payee_cell_data_function
, NULL
);
1068 gtk_tree_view_append_column (GTK_TREE_VIEW(treeview
), column
);
1070 g_signal_connect ( G_OBJECT (gtk_tree_view_column_get_button (column
)),
1071 "button-press-event",
1072 G_CALLBACK ( list_txn_column_popup_callback
),
1075 column
= list_txn_column_text_create(list_type
, _("Memo"), LST_DSPOPE_WORDING
, list_txn_wording_cell_data_function
, NULL
);
1076 gtk_tree_view_append_column (GTK_TREE_VIEW(treeview
), column
);
1078 g_signal_connect ( G_OBJECT (gtk_tree_view_column_get_button (column
)),
1079 "button-press-event",
1080 G_CALLBACK ( list_txn_column_popup_callback
),
1083 /* column status CLR */
1084 column
= gtk_tree_view_column_new();
1085 gtk_tree_view_column_set_title(column
, _("Status"));
1086 //renderer = gtk_cell_renderer_text_new ();
1087 renderer
= gtk_cell_renderer_pixbuf_new();
1088 gtk_tree_view_column_pack_start(column
, renderer
, TRUE
);
1089 g_object_set(renderer
, "xalign", 1.0, NULL
);
1090 gtk_tree_view_column_set_cell_data_func(column
, renderer
, list_txn_clr_cell_data_function
, NULL
, NULL
);
1091 gtk_tree_view_column_set_reorderable(column
, TRUE
);
1092 gtk_tree_view_column_set_sort_column_id (column
, LST_DSPOPE_CLR
);
1093 //gtk_tree_view_column_set_sort_indicator (column, FALSE);
1094 //gtk_tree_view_column_set_resizable(column, TRUE);
1095 gtk_tree_view_append_column (GTK_TREE_VIEW(treeview
), column
);
1097 g_signal_connect ( G_OBJECT (gtk_tree_view_column_get_button (column
)),
1098 "button-press-event",
1099 G_CALLBACK ( list_txn_column_popup_callback
),
1103 column
= list_txn_column_amount_create(list_type
, _("Amount"), LST_DSPOPE_AMOUNT
, list_txn_amount_cell_data_function
);
1104 gtk_tree_view_append_column (GTK_TREE_VIEW(treeview
), column
);
1106 g_signal_connect ( G_OBJECT (gtk_tree_view_column_get_button (column
)),
1107 "button-press-event",
1108 G_CALLBACK ( list_txn_column_popup_callback
),
1111 column
= list_txn_column_amount_create(list_type
, _("Expense"), LST_DSPOPE_EXPENSE
, list_txn_amount_cell_data_function
);
1112 gtk_tree_view_append_column (GTK_TREE_VIEW(treeview
), column
);
1114 g_signal_connect ( G_OBJECT (gtk_tree_view_column_get_button (column
)),
1115 "button-press-event",
1116 G_CALLBACK ( list_txn_column_popup_callback
),
1119 column
= list_txn_column_amount_create(list_type
, _("Income"), LST_DSPOPE_INCOME
, list_txn_amount_cell_data_function
);
1120 gtk_tree_view_append_column (GTK_TREE_VIEW(treeview
), column
);
1122 g_signal_connect ( G_OBJECT (gtk_tree_view_column_get_button (column
)),
1123 "button-press-event",
1124 G_CALLBACK ( list_txn_column_popup_callback
),
1127 column
= list_txn_column_text_create(list_type
, _("Category"), LST_DSPOPE_CATEGORY
, list_txn_category_cell_data_function
, NULL
);
1128 gtk_tree_view_append_column (GTK_TREE_VIEW(treeview
), column
);
1130 g_signal_connect ( G_OBJECT (gtk_tree_view_column_get_button (column
)),
1131 "button-press-event",
1132 G_CALLBACK ( list_txn_column_popup_callback
),
1135 column
= list_txn_column_text_create(list_type
, _("Tags"), LST_DSPOPE_TAGS
, list_txn_tags_cell_data_function
, NULL
);
1136 gtk_tree_view_append_column (GTK_TREE_VIEW(treeview
), column
);
1138 g_signal_connect ( G_OBJECT (gtk_tree_view_column_get_button (column
)),
1139 "button-press-event",
1140 G_CALLBACK ( list_txn_column_popup_callback
),
1143 if(list_type
== LIST_TXN_TYPE_BOOK
)
1145 column
= list_txn_column_amount_create(list_type
, _("Balance"), LST_DSPOPE_BALANCE
, list_txn_amount_cell_data_function
);
1146 data
->tvc_balance
= column
;
1147 gtk_tree_view_column_set_clickable(column
, FALSE
);
1148 gtk_tree_view_append_column (GTK_TREE_VIEW(treeview
), column
);
1150 g_signal_connect ( G_OBJECT (gtk_tree_view_column_get_button (column
)),
1151 "button-press-event",
1152 G_CALLBACK ( list_txn_column_popup_callback
),
1156 /* column 9: empty */
1157 column
= gtk_tree_view_column_new();
1158 gtk_tree_view_append_column (GTK_TREE_VIEW(treeview
), column
);
1161 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(store
), LST_DSPOPE_STATUS
, list_txn_sort_iter_compare_func
, GINT_TO_POINTER(LST_DSPOPE_STATUS
), NULL
);
1162 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(store
), LST_DSPOPE_DATE
, list_txn_sort_iter_compare_func
, GINT_TO_POINTER(LST_DSPOPE_DATE
), NULL
);
1163 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(store
), LST_DSPOPE_INFO
, list_txn_sort_iter_compare_func
, GINT_TO_POINTER(LST_DSPOPE_INFO
), NULL
);
1164 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(store
), LST_DSPOPE_PAYEE
, list_txn_sort_iter_compare_func
, GINT_TO_POINTER(LST_DSPOPE_PAYEE
), NULL
);
1165 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(store
), LST_DSPOPE_WORDING
, list_txn_sort_iter_compare_func
, GINT_TO_POINTER(LST_DSPOPE_WORDING
), NULL
);
1166 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(store
), LST_DSPOPE_AMOUNT
, list_txn_sort_iter_compare_func
, GINT_TO_POINTER(LST_DSPOPE_AMOUNT
), NULL
);
1167 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(store
), LST_DSPOPE_EXPENSE
, list_txn_sort_iter_compare_func
, GINT_TO_POINTER(LST_DSPOPE_EXPENSE
), NULL
);
1168 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(store
), LST_DSPOPE_INCOME
, list_txn_sort_iter_compare_func
, GINT_TO_POINTER(LST_DSPOPE_INCOME
), NULL
);
1169 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(store
), LST_DSPOPE_CATEGORY
, list_txn_sort_iter_compare_func
, GINT_TO_POINTER(LST_DSPOPE_CATEGORY
), NULL
);
1170 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(store
), LST_DSPOPE_TAGS
, list_txn_sort_iter_compare_func
, GINT_TO_POINTER(LST_DSPOPE_TAGS
), NULL
);
1171 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(store
), LST_DSPOPE_CLR
, list_txn_sort_iter_compare_func
, GINT_TO_POINTER(LST_DSPOPE_CLR
), NULL
);
1172 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(store
), LST_DSPOPE_ACCOUNT
, list_txn_sort_iter_compare_func
, GINT_TO_POINTER(LST_DSPOPE_ACCOUNT
), NULL
);
1174 /* apply user preference for columns */
1175 list_txn_set_columns(GTK_TREE_VIEW(treeview
), pref_columns
);
1177 /* force account column for detail treeview */
1178 if(list_type
== LIST_TXN_TYPE_DETAIL
)
1180 gtk_tree_view_move_column_after(GTK_TREE_VIEW(treeview
), col_acc
, col_status
);
1183 /* set initial sort order */
1184 DB( g_print("set sort to %d %d\n", PREFS
->lst_ope_sort_id
, PREFS
->lst_ope_sort_order
) );
1185 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(store
), PREFS
->lst_ope_sort_id
, PREFS
->lst_ope_sort_order
);
1189 if(list_type
== LIST_TXN_TYPE_BOOK
)
1190 g_signal_connect (GTK_TREE_SORTABLE(store
), "sort-column-changed", G_CALLBACK (list_txn_sort_column_changed
), data
);
1196 /* ---------------------------------------------- */
1197 /* import list : soon obsolete */
1198 /* ---------------------------------------------- */
1201 ** account cell function
1203 static void ope_importaccount_cell_data_function (GtkTreeViewColumn
*col
, GtkCellRenderer
*renderer
, GtkTreeModel
*model
, GtkTreeIter
*iter
, gpointer user_data
)
1206 Account
*acc
, *dacc
;
1208 gtk_tree_model_get(model
, iter
, LST_DSPOPE_DATAS
, &ope
, -1);
1210 acc
= da_acc_get(ope
->kacc
);
1213 if(acc
->imp_key
> 0)
1215 dacc
= da_acc_get(acc
->imp_key
);
1217 g_object_set(renderer
, "text", dacc
->name
, NULL
);
1220 g_object_set(renderer
, "text", acc
->name
, NULL
);
1226 ** amount cell function
1228 static void ope_importamount_cell_data_function (GtkTreeViewColumn
*col
, GtkCellRenderer
*renderer
, GtkTreeModel
*model
, GtkTreeIter
*iter
, gpointer user_data
)
1231 gchar formatd_buf
[G_ASCII_DTOSTR_BUF_SIZE
];
1234 gtk_tree_model_get(model
, iter
, LST_DSPOPE_DATAS
, &ope
, -1);
1236 //mystrfnum(buf, G_ASCII_DTOSTR_BUF_SIZE-1, ope->amount, GLOBALS->minor);
1237 //hb_strfmon(buf, G_ASCII_DTOSTR_BUF_SIZE-1, ope->amount, GLOBALS->minor);
1238 g_ascii_formatd(formatd_buf
, G_ASCII_DTOSTR_BUF_SIZE
-1, "%.2f", ope
->amount
);
1240 color
= get_normal_color_amount(ope
->amount
);
1242 g_object_set(renderer
,
1243 "foreground", color
,
1244 "text", formatd_buf
,
1250 static void ope_importstatus_cell_data_function (GtkTreeViewColumn
*col
, GtkCellRenderer
*renderer
, GtkTreeModel
*model
, GtkTreeIter
*iter
, gpointer user_data
)
1253 gchar
*iconname
= NULL
;
1255 // get the transaction
1256 gtk_tree_model_get(model
, iter
, LST_DSPOPE_DATAS
, &ope
, -1);
1258 iconname
= ( ope
->same
!= NULL
) ? ICONNAME_WARNING
: NULL
;
1260 g_object_set(renderer
, "icon-name", iconname
, NULL
);
1265 ope_importfixed_toggled (GtkCellRendererToggle
*cell
,
1269 GtkTreeModel
*model
= (GtkTreeModel
*)data
;
1271 GtkTreePath
*path
= gtk_tree_path_new_from_string (path_str
);
1274 /* get toggled iter */
1275 gtk_tree_model_get_iter (model
, &iter
, path
);
1276 gtk_tree_model_get (model
, &iter
, LST_OPE_IMPTOGGLE
, &fixed
, -1);
1278 /* do something with the value */
1282 gtk_list_store_set (GTK_LIST_STORE (model
), &iter
, LST_OPE_IMPTOGGLE
, fixed
, -1);
1285 gtk_tree_path_free (path
);
1289 ** create our transaction list
1291 GtkWidget
*create_list_import_transaction(gboolean enable_choose
)
1293 GtkListStore
*store
;
1294 GtkWidget
*treeview
;
1295 GtkCellRenderer
*renderer
;
1296 GtkTreeViewColumn
*column
;
1298 /* create list store */
1299 store
= gtk_list_store_new(
1314 treeview
= gtk_tree_view_new_with_model(GTK_TREE_MODEL(store
));
1315 g_object_unref(store
);
1317 gtk_tree_view_set_grid_lines (GTK_TREE_VIEW (treeview
), PREFS
->grid_lines
);
1318 //gtk_tree_view_set_search_column (GTK_TREE_VIEW (treeview),
1319 // COLUMN_DESCRIPTION);
1321 //gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(view)), GTK_SELECTION_MULTIPLE);
1323 /* column: Selection */
1326 renderer
= gtk_cell_renderer_toggle_new ();
1328 g_signal_connect (renderer
, "toggled", G_CALLBACK (ope_importfixed_toggled
), store
);
1331 column
= gtk_tree_view_column_new_with_attributes (NULL
,
1333 "active", LST_OPE_IMPTOGGLE
,
1336 gtk_tree_view_append_column (GTK_TREE_VIEW(treeview
), column
);
1338 /* column: Duplicate */
1339 column
= gtk_tree_view_column_new();
1340 //gtk_tree_view_column_set_title(column, _("Import ?"));
1341 renderer
= gtk_cell_renderer_pixbuf_new ();
1342 //gtk_cell_renderer_set_fixed_size(renderer, GLOBALS->lst_pixbuf_maxwidth, -1);
1343 gtk_tree_view_column_pack_start(column
, renderer
, TRUE
);
1344 gtk_tree_view_column_set_cell_data_func(column
, renderer
, ope_importstatus_cell_data_function
, NULL
, NULL
);
1345 gtk_tree_view_append_column (GTK_TREE_VIEW(treeview
), column
);
1349 /* column: Account */
1350 column
= gtk_tree_view_column_new();
1351 gtk_tree_view_column_set_title(column
, _("Account"));
1352 renderer
= gtk_cell_renderer_text_new ();
1353 gtk_tree_view_column_pack_start(column
, renderer
, TRUE
);
1354 gtk_tree_view_column_set_cell_data_func(column
, renderer
, ope_importaccount_cell_data_function
, NULL
, NULL
);
1355 //gtk_tree_view_column_set_sort_column_id (column, LST_DSPOPE_DATE);
1356 gtk_tree_view_column_set_resizable(column
, TRUE
);
1357 gtk_tree_view_append_column (GTK_TREE_VIEW(treeview
), column
);
1361 column
= gtk_tree_view_column_new();
1362 gtk_tree_view_column_set_title(column
, _("Date"));
1363 renderer
= gtk_cell_renderer_text_new ();
1364 g_object_set(renderer
, "xalign", 1.0, NULL
);
1365 gtk_tree_view_column_pack_start(column
, renderer
, TRUE
);
1366 gtk_tree_view_column_set_cell_data_func(column
, renderer
, list_txn_date_cell_data_function
, NULL
, NULL
);
1367 //gtk_tree_view_column_set_sort_column_id (column, LST_DSPOPE_DATE);
1368 gtk_tree_view_column_set_resizable(column
, TRUE
);
1369 gtk_tree_view_append_column (GTK_TREE_VIEW(treeview
), column
);
1371 column
= list_txn_column_text_create(LIST_TXN_TYPE_IMPORT
, _("Memo"), -1, list_txn_wording_cell_data_function
, NULL
);
1372 gtk_tree_view_append_column (GTK_TREE_VIEW(treeview
), column
);
1374 column
= list_txn_column_amount_create(LIST_TXN_TYPE_IMPORT
, _("Amount"), -1, ope_importamount_cell_data_function
);
1375 gtk_tree_view_append_column (GTK_TREE_VIEW(treeview
), column
);
1377 column
= list_txn_column_info_create(LIST_TXN_TYPE_IMPORT
);
1378 gtk_tree_view_append_column (GTK_TREE_VIEW(treeview
), column
);
1380 column
= list_txn_column_text_create(LIST_TXN_TYPE_IMPORT
, _("Payee"), -1, list_txn_payee_cell_data_function
, NULL
);
1381 gtk_tree_view_append_column (GTK_TREE_VIEW(treeview
), column
);
1383 column
= list_txn_column_text_create(LIST_TXN_TYPE_IMPORT
, _("Category"), -1, list_txn_category_cell_data_function
, NULL
);
1384 gtk_tree_view_append_column (GTK_TREE_VIEW(treeview
), column
);
1386 column
= gtk_tree_view_column_new();
1387 gtk_tree_view_append_column (GTK_TREE_VIEW(treeview
), column
);