mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Merge branch 'fixes02' of https://github.com/Bob-IT/gnucash into maint
This commit is contained in:
commit
9921ab22a2
@ -2505,6 +2505,7 @@ gnc_option_set_ui_widget_text (GNCOption *option, GtkBox *page_box,
|
||||
value = gtk_text_view_new();
|
||||
gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(value), GTK_WRAP_WORD);
|
||||
gtk_text_view_set_editable(GTK_TEXT_VIEW(value), TRUE);
|
||||
gtk_text_view_set_accepts_tab (GTK_TEXT_VIEW(value), FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (scroll), value);
|
||||
|
||||
gnc_option_set_widget (option, value);
|
||||
|
@ -1154,6 +1154,7 @@ dialog_response_cb(GtkDialog *dialog, gint response_id, GncSxSinceLastRunDialog
|
||||
gnc_suspend_gui_refresh();
|
||||
gnc_sx_slr_model_effect_change(app_dialog->editing_model, FALSE, &app_dialog->created_txns, &creation_errors);
|
||||
gnc_resume_gui_refresh();
|
||||
gnc_gui_refresh_all (); // force a refresh of all registers
|
||||
if (creation_errors)
|
||||
creation_error_dialog(&creation_errors);
|
||||
|
||||
|
@ -433,6 +433,7 @@ Select location and file name for the Import, then click 'OK'...
|
||||
<object class="GtkGrid" id="table2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="column_spacing">5</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
|
@ -433,6 +433,7 @@ Select location and file name for the Import, then click 'OK'...
|
||||
<object class="GtkGrid" id="table2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="column_spacing">5</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
|
@ -1253,6 +1253,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="wrap_mode">word</property>
|
||||
<property name="accepts_tab">False</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.20.0 -->
|
||||
<!-- Generated with glade 3.20.4 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.10"/>
|
||||
<object class="GtkImage" id="account_new_icon">
|
||||
@ -1122,6 +1122,21 @@
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="show_source_account_button">
|
||||
<property name="label" translatable="yes">Show the Source Account column</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkDialog" id="transaction_matcher_dialog">
|
||||
<property name="can_focus">False</property>
|
||||
|
@ -73,6 +73,7 @@ void csv_export_show_range_cb (GtkRadioButton *button, gpointer user_data);
|
||||
void csv_export_start_date_cb (GtkWidget *radio, gpointer user_data);
|
||||
void csv_export_end_date_cb (GtkWidget *radio, gpointer user_data);
|
||||
|
||||
void csv_export_file_chooser_file_activated_cb (GtkFileChooser *chooser, CsvExportInfo *info);
|
||||
void csv_export_file_chooser_selection_changed_cb (GtkFileChooser *chooser, CsvExportInfo *info);
|
||||
|
||||
static const gchar *finish_tree_string = N_(
|
||||
@ -121,21 +122,15 @@ static const gchar *start_trans_simple_string = N_(
|
||||
|
||||
|
||||
/**************************************************
|
||||
* csv_export_file_chooser_selection_changed_cb
|
||||
* csv_export_assistant_check_filename
|
||||
*
|
||||
* call back for GtkFileChooser widget
|
||||
* check for a valid filename for GtkFileChooser callbacks
|
||||
**************************************************/
|
||||
void
|
||||
csv_export_file_chooser_selection_changed_cb (GtkFileChooser *chooser, CsvExportInfo *info)
|
||||
static gboolean
|
||||
csv_export_assistant_check_filename (GtkFileChooser *chooser,
|
||||
CsvExportInfo *info)
|
||||
{
|
||||
GtkAssistant *assistant = GTK_ASSISTANT(info->window);
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
GtkWidget *page = gtk_assistant_get_nth_page (assistant, num);
|
||||
gchar *file_name;
|
||||
|
||||
gtk_assistant_set_page_complete (assistant, page, FALSE);
|
||||
|
||||
file_name = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(info->file_chooser));
|
||||
gchar *file_name = gtk_file_chooser_get_filename (chooser);
|
||||
|
||||
/* Test for a valid filename and not a directory */
|
||||
if (file_name && !g_file_test (file_name, G_FILE_TEST_IS_DIR))
|
||||
@ -151,13 +146,52 @@ csv_export_file_chooser_selection_changed_cb (GtkFileChooser *chooser, CsvExport
|
||||
|
||||
g_free (filedir);
|
||||
g_free (filepath);
|
||||
g_free (file_name);
|
||||
|
||||
gtk_assistant_set_page_complete (assistant, page, TRUE);
|
||||
DEBUG("file_name selected is %s", info->file_name);
|
||||
DEBUG("starting directory is %s", info->starting_dir);
|
||||
return TRUE;
|
||||
}
|
||||
g_free (file_name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DEBUG("file_name selected is %s", info->file_name);
|
||||
DEBUG("starting directory is %s", info->starting_dir);
|
||||
|
||||
/**************************************************
|
||||
* csv_export_file_chooser_file_activated_cb
|
||||
*
|
||||
* call back for GtkFileChooser file-activated signal
|
||||
**************************************************/
|
||||
void
|
||||
csv_export_file_chooser_file_activated_cb (GtkFileChooser *chooser,
|
||||
CsvExportInfo *info)
|
||||
{
|
||||
GtkAssistant *assistant = GTK_ASSISTANT(info->assistant);
|
||||
gtk_assistant_set_page_complete (assistant, info->file_page, FALSE);
|
||||
|
||||
/* Test for a valid filename and not a directory */
|
||||
if (csv_export_assistant_check_filename (chooser, info))
|
||||
{
|
||||
gtk_assistant_set_page_complete (assistant, info->file_page, TRUE);
|
||||
gtk_assistant_next_page (assistant);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**************************************************
|
||||
* csv_export_file_chooser_selection_changed_cb
|
||||
*
|
||||
* call back for GtkFileChooser widget
|
||||
**************************************************/
|
||||
void
|
||||
csv_export_file_chooser_selection_changed_cb (GtkFileChooser *chooser,
|
||||
CsvExportInfo *info)
|
||||
{
|
||||
GtkAssistant *assistant = GTK_ASSISTANT(info->assistant);
|
||||
|
||||
/* Enable the forward button based on a valid filename */
|
||||
gtk_assistant_set_page_complete (assistant, info->file_page,
|
||||
csv_export_assistant_check_filename (chooser, info));
|
||||
}
|
||||
|
||||
|
||||
@ -170,12 +204,9 @@ void
|
||||
csv_export_sep_cb (GtkWidget *radio, gpointer user_data)
|
||||
{
|
||||
CsvExportInfo *info = user_data;
|
||||
GtkAssistant *assistant = GTK_ASSISTANT(info->assistant);
|
||||
const gchar *name;
|
||||
|
||||
GtkAssistant *assistant = GTK_ASSISTANT(info->window);
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
GtkWidget *page = gtk_assistant_get_nth_page (assistant, num);
|
||||
|
||||
if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(radio)))
|
||||
{
|
||||
LEAVE("1st callback of pair. Defer to 2nd callback.");
|
||||
@ -186,7 +217,7 @@ csv_export_sep_cb (GtkWidget *radio, gpointer user_data)
|
||||
|
||||
gtk_widget_set_sensitive (info->custom_entry, FALSE);
|
||||
info->use_custom = FALSE;
|
||||
gtk_assistant_set_page_complete (assistant, page, TRUE);
|
||||
gtk_assistant_set_page_complete (assistant, info->start_page, TRUE);
|
||||
|
||||
if (g_strcmp0 (name, "comma_radio") == 0)
|
||||
info->separator_str = ",";
|
||||
@ -200,7 +231,7 @@ csv_export_sep_cb (GtkWidget *radio, gpointer user_data)
|
||||
gtk_widget_set_sensitive (info->custom_entry, TRUE);
|
||||
info->use_custom = TRUE;
|
||||
if (gtk_entry_get_text_length (GTK_ENTRY(info->custom_entry)) == 0)
|
||||
gtk_assistant_set_page_complete (assistant, page, FALSE);
|
||||
gtk_assistant_set_page_complete (assistant, info->start_page, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -246,19 +277,16 @@ void
|
||||
csv_export_custom_entry_cb (GtkWidget *widget, gpointer user_data)
|
||||
{
|
||||
CsvExportInfo *info = user_data;
|
||||
GtkAssistant *assistant = GTK_ASSISTANT(info->assistant);
|
||||
const gchar *custom_str;
|
||||
|
||||
GtkAssistant *assistant = GTK_ASSISTANT(info->window);
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
GtkWidget *page = gtk_assistant_get_nth_page (assistant, num);
|
||||
|
||||
custom_str = gtk_entry_get_text (GTK_ENTRY(info->custom_entry));
|
||||
info->separator_str = strdup (custom_str);
|
||||
|
||||
if (info->use_custom == TRUE && gtk_entry_get_text_length (GTK_ENTRY(info->custom_entry)) == 0)
|
||||
gtk_assistant_set_page_complete (assistant, page, FALSE);
|
||||
gtk_assistant_set_page_complete (assistant, info->start_page, FALSE);
|
||||
else
|
||||
gtk_assistant_set_page_complete (assistant, page, TRUE);
|
||||
gtk_assistant_set_page_complete (assistant, info->start_page, TRUE);
|
||||
}
|
||||
|
||||
|
||||
@ -384,10 +412,7 @@ csv_export_account_changed_cb (GtkTreeSelection *selection,
|
||||
gpointer user_data)
|
||||
{
|
||||
CsvExportInfo *info = user_data;
|
||||
GtkAssistant *assistant = GTK_ASSISTANT(info->window);
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
GtkWidget *page = gtk_assistant_get_nth_page (assistant, num);
|
||||
|
||||
GtkAssistant *assistant = GTK_ASSISTANT(info->assistant);
|
||||
GncTreeViewAccount *view;
|
||||
|
||||
g_return_if_fail(GTK_IS_TREE_SELECTION(selection));
|
||||
@ -396,9 +421,9 @@ csv_export_account_changed_cb (GtkTreeSelection *selection,
|
||||
|
||||
/* Enable the Forward Assistant Button if we have accounts */
|
||||
if (info->csva.num_accounts > 0)
|
||||
gtk_assistant_set_page_complete (assistant, page, TRUE);
|
||||
gtk_assistant_set_page_complete (assistant, info->account_page, TRUE);
|
||||
else
|
||||
gtk_assistant_set_page_complete (assistant, page, FALSE);
|
||||
gtk_assistant_set_page_complete (assistant, info->account_page, FALSE);
|
||||
|
||||
view = GNC_TREE_VIEW_ACCOUNT(info->csva.account_treeview);
|
||||
info->csva.account_list = gnc_tree_view_account_get_selected_accounts (view);
|
||||
@ -612,8 +637,6 @@ csv_export_assistant_start_page_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
{
|
||||
CsvExportInfo *info = user_data;
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
GtkWidget *page = gtk_assistant_get_nth_page (assistant, num);
|
||||
|
||||
/* Set Start page text */
|
||||
if (info->export_type == XML_EXPORT_TREE)
|
||||
@ -628,7 +651,7 @@ csv_export_assistant_start_page_prepare (GtkAssistant *assistant,
|
||||
}
|
||||
|
||||
/* Enable the Assistant Buttons */
|
||||
gtk_assistant_set_page_complete (assistant, page, TRUE);
|
||||
gtk_assistant_set_page_complete (assistant, info->start_page, TRUE);
|
||||
}
|
||||
|
||||
|
||||
@ -637,14 +660,12 @@ csv_export_assistant_account_page_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
{
|
||||
CsvExportInfo *info = user_data;
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
GtkWidget *page = gtk_assistant_get_nth_page (assistant, num);
|
||||
|
||||
/* Enable the Forward Assistant Button if we have accounts */
|
||||
if (info->csva.num_accounts > 0)
|
||||
gtk_assistant_set_page_complete (assistant, page, TRUE);
|
||||
gtk_assistant_set_page_complete (assistant, info->account_page, TRUE);
|
||||
else
|
||||
gtk_assistant_set_page_complete (assistant, page, FALSE);
|
||||
gtk_assistant_set_page_complete (assistant, info->account_page, FALSE);
|
||||
}
|
||||
|
||||
|
||||
@ -653,8 +674,6 @@ csv_export_assistant_file_page_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
{
|
||||
CsvExportInfo *info = user_data;
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
GtkWidget *page = gtk_assistant_get_nth_page (assistant, num);
|
||||
|
||||
/* Set the default directory */
|
||||
if (info->starting_dir)
|
||||
@ -662,7 +681,7 @@ csv_export_assistant_file_page_prepare (GtkAssistant *assistant,
|
||||
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER(info->file_chooser), "");
|
||||
|
||||
/* Disable the Forward Assistant Button */
|
||||
gtk_assistant_set_page_complete (assistant, page, FALSE);
|
||||
gtk_assistant_set_page_complete (assistant, info->file_page, FALSE);
|
||||
}
|
||||
|
||||
|
||||
@ -671,8 +690,6 @@ csv_export_assistant_finish_page_prepare (GtkAssistant *assistant,
|
||||
gpointer user_data)
|
||||
{
|
||||
CsvExportInfo *info = user_data;
|
||||
gint num = gtk_assistant_get_current_page (assistant);
|
||||
GtkWidget *page = gtk_assistant_get_nth_page (assistant, num);
|
||||
gchar *text;
|
||||
|
||||
/* Set Finish page text */
|
||||
@ -699,7 +716,7 @@ csv_export_assistant_finish_page_prepare (GtkAssistant *assistant,
|
||||
gtk_assistant_previous_page (assistant);
|
||||
}
|
||||
/* Enable the Assistant Buttons */
|
||||
gtk_assistant_set_page_complete (assistant, page, TRUE);
|
||||
gtk_assistant_set_page_complete (assistant, info->finish_label, TRUE);
|
||||
}
|
||||
|
||||
|
||||
@ -793,8 +810,8 @@ csv_export_close_handler (gpointer user_data)
|
||||
if (info->mid_sep)
|
||||
g_free (info->mid_sep);
|
||||
|
||||
gnc_save_window_size (GNC_PREFS_GROUP, GTK_WINDOW(info->window));
|
||||
gtk_widget_destroy (info->window);
|
||||
gnc_save_window_size (GNC_PREFS_GROUP, GTK_WINDOW(info->assistant));
|
||||
gtk_widget_destroy (info->assistant);
|
||||
}
|
||||
|
||||
/*******************************************************
|
||||
@ -804,19 +821,17 @@ static GtkWidget *
|
||||
csv_export_assistant_create (CsvExportInfo *info)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GtkWidget *window;
|
||||
GtkWidget *box, *h_box;
|
||||
GtkWidget *h_box;
|
||||
GtkWidget *button;
|
||||
GtkWidget *table, *hbox;
|
||||
time64 start_time, end_time;
|
||||
|
||||
builder = gtk_builder_new();
|
||||
gnc_builder_add_from_file (builder , "assistant-csv-export.glade", "csv_export_assistant");
|
||||
window = GTK_WIDGET(gtk_builder_get_object (builder, "csv_export_assistant"));
|
||||
info->window = window;
|
||||
info->assistant = GTK_WIDGET(gtk_builder_get_object (builder, "csv_export_assistant"));
|
||||
|
||||
// Set the style context for this assistant so it can be easily manipulated with css
|
||||
gnc_widget_set_style_context (GTK_WIDGET(window), "GncAssistExport");
|
||||
gnc_widget_set_style_context (GTK_WIDGET(info->assistant), "GncAssistExport");
|
||||
|
||||
/* Load default settings */
|
||||
load_settings (info);
|
||||
@ -837,7 +852,7 @@ csv_export_assistant_create (CsvExportInfo *info)
|
||||
// Don't provide simple export layout for search registers and General Journal
|
||||
if ((info->export_type == XML_EXPORT_TREE) || (info->account == NULL))
|
||||
gtk_widget_destroy (chkbox);
|
||||
gtk_assistant_remove_page (GTK_ASSISTANT(window), 1); //remove accounts page
|
||||
gtk_assistant_remove_page (GTK_ASSISTANT(info->assistant), 1); //remove accounts page
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -922,8 +937,10 @@ csv_export_assistant_create (CsvExportInfo *info)
|
||||
g_signal_connect (G_OBJECT(info->file_chooser), "selection-changed",
|
||||
G_CALLBACK(csv_export_file_chooser_selection_changed_cb), info);
|
||||
|
||||
box = GTK_WIDGET(gtk_builder_get_object (builder, "file_page"));
|
||||
gtk_box_pack_start (GTK_BOX (box), info->file_chooser, TRUE, TRUE, 6);
|
||||
g_signal_connect (G_OBJECT(info->file_chooser), "file-activated",
|
||||
G_CALLBACK(csv_export_file_chooser_file_activated_cb), info);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (info->file_page), info->file_chooser, TRUE, TRUE, 6);
|
||||
gtk_widget_show (info->file_chooser);
|
||||
|
||||
/* Finish Page */
|
||||
@ -932,11 +949,11 @@ csv_export_assistant_create (CsvExportInfo *info)
|
||||
/* Summary Page */
|
||||
info->summary_label = GTK_WIDGET(gtk_builder_get_object (builder, "summary_page"));
|
||||
|
||||
g_signal_connect (G_OBJECT(window), "destroy",
|
||||
g_signal_connect (G_OBJECT(info->assistant), "destroy",
|
||||
G_CALLBACK(csv_export_assistant_destroy_cb), info);
|
||||
|
||||
gnc_restore_window_size (GNC_PREFS_GROUP,
|
||||
GTK_WINDOW(info->window), gnc_ui_get_main_window(NULL));
|
||||
GTK_WINDOW(info->assistant), gnc_ui_get_main_window(NULL));
|
||||
if (gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY))
|
||||
{
|
||||
GObject *object = gtk_builder_get_object (builder, "paned");
|
||||
@ -945,7 +962,7 @@ csv_export_assistant_create (CsvExportInfo *info)
|
||||
|
||||
gtk_builder_connect_signals (builder, info);
|
||||
g_object_unref (G_OBJECT(builder));
|
||||
return window;
|
||||
return info->assistant;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -967,8 +984,8 @@ gnc_file_csv_export_internal (CsvExportType export_type, Query *q, Account *acc)
|
||||
gnc_register_gui_component (ASSISTANT_CSV_EXPORT_CM_CLASS,
|
||||
NULL, csv_export_close_handler,
|
||||
info);
|
||||
gtk_widget_show_all (info->window);
|
||||
gnc_window_adjust_for_screen (GTK_WINDOW(info->window));
|
||||
gtk_widget_show_all (info->assistant);
|
||||
gnc_window_adjust_for_screen (GTK_WINDOW(info->assistant));
|
||||
}
|
||||
|
||||
|
||||
|
@ -78,7 +78,6 @@ typedef struct
|
||||
GtkWidget *account_page;
|
||||
GtkWidget *file_page;
|
||||
|
||||
GtkWidget *window;
|
||||
GtkWidget *assistant;
|
||||
GtkWidget *start_label;
|
||||
GtkWidget *custom_entry;
|
||||
|
@ -62,6 +62,7 @@ void csv_import_assistant_summary_page_prepare (GtkAssistant *assistant, gpointe
|
||||
void csv_import_sep_cb (GtkWidget *radio, gpointer user_data );
|
||||
void csv_import_hrows_cb (GtkWidget *spin, gpointer user_data );
|
||||
|
||||
void csv_import_file_chooser_file_activated_cb (GtkFileChooser *chooser, CsvImportInfo *info);
|
||||
void csv_import_file_chooser_selection_changed_cb (GtkFileChooser *chooser, CsvImportInfo *info);
|
||||
|
||||
static gchar *gnc_input_dialog (GtkWidget *parent, const gchar *title, const gchar *msg, const gchar *default_input);
|
||||
@ -135,38 +136,78 @@ void create_regex (GString *regex_str, const gchar *sep)
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**************************************************
|
||||
* csv_import_assistant_check_filename
|
||||
*
|
||||
* check for a valid filename for GtkFileChooser callbacks
|
||||
**************************************************/
|
||||
static gboolean
|
||||
csv_import_assistant_check_filename (GtkFileChooser *chooser,
|
||||
CsvImportInfo *info)
|
||||
{
|
||||
gchar *file_name = gtk_file_chooser_get_filename (chooser);
|
||||
|
||||
/* Test for a valid filename and not a directory */
|
||||
if (file_name && !g_file_test (file_name, G_FILE_TEST_IS_DIR))
|
||||
{
|
||||
gchar *filepath = gnc_uri_get_path (file_name);
|
||||
gchar *filedir = g_path_get_dirname (filepath);
|
||||
|
||||
g_free (info->file_name);
|
||||
info->file_name = g_strdup (file_name);
|
||||
|
||||
g_free (info->starting_dir);
|
||||
info->starting_dir = g_strdup (filedir);
|
||||
|
||||
g_free (filedir);
|
||||
g_free (filepath);
|
||||
g_free (file_name);
|
||||
|
||||
DEBUG("file_name selected is %s", info->file_name);
|
||||
DEBUG("starting directory is %s", info->starting_dir);
|
||||
return TRUE;
|
||||
}
|
||||
g_free (file_name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************
|
||||
* csv_import_file_chooser_file_activated_cb
|
||||
*
|
||||
* call back for GtkFileChooser file-activated signal
|
||||
**************************************************/
|
||||
void
|
||||
csv_import_file_chooser_file_activated_cb (GtkFileChooser *chooser,
|
||||
CsvImportInfo *info)
|
||||
{
|
||||
GtkAssistant *assistant = GTK_ASSISTANT(info->assistant);
|
||||
gtk_assistant_set_page_complete (assistant, info->file_page, FALSE);
|
||||
|
||||
/* Test for a valid filename and not a directory */
|
||||
if (csv_import_assistant_check_filename (chooser, info))
|
||||
{
|
||||
gtk_assistant_set_page_complete (assistant, info->file_page, TRUE);
|
||||
gtk_assistant_next_page (assistant);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**************************************************
|
||||
* csv_import_file_chooser_selection_changed_cb
|
||||
*
|
||||
* call back for file chooser widget
|
||||
**************************************************/
|
||||
void
|
||||
csv_import_file_chooser_selection_changed_cb (GtkFileChooser *chooser, CsvImportInfo *info)
|
||||
csv_import_file_chooser_selection_changed_cb (GtkFileChooser *chooser,
|
||||
CsvImportInfo *info)
|
||||
{
|
||||
GtkAssistant *assistant = GTK_ASSISTANT(info->assistant);
|
||||
gchar *file_name;
|
||||
|
||||
gtk_assistant_set_page_complete (assistant, info->file_page, FALSE);
|
||||
gtk_assistant_set_page_complete (assistant, info->account_page, FALSE);
|
||||
|
||||
file_name = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(info->file_chooser));
|
||||
|
||||
if (file_name && !g_file_test (file_name, G_FILE_TEST_IS_DIR))
|
||||
{
|
||||
gchar *filepath = gnc_uri_get_path (file_name);
|
||||
gchar *filedir = g_path_get_dirname (filepath);
|
||||
info->starting_dir = g_strdup (filedir);
|
||||
g_free (filedir);
|
||||
g_free (filepath);
|
||||
|
||||
info->file_name = g_strdup (file_name);
|
||||
|
||||
gtk_assistant_set_page_complete (assistant, info->file_page, TRUE);
|
||||
}
|
||||
g_free (file_name);
|
||||
|
||||
DEBUG("file_name selected is %s", info->file_name);
|
||||
DEBUG("starting directory is %s", info->starting_dir);
|
||||
/* Enable the forward button based on a valid filename */
|
||||
gtk_assistant_set_page_complete (assistant, info->file_page,
|
||||
csv_import_assistant_check_filename (chooser, info));
|
||||
}
|
||||
|
||||
|
||||
@ -630,6 +671,8 @@ csv_import_assistant_create (CsvImportInfo *info)
|
||||
info->file_chooser = gtk_file_chooser_widget_new (GTK_FILE_CHOOSER_ACTION_OPEN);
|
||||
g_signal_connect (G_OBJECT(info->file_chooser), "selection-changed",
|
||||
G_CALLBACK(csv_import_file_chooser_selection_changed_cb), info);
|
||||
g_signal_connect (G_OBJECT(info->file_chooser), "file-activated",
|
||||
G_CALLBACK(csv_import_file_chooser_file_activated_cb), info);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX(info->file_page), info->file_chooser, TRUE, TRUE, 6);
|
||||
gtk_widget_show (info->file_chooser);
|
||||
|
@ -93,6 +93,7 @@ public:
|
||||
void assist_finish ();
|
||||
void assist_compmgr_close ();
|
||||
|
||||
void file_activated_cb ();
|
||||
void file_selection_changed_cb ();
|
||||
|
||||
void preview_settings_delete ();
|
||||
@ -133,6 +134,8 @@ private:
|
||||
GtkWidget* preview_cbox_factory (GtkTreeModel* model, uint32_t colnum);
|
||||
/* helper function to set rendering parameters for preview data columns */
|
||||
void preview_style_column (uint32_t col_num, GtkTreeModel* model);
|
||||
/* helper function to check for a valid filename as opposed to a directory */
|
||||
bool check_for_valid_filename ();
|
||||
|
||||
GtkAssistant *csv_imp_asst;
|
||||
|
||||
@ -190,6 +193,7 @@ extern "C"
|
||||
void csv_price_imp_assist_prepare_cb (GtkAssistant *assistant, GtkWidget *page, CsvImpPriceAssist* info);
|
||||
void csv_price_imp_assist_close_cb (GtkAssistant *gtkassistant, CsvImpPriceAssist* info);
|
||||
void csv_price_imp_assist_finish_cb (GtkAssistant *gtkassistant, CsvImpPriceAssist* info);
|
||||
void csv_price_imp_file_activated_changed_cb (GtkFileChooser *chooser, CsvImpPriceAssist *info);
|
||||
void csv_price_imp_file_selection_changed_cb (GtkFileChooser *chooser, CsvImpPriceAssist *info);
|
||||
void csv_price_imp_preview_del_settings_cb (GtkWidget *button, CsvImpPriceAssist *info);
|
||||
void csv_price_imp_preview_save_settings_cb (GtkWidget *button, CsvImpPriceAssist *info);
|
||||
@ -228,6 +232,11 @@ csv_price_imp_assist_finish_cb (GtkAssistant *assistant, CsvImpPriceAssist* info
|
||||
info->assist_finish ();
|
||||
}
|
||||
|
||||
void csv_price_imp_file_activated_changed_cb (GtkFileChooser *chooser, CsvImpPriceAssist *info)
|
||||
{
|
||||
info->file_activated_cb();
|
||||
}
|
||||
|
||||
void csv_price_imp_file_selection_changed_cb (GtkFileChooser *chooser, CsvImpPriceAssist *info)
|
||||
{
|
||||
info->file_selection_changed_cb();
|
||||
@ -503,6 +512,8 @@ CsvImpPriceAssist::CsvImpPriceAssist ()
|
||||
|
||||
g_signal_connect (G_OBJECT(file_chooser), "selection-changed",
|
||||
G_CALLBACK(csv_price_imp_file_selection_changed_cb), this);
|
||||
g_signal_connect (G_OBJECT(file_chooser), "file-activated",
|
||||
G_CALLBACK(csv_price_imp_file_activated_changed_cb), this);
|
||||
|
||||
auto box = GTK_WIDGET(gtk_builder_get_object (builder, "file_page"));
|
||||
gtk_box_pack_start (GTK_BOX(box), file_chooser, TRUE, TRUE, 6);
|
||||
@ -667,18 +678,14 @@ CsvImpPriceAssist::~CsvImpPriceAssist ()
|
||||
* Code related to the file chooser page
|
||||
**************************************************/
|
||||
|
||||
/* csv_price_imp_file_selection_changed_cb
|
||||
*
|
||||
* call back for file chooser widget
|
||||
/* check_for_valid_filename for a valid file to activate the forward button
|
||||
*/
|
||||
void
|
||||
CsvImpPriceAssist::file_selection_changed_cb ()
|
||||
bool
|
||||
CsvImpPriceAssist::check_for_valid_filename ()
|
||||
{
|
||||
gtk_assistant_set_page_complete (csv_imp_asst, file_page, false);
|
||||
|
||||
auto file_name = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(file_chooser));
|
||||
if (!file_name || g_file_test (file_name, G_FILE_TEST_IS_DIR))
|
||||
return;
|
||||
return false;
|
||||
|
||||
auto filepath = gnc_uri_get_path (file_name);
|
||||
auto starting_dir = g_path_get_dirname (filepath);
|
||||
@ -693,7 +700,36 @@ CsvImpPriceAssist::file_selection_changed_cb ()
|
||||
g_free (file_name);
|
||||
g_free (starting_dir);
|
||||
|
||||
gtk_assistant_set_page_complete (csv_imp_asst, file_page, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* csv_price_imp_file_activated_cb
|
||||
*
|
||||
* call back for file chooser widget
|
||||
*/
|
||||
void
|
||||
CsvImpPriceAssist::file_activated_cb ()
|
||||
{
|
||||
gtk_assistant_set_page_complete (csv_imp_asst, file_page, false);
|
||||
|
||||
/* Test for a valid filename and not a directory */
|
||||
if (check_for_valid_filename ())
|
||||
{
|
||||
gtk_assistant_set_page_complete (csv_imp_asst, file_page, true);
|
||||
gtk_assistant_next_page (csv_imp_asst);
|
||||
}
|
||||
}
|
||||
|
||||
/* csv_price_imp_file_selection_changed_cb
|
||||
*
|
||||
* call back for file chooser widget
|
||||
*/
|
||||
void
|
||||
CsvImpPriceAssist::file_selection_changed_cb ()
|
||||
{
|
||||
/* Enable the forward button based on a valid filename */
|
||||
gtk_assistant_set_page_complete (csv_imp_asst, file_page,
|
||||
check_for_valid_filename ());
|
||||
}
|
||||
|
||||
|
||||
|
@ -159,6 +159,7 @@ public:
|
||||
void assist_finish ();
|
||||
void assist_compmgr_close ();
|
||||
|
||||
void file_activated_cb ();
|
||||
void file_selection_changed_cb ();
|
||||
|
||||
void preview_settings_delete ();
|
||||
@ -202,6 +203,8 @@ private:
|
||||
GtkWidget* preview_cbox_factory (GtkTreeModel* model, uint32_t colnum);
|
||||
/* helper function to set rendering parameters for preview data columns */
|
||||
void preview_style_column (uint32_t col_num, GtkTreeModel* model);
|
||||
/* helper function to check for a valid filename as opposed to a directory */
|
||||
bool check_for_valid_filename ();
|
||||
|
||||
GtkAssistant *csv_imp_asst;
|
||||
|
||||
@ -269,6 +272,7 @@ extern "C"
|
||||
void csv_tximp_assist_prepare_cb (GtkAssistant *assistant, GtkWidget *page, CsvImpTransAssist* info);
|
||||
void csv_tximp_assist_close_cb (GtkAssistant *gtkassistant, CsvImpTransAssist* info);
|
||||
void csv_tximp_assist_finish_cb (GtkAssistant *gtkassistant, CsvImpTransAssist* info);
|
||||
void csv_tximp_file_activated_cb (GtkFileChooser *chooser, CsvImpTransAssist *info);
|
||||
void csv_tximp_file_selection_changed_cb (GtkFileChooser *chooser, CsvImpTransAssist *info);
|
||||
void csv_tximp_preview_del_settings_cb (GtkWidget *button, CsvImpTransAssist *info);
|
||||
void csv_tximp_preview_save_settings_cb (GtkWidget *button, CsvImpTransAssist *info);
|
||||
@ -309,6 +313,10 @@ csv_tximp_assist_finish_cb (GtkAssistant *assistant, CsvImpTransAssist* info)
|
||||
info->assist_finish ();
|
||||
}
|
||||
|
||||
void csv_tximp_file_activated_cb (GtkFileChooser *chooser, CsvImpTransAssist *info)
|
||||
{
|
||||
info->file_activated_cb();
|
||||
}
|
||||
|
||||
void csv_tximp_file_selection_changed_cb (GtkFileChooser *chooser, CsvImpTransAssist *info)
|
||||
{
|
||||
@ -481,6 +489,8 @@ CsvImpTransAssist::CsvImpTransAssist ()
|
||||
file_chooser = gtk_file_chooser_widget_new (GTK_FILE_CHOOSER_ACTION_OPEN);
|
||||
g_signal_connect (G_OBJECT(file_chooser), "selection-changed",
|
||||
G_CALLBACK(csv_tximp_file_selection_changed_cb), this);
|
||||
g_signal_connect (G_OBJECT(file_chooser), "file-activated",
|
||||
G_CALLBACK(csv_tximp_file_activated_cb), this);
|
||||
|
||||
auto box = GTK_WIDGET(gtk_builder_get_object (builder, "file_page"));
|
||||
gtk_box_pack_start (GTK_BOX(box), file_chooser, TRUE, TRUE, 6);
|
||||
@ -671,18 +681,14 @@ CsvImpTransAssist::~CsvImpTransAssist ()
|
||||
* Code related to the file chooser page
|
||||
**************************************************/
|
||||
|
||||
/* csv_tximp_file_selection_changed_cb
|
||||
*
|
||||
* call back for ok button in file chooser widget
|
||||
/* check_for_valid_filename for a valid file to activate the forward button
|
||||
*/
|
||||
void
|
||||
CsvImpTransAssist::file_selection_changed_cb ()
|
||||
bool
|
||||
CsvImpTransAssist::check_for_valid_filename ()
|
||||
{
|
||||
gtk_assistant_set_page_complete (csv_imp_asst, file_page, false);
|
||||
|
||||
auto file_name = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(file_chooser));
|
||||
if (!file_name || g_file_test (file_name, G_FILE_TEST_IS_DIR))
|
||||
return;
|
||||
return false;
|
||||
|
||||
auto filepath = gnc_uri_get_path (file_name);
|
||||
auto starting_dir = g_path_get_dirname (filepath);
|
||||
@ -697,7 +703,36 @@ CsvImpTransAssist::file_selection_changed_cb ()
|
||||
g_free (file_name);
|
||||
g_free (starting_dir);
|
||||
|
||||
gtk_assistant_set_page_complete (csv_imp_asst, file_page, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* csv_tximp_file_activated_cb
|
||||
*
|
||||
* call back for file chooser widget
|
||||
*/
|
||||
void
|
||||
CsvImpTransAssist::file_activated_cb ()
|
||||
{
|
||||
gtk_assistant_set_page_complete (csv_imp_asst, file_page, false);
|
||||
|
||||
/* Test for a valid filename and not a directory */
|
||||
if (check_for_valid_filename ())
|
||||
{
|
||||
gtk_assistant_set_page_complete (csv_imp_asst, file_page, true);
|
||||
gtk_assistant_next_page (csv_imp_asst);
|
||||
}
|
||||
}
|
||||
|
||||
/* csv_tximp_file_selection_changed_cb
|
||||
*
|
||||
* call back for file chooser widget
|
||||
*/
|
||||
void
|
||||
CsvImpTransAssist::file_selection_changed_cb ()
|
||||
{
|
||||
/* Enable the forward button based on a valid filename */
|
||||
gtk_assistant_set_page_complete (csv_imp_asst, file_page,
|
||||
check_for_valid_filename ());
|
||||
}
|
||||
|
||||
|
||||
@ -1847,7 +1882,7 @@ CsvImpTransAssist::assist_preview_page_prepare ()
|
||||
{
|
||||
auto go_back = false;
|
||||
|
||||
/* Load the file into parse_data, reset it if altrady loaded. */
|
||||
/* Load the file into parse_data, reset if already loaded. */
|
||||
if (tx_imp)
|
||||
tx_imp.reset();
|
||||
|
||||
|
@ -78,7 +78,7 @@ fill_model_with_match(GMatchInfo *match_info,
|
||||
* Parse the file for a correctly formatted file
|
||||
*******************************************************/
|
||||
csv_import_result
|
||||
csv_import_read_file (GtkWindow *win, const gchar *filename,
|
||||
csv_import_read_file (GtkWindow *window, const gchar *filename,
|
||||
const gchar *parser_regexp,
|
||||
GtkListStore *store, guint max_rows)
|
||||
{
|
||||
@ -114,7 +114,7 @@ csv_import_read_file (GtkWindow *win, const gchar *filename,
|
||||
parser_regexp, err->message);
|
||||
g_error_free (err);
|
||||
|
||||
dialog = gtk_message_dialog_new (NULL,
|
||||
dialog = gtk_message_dialog_new (window,
|
||||
GTK_DIALOG_MODAL,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_OK, "%s", errmsg);
|
||||
|
@ -64,6 +64,7 @@ struct _main_matcher_info
|
||||
GNCTransactionProcessedCB transaction_processed_cb;
|
||||
gpointer user_data;
|
||||
GNCImportPendingMatches *pending_matches;
|
||||
GtkTreeViewColumn *account_column;
|
||||
};
|
||||
|
||||
enum downloaded_cols
|
||||
@ -72,6 +73,7 @@ enum downloaded_cols
|
||||
DOWNLOADED_COL_DATE_INT64,
|
||||
DOWNLOADED_COL_ACCOUNT,
|
||||
DOWNLOADED_COL_AMOUNT,
|
||||
DOWNLOADED_COL_AMOUNT_DOUBLE,
|
||||
DOWNLOADED_COL_DESCRIPTION,
|
||||
DOWNLOADED_COL_MEMO,
|
||||
DOWNLOADED_COL_ACTION_ADD,
|
||||
@ -423,6 +425,12 @@ add_text_column(GtkTreeView *view, const gchar *title, int col_num)
|
||||
// If date column, use the time64 value for the sorting.
|
||||
if (col_num == DOWNLOADED_COL_DATE_TXT)
|
||||
gtk_tree_view_column_set_sort_column_id(column, DOWNLOADED_COL_DATE_INT64);
|
||||
else if (col_num == DOWNLOADED_COL_AMOUNT) // If amount column, use double value
|
||||
{
|
||||
gtk_cell_renderer_set_alignment (renderer, 1.0, 0.5); // right align amount column
|
||||
gtk_cell_renderer_set_padding (renderer, 5, 0); // add padding so its not close to description
|
||||
gtk_tree_view_column_set_sort_column_id(column, DOWNLOADED_COL_AMOUNT_DOUBLE);
|
||||
}
|
||||
else
|
||||
gtk_tree_view_column_set_sort_column_id(column, col_num);
|
||||
|
||||
@ -468,8 +476,8 @@ gnc_gen_trans_init_view (GNCImportMainMatcher *info,
|
||||
GtkTreeSelection *selection;
|
||||
|
||||
view = info->view;
|
||||
store = gtk_list_store_new(NUM_DOWNLOADED_COLS, G_TYPE_STRING,
|
||||
G_TYPE_INT64, G_TYPE_STRING, G_TYPE_STRING,
|
||||
store = gtk_list_store_new(NUM_DOWNLOADED_COLS, G_TYPE_STRING, G_TYPE_INT64,
|
||||
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_DOUBLE,
|
||||
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN,
|
||||
G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_STRING,
|
||||
GDK_TYPE_PIXBUF, G_TYPE_POINTER, G_TYPE_STRING);
|
||||
@ -483,8 +491,8 @@ gnc_gen_trans_init_view (GNCImportMainMatcher *info,
|
||||
* (keep the line break below to avoid a translator comment) */
|
||||
add_text_column(view,
|
||||
_("Date"), DOWNLOADED_COL_DATE_TXT);
|
||||
column = add_text_column(view, _("Account"), DOWNLOADED_COL_ACCOUNT);
|
||||
gtk_tree_view_column_set_visible(column, show_account);
|
||||
info->account_column = add_text_column(view, _("Account"), DOWNLOADED_COL_ACCOUNT);
|
||||
gtk_tree_view_column_set_visible(info->account_column, show_account);
|
||||
add_text_column(view, _("Amount"), DOWNLOADED_COL_AMOUNT);
|
||||
add_text_column(view, _("Description"), DOWNLOADED_COL_DESCRIPTION);
|
||||
add_text_column(view, _("Memo"), DOWNLOADED_COL_MEMO);
|
||||
@ -530,7 +538,13 @@ gnc_gen_trans_init_view (GNCImportMainMatcher *info,
|
||||
G_CALLBACK(gnc_gen_trans_row_changed_cb), info);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
show_account_column_toggled_cb (GtkToggleButton *togglebutton,
|
||||
GNCImportMainMatcher *info)
|
||||
{
|
||||
gtk_tree_view_column_set_visible (info->account_column,
|
||||
gtk_toggle_button_get_active (togglebutton));
|
||||
}
|
||||
|
||||
GNCImportMainMatcher *gnc_gen_trans_list_new (GtkWidget *parent,
|
||||
const gchar* heading,
|
||||
@ -544,6 +558,7 @@ GNCImportMainMatcher *gnc_gen_trans_list_new (GtkWidget *parent,
|
||||
gboolean show_update;
|
||||
GtkStyleContext *stylectxt;
|
||||
GdkRGBA color;
|
||||
GtkWidget *button;
|
||||
|
||||
info = g_new0 (GNCImportMainMatcher, 1);
|
||||
info->pending_matches = gnc_import_PendingMatches_new();
|
||||
@ -572,6 +587,11 @@ GNCImportMainMatcher *gnc_gen_trans_list_new (GtkWidget *parent,
|
||||
info->view = GTK_TREE_VIEW(gtk_builder_get_object (builder, "downloaded_view"));
|
||||
g_assert (info->view != NULL);
|
||||
|
||||
button = GTK_WIDGET(gtk_builder_get_object (builder, "show_source_account_button"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), all_from_same_account);
|
||||
g_signal_connect(G_OBJECT(button), "toggled",
|
||||
G_CALLBACK(show_account_column_toggled_cb), info);
|
||||
|
||||
show_update = gnc_import_Settings_get_action_update_enabled(info->user_settings);
|
||||
gnc_gen_trans_init_view(info, all_from_same_account, show_update);
|
||||
heading_label = GTK_WIDGET(gtk_builder_get_object (builder, "heading_label"));
|
||||
@ -611,6 +631,7 @@ GNCImportMainMatcher * gnc_gen_trans_assist_new (GtkWidget *parent,
|
||||
gboolean show_update;
|
||||
GtkStyleContext *stylectxt;
|
||||
GdkRGBA color;
|
||||
GtkWidget *button;
|
||||
|
||||
info = g_new0 (GNCImportMainMatcher, 1);
|
||||
info->pending_matches = gnc_import_PendingMatches_new();
|
||||
@ -639,6 +660,11 @@ GNCImportMainMatcher * gnc_gen_trans_assist_new (GtkWidget *parent,
|
||||
info->view = GTK_TREE_VIEW(gtk_builder_get_object (builder, "downloaded_view"));
|
||||
g_assert (info->view != NULL);
|
||||
|
||||
button = GTK_WIDGET(gtk_builder_get_object (builder, "show_source_account_button"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), all_from_same_account);
|
||||
g_signal_connect(G_OBJECT(button), "toggled",
|
||||
G_CALLBACK(show_account_column_toggled_cb), info);
|
||||
|
||||
show_update = gnc_import_Settings_get_action_update_enabled(info->user_settings);
|
||||
gnc_gen_trans_init_view(info, all_from_same_account, show_update);
|
||||
heading_label = GTK_WIDGET(gtk_builder_get_object (builder, "heading_label"));
|
||||
@ -713,6 +739,7 @@ refresh_model_row (GNCImportMainMatcher *gui,
|
||||
gchar *class_extension = NULL;
|
||||
Split *split;
|
||||
time64 date;
|
||||
gnc_numeric amount;
|
||||
g_assert (gui);
|
||||
g_assert (model);
|
||||
g_assert (info);
|
||||
@ -742,11 +769,10 @@ refresh_model_row (GNCImportMainMatcher *gui,
|
||||
g_free(text);
|
||||
|
||||
/*Amount*/
|
||||
ro_text = xaccPrintAmount
|
||||
(xaccSplitGetAmount (split),
|
||||
gnc_split_amount_print_info(split, TRUE)
|
||||
);
|
||||
amount = xaccSplitGetAmount (split);
|
||||
ro_text = xaccPrintAmount (amount, gnc_split_amount_print_info(split, TRUE));
|
||||
gtk_list_store_set(store, iter, DOWNLOADED_COL_AMOUNT, ro_text, -1);
|
||||
gtk_list_store_set(store, iter, DOWNLOADED_COL_AMOUNT_DOUBLE, gnc_numeric_to_double (amount), -1);
|
||||
|
||||
/*Description*/
|
||||
ro_text = xaccTransGetDescription(gnc_import_TransInfo_get_trans(info) );
|
||||
|
Loading…
Reference in New Issue
Block a user