mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug 797042 - OK button in OFX importer doesn't work if nothing is imported.
This commit is contained in:
parent
9865a99663
commit
3cb49c92d1
@ -177,6 +177,17 @@ void gnc_gen_trans_list_delete (GNCImportMainMatcher *info)
|
||||
g_free (info);
|
||||
}
|
||||
|
||||
gboolean gnc_gen_trans_list_empty(GNCImportMainMatcher *info) {
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
GNCImportTransInfo *trans_info;
|
||||
|
||||
g_assert (info);
|
||||
|
||||
model = gtk_tree_view_get_model (info->view);
|
||||
return !gtk_tree_model_get_iter_first (model, &iter);
|
||||
}
|
||||
|
||||
void
|
||||
on_matcher_ok_clicked (GtkButton *button, GNCImportMainMatcher *info)
|
||||
{
|
||||
@ -189,8 +200,11 @@ on_matcher_ok_clicked (GtkButton *button, GNCImportMainMatcher *info)
|
||||
/* DEBUG ("Begin") */
|
||||
|
||||
model = gtk_tree_view_get_model (info->view);
|
||||
if (!gtk_tree_model_get_iter_first (model, &iter))
|
||||
if (!gtk_tree_model_get_iter_first (model, &iter)) {
|
||||
// No transaction, we can just close the dialog. JEAN OK CLICKED NO TRANS
|
||||
gnc_gen_trans_list_delete (info);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Don't run any queries and/or split sorts while processing the matcher
|
||||
results. */
|
||||
|
@ -178,5 +178,11 @@ gboolean gnc_gen_trans_list_run (GNCImportMainMatcher *info);
|
||||
*/
|
||||
GtkWidget *gnc_gen_trans_list_widget (GNCImportMainMatcher *info);
|
||||
|
||||
/** Checks whether there are no transactions to match.
|
||||
*/
|
||||
gboolean gnc_gen_trans_list_empty(GNCImportMainMatcher *info);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
/**@}*/
|
||||
|
@ -1064,6 +1064,7 @@ void gnc_file_ofx_import (GtkWindow *parent)
|
||||
DEBUG("Filename found: %s", selected_filename);
|
||||
|
||||
/* Create the Generic transaction importer GUI. */
|
||||
// JEAN IMPORT: Trans list UI created
|
||||
gnc_ofx_importer_gui = gnc_gen_trans_list_new (GTK_WIDGET(parent), NULL, FALSE, 42);
|
||||
|
||||
/* Look up the needed preferences */
|
||||
@ -1085,7 +1086,15 @@ void gnc_file_ofx_import (GtkWindow *parent)
|
||||
#endif
|
||||
|
||||
DEBUG("Opening selected file");
|
||||
// JEAN: Where the ofx file is loaded.
|
||||
libofx_proc_file(libofx_context, selected_filename, AUTODETECT);
|
||||
// Now would be a good time to see whether the view has anything in it!
|
||||
gboolean is_empty = gnc_gen_trans_list_empty(gnc_ofx_importer_gui);
|
||||
if(is_empty) {
|
||||
// JEAN CLOSE THE WINDOW NO TRANS
|
||||
gnc_gen_trans_list_delete (gnc_ofx_importer_gui);
|
||||
gnc_info_dialog(parent,_("OFX file imported, no new transactions"));
|
||||
}
|
||||
g_free(selected_filename);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user