import homebank-5.1.2
[chaz/homebank] / src / list_account.c
index 3e4fb824f5926bb694d365e12c6908096ec972de..7243e7a26d9086e86f1ab98db1b8f24c96745213 100644 (file)
@@ -1,5 +1,5 @@
 /*  HomeBank -- Free, easy, personal accounting for everyone.
- *  Copyright (C) 1995-2014 Maxime DOYEN
+ *  Copyright (C) 1995-2016 Maxime DOYEN
  *
  *  This file is part of HomeBank.
  *
@@ -50,6 +50,7 @@ status_cell_data_function (GtkTreeViewColumn *col,
                            gpointer           user_data)
 {
 Account *acc;
+gchar *iconname = NULL;
 gint dt;
 
        gtk_tree_model_get(model, iter, 
@@ -63,15 +64,15 @@ gint dt;
                switch(GPOINTER_TO_INT(user_data))
                {
                        case 1:
-                               g_object_set(renderer, "pixbuf", (acc->flags & AF_ADDED) ? GLOBALS->lst_pixbuf[LST_PIXBUF_ADD] : NULL, NULL);
+                               iconname = (acc->flags & AF_ADDED) ? ICONNAME_NEW : NULL;
                                break;
                        case 2:
-                               g_object_set(renderer, "pixbuf", (acc->flags & AF_CHANGED) ? GLOBALS->lst_pixbuf[LST_PIXBUF_EDIT] : NULL, NULL);
+                               iconname = (acc->flags & AF_CHANGED) ? ICONNAME_HB_OPE_EDIT : NULL;
                                break;
                }
        }
-       else
-               g_object_set(renderer, "pixbuf", NULL, NULL);
+
+       g_object_set(renderer, "icon-name", iconname, NULL);
 }
 
 /*
@@ -138,6 +139,7 @@ gchar *groupname;
                    NULL);
 }
 
+
 static void
 float_cell_data_function (GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data)
 {
@@ -154,6 +156,8 @@ gchar *color;
                GPOINTER_TO_INT(user_data), &value,             //LST_DSPACC_(BANK/TODAY/FUTURE)
                -1);
 
+       guint32 kcur = (acc != NULL) ? acc->kcur : GLOBALS->kcur;
+       
        if( dt == DSPACC_TYPE_HEADER )
        {
        gboolean expanded;
@@ -164,8 +168,7 @@ gchar *color;
        
                if(!expanded)
                {
-                       //hb_strfmon(buf, G_ASCII_DTOSTR_BUF_SIZE-1, value, GLOBALS->kcur);
-                       mystrfmon(buf, G_ASCII_DTOSTR_BUF_SIZE-1, value, GLOBALS->minor);
+                       hb_strfmon(buf, G_ASCII_DTOSTR_BUF_SIZE-1, value, kcur, GLOBALS->minor);
                        color = get_normal_color_amount(value);
                        g_object_set(renderer,
                            "weight", PANGO_WEIGHT_NORMAL,
@@ -176,31 +179,12 @@ gchar *color;
                else
                        g_object_set(renderer, "text", NULL, 
                    NULL);
-                       
-               
+       
        }
        else
        {
-               // prevent errors
-               //kcur = acc != NULL ? acc->kcur : GLOBALS->kcur;
-
-               //original
-               //mystrfmon(buf, G_ASCII_DTOSTR_BUF_SIZE-1, value, GLOBALS->minor);
+               hb_strfmon(buf, G_ASCII_DTOSTR_BUF_SIZE-1, value, kcur, GLOBALS->minor);
 
-               //base test
-               /*
-               if(kcur != GLOBALS->kcur)
-               {
-                       gdouble newval = amount_base_amount(value, kcur);
-                       //g_print("currency=%d :: value='%.2f' newvalue='%.2f'\n", kcur, value, newval);
-                       value = newval;
-                       mystrfmoncurr(buf, G_ASCII_DTOSTR_BUF_SIZE-1, value, GLOBALS->kcur);
-               }
-               else*/
-               
-               //hb_strfmon(buf, G_ASCII_DTOSTR_BUF_SIZE-1, value, kcur);
-               mystrfmon(buf, G_ASCII_DTOSTR_BUF_SIZE-1, value, GLOBALS->minor);
-               
                color = NULL;
                weight = PANGO_WEIGHT_NORMAL;
 
@@ -238,8 +222,7 @@ GtkCellRenderer    *renderer;
        g_object_set(renderer, "xalign", 1.0, NULL);
        gtk_tree_view_column_pack_start(column, renderer, TRUE);
        gtk_tree_view_column_set_cell_data_func(column, renderer, float_cell_data_function, GINT_TO_POINTER(id), NULL);
-       //gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
-       gtk_tree_view_column_set_resizable(column, TRUE);
+       gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
        gtk_tree_view_column_set_alignment (column, 0.5);
        gtk_tree_view_column_set_spacing( column, 16 );
        //gtk_tree_view_column_set_sort_column_id (column, LST_DSPACC_BANK);
@@ -326,23 +309,23 @@ GtkTreeViewColumn  *column;
        view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
        g_object_unref(store);
 
-       gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (view), PREFS->rules_hint);
+       gtk_tree_view_set_grid_lines (GTK_TREE_VIEW (view), PREFS->grid_lines);
        //gtk_tree_view_set_search_column (GTK_TREE_VIEW (treeview),
        //                             COLUMN_DESCRIPTION);
 
+       //gtk_tree_view_set_enable_tree_lines(GTK_TREE_VIEW (view), TRUE);
+
        gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(view)), GTK_SELECTION_SINGLE);
 
     /* Status */
        column = gtk_tree_view_column_new();
-    gtk_tree_view_column_set_title(column, _("Status"));
+    //gtk_tree_view_column_set_title(column, _("Status"));
 
     renderer = gtk_cell_renderer_pixbuf_new ();
-       gtk_cell_renderer_set_fixed_size(renderer, GLOBALS->lst_pixbuf_maxwidth, -1);
     gtk_tree_view_column_pack_start(column, renderer, TRUE);
     gtk_tree_view_column_set_cell_data_func(column, renderer, status_cell_data_function, GINT_TO_POINTER(1), NULL);
 
     renderer = gtk_cell_renderer_pixbuf_new ();
-       gtk_cell_renderer_set_fixed_size(renderer, GLOBALS->lst_pixbuf_maxwidth, -1);
     gtk_tree_view_column_pack_start(column, renderer, TRUE);
     gtk_tree_view_column_set_cell_data_func(column, renderer, status_cell_data_function, GINT_TO_POINTER(2), NULL);
 
@@ -350,33 +333,31 @@ GtkTreeViewColumn  *column;
     gtk_tree_view_append_column (GTK_TREE_VIEW(view), column);
 
        /* Account */
-       column = gtk_tree_view_column_new();
-    gtk_tree_view_column_set_title(column, _("Accounts"));
-       
        renderer = gtk_cell_renderer_text_new ();
+       /*g_object_set(renderer, 
+               "ellipsize", PANGO_ELLIPSIZE_END,
+               "ellipsize-set", TRUE,
+               NULL);*/
+
+       column = gtk_tree_view_column_new();
+       gtk_tree_view_column_set_title(column, _("Accounts"));
        gtk_tree_view_column_pack_start(column, renderer, TRUE);
        gtk_tree_view_column_set_cell_data_func(column, renderer, text_cell_data_function, GINT_TO_POINTER(1), NULL);
-       gtk_tree_view_column_set_resizable(column, TRUE);
        gtk_tree_view_column_set_alignment (column, 0.5);
-
+       //gtk_tree_view_column_set_min_width(column, HB_MINWIDTH_LIST);
+       gtk_tree_view_column_set_resizable(column, TRUE);
        gtk_tree_view_append_column (GTK_TREE_VIEW(view), column);
 
        gtk_tree_view_set_expander_column(GTK_TREE_VIEW (view), column);
 
-
-
-
-
     /* Bank */
        column = amount_list_account_column(_("Bank"), LST_DSPACC_BANK);
        gtk_tree_view_append_column (GTK_TREE_VIEW(view), column);
 
-
     /* Today */
        column = amount_list_account_column(_("Today"), LST_DSPACC_TODAY);
        gtk_tree_view_append_column (GTK_TREE_VIEW(view), column);
 
-
     /* Future */
        column = amount_list_account_column(_("Future"), LST_DSPACC_FUTURE);
        gtk_tree_view_append_column (GTK_TREE_VIEW(view), column);
@@ -394,7 +375,6 @@ GtkTreeViewColumn  *column;
        gtk_tree_sortable_set_default_sort_func(GTK_TREE_SORTABLE(store), list_account_compare_func, NULL, NULL);
        gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(store), GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, GTK_SORT_ASCENDING);
 
-
        return(view);
 }
 
This page took 0.02802 seconds and 4 git commands to generate.