mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Files linked to assistant-csv-account-import.glade
This commit is contained in:
parent
751695573f
commit
3e8581c903
@ -121,7 +121,7 @@ void create_regex (GString *regex_str, const gchar *sep)
|
||||
"(?<name>\"(?:[^\"]|\"\")*\"|[^%s]*)%s"
|
||||
"(?<code>\"(?:[^\"]|\"\")*\"|[^%s]*)%s?"
|
||||
"(?<description>\"(?:[^\"]|\"\")*\"|[^%s]*)%s"
|
||||
"(?<color>[^%s]*)%s"
|
||||
"(?<color>\"(?:[^\"]|\"\")*\"|[^%s]*)%s"
|
||||
"(?<notes>\"(?:[^\"]|\"\")*\"|[^%s]*)%s"
|
||||
"(?<commoditym>\"(?:[^\"]|\"\")*\"|[^%s]*)%s"
|
||||
"(?<commodityn>\"(?:[^\"]|\"\")*\"|[^%s]*)%s"
|
||||
@ -267,14 +267,12 @@ void csv_import_sep_cb (GtkWidget *radio, gpointer user_data)
|
||||
|
||||
/* Generate preview */
|
||||
gtk_list_store_clear (info->store);
|
||||
gtk_widget_set_sensitive (info->header_row_spin, TRUE);
|
||||
|
||||
if (csv_import_read_file (info->file_name, info->regexp->str, info->store, 11) == MATCH_FOUND)
|
||||
gtk_widget_set_sensitive (info->header_row_spin, TRUE);
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON(info->header_row_spin), 1); // set header spin to 1
|
||||
else
|
||||
gtk_widget_set_sensitive (info->header_row_spin, FALSE);
|
||||
|
||||
/* Reset Header spin to 0 */
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON(info->header_row_spin), 0);
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON(info->header_row_spin), 0); //reset header spin to 0
|
||||
}
|
||||
|
||||
|
||||
@ -407,10 +405,12 @@ csv_import_assistant_account_page_prepare (GtkAssistant *assistant,
|
||||
|
||||
gtk_list_store_clear (info->store);
|
||||
|
||||
gtk_widget_set_sensitive (info->header_row_spin, TRUE);
|
||||
|
||||
if (csv_import_read_file (info->file_name, info->regexp->str, info->store, 11 ) == MATCH_FOUND)
|
||||
gtk_widget_set_sensitive (info->header_row_spin, TRUE);
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON(info->header_row_spin), 1); // set header spin to 1
|
||||
else
|
||||
gtk_widget_set_sensitive (info->header_row_spin, FALSE);
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON(info->header_row_spin), 0); //reset header spin to 0
|
||||
}
|
||||
|
||||
|
||||
@ -577,8 +577,8 @@ csv_import_assistant_create (CsvImportInfo *info)
|
||||
|
||||
builder = gtk_builder_new();
|
||||
gnc_builder_add_from_file (builder, "assistant-csv-account-import.glade", "num_hrows_adj");
|
||||
gnc_builder_add_from_file (builder, "assistant-csv-account-import.glade", "CSV Account Import Assistant");
|
||||
window = GTK_WIDGET(gtk_builder_get_object (builder, "CSV Account Import Assistant"));
|
||||
gnc_builder_add_from_file (builder, "assistant-csv-account-import.glade", "csv_account_import_assistant");
|
||||
window = GTK_WIDGET(gtk_builder_get_object (builder, "csv_account_import_assistant"));
|
||||
info->window = window;
|
||||
|
||||
/* Load default settings */
|
||||
|
@ -1,22 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.20.0 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="2.16"/>
|
||||
<!-- interface-naming-policy project-wide -->
|
||||
<object class="GtkAssistant" id="CSV Account Import Assistant">
|
||||
<requires lib="gtk+" version="3.10"/>
|
||||
<object class="GtkAdjustment" id="num_hrows_adj">
|
||||
<property name="upper">100</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkAssistant" id="csv_account_import_assistant">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">12</property>
|
||||
<property name="title" translatable="yes">CSV Import Assistant</property>
|
||||
<property name="default_width">400</property>
|
||||
<property name="default_height">500</property>
|
||||
<signal name="close" handler="csv_import_assistant_close" swapped="no"/>
|
||||
<signal name="apply" handler="csv_import_assistant_finish" swapped="no"/>
|
||||
<signal name="prepare" handler="csv_import_assistant_prepare" swapped="no"/>
|
||||
<signal name="cancel" handler="csv_import_assistant_cancel" swapped="no"/>
|
||||
<signal name="close" handler="csv_import_assistant_close" swapped="no"/>
|
||||
<signal name="prepare" handler="csv_import_assistant_prepare" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkVBox" id="start_page">
|
||||
<object class="GtkBox" id="start_page">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">12</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="start_label">
|
||||
<property name="visible">True</property>
|
||||
@ -24,7 +30,7 @@
|
||||
<property name="label" translatable="yes">
|
||||
This assistant will help you import Accounts from a file.
|
||||
|
||||
The file must be in the same format as that exported as this is a fixed format import which can be seen by looking at a file created by using the Account Tree export menu option.
|
||||
The file must be in the same format as that exported as this is a fixed format import which can be seen by looking at a file created by using the 'Export Account Tree to CSV' export menu option.
|
||||
|
||||
If the account is missing, based on the full account name, it will be added as long as the security / currency specified exists. If the account exists, then four fields will be updated. These are code, description, notes and color.
|
||||
|
||||
@ -44,13 +50,15 @@ Click on 'Forward' to proceed or 'Cancel' to Abort Import.
|
||||
<property name="page_type">intro</property>
|
||||
<property name="title" translatable="yes">Import Account Assistant</property>
|
||||
<property name="complete">True</property>
|
||||
<property name="has_padding">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkVBox" id="file_page">
|
||||
<object class="GtkBox" id="file_page">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">12</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label4">
|
||||
<property name="visible">True</property>
|
||||
@ -72,22 +80,24 @@ Enter file name and location for the Import...
|
||||
</object>
|
||||
<packing>
|
||||
<property name="title" translatable="yes">Choose File to Import</property>
|
||||
<property name="has_padding">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkVBox" id="import_tree_page">
|
||||
<object class="GtkBox" id="import_tree_page">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">12</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox1">
|
||||
<object class="GtkBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xpad">6</property>
|
||||
<property name="margin_right">5</property>
|
||||
<property name="label" translatable="yes">Number of rows for the Header</property>
|
||||
</object>
|
||||
<packing>
|
||||
@ -100,13 +110,9 @@ Enter file name and location for the Import...
|
||||
<object class="GtkSpinButton" id="num_hrows">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">False</property>
|
||||
<property name="invisible_char">●</property>
|
||||
<property name="invisible_char_set">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="secondary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">True</property>
|
||||
<property name="secondary_icon_sensitive">True</property>
|
||||
<property name="adjustment">num_hrows_adj</property>
|
||||
<signal name="value-changed" handler="csv_import_hrows_cb" swapped="no"/>
|
||||
</object>
|
||||
@ -133,23 +139,25 @@ Enter file name and location for the Import...
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<child>
|
||||
<object class="GtkTable" id="table4">
|
||||
<object class="GtkGrid" id="table4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">12</property>
|
||||
<property name="n_rows">3</property>
|
||||
<property name="n_columns">3</property>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="radio_comma">
|
||||
<property name="label" translatable="yes">Comma Separated</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="halign">start</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="csv_import_sep_cb" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="radio_semi">
|
||||
@ -157,14 +165,14 @@ Enter file name and location for the Import...
|
||||
<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="halign">start</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">radio_comma</property>
|
||||
<signal name="toggled" handler="csv_import_sep_cb" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -173,14 +181,14 @@ Enter file name and location for the Import...
|
||||
<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="halign">start</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">radio_comma</property>
|
||||
<signal name="toggled" handler="csv_import_sep_cb" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -189,16 +197,31 @@ Enter file name and location for the Import...
|
||||
<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="halign">start</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">radio_comma</property>
|
||||
<signal name="toggled" handler="csv_import_sep_cb" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
@ -228,12 +251,13 @@ Enter file name and location for the Import...
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="border_width">6</property>
|
||||
<property name="hscrollbar_policy">automatic</property>
|
||||
<property name="vscrollbar_policy">automatic</property>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="treeview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection" id="treeview-selection1"/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@ -258,6 +282,7 @@ Enter file name and location for the Import...
|
||||
<property name="page_type">progress</property>
|
||||
<property name="title" translatable="yes">Import Account Preview, first 10 rows only</property>
|
||||
<property name="complete">True</property>
|
||||
<property name="has_padding">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -271,13 +296,15 @@ Cancel to abort.</property>
|
||||
<packing>
|
||||
<property name="page_type">confirm</property>
|
||||
<property name="title" translatable="yes">Import Accounts Now</property>
|
||||
<property name="has_padding">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkVBox" id="summary_page">
|
||||
<object class="GtkBox" id="summary_page">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">12</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="summary_label">
|
||||
<property name="visible">True</property>
|
||||
@ -296,8 +323,6 @@ Cancel to abort.</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">1</property>
|
||||
<property name="hscrollbar_policy">automatic</property>
|
||||
<property name="vscrollbar_policy">automatic</property>
|
||||
<property name="shadow_type">etched-in</property>
|
||||
<child>
|
||||
<object class="GtkTextView" id="summary_error_view">
|
||||
@ -322,12 +347,16 @@ Cancel to abort.</property>
|
||||
<property name="page_type">summary</property>
|
||||
<property name="title" translatable="yes">Import Summary</property>
|
||||
<property name="complete">True</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>
|
||||
<packing>
|
||||
<property name="has_padding">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="num_hrows_adj">
|
||||
<property name="upper">100</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
</interface>
|
||||
|
@ -128,7 +128,6 @@ csv_import_read_file (const gchar *filename, const gchar *parser_regexp,
|
||||
g_regex_match (regexpat, contents, 0, &match_info);
|
||||
while (g_match_info_matches (match_info))
|
||||
{
|
||||
match_found = TRUE;
|
||||
// fill in the values
|
||||
gtk_list_store_append (store, &iter);
|
||||
fill_model_with_match (match_info, "type", store, &iter, TYPE);
|
||||
@ -145,6 +144,16 @@ csv_import_read_file (const gchar *filename, const gchar *parser_regexp,
|
||||
fill_model_with_match (match_info, "place_holder", store, &iter, PLACE_HOLDER);
|
||||
gtk_list_store_set (store, &iter, ROW_COLOR, NULL, -1);
|
||||
|
||||
if (row == 0)
|
||||
{
|
||||
gchar *str_type;
|
||||
gtk_tree_model_get (GTK_TREE_MODEL(store), &iter, TYPE, &str_type, -1);
|
||||
|
||||
if (g_strcmp0 (_("type"), str_type) == 0)
|
||||
match_found = TRUE;
|
||||
g_free (str_type);
|
||||
}
|
||||
|
||||
row++;
|
||||
if (row == max_rows)
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user