r20251 - gnucash/trunk/src/gnome-utils - Partly revert r20207, "Modify Tax Info on Account Page..."

Christian Stimming cstim at code.gnucash.org
Sun Feb 6 16:18:49 EST 2011


Author: cstim
Date: 2011-02-06 16:18:49 -0500 (Sun, 06 Feb 2011)
New Revision: 20251
Trac: http://svn.gnucash.org/trac/changeset/20251

Modified:
   gnucash/trunk/src/gnome-utils/gnc-tree-model-account.c
   gnucash/trunk/src/gnome-utils/gnc-tree-model-account.h
   gnucash/trunk/src/gnome-utils/gnc-tree-view-account.c
Log:
Partly revert r20207, "Modify Tax Info on Account Page..."

The changes in the tree-model-account caused CRITICAL gtk warnings, so we
revert that part for now. The changes in gnc-ui-utils.[hc] have been kept.

Modified: gnucash/trunk/src/gnome-utils/gnc-tree-model-account.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-tree-model-account.c	2011-02-06 21:16:52 UTC (rev 20250)
+++ gnucash/trunk/src/gnome-utils/gnc-tree-model-account.c	2011-02-06 21:18:49 UTC (rev 20251)
@@ -411,7 +411,6 @@
     case GNC_TREE_MODEL_ACCOUNT_COL_TOTAL_PERIOD:
     case GNC_TREE_MODEL_ACCOUNT_COL_NOTES:
     case GNC_TREE_MODEL_ACCOUNT_COL_TAX_INFO:
-    case GNC_TREE_MODEL_ACCOUNT_COL_TAX_INFO_SUB_ACCT:
     case GNC_TREE_MODEL_ACCOUNT_COL_LASTNUM:
 
     case GNC_TREE_MODEL_ACCOUNT_COL_COLOR_PRESENT:
@@ -802,11 +801,6 @@
         g_value_take_string (value, gnc_ui_account_get_tax_info_string (account));
         break;
 
-    case GNC_TREE_MODEL_ACCOUNT_COL_TAX_INFO_SUB_ACCT:
-        g_value_init (value, G_TYPE_STRING);
-        g_value_take_string (value, gnc_ui_account_get_tax_info_sub_acct_string (account));
-        break;
-
     case GNC_TREE_MODEL_ACCOUNT_COL_LASTNUM:
         g_value_init (value, G_TYPE_STRING);
         g_value_set_string (value, xaccAccountGetLastNum (account));

Modified: gnucash/trunk/src/gnome-utils/gnc-tree-model-account.h
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-tree-model-account.h	2011-02-06 21:16:52 UTC (rev 20250)
+++ gnucash/trunk/src/gnome-utils/gnc-tree-model-account.h	2011-02-06 21:18:49 UTC (rev 20251)
@@ -78,7 +78,6 @@
     GNC_TREE_MODEL_ACCOUNT_COL_TOTAL_PERIOD,
     GNC_TREE_MODEL_ACCOUNT_COL_NOTES,
     GNC_TREE_MODEL_ACCOUNT_COL_TAX_INFO,
-    GNC_TREE_MODEL_ACCOUNT_COL_TAX_INFO_SUB_ACCT,
     GNC_TREE_MODEL_ACCOUNT_COL_PLACEHOLDER,
 
     GNC_TREE_MODEL_ACCOUNT_COL_LAST_VISIBLE = GNC_TREE_MODEL_ACCOUNT_COL_PLACEHOLDER,

Modified: gnucash/trunk/src/gnome-utils/gnc-tree-view-account.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-tree-view-account.c	2011-02-06 21:16:52 UTC (rev 20250)
+++ gnucash/trunk/src/gnome-utils/gnc-tree-view-account.c	2011-02-06 21:18:49 UTC (rev 20251)
@@ -71,12 +71,6 @@
         GtkCellRenderer *renderer,
         GncTreeViewAccountColumnTextEdited col_edited_cb);
 
-static void tax_info_data_func (GtkTreeViewColumn *col,
-        GtkCellRenderer   *renderer,
-        GtkTreeModel      *model,
-        GtkTreeIter       *iter,
-        gpointer           view);
-
 typedef struct GncTreeViewAccountPrivate
 {
     AccountViewInfo avi;
@@ -466,66 +460,6 @@
 }
 
 /************************************************************/
-/*                 Tax_Info data function                   */
-/************************************************************/
-
-/*
- * The tax-info column in the account tree view is based on the
- * combination of two columns in the account tree model. The data
- * function displays only the the data in the
- * GNC_TREE_MODEL_ACCOUNT_COL_TAX_INFO model column if the row is 
- * expanded; otherwise it combines it with the data
- * in the GNC_TREE_MODEL_ACCOUNT_COL_TAX_INFO_SUB_ACCT model column.
- */
-static void
-tax_info_data_func (GtkTreeViewColumn *col,
-                    GtkCellRenderer   *renderer,
-                    GtkTreeModel      *model,
-                    GtkTreeIter       *iter,
-                    gpointer           view)
-{
-    const gchar *tax_info, *tax_info_sub_acct;
-    GtkTreePath *path;
-
-    gtk_tree_model_get(model,
-                       iter, 
-                       GNC_TREE_MODEL_ACCOUNT_COL_TAX_INFO,
-                       &tax_info,
-                       -1);
-
-    if (tax_info == NULL)
-        tax_info = "";
-    path = gtk_tree_model_get_path(model, iter);
-    if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(view), path))
-        g_object_set(renderer, "text", tax_info, NULL);
-    else
-    {
-        gtk_tree_model_get(model,
-                           iter, 
-                           GNC_TREE_MODEL_ACCOUNT_COL_TAX_INFO_SUB_ACCT,
-                           &tax_info_sub_acct,
-                           -1);
-        if (tax_info_sub_acct == NULL)
-            tax_info_sub_acct = "";
-        if (safe_strcmp (tax_info_sub_acct, "") == 0)
-            g_object_set(renderer, "text", tax_info, NULL);
-        else
-        {
-            if (safe_strcmp (tax_info, "") == 0)
-                g_object_set(renderer, "text", tax_info_sub_acct, NULL);
-            else
-            {
-                const gchar *combined_tax_info;
-                combined_tax_info = g_strdup_printf ("%s; %s", tax_info,
-                       tax_info_sub_acct);
-                g_object_set(renderer, "text", combined_tax_info, NULL);
-            }
-        }
-    }
-    gtk_tree_path_free(path);
-}
-
-/************************************************************/
 /*                    New View Creation                     */
 /************************************************************/
 
@@ -543,8 +477,6 @@
     GtkTreePath *virtual_root_path = NULL;
     const gchar *sample_type, *sample_commodity;
     GncTreeViewAccountPrivate *priv;
-    GtkTreeViewColumn *tax_info_column;
-    GtkCellRenderer *renderer;
 
     ENTER(" ");
     /* Create our view */
@@ -712,18 +644,11 @@
                                     GNC_TREE_MODEL_ACCOUNT_COL_NOTES,
                                     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                     sort_by_string);
-    tax_info_column
-    = gnc_tree_view_add_text_column(view, _("Tax Info"), "tax-info", NULL,
+    gnc_tree_view_add_text_column(view, _("Tax Info"), "tax-info", NULL,
                                   "Sample tax info.",
-                                  GNC_TREE_VIEW_COLUMN_DATA_NONE,
+                                  GNC_TREE_MODEL_ACCOUNT_COL_TAX_INFO,
                                   GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
                                   sort_by_string);
-    renderer = gnc_tree_view_column_get_renderer(tax_info_column);
-    gtk_tree_view_column_set_cell_data_func(tax_info_column,
-                                            renderer,
-                                            tax_info_data_func,
-                                            GTK_TREE_VIEW(view),
-                                            NULL);
     gnc_tree_view_add_toggle_column(view, _("Placeholder"),
                                     /* Translators: This string has a context prefix; the translation
                                     	must only contain the part after the | character. */



More information about the gnucash-changes mailing list