app-utils - move component manager to gnome-utils

It's primary purpose is to track gui objects' lifetimes. There's no
need for libgnucash (a non-gui library) to deal with that.
This required two book options related gui-only call backs
to be moved to gnome-utils as well.
This commit is contained in:
Geert Janssens 2019-11-26 16:39:21 +01:00
parent 0de3dc6bf1
commit 43647c7a54
10 changed files with 48 additions and 49 deletions

View File

@ -53,6 +53,7 @@ set (gnome_utils_SOURCES
gnc-cell-renderer-text-flag.c
gnc-combott.c
gnc-commodity-edit.c
gnc-component-manager.c
gnc-currency-edit.c
gnc-date-delta.c
gnc-date-edit.c
@ -141,6 +142,7 @@ set (gnome_utils_HEADERS
gnc-cell-renderer-text-flag.h
gnc-combott.h
gnc-commodity-edit.h
gnc-component-manager.h
gnc-currency-edit.h
gnc-date-delta.h
gnc-date-edit.h

View File

@ -48,9 +48,11 @@
#include "dialog-reset-warnings.h"
#include "dialog-transfer.h"
#include "dialog-utils.h"
#include "engine-helpers.h"
#include "file-utils.h"
#include "gnc-component-manager.h"
#include "gnc-engine.h"
#include "gnc-features.h"
#include "gnc-file.h"
#include "gnc-filepath-utils.h"
#include "gnc-gkeyfile-utils.h"
@ -4111,6 +4113,44 @@ gnc_book_options_dialog_close_cb(GNCOptionWin * optionwin,
gnc_option_db_destroy(options);
}
/** Calls gnc_book_option_num_field_source_change to initiate registered
* callbacks when num_field_source book option changes so that
* registers/reports can update themselves; sets feature flag */
void
gnc_book_option_num_field_source_change_cb (gboolean num_action)
{
gnc_suspend_gui_refresh ();
if (num_action)
{
/* Set a feature flag in the book for use of the split action field as number.
* This will prevent older GnuCash versions that don't support this feature
* from opening this file. */
gnc_features_set_used (gnc_get_current_book(),
GNC_FEATURE_NUM_FIELD_SOURCE);
}
gnc_book_option_num_field_source_change (num_action);
gnc_resume_gui_refresh ();
}
/** Calls gnc_book_option_book_currency_selected to initiate registered
* callbacks when currency accounting book option changes to book-currency so
* that registers/reports can update themselves; sets feature flag */
void
gnc_book_option_book_currency_selected_cb (gboolean use_book_currency)
{
gnc_suspend_gui_refresh ();
if (use_book_currency)
{
/* Set a feature flag in the book for use of book currency. This will
* prevent older GnuCash versions that don't support this feature from
* opening this file. */
gnc_features_set_used (gnc_get_current_book(),
GNC_FEATURE_BOOK_CURRENCY);
}
gnc_book_option_book_currency_selected (use_book_currency);
gnc_resume_gui_refresh ();
}
static gboolean
show_handler (const char *class_name, gint component_id,
gpointer user_data, gpointer iter_data)

View File

@ -33,6 +33,7 @@
#include "gnc-module.h"
#include "gnc-module-api.h"
#include "gnc-component-manager.h"
#include "dialog-options.h"
#include "qof.h"
#include "gnc-gui-query.h"
@ -85,6 +86,7 @@ libgncmod_gnome_utils_gnc_module_init(int refcount)
/* Initialize the options-ui database */
if (refcount == 0)
{
gnc_component_manager_init ();
gnc_options_ui_initialize ();
}
@ -94,5 +96,8 @@ libgncmod_gnome_utils_gnc_module_init(int refcount)
int
libgncmod_gnome_utils_gnc_module_end(int refcount)
{
if (refcount == 0)
gnc_component_manager_shutdown ();
return TRUE;
}

View File

@ -18,7 +18,6 @@ set (app_utils_HEADERS
gnc-account-merge.h
gnc-accounting-period.h
gnc-addr-quickfill.h
gnc-component-manager.h
gnc-entry-quickfill.h
gnc-euro.h
gnc-exp-parser.h
@ -56,7 +55,6 @@ set (app_utils_SOURCES
gnc-account-merge.c
gnc-accounting-period.c
gnc-addr-quickfill.c
gnc-component-manager.c
gnc-entry-quickfill.c
gnc-euro.c
gnc-exp-parser.c

View File

@ -30,7 +30,6 @@
#include <gnc-helpers.h>
#include <gnc-accounting-period.h>
#include <gnc-session.h>
#include <gnc-component-manager.h>
#include <gnc-sx-instance-model.h>
#include "gnc-engine-guile.h"

View File

@ -56,8 +56,6 @@
#include "gnc-session.h"
#include "engine-helpers.h"
#include "gnc-locale-utils.h"
#include "gnc-component-manager.h"
#include "gnc-features.h"
#include "gnc-guile-utils.h"
#define GNC_PREF_CURRENCY_CHOICE_LOCALE "currency-choice-locale"
@ -414,44 +412,6 @@ gnc_get_current_book_tax_type (void)
}
}
/** Calls gnc_book_option_num_field_source_change to initiate registered
* callbacks when num_field_source book option changes so that
* registers/reports can update themselves; sets feature flag */
void
gnc_book_option_num_field_source_change_cb (gboolean num_action)
{
gnc_suspend_gui_refresh ();
if (num_action)
{
/* Set a feature flag in the book for use of the split action field as number.
* This will prevent older GnuCash versions that don't support this feature
* from opening this file. */
gnc_features_set_used (gnc_get_current_book(),
GNC_FEATURE_NUM_FIELD_SOURCE);
}
gnc_book_option_num_field_source_change (num_action);
gnc_resume_gui_refresh ();
}
/** Calls gnc_book_option_book_currency_selected to initiate registered
* callbacks when currency accounting book option changes to book-currency so
* that registers/reports can update themselves; sets feature flag */
void
gnc_book_option_book_currency_selected_cb (gboolean use_book_currency)
{
gnc_suspend_gui_refresh ();
if (use_book_currency)
{
/* Set a feature flag in the book for use of book currency. This will
* prevent older GnuCash versions that don't support this feature from
* opening this file. */
gnc_features_set_used (gnc_get_current_book(),
GNC_FEATURE_BOOK_CURRENCY);
}
gnc_book_option_book_currency_selected (use_book_currency);
gnc_resume_gui_refresh ();
}
/** Returns TRUE if both book-currency and default gain/loss policy KVPs exist
* and are valid and trading accounts are not used. */
gboolean

View File

@ -32,7 +32,6 @@
#include "gnc-module.h"
#include "gnc-module-api.h"
#include "gnc-component-manager.h"
#include "gnc-hooks.h"
#include "gnc-exp-parser.h"
@ -88,7 +87,6 @@ libgncmod_app_utils_gnc_module_init(int refcount)
if (refcount == 0)
{
gnc_component_manager_init ();
gnc_hook_add_dangler(HOOK_STARTUP, (GFunc)gnc_exp_parser_init, NULL, NULL);
gnc_hook_add_dangler(HOOK_SHUTDOWN, (GFunc)app_utils_shutdown, NULL, NULL);
}
@ -99,8 +97,5 @@ libgncmod_app_utils_gnc_module_init(int refcount)
int
libgncmod_app_utils_gnc_module_end(int refcount)
{
if (refcount == 0)
gnc_component_manager_shutdown ();
return TRUE;
}

View File

@ -157,6 +157,7 @@ gnucash/gnome-utils/gnc-cell-renderer-popup-entry.c
gnucash/gnome-utils/gnc-cell-renderer-text-flag.c
gnucash/gnome-utils/gnc-combott.c
gnucash/gnome-utils/gnc-commodity-edit.c
gnucash/gnome-utils/gnc-component-manager.c
gnucash/gnome-utils/gnc-currency-edit.c
gnucash/gnome-utils/gnc-date-delta.c
gnucash/gnome-utils/gnc-date-edit.c
@ -528,7 +529,6 @@ libgnucash/app-utils/gfec.c
libgnucash/app-utils/gnc-accounting-period.c
libgnucash/app-utils/gnc-account-merge.c
libgnucash/app-utils/gnc-addr-quickfill.c
libgnucash/app-utils/gnc-component-manager.c
libgnucash/app-utils/gnc-entry-quickfill.c
libgnucash/app-utils/gnc-euro.c
libgnucash/app-utils/gnc-exp-parser.c