mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[gnucash-core-app.cpp] gnc_load_scm_config has callback to show/log message
thus the cli gnucash-commands.cpp sends a customised callback which doesn't update splash screen.
This commit is contained in:
parent
f8546dc4da
commit
bda9ab71e8
@ -130,7 +130,7 @@ scm_run_report (void *data,
|
||||
scm_c_use_module ("gnucash reports");
|
||||
|
||||
gnc_report_init ();
|
||||
Gnucash::gnc_load_scm_config();
|
||||
Gnucash::gnc_load_scm_config ([](const gchar *msg){ PINFO ("%s", msg); });
|
||||
gnc_prefs_init ();
|
||||
qof_event_suspend ();
|
||||
|
||||
@ -259,7 +259,7 @@ scm_report_show (void *data,
|
||||
scm_c_use_module ("gnucash app-utils");
|
||||
scm_c_use_module ("gnucash reports");
|
||||
gnc_report_init ();
|
||||
Gnucash::gnc_load_scm_config();
|
||||
Gnucash::gnc_load_scm_config ([](const gchar *msg){ PINFO ("%s", msg); });
|
||||
|
||||
if (!args->file_to_load.empty())
|
||||
{
|
||||
@ -291,7 +291,7 @@ scm_report_list ([[maybe_unused]] void *data,
|
||||
scm_c_use_module ("gnucash app-utils");
|
||||
scm_c_use_module ("gnucash reports");
|
||||
gnc_report_init ();
|
||||
Gnucash::gnc_load_scm_config();
|
||||
Gnucash::gnc_load_scm_config ([](const gchar *msg){ PINFO ("%s", msg); });
|
||||
|
||||
scm_call_1 (scm_c_eval_string ("gnc:cmdline-report-list"),
|
||||
scm_current_output_port ());
|
||||
|
@ -41,7 +41,6 @@
|
||||
#include <gnc-path.h>
|
||||
#include <gnc-prefs.h>
|
||||
#include <gnc-gsettings.h>
|
||||
#include <gnc-splash.h>
|
||||
#include <gnc-version.h>
|
||||
#include "gnucash-locale-platform.h"
|
||||
|
||||
@ -84,22 +83,15 @@ gnc_print_unstable_message(void)
|
||||
<< bl::format (std::string{_("To find the last stable version, please refer to {1}")}) % PACKAGE_URL << "\n";
|
||||
}
|
||||
|
||||
static void
|
||||
update_message(const gchar *msg)
|
||||
{
|
||||
gnc_update_splash_screen(msg, GNC_SPLASH_PERCENTAGE_UNKNOWN);
|
||||
PINFO("%s", msg);
|
||||
}
|
||||
|
||||
void
|
||||
Gnucash::gnc_load_scm_config (void)
|
||||
Gnucash::gnc_load_scm_config (MessageCb update_message_cb)
|
||||
{
|
||||
static auto is_system_config_loaded = false;
|
||||
if (!is_system_config_loaded)
|
||||
{
|
||||
/* Translators: Guile is the programming language of the reports */
|
||||
auto msg = _("Loading system wide Guile extensions…");
|
||||
update_message (msg);
|
||||
update_message_cb (msg);
|
||||
auto system_config_dir = gnc_path_get_pkgsysconfdir ();
|
||||
auto system_config = g_build_filename (system_config_dir, "config", nullptr);
|
||||
is_system_config_loaded = gfec_try_load (system_config);
|
||||
@ -111,7 +103,7 @@ Gnucash::gnc_load_scm_config (void)
|
||||
if (!is_user_config_loaded)
|
||||
{
|
||||
auto msg = _("Loading user specific Guile extensions…");
|
||||
update_message (msg);
|
||||
update_message_cb (msg);
|
||||
auto config_filename = g_build_filename (gnc_userconfig_dir (), "config-user.scm", nullptr);
|
||||
is_user_config_loaded = gfec_try_load (config_filename);
|
||||
g_free (config_filename);
|
||||
|
@ -70,6 +70,8 @@ private:
|
||||
char *sys_locale = nullptr;
|
||||
};
|
||||
|
||||
void gnc_load_scm_config(void);
|
||||
using MessageCb = std::function<void(const char*)>;
|
||||
|
||||
void gnc_load_scm_config (MessageCb update_message);
|
||||
}
|
||||
#endif
|
||||
|
@ -155,7 +155,11 @@ scm_run_gnucash (void *data, [[maybe_unused]] int argc, [[maybe_unused]] char **
|
||||
/* Load the scm config files before starting up the gui. This ensures that
|
||||
* custom reports have been read into memory before the Reports
|
||||
* menu is created. */
|
||||
Gnucash::gnc_load_scm_config();
|
||||
Gnucash::gnc_load_scm_config ([](const gchar *msg)
|
||||
{
|
||||
gnc_update_splash_screen (msg, GNC_SPLASH_PERCENTAGE_UNKNOWN);
|
||||
PINFO ("%s", msg);
|
||||
});
|
||||
|
||||
/* Setting-up the report menu must come after the module
|
||||
loading but before the gui initialization. */
|
||||
|
Loading…
Reference in New Issue
Block a user