gnucash master: Remove Account Tree filter as not really required.

Geert Janssens gjanssens at code.gnucash.org
Wed Jan 28 12:04:53 EST 2015


Updated	 via  https://github.com/Gnucash/gnucash/commit/13303eb3 (commit)
	from  https://github.com/Gnucash/gnucash/commit/483091e9 (commit)



commit 13303eb38e174055cb8cb1dd8de0aeeed082c6d6
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sun Jan 18 15:46:11 2015 +0000

    Remove Account Tree filter as not really required.
    
    By removing the filter options it makes it much easier to select
    different types of accounts for export at the same time.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=739188

diff --git a/src/import-export/csv-exp/assistant-csv-export.c b/src/import-export/csv-exp/assistant-csv-export.c
index ea27e5b..d0755d8 100644
--- a/src/import-export/csv-exp/assistant-csv-export.c
+++ b/src/import-export/csv-exp/assistant-csv-export.c
@@ -303,24 +303,20 @@ show_acct_type_accounts (CsvExportInfo *info)
 
     for (type = 0; type < NUM_ACCOUNT_TYPES; type++) /* from Account.h */
     {
-        if (info->csva.account_type == ACCT_TYPE_EXPENSE)
-            Viewinfo.include_type[type] = (type == ACCT_TYPE_EXPENSE);
-        else if (info->csva.account_type == ACCT_TYPE_INCOME)
-            Viewinfo.include_type[type] = (type == ACCT_TYPE_INCOME);
-        else if (info->csva.account_type == ACCT_TYPE_ASSET)
-            Viewinfo.include_type[type] = ((type == ACCT_TYPE_BANK)  ||
-                                           (type == ACCT_TYPE_CASH)      ||
-                                           (type == ACCT_TYPE_ASSET)     ||
-                                           (type == ACCT_TYPE_STOCK)     ||
-                                           (type == ACCT_TYPE_MUTUAL)    ||
-                                           (type == ACCT_TYPE_RECEIVABLE));
-        else if (info->csva.account_type == ACCT_TYPE_LIABILITY)
-            Viewinfo.include_type[type] = ((type == ACCT_TYPE_CREDIT) ||
-                                           (type == ACCT_TYPE_LIABILITY) ||
-                                           (type == ACCT_TYPE_EQUITY)    ||
-                                           (type == ACCT_TYPE_PAYABLE));
-        else
-            Viewinfo.include_type[type] = FALSE;
+        Viewinfo.include_type[type] = ((type == ACCT_TYPE_BANK)      ||
+                                       (type == ACCT_TYPE_CASH)      ||
+                                       (type == ACCT_TYPE_CREDIT)    ||
+                                       (type == ACCT_TYPE_ASSET)     ||
+                                       (type == ACCT_TYPE_LIABILITY) ||
+                                       (type == ACCT_TYPE_STOCK)     ||
+                                       (type == ACCT_TYPE_MUTUAL)    ||
+                                       (type == ACCT_TYPE_INCOME)    ||
+                                       (type == ACCT_TYPE_EXPENSE)   ||
+                                       (type == ACCT_TYPE_EQUITY)    ||
+                                       (type == ACCT_TYPE_RECEIVABLE)||
+                                       (type == ACCT_TYPE_PAYABLE)   ||
+                                       (type == ACCT_TYPE_ROOT)      ||
+                                       (type == ACCT_TYPE_TRADING));
     }
     gnc_tree_view_account_set_view_info (tree, &Viewinfo);
     csv_export_cursor_changed_cb (GTK_WIDGET(tree), info);
@@ -328,38 +324,6 @@ show_acct_type_accounts (CsvExportInfo *info)
 
 
 /*******************************************************
- * account_filter_func
- *
- * update filter for account tree
- *******************************************************/
-static gboolean
-account_filter_func (Account *account, gpointer user_data)
-{
-    CsvExportInfo *info = user_data;
-    gboolean included = FALSE;
-
-    if ((info->csva.account_type == ACCT_TYPE_INCOME) ||
-            (info->csva.account_type == ACCT_TYPE_EXPENSE))
-        included = (xaccAccountGetType (account) == info->csva.account_type);
-    else if (info->csva.account_type == ACCT_TYPE_ASSET)
-        included = ((xaccAccountGetType (account) == ACCT_TYPE_BANK) ||
-                    (xaccAccountGetType (account) == ACCT_TYPE_CASH) ||
-                    (xaccAccountGetType (account) == ACCT_TYPE_ASSET) ||
-                    (xaccAccountGetType (account) == ACCT_TYPE_STOCK) ||
-                    (xaccAccountGetType (account) == ACCT_TYPE_MUTUAL) ||
-                    (xaccAccountGetType (account) == ACCT_TYPE_RECEIVABLE));
-    else if (info->csva.account_type == ACCT_TYPE_LIABILITY)
-        included = ((xaccAccountGetType (account) == ACCT_TYPE_CREDIT) ||
-                    (xaccAccountGetType (account) == ACCT_TYPE_LIABILITY) ||
-                    (xaccAccountGetType (account) == ACCT_TYPE_EQUITY) ||
-                    (xaccAccountGetType (account) == ACCT_TYPE_PAYABLE));
-    else
-        included = FALSE;
-    return included;
-}
-
-
-/*******************************************************
  * update_accounts_tree
  *
  * update the account tree
@@ -440,41 +404,6 @@ csv_export_select_subaccounts_clicked_cb (GtkWidget *widget, gpointer user_data)
     gtk_widget_grab_focus (info->csva.account_treeview);
 }
 
-
-/*******************************************************
- * csv_export_info_acct_type_cb
- *
- * select which type of accounts to display
- *******************************************************/
-static void
-csv_export_info_acct_type_cb (GtkWidget *w, gpointer user_data)
-{
-    CsvExportInfo *info = user_data;
-    const gchar *button_name;
-
-    if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w)))
-    {
-        button_name = gtk_buildable_get_name(GTK_BUILDABLE(w));
-        if (g_strcmp0 (button_name, "income_radio") == 0)
-            info->csva.account_type = ACCT_TYPE_INCOME;
-        else if (g_strcmp0 (button_name, "expense_radio") == 0)
-            info->csva.account_type = ACCT_TYPE_EXPENSE;
-        else if (g_strcmp0 (button_name, "asset_radio") == 0)
-            info->csva.account_type = ACCT_TYPE_ASSET;
-        else if (g_strcmp0 (button_name, "liab_eq_radio") == 0)
-            info->csva.account_type = ACCT_TYPE_LIABILITY;
-        else
-            return;
-
-        show_acct_type_accounts (info);
-        gnc_tree_view_account_refilter
-        (GNC_TREE_VIEW_ACCOUNT (info->csva.account_treeview));
-        update_accounts_tree (info);
-    }
-    else
-        return;
-}
-
 /* =============================================================== */
 
 /*******************************************************
@@ -862,15 +791,12 @@ csv_export_assistant_create (CsvExportInfo *info)
     {
         GtkTreeView *tree_view;
         GtkTreeSelection *selection;
-        GtkWidget *income_radio, *expense_radio, *asset_radio,
-                  *liab_eq_radio, *box, *label;
+        GtkWidget *box, *label;
 
         info->csva.acct_info = GTK_WIDGET(gtk_builder_get_object (builder, "acct_info_vbox"));
         info->csva.num_acct_label = GTK_WIDGET(gtk_builder_get_object (builder, "num_accounts_label"));
 
         tree_view = gnc_tree_view_account_new (FALSE);
-        gnc_tree_view_account_set_filter (GNC_TREE_VIEW_ACCOUNT(tree_view),
-                                          account_filter_func, info, NULL);
         info->csva.account_treeview = GTK_WIDGET(tree_view);
 
         selection = gtk_tree_view_get_selection (tree_view);
@@ -885,25 +811,6 @@ csv_export_assistant_create (CsvExportInfo *info)
         label = GTK_WIDGET(gtk_builder_get_object (builder, "accounts_label"));
         gtk_label_set_mnemonic_widget (GTK_LABEL(label), GTK_WIDGET(tree_view));
 
-        income_radio = GTK_WIDGET(gtk_builder_get_object (builder, "income_radio"));
-        expense_radio = GTK_WIDGET(gtk_builder_get_object (builder, "expense_radio"));
-        info->csva.expense_radio = expense_radio;
-        asset_radio = GTK_WIDGET(gtk_builder_get_object (builder, "asset_radio"));
-        info->csva.asset_radio = asset_radio;
-        liab_eq_radio = GTK_WIDGET(gtk_builder_get_object (builder, "liab_eq_radio"));
-        info->csva.liab_eq_radio = liab_eq_radio;
-        info->csva.account_type = ACCT_TYPE_EXPENSE;
-        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(expense_radio), TRUE);
-
-        g_signal_connect (G_OBJECT(income_radio), "toggled",
-                          G_CALLBACK(csv_export_info_acct_type_cb), info);
-        g_signal_connect (G_OBJECT(expense_radio), "toggled",
-                          G_CALLBACK(csv_export_info_acct_type_cb), info);
-        g_signal_connect (G_OBJECT(asset_radio), "toggled",
-                          G_CALLBACK(csv_export_info_acct_type_cb), info);
-        g_signal_connect (G_OBJECT(liab_eq_radio), "toggled",
-                          G_CALLBACK(csv_export_info_acct_type_cb), info);
-
         /* select subaccounts button */
         button = GTK_WIDGET(gtk_builder_get_object (builder, "select_subaccounts_button"));
         info->csva.select_button = button;
diff --git a/src/import-export/csv-exp/assistant-csv-export.glade b/src/import-export/csv-exp/assistant-csv-export.glade
index 6b04330..353ea00 100644
--- a/src/import-export/csv-exp/assistant-csv-export.glade
+++ b/src/import-export/csv-exp/assistant-csv-export.glade
@@ -84,12 +84,6 @@ Select the type of Export required and the separator that will be used.
                         <property name="y_options">GTK_FILL</property>
                       </packing>
                     </child>
-                    <child>
-                      <placeholder/>
-                    </child>
-                    <child>
-                      <placeholder/>
-                    </child>
                   </object>
                 </child>
               </object>
@@ -303,95 +297,17 @@ Select the type of Export required and the separator that will be used.
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <child>
-                          <object class="GtkTable" id="table3">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="n_rows">2</property>
-                            <property name="n_columns">2</property>
-                            <child>
-                              <object class="GtkRadioButton" id="income_radio">
-                                <property name="label" translatable="yes">_Income</property>
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">False</property>
-                                <property name="use_action_appearance">False</property>
-                                <property name="use_underline">True</property>
-                                <property name="active">True</property>
-                                <property name="draw_indicator">True</property>
-                              </object>
-                            </child>
-                            <child>
-                              <object class="GtkRadioButton" id="expense_radio">
-                                <property name="label" translatable="yes">_Expense</property>
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">False</property>
-                                <property name="use_action_appearance">False</property>
-                                <property name="use_underline">True</property>
-                                <property name="draw_indicator">True</property>
-                                <property name="group">income_radio</property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">1</property>
-                                <property name="right_attach">2</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkRadioButton" id="asset_radio">
-                                <property name="label" translatable="yes">_Asset</property>
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">False</property>
-                                <property name="use_action_appearance">False</property>
-                                <property name="use_underline">True</property>
-                                <property name="draw_indicator">True</property>
-                                <property name="group">income_radio</property>
-                              </object>
-                              <packing>
-                                <property name="top_attach">1</property>
-                                <property name="bottom_attach">2</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkRadioButton" id="liab_eq_radio">
-                                <property name="label" translatable="yes">_Liability/Equity</property>
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">False</property>
-                                <property name="use_action_appearance">False</property>
-                                <property name="use_underline">True</property>
-                                <property name="draw_indicator">True</property>
-                                <property name="group">income_radio</property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">1</property>
-                                <property name="right_attach">2</property>
-                                <property name="top_attach">1</property>
-                                <property name="bottom_attach">2</property>
-                              </packing>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
-                        <child>
                           <object class="GtkScrolledWindow" id="account_scroll">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="hscrollbar_policy">automatic</property>
                             <property name="vscrollbar_policy">automatic</property>
                             <property name="shadow_type">in</property>
-                            <child>
-                              <placeholder/>
-                            </child>
                           </object>
                           <packing>
                             <property name="expand">True</property>
                             <property name="fill">True</property>
-                            <property name="position">1</property>
+                            <property name="position">0</property>
                           </packing>
                         </child>
                         <child>
@@ -435,7 +351,7 @@ Select the type of Export required and the separator that will be used.
                               <packing>
                                 <property name="expand">False</property>
                                 <property name="fill">False</property>
-                                <property name="position">2</property>
+                                <property name="position">1</property>
                               </packing>
                             </child>
                             <child>
@@ -453,7 +369,7 @@ Select the type of Export required and the separator that will be used.
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">True</property>
-                            <property name="position">2</property>
+                            <property name="position">1</property>
                           </packing>
                         </child>
                         <child>
@@ -518,7 +434,7 @@ Select the type of Export required and the separator that will be used.
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">True</property>
-                            <property name="position">3</property>
+                            <property name="position">2</property>
                           </packing>
                         </child>
                       </object>
diff --git a/src/import-export/csv-exp/assistant-csv-export.h b/src/import-export/csv-exp/assistant-csv-export.h
index 7a54ba1..71095e1 100644
--- a/src/import-export/csv-exp/assistant-csv-export.h
+++ b/src/import-export/csv-exp/assistant-csv-export.h
@@ -53,9 +53,6 @@ typedef struct
 typedef struct
 {
     GtkWidget        *acct_info;
-    GtkWidget        *expense_radio;
-    GtkWidget        *asset_radio;
-    GtkWidget        *liab_eq_radio;
     GtkWidget        *account_treeview;
     GtkWidget        *select_button;
     GtkWidget        *num_acct_label;



Summary of changes:
 src/import-export/csv-exp/assistant-csv-export.c   | 123 +++------------------
 .../csv-exp/assistant-csv-export.glade             |  92 +--------------
 src/import-export/csv-exp/assistant-csv-export.h   |   3 -
 3 files changed, 19 insertions(+), 199 deletions(-)



More information about the gnucash-changes mailing list