Skip to content

Commit

Permalink
Use GncQuotes in price db window
Browse files Browse the repository at this point in the history
  • Loading branch information
gjanssens authored and jralls committed Oct 2, 2022
1 parent 8896d61 commit 8c08fed
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 21 deletions.
2 changes: 2 additions & 0 deletions gnucash/gnome/CMakeLists.txt
Expand Up @@ -133,6 +133,7 @@ target_link_libraries(gnc-gnome
gnc-register-gnome
gnc-register-core
gnc-gnome-utils
gnc-app-utils
gnc-engine
gnc-expressions
gnc-html
Expand All @@ -148,6 +149,7 @@ target_compile_options(gnc-gnome PRIVATE -Wno-deprecated-declarations)
target_include_directories(gnc-gnome
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE
${CMAKE_SOURCE_DIR}/libgnucash/app-utils
${CMAKE_SOURCE_DIR}/libgnucash/app-utils/calculation
${CMAKE_SOURCE_DIR}/gnucash/html
${CMAKE_BINARY_DIR}/gnucash/gnome-utils # for gnc-warnings.h
Expand Down
28 changes: 7 additions & 21 deletions gnucash/gnome/dialog-price-edit-db.cpp
Expand Up @@ -27,8 +27,8 @@

#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <libguile.h>
#include <time.h>
#include <gnc-quotes.hpp>

extern "C" {
#include "dialog-utils.h"
Expand All @@ -47,9 +47,6 @@ extern "C" {
#include "gnc-ui.h"
#include "gnc-ui-util.h"
#include "gnc-warnings.h"
#include "swig-runtime.h"
#include "guile-mappings.h"
#include "gnc-engine-guile.h"
#include <gnc-glib-utils.h>
}

Expand Down Expand Up @@ -560,30 +557,19 @@ void
gnc_prices_dialog_get_quotes_clicked (GtkWidget *widget, gpointer data)
{
auto pdb_dialog = static_cast<PricesDialog *> (data);
SCM quotes_func;
SCM book_scm;
SCM scm_window;

ENTER(" ");
quotes_func = scm_c_eval_string ("gnc:book-add-quotes");
if (!scm_is_procedure (quotes_func))
GncQuotes quotes (pdb_dialog->book);
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;
}

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);
scm_call_2 (quotes_func, scm_window, book_scm);
quotes.fetch_all();
gnc_unset_busy_cursor (NULL);

/* Without this, the summary bar on the accounts tab
Expand Down

0 comments on commit 8c08fed

Please sign in to comment.