Skip to content

Commit

Permalink
Add a select all Accounts button for CSV Transaction export.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bob-IT committed Apr 22, 2019
1 parent 91c992d commit 3985541
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 9 deletions.
30 changes: 22 additions & 8 deletions gnucash/gtkbuilder/assistant-csv-export.glade
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkAssistant" id="csv_export_assistant">
Expand All @@ -12,6 +12,9 @@
<signal name="cancel" handler="csv_export_assistant_cancel" swapped="no"/>
<signal name="close" handler="csv_export_assistant_close" swapped="no"/>
<signal name="prepare" handler="csv_export_assistant_prepare" swapped="no"/>
<child>
<placeholder/>
</child>
<child>
<object class="GtkBox" id="start_page">
<property name="visible">True</property>
Expand Down Expand Up @@ -275,7 +278,7 @@ Select the type of Export required and the separator that will be used.
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">&lt;b&gt;_Accounts&lt;/b&gt;</property>
<property name="label" translatable="yes">&lt;b&gt;Accounts&lt;/b&gt;</property>
<property name="use_markup">True</property>
<property name="use_underline">True</property>
</object>
Expand Down Expand Up @@ -372,6 +375,7 @@ Select the type of Export required and the separator that will be used.
<object class="GtkButtonBox" id="hbox99">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkButton" id="select_subaccounts_button">
<property name="label" translatable="yes">_Select Subaccounts</property>
Expand All @@ -387,6 +391,21 @@ Select the type of Export required and the separator that will be used.
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="select_all_button">
<property name="label" translatable="yes">Select _All</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="border_width">3</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
Expand Down Expand Up @@ -420,7 +439,7 @@ Select the type of Export required and the separator that will be used.
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">&lt;b&gt;_Dates&lt;/b&gt;</property>
<property name="label" translatable="yes">&lt;b&gt;Dates&lt;/b&gt;</property>
<property name="use_markup">True</property>
<property name="use_underline">True</property>
</object>
Expand Down Expand Up @@ -735,10 +754,5 @@ Cancel to abort.</property>
<property name="has_padding">False</property>
</packing>
</child>
<child internal-child="action_area">
<object class="GtkBox" id="assistant-action_area2">
<property name="can_focus">False</property>
</object>
</child>
</object>
</interface>
26 changes: 25 additions & 1 deletion gnucash/import-export/csv-exp/assistant-csv-export.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,25 @@ csv_export_account_changed_cb (GtkTreeSelection *selection,
}


/*******************************************************
* csv_export_select_all_clicked_cb
*
* select all the accounts
*******************************************************/
static void
csv_export_select_all_clicked_cb (GtkWidget *widget, gpointer user_data)
{
CsvExportInfo *info = user_data;
GtkTreeSelection *selection = gtk_tree_view_get_selection
(GTK_TREE_VIEW (info->csva.account_treeview));

gtk_tree_view_expand_all (GTK_TREE_VIEW (info->csva.account_treeview));
gtk_tree_selection_select_all (selection);

gtk_widget_grab_focus (info->csva.account_treeview);
}


/*******************************************************
* csv_export_select_subaccounts_clicked_cb
*
Expand Down Expand Up @@ -886,9 +905,14 @@ csv_export_assistant_create (CsvExportInfo *info)
/* select subaccounts button */
button = GTK_WIDGET(gtk_builder_get_object (builder, "select_subaccounts_button"));
info->csva.select_button = button;

g_signal_connect (G_OBJECT(button), "clicked",
G_CALLBACK(csv_export_select_subaccounts_clicked_cb), info);

button = GTK_WIDGET(gtk_builder_get_object (builder, "select_all_button"));
info->csva.select_button = button;
g_signal_connect (G_OBJECT(button), "clicked",
G_CALLBACK(csv_export_select_all_clicked_cb), info);

g_signal_connect (G_OBJECT(info->csva.account_treeview), "cursor_changed",
G_CALLBACK(csv_export_cursor_changed_cb), info);

Expand Down

0 comments on commit 3985541

Please sign in to comment.