mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Further cleanup in gnucash and gnucash-cli
- Remove unneeded includes, required a few fixes in other header files - Silence unused parameter warnings using c++17 attribute [[maybe_unused]] - Remove some duplicate, unused functions from gnucash and gnucash-cli They were a left over from a previous commit
This commit is contained in:
parent
c58cfdb87d
commit
969d00a59f
@ -117,6 +117,7 @@
|
||||
|
||||
#include <glib.h>
|
||||
#include "qof.h"
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -26,6 +26,8 @@
|
||||
#define GNC_PREFS_GROUP_NEW_USER "dialogs.new-user"
|
||||
#define GNC_PREF_FIRST_STARTUP "first-startup"
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
typedef struct _GNCNewUserDialog GNCNewUserDialog;
|
||||
|
||||
void gnc_ui_new_user_dialog (void);
|
||||
|
@ -22,18 +22,10 @@
|
||||
*/
|
||||
#include <config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <libguile.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <glib.h>
|
||||
#include <binreloc.h>
|
||||
#include <gnc-locale-utils.h>
|
||||
#include <gnc-engine.h>
|
||||
#include <gnc-ui-util.h>
|
||||
#include <gnc-commodity.h>
|
||||
#include <swig-runtime.h>
|
||||
#include <guile-mappings.h>
|
||||
#ifdef __MINGW32__
|
||||
#include <Windows.h>
|
||||
@ -44,17 +36,12 @@
|
||||
|
||||
extern "C" {
|
||||
#include <gfec.h>
|
||||
#include <gnc-engine-guile.h>
|
||||
#include <gnc-environment.h>
|
||||
#include <gnc-filepath-utils.h>
|
||||
#include <gnc-hooks.h>
|
||||
#include <gnc-path.h>
|
||||
#include <gnc-prefs.h>
|
||||
#include <gnc-prefs-utils.h>
|
||||
#include <gnc-gnome-utils.h>
|
||||
#include <gnc-gsettings.h>
|
||||
#include <gnc-report.h>
|
||||
#include <gnc-session.h>
|
||||
#include <gnc-splash.h>
|
||||
#include <gnc-version.h>
|
||||
}
|
||||
|
@ -44,15 +44,15 @@ private:
|
||||
int gnucash_show_version = 0;
|
||||
int debugging = 0;
|
||||
int extra = 0;
|
||||
gchar **log_flags = NULL;
|
||||
char *log_to_filename = NULL;
|
||||
char **log_flags = nullptr;
|
||||
char *log_to_filename = nullptr;
|
||||
int nofile = 0;
|
||||
const gchar *gsettings_prefix = NULL;
|
||||
const char *add_quotes_file = NULL;
|
||||
char *namespace_regexp = NULL;
|
||||
const char *file_to_load = NULL;
|
||||
gchar **args_remaining = NULL;
|
||||
gchar *sys_locale = NULL;
|
||||
const char *gsettings_prefix = nullptr;
|
||||
const char *add_quotes_file = nullptr;
|
||||
char *namespace_regexp = nullptr;
|
||||
const char *file_to_load = nullptr;
|
||||
char **args_remaining = nullptr;
|
||||
char *sys_locale = nullptr;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -22,18 +22,7 @@
|
||||
*/
|
||||
#include <config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <libguile.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <glib.h>
|
||||
#include <binreloc.h>
|
||||
#include <gnc-locale-utils.h>
|
||||
#include <gnc-engine.h>
|
||||
#include <gnc-ui-util.h>
|
||||
#include <gnc-commodity.h>
|
||||
#include <swig-runtime.h>
|
||||
#include <guile-mappings.h>
|
||||
#ifdef __MINGW32__
|
||||
#include <Windows.h>
|
||||
@ -43,137 +32,17 @@
|
||||
#include "gnucash-base.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include <gfec.h>
|
||||
#include <gnc-engine-guile.h>
|
||||
#include <gnc-environment.h>
|
||||
#include <gnc-filepath-utils.h>
|
||||
#include <gnc-hooks.h>
|
||||
#include <gnc-path.h>
|
||||
#include <gnc-prefs.h>
|
||||
#include <gnc-prefs-utils.h>
|
||||
#include <gnc-gnome-utils.h>
|
||||
#include <gnc-gsettings.h>
|
||||
#include <gnc-report.h>
|
||||
#include <gnc-session.h>
|
||||
#include <gnc-splash.h>
|
||||
#include <gnc-version.h>
|
||||
}
|
||||
|
||||
/* This static indicates the debugging module that this .o belongs to. */
|
||||
static QofLogModule log_module = GNC_MOD_GUI;
|
||||
|
||||
/* Change the following to have a console window attached to GnuCash
|
||||
* for displaying stdout and stderr on Windows.
|
||||
*/
|
||||
#define __MSWIN_CONSOLE__ 0
|
||||
|
||||
#include <libintl.h>
|
||||
#include <locale.h>
|
||||
|
||||
#ifdef MAC_INTEGRATION
|
||||
# include <Foundation/Foundation.h>
|
||||
#endif
|
||||
|
||||
/* GNC_VCS is defined whenever we're building from an svn/svk/git/bzr tree */
|
||||
#ifdef GNC_VCS
|
||||
static int is_development_version = TRUE;
|
||||
#else
|
||||
static int is_development_version = FALSE;
|
||||
#define GNC_VCS ""
|
||||
#endif
|
||||
|
||||
static gchar *userdata_migration_msg = NULL;
|
||||
|
||||
static void
|
||||
gnc_print_unstable_message(void)
|
||||
{
|
||||
if (!is_development_version) return;
|
||||
|
||||
g_print("\n\n%s\n%s\n%s %s\n%s %s\n",
|
||||
_("This is a development version. It may or may not work."),
|
||||
_("Report bugs and other problems to gnucash-devel@gnucash.org"),
|
||||
/* Translators: An URLs follows*/
|
||||
_("You can also lookup and file bug reports at"), PACKAGE_BUGREPORT,
|
||||
/* Translators: An URLs follows*/
|
||||
_("To find the last stable version, please refer to"), PACKAGE_URL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
try_load_config_array(const gchar *fns[])
|
||||
{
|
||||
gchar *filename;
|
||||
int i;
|
||||
|
||||
for (i = 0; fns[i]; i++)
|
||||
{
|
||||
filename = gnc_build_userdata_path(fns[i]);
|
||||
if (gfec_try_load(filename))
|
||||
{
|
||||
g_free(filename);
|
||||
return TRUE;
|
||||
}
|
||||
g_free(filename);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
update_message(const gchar *msg)
|
||||
{
|
||||
gnc_update_splash_screen(msg, GNC_SPLASH_PERCENTAGE_UNKNOWN);
|
||||
g_message("%s", msg);
|
||||
}
|
||||
|
||||
static void
|
||||
load_system_config(void)
|
||||
{
|
||||
static int is_system_config_loaded = FALSE;
|
||||
gchar *system_config_dir;
|
||||
gchar *system_config;
|
||||
|
||||
if (is_system_config_loaded) return;
|
||||
|
||||
update_message("loading system configuration");
|
||||
system_config_dir = gnc_path_get_pkgsysconfdir();
|
||||
system_config = g_build_filename(system_config_dir, "config", NULL);
|
||||
is_system_config_loaded = gfec_try_load(system_config);
|
||||
g_free(system_config_dir);
|
||||
g_free(system_config);
|
||||
}
|
||||
|
||||
static void
|
||||
load_user_config(void)
|
||||
{
|
||||
/* Don't continue adding to this list. When 3.0 rolls around bump
|
||||
the 2.4 files off the list. */
|
||||
static const gchar *saved_report_files[] =
|
||||
{
|
||||
SAVED_REPORTS_FILE, SAVED_REPORTS_FILE_OLD_REV, NULL
|
||||
};
|
||||
static const gchar *stylesheet_files[] = { "stylesheets-2.0", NULL};
|
||||
static int is_user_config_loaded = FALSE;
|
||||
|
||||
if (is_user_config_loaded)
|
||||
return;
|
||||
else is_user_config_loaded = TRUE;
|
||||
|
||||
update_message("loading user configuration");
|
||||
{
|
||||
gchar *config_filename;
|
||||
config_filename = g_build_filename (gnc_userconfig_dir (),
|
||||
"config-user.scm", (char *)NULL);
|
||||
gfec_try_load(config_filename);
|
||||
g_free(config_filename);
|
||||
}
|
||||
|
||||
update_message("loading saved reports");
|
||||
try_load_config_array(saved_report_files);
|
||||
update_message("loading stylesheets");
|
||||
try_load_config_array(stylesheet_files);
|
||||
}
|
||||
|
||||
static void
|
||||
inner_main_add_price_quotes(void *data, int argc, char **argv)
|
||||
inner_main_add_price_quotes(void *data, [[maybe_unused]] int argc, [[maybe_unused]] char **argv)
|
||||
{
|
||||
const char* add_quotes_file = static_cast<const char*>(data);
|
||||
SCM mod, add_quotes, scm_book, scm_result = SCM_BOOL_F;
|
||||
|
@ -22,21 +22,8 @@
|
||||
*/
|
||||
#include <config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <libguile.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <glib.h>
|
||||
#include <binreloc.h>
|
||||
#include <gnc-locale-utils.h>
|
||||
#include <gnc-engine.h>
|
||||
#include <gnc-ui-util.h>
|
||||
#include <gnc-commodity.h>
|
||||
#include <swig-runtime.h>
|
||||
#include <guile-mappings.h>
|
||||
#include <window-report.h>
|
||||
#ifdef __MINGW32__
|
||||
#include <Windows.h>
|
||||
#include <fcntl.h>
|
||||
@ -47,14 +34,10 @@
|
||||
extern "C" {
|
||||
#include <dialog-new-user.h>
|
||||
#include <gfec.h>
|
||||
#include <gnc-engine-guile.h>
|
||||
#include <gnc-environment.h>
|
||||
#include <gnc-file.h>
|
||||
#include <gnc-filepath-utils.h>
|
||||
#include <gnc-gnome-utils.h>
|
||||
#include <gnc-gsettings.h>
|
||||
#include <gnc-hooks.h>
|
||||
#include <gnc-main-window.h>
|
||||
#include <gnc-module.h>
|
||||
#include <gnc-path.h>
|
||||
#include <gnc-plugin-bi-import.h>
|
||||
@ -70,7 +53,6 @@ extern "C" {
|
||||
#include <gnc-report.h>
|
||||
#include <gnc-session.h>
|
||||
#include <gnc-splash.h>
|
||||
#include <gnc-version.h>
|
||||
#include <gnucash-register.h>
|
||||
#include <search-core-type.h>
|
||||
#include <top-level.h>
|
||||
@ -78,43 +60,8 @@ extern "C" {
|
||||
|
||||
/* This static indicates the debugging module that this .o belongs to. */
|
||||
static QofLogModule log_module = GNC_MOD_GUI;
|
||||
|
||||
/* Change the following to have a console window attached to GnuCash
|
||||
* for displaying stdout and stderr on Windows.
|
||||
*/
|
||||
#define __MSWIN_CONSOLE__ 0
|
||||
|
||||
#include <libintl.h>
|
||||
#include <locale.h>
|
||||
|
||||
#ifdef MAC_INTEGRATION
|
||||
# include <Foundation/Foundation.h>
|
||||
#endif
|
||||
|
||||
/* GNC_VCS is defined whenever we're building from an svn/svk/git/bzr tree */
|
||||
#ifdef GNC_VCS
|
||||
static int is_development_version = TRUE;
|
||||
#else
|
||||
static int is_development_version = FALSE;
|
||||
#define GNC_VCS ""
|
||||
#endif
|
||||
|
||||
static gchar *userdata_migration_msg = NULL;
|
||||
|
||||
static void
|
||||
gnc_print_unstable_message(void)
|
||||
{
|
||||
if (!is_development_version) return;
|
||||
|
||||
g_print("\n\n%s\n%s\n%s %s\n%s %s\n",
|
||||
_("This is a development version. It may or may not work."),
|
||||
_("Report bugs and other problems to gnucash-devel@gnucash.org"),
|
||||
/* Translators: An URLs follows*/
|
||||
_("You can also lookup and file bug reports at"), PACKAGE_BUGREPORT,
|
||||
/* Translators: An URLs follows*/
|
||||
_("To find the last stable version, please refer to"), PACKAGE_URL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
try_load_config_array(const gchar *fns[])
|
||||
{
|
||||
@ -231,7 +178,7 @@ load_gnucash_modules()
|
||||
}
|
||||
|
||||
static void
|
||||
inner_main_add_price_quotes(void *data, int argc, char **argv)
|
||||
inner_main_add_price_quotes(void *data, [[maybe_unused]] int argc, [[maybe_unused]] char **argv)
|
||||
{
|
||||
const char* add_quotes_file = static_cast<const char*>(data);
|
||||
SCM mod, add_quotes, scm_book, scm_result = SCM_BOOL_F;
|
||||
@ -309,7 +256,7 @@ struct t_file_spec {
|
||||
};
|
||||
|
||||
static void
|
||||
inner_main (void *data, int argc, char **argv)
|
||||
inner_main (void *data, [[maybe_unused]] int argc, [[maybe_unused]] char **argv)
|
||||
{
|
||||
auto user_file_spec = static_cast<t_file_spec*>(data);
|
||||
SCM main_mod;
|
||||
|
Loading…
Reference in New Issue
Block a user