Transaction *ope1, *ope2;
gdouble tmpval = 0;
- gtk_tree_model_get(model, a, LST_DSPOPE_DATAS, &ope1, -1);
- gtk_tree_model_get(model, b, LST_DSPOPE_DATAS, &ope2, -1);
+ gtk_tree_model_get(model, a, MODEL_TXN_POINTER, &ope1, -1);
+ gtk_tree_model_get(model, b, MODEL_TXN_POINTER, &ope2, -1);
switch (sortcol)
{
Transaction *txn;
gchar *iconname = NULL;
- gtk_tree_model_get(model, iter, LST_DSPOPE_DATAS, &txn, -1);
+ gtk_tree_model_get(model, iter, MODEL_TXN_POINTER, &txn, -1);
/*
stat[0] = ( entry->ope_Flags & OF_ADDED ) ? data->istatus[2] : data->istatus[0];
Transaction *ope;
Account *acc;
- gtk_tree_model_get(model, iter, LST_DSPOPE_DATAS, &ope, -1);
+ gtk_tree_model_get(model, iter, MODEL_TXN_POINTER, &ope, -1);
acc = da_acc_get(ope->kacc);
if( acc )
gchar buffer[256];
GDate date;
- gtk_tree_model_get(model, iter, LST_DSPOPE_DATAS, &ope, -1);
+ gtk_tree_model_get(model, iter, MODEL_TXN_POINTER, &ope, -1);
list_txn_eval_future(renderer, ope);
if(ope->date > 0)
{
Transaction *ope;
- gtk_tree_model_get(model, iter, LST_DSPOPE_DATAS, &ope, -1);
+ gtk_tree_model_get(model, iter, MODEL_TXN_POINTER, &ope, -1);
switch(GPOINTER_TO_INT(user_data))
{
}
}
+
+static void list_txn_payeexfer_cell_data_function (GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data)
+{
+Transaction *ope;
+gchar *direction = "";
+
+ gtk_tree_model_get(model, iter, MODEL_TXN_POINTER, &ope, -1);
+ list_txn_eval_future(renderer, ope);
+
+ if(ope->paymode == PAYMODE_INTXFER)
+ {
+ direction = ( ope->flags & OF_INCOME ) ? "<" : ">";
+ }
+ g_object_set(renderer, "text", direction, NULL);
+}
+
+
/*
** payee cell function
*/
{
Transaction *ope;
- gtk_tree_model_get(model, iter, LST_DSPOPE_DATAS, &ope, -1);
+ gtk_tree_model_get(model, iter, MODEL_TXN_POINTER, &ope, -1);
list_txn_eval_future(renderer, ope);
//#926782
Transaction *ope;
gchar *str;
- gtk_tree_model_get(model, iter, LST_DSPOPE_DATAS, &ope, -1);
+ gtk_tree_model_get(model, iter, MODEL_TXN_POINTER, &ope, -1);
list_txn_eval_future(renderer, ope);
if(ope->tags != NULL)
{
Transaction *ope;
- gtk_tree_model_get(model, iter, LST_DSPOPE_DATAS, &ope, -1);
+ gtk_tree_model_get(model, iter, MODEL_TXN_POINTER, &ope, -1);
list_txn_eval_future(renderer, ope);
g_object_set(renderer, "text", ope->memo, NULL);
gchar *iconname = NULL;
//const gchar *c = "";
- gtk_tree_model_get(model, iter, LST_DSPOPE_DATAS, &ope, -1);
+ gtk_tree_model_get(model, iter, MODEL_TXN_POINTER, &ope, -1);
switch(ope->status)
{
/*case TXN_STATUS_CLEARED: c = "c"; break;
*/
static void list_txn_amount_cell_data_function (GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data)
{
+struct list_txn_data *data = NULL;
+GtkWidget *widget;
Transaction *ope;
gint column = GPOINTER_TO_INT(user_data);
gchar buf[G_ASCII_DTOSTR_BUF_SIZE];
gint type;
-gdouble amount;
+gdouble amount, samount;
gchar *color;
+ widget = gtk_tree_view_column_get_tree_view(col);
+ if( widget )
+ data = g_object_get_data(G_OBJECT(widget), "inst_data");
+
// get the transaction
- gtk_tree_model_get(model, iter, LST_DSPOPE_DATAS, &ope, -1);
+ gtk_tree_model_get(model, iter, MODEL_TXN_POINTER, &ope, MODEL_TXN_SPLITAMT, &samount, -1);
list_txn_eval_future(renderer, ope);
if(column == LST_DSPOPE_BALANCE)
else
amount = ope->amount;
+ //for detail display the split part (if any)
+ if( data && (data->list_type == LIST_TXN_TYPE_DETAIL) )
+ amount = samount;
+
if(column == LST_DSPOPE_INCOME || column == LST_DSPOPE_EXPENSE)
{
type = (ope->flags & OF_INCOME) ? LST_DSPOPE_INCOME : LST_DSPOPE_EXPENSE;
Transaction *ope;
Category *cat;
- gtk_tree_model_get(model, iter, LST_DSPOPE_DATAS, &ope, -1);
+ gtk_tree_model_get(model, iter, MODEL_TXN_POINTER, &ope, -1);
list_txn_eval_future(renderer, ope);
if(ope->flags & OF_SPLIT)
GString *list_txn_to_string(GtkTreeView *treeview, gboolean clipboard)
{
+struct list_txn_data *data = NULL;
GtkTreeModel *model;
GtkTreeIter iter;
gboolean valid;
Transaction *ope;
gchar datebuf[16];
gchar *info, *payeename, *categoryname;
+gdouble amount, samount;
Payee *payee;
Category *category;
gchar *tags;
char amountbuf[G_ASCII_DTOSTR_BUF_SIZE];
+ data = g_object_get_data(G_OBJECT(treeview), "inst_data");
+
node = g_string_new(NULL);
//title line
while (valid)
{
gtk_tree_model_get (model, &iter,
- LST_DSPOPE_DATAS, &ope,
+ MODEL_TXN_POINTER, &ope,
+ MODEL_TXN_SPLITAMT, &samount,
-1);
hb_sprint_date(datebuf, ope->date);
categoryname = (category->name == NULL) ? NULL : category->fullname;
tags = tags_tostring(ope->tags);
+ amount = ope->amount;
+ //for detail display the split part (if any)
+ if( data && (data->list_type == LIST_TXN_TYPE_DETAIL) )
+ amount = samount;
+
//#793719
//g_ascii_dtostr (amountbuf, sizeof (amountbuf), ope->amount);
//#1750257 use locale numdigit
//g_ascii_formatd (amountbuf, sizeof (amountbuf), "%.2f", ope->amount);
- g_snprintf(amountbuf, sizeof (amountbuf), "%.2f", ope->amount);
+ g_snprintf(amountbuf, sizeof (amountbuf), "%.2f", amount);
- DB( g_print("amount = %f '%s'\n", ope->amount, amountbuf) );
+ DB( g_print("amount = %f '%s'\n", amount, amountbuf) );
format = (clipboard == TRUE) ? "%s\t%d\t%s\t%s\t%s\t%s\t%s\t%s\n" : "%s;%d;%s;%s;%s;%s;%s;%s\n";
g_string_append_printf(node, format,
}
-static gboolean list_txn_column_popup_callback ( GtkWidget *button,
+static gboolean
+list_txn_column_popup_callback ( GtkWidget *button,
GdkEventButton *ev,
gpointer user_data )
{
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
+ column = gtk_tree_view_column_new();
+ gtk_tree_view_column_set_title(column, title);
+
+ //5.3 add > < for internal xfer
+ if( sortcolumnid == LST_DSPOPE_PAYEE )
+ {
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_tree_view_column_pack_start(column, renderer, FALSE);
+ gtk_tree_view_column_set_cell_data_func(column, renderer, list_txn_payeexfer_cell_data_function, NULL, NULL);
+ }
+
renderer = gtk_cell_renderer_text_new ();
g_object_set(renderer,
"ellipsize", PANGO_ELLIPSIZE_END,
"ellipsize-set", TRUE,
+ //taken from nemo, not exactly a resize to content, but good compromise
+ "width-chars", 40,
NULL);
+ gtk_tree_view_column_pack_start(column, renderer, FALSE);
+ gtk_tree_view_column_set_cell_data_func(column, renderer, func, NULL, NULL);
- column = gtk_tree_view_column_new_with_attributes(title, renderer, NULL);
-
gtk_tree_view_column_set_alignment (column, 0.5);
gtk_tree_view_column_set_resizable(column, TRUE);
gtk_tree_view_column_set_cell_data_func(column, renderer, list_txn_info_cell_data_function, GINT_TO_POINTER(1), NULL);
renderer = gtk_cell_renderer_text_new ();
- /*g_object_set(renderer,
+ g_object_set(renderer,
"ellipsize", PANGO_ELLIPSIZE_END,
"ellipsize-set", TRUE,
- NULL);*/
+ //taken from nemo, not exactly a resize to content, but good compromise
+ "width-chars", 40,
+ NULL);
gtk_tree_view_column_pack_start(column, renderer, TRUE);
gtk_tree_view_column_set_cell_data_func(column, renderer, list_txn_info_cell_data_function, GINT_TO_POINTER(2), NULL);
GtkTreeIter iter;
gtk_tree_model_get_iter(model, &iter, list->data);
- gtk_tree_model_get(model, &iter, LST_DSPOPE_DATAS, &ope, -1);
+ gtk_tree_model_get(model, &iter, MODEL_TXN_POINTER, &ope, -1);
}
g_list_foreach(list, (GFunc)gtk_tree_path_free, NULL);
/* create list store */
store = gtk_list_store_new(
- 1, G_TYPE_POINTER /*only really used column */
+ 2, G_TYPE_POINTER, // MODEL_TXN_POINTER
+ G_TYPE_DOUBLE // MODEL_TXN_SPLITAMT amount part of split for detail only
);
//treeview