Use GncQuotes in price db window

This commit is contained in:
Geert Janssens 2021-03-16 13:54:01 +01:00 committed by John Ralls
parent 8896d61c7a
commit 8c08fedaa1
2 changed files with 9 additions and 21 deletions

View File

@ -133,6 +133,7 @@ target_link_libraries(gnc-gnome
gnc-register-gnome gnc-register-gnome
gnc-register-core gnc-register-core
gnc-gnome-utils gnc-gnome-utils
gnc-app-utils
gnc-engine gnc-engine
gnc-expressions gnc-expressions
gnc-html gnc-html
@ -148,6 +149,7 @@ target_compile_options(gnc-gnome PRIVATE -Wno-deprecated-declarations)
target_include_directories(gnc-gnome target_include_directories(gnc-gnome
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE PRIVATE
${CMAKE_SOURCE_DIR}/libgnucash/app-utils
${CMAKE_SOURCE_DIR}/libgnucash/app-utils/calculation ${CMAKE_SOURCE_DIR}/libgnucash/app-utils/calculation
${CMAKE_SOURCE_DIR}/gnucash/html ${CMAKE_SOURCE_DIR}/gnucash/html
${CMAKE_BINARY_DIR}/gnucash/gnome-utils # for gnc-warnings.h ${CMAKE_BINARY_DIR}/gnucash/gnome-utils # for gnc-warnings.h

View File

@ -27,8 +27,8 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <glib/gi18n.h> #include <glib/gi18n.h>
#include <libguile.h>
#include <time.h> #include <time.h>
#include <gnc-quotes.hpp>
extern "C" { extern "C" {
#include "dialog-utils.h" #include "dialog-utils.h"
@ -47,9 +47,6 @@ extern "C" {
#include "gnc-ui.h" #include "gnc-ui.h"
#include "gnc-ui-util.h" #include "gnc-ui-util.h"
#include "gnc-warnings.h" #include "gnc-warnings.h"
#include "swig-runtime.h"
#include "guile-mappings.h"
#include "gnc-engine-guile.h"
#include <gnc-glib-utils.h> #include <gnc-glib-utils.h>
} }
@ -560,30 +557,19 @@ void
gnc_prices_dialog_get_quotes_clicked (GtkWidget *widget, gpointer data) gnc_prices_dialog_get_quotes_clicked (GtkWidget *widget, gpointer data)
{ {
auto pdb_dialog = static_cast<PricesDialog *> (data); auto pdb_dialog = static_cast<PricesDialog *> (data);
SCM quotes_func;
SCM book_scm;
SCM scm_window;
ENTER(" "); ENTER(" ");
quotes_func = scm_c_eval_string ("gnc:book-add-quotes"); GncQuotes quotes (pdb_dialog->book);
if (!scm_is_procedure (quotes_func)) if (quotes.cmd_result() != 0)
{ {
LEAVE(" no procedure"); if (!quotes.error_msg().empty())
PWARN ("%s", quotes.error_msg().c_str());
LEAVE("quote retrieval failed");
return; return;
} }
book_scm = gnc_book_to_scm (pdb_dialog->book);
if (scm_is_true (scm_not (book_scm)))
{
LEAVE("no book");
return;
}
scm_window = SWIG_NewPointerObj(pdb_dialog->window,
SWIG_TypeQuery("_p_GtkWindow"), 0);
gnc_set_busy_cursor (NULL, TRUE); gnc_set_busy_cursor (NULL, TRUE);
scm_call_2 (quotes_func, scm_window, book_scm); quotes.fetch_all();
gnc_unset_busy_cursor (NULL); gnc_unset_busy_cursor (NULL);
/* Without this, the summary bar on the accounts tab /* Without this, the summary bar on the accounts tab