From dc99c087e5e90d645b1977cf0841ea608798cc44 Mon Sep 17 00:00:00 2001 From: Dave Peticolas Date: Mon, 19 Jun 2000 07:48:24 +0000 Subject: [PATCH] Remove guile dependency from src/register/gnome git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2481 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 9 ++++++ src/gnome/top-level.c | 42 ++++++++++++++++++++++++++++ src/register/combocell.h | 24 ++++++++-------- src/register/gnome/Makefile.am | 1 - src/register/gnome/Makefile.in | 2 +- src/register/gnome/combocell-gnome.c | 14 +++++++--- 6 files changed, 74 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6059fb047e..6808c38fed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2000-06-19 Dave Peticolas + + * src/gnome/top-level.c: configure list auto-popping from here. + + * src/register/gnome/combocell-gnome.c: determine whether or not + to auto-pop lists based on a class variable, and not by looking + up the guile function. This removes a src/guile dependency from + src/register/gnome. + 2000-06-14 Dave Peticolas * src/register/gnome/gnucash-item-edit.c (item_edit_show_list): diff --git a/src/gnome/top-level.c b/src/gnome/top-level.c index eabc971c69..8bc43ee3e5 100644 --- a/src/gnome/top-level.c +++ b/src/gnome/top-level.c @@ -52,6 +52,7 @@ #include "SplitLedger.h" #include "guile-util.h" #include "splitreg.h" +#include "combocell.h" /** PROTOTYPES ******************************************************/ @@ -68,6 +69,8 @@ static void gnc_configure_register_borders(void); static void gnc_configure_reverse_balance_cb(void *); static void gnc_configure_reverse_balance(void); static void gnc_configure_sr_label_callbacks(); +static void gnc_configure_auto_raise_cb(void *); +static void gnc_configure_auto_raise(void); /** GLOBALS *********************************************************/ /* This static indicates the debugging module that this .o belongs to. */ @@ -85,6 +88,7 @@ static SCM account_separator_callback_id = SCM_UNDEFINED; static SCM register_colors_callback_id = SCM_UNDEFINED; static SCM register_borders_callback_id = SCM_UNDEFINED; static SCM reverse_balance_callback_id = SCM_UNDEFINED; +static SCM auto_raise_callback_id = SCM_UNDEFINED; /* ============================================================== */ @@ -169,6 +173,12 @@ gnucash_ui_init() NULL, "General", "Reversed-balance account types"); + gnc_configure_auto_raise(); + auto_raise_callback_id = + gnc_register_option_change_callback(gnc_configure_auto_raise_cb, + NULL, "Register", + "Auto-Raise Lists"); + gnc_configure_sr_label_callbacks(); mainWindow(); @@ -221,6 +231,7 @@ gnc_ui_destroy (void) gnc_unregister_option_change_callback_id(register_colors_callback_id); gnc_unregister_option_change_callback_id(register_borders_callback_id); gnc_unregister_option_change_callback_id(reverse_balance_callback_id); + gnc_unregister_option_change_callback_id(auto_raise_callback_id); if (app != NULL) { @@ -586,6 +597,37 @@ gnc_configure_register_borders(void) gnucash_style_set_register_borders (reg_borders); } +/* gnc_configure_auto_raise_cb + * Callback called when options change - sets + * auto-raise status of combocell class + * + * Args: Nothing + * Returns: Nothing + */ +static void +gnc_configure_auto_raise_cb(void *data) +{ + gnc_configure_auto_raise(); +} + +/* gnc_configure_auto_raise + * sets combocell auto raise status + * + * Args: Nothing + * Returns: Nothing + */ +static void +gnc_configure_auto_raise(void) +{ + gncBoolean auto_pop; + + auto_pop = gnc_lookup_boolean_option("Register", + "Auto-Raise Lists", + GNC_T); + + xaccComboCellSetAutoPop(auto_pop); +} + /* gnc_configure_reverse_balance_cb * Callback called when options change - sets * reverse balance info for the callback diff --git a/src/register/combocell.h b/src/register/combocell.h index b73d1e77b4..2a09cc842a 100644 --- a/src/register/combocell.h +++ b/src/register/combocell.h @@ -60,26 +60,26 @@ void xaccSetComboCellValue (ComboCell *, const char *); void xaccClearComboCellMenu (ComboCell *); void xaccAddComboCellMenuItem (ComboCell *, char * menustr); -/* Only functional in Gnome, right now. Determines whether - * the cell will accept strings not in the menu. Defaults - * to strict, i.e., only menu items are accepted. */ +/* Determines whether the cell will accept strings not in the + * menu. Defaults to strict, i.e., only menu items are accepted. */ void xaccComboCellSetStrict (ComboCell *, gncBoolean); -/* Only functional in Gnome, right now. Sets a character used - * for special completion processing. */ +/* Sets a character used for special completion processing. */ void xaccComboCellSetCompleteChar (ComboCell *, char); -/* Only functional in Gnome, right now. Sets a string which, - * if the cell has that value, will be returned on an enter, - * thus preventing the cell from being edited. This is used - * for transactions with multiple splits. */ +/* Sets a string which, if the cell has that value, will be returned + * on an enter, thus preventing the cell from being edited. This is + * used for transactions with multiple splits. */ void xaccComboCellSetIgnoreString (ComboCell *, const char *); -/* Only functional in Gnome, right now. Sets a string which, - * if the cell has the ignore value, will be returned as the - * help string. */ +/* Sets a string which, if the cell has the ignore value, will be + * returned as the help string. */ void xaccComboCellSetIgnoreHelp (ComboCell *, const char *); +/* Determines whether combocells are automatically raised upon typing. + * Defaults to false. This is a 'class' method. */ +void xaccComboCellSetAutoPop (gncBoolean auto_pop_combos); + #endif /* __XACC_COMBO_CELL_H__ */ /* --------------- end of file ---------------------- */ diff --git a/src/register/gnome/Makefile.am b/src/register/gnome/Makefile.am index 9dbcc2455b..0b46dcab6e 100644 --- a/src/register/gnome/Makefile.am +++ b/src/register/gnome/Makefile.am @@ -31,5 +31,4 @@ CFLAGS = @CFLAGS@ ${GNOME_CFLAGS} INCLUDES = \ -I${top_srcdir}/src \ -I${top_srcdir}/src/engine \ - -I${top_srcdir}/src/guile \ -I${top_srcdir}/src/register diff --git a/src/register/gnome/Makefile.in b/src/register/gnome/Makefile.in index 47b4511beb..7a159c2194 100644 --- a/src/register/gnome/Makefile.in +++ b/src/register/gnome/Makefile.in @@ -129,7 +129,7 @@ EXTRA_DIST = .cvsignore CFLAGS = @CFLAGS@ ${GNOME_CFLAGS} -INCLUDES = -I${top_srcdir}/src -I${top_srcdir}/src/engine -I${top_srcdir}/src/guile -I${top_srcdir}/src/register +INCLUDES = -I${top_srcdir}/src -I${top_srcdir}/src/engine -I${top_srcdir}/src/register mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ../../../config.h diff --git a/src/register/gnome/combocell-gnome.c b/src/register/gnome/combocell-gnome.c index 9839d48c75..58c74c1104 100644 --- a/src/register/gnome/combocell-gnome.c +++ b/src/register/gnome/combocell-gnome.c @@ -41,7 +41,6 @@ #include "gnucash-sheet.h" #include "gnucash-item-edit.h" #include "gnucash-item-list.h" -#include "global-options.h" #include "messages.h" #include "util.h" @@ -90,6 +89,7 @@ static const char * leaveCombo (BasicCell *bcell, const char *value); /* This static indicates the debugging module that this .o belongs to. */ static short module = MOD_GTK_REG; +static gncBoolean auto_pop_combos = GNC_F; /* =============================================== */ @@ -505,9 +505,7 @@ ComboMV (BasicCell *_cell, *cursor_position += strlen(change); if (!box->list_popped) - pop_list = gnc_lookup_boolean_option("Register", - "Auto-Raise Lists", - TRUE); + pop_list = auto_pop_combos; else pop_list = FALSE; @@ -876,6 +874,14 @@ xaccComboCellSetIgnoreHelp (ComboCell *cell, const char *ignore_help) box->ignore_help = g_strdup(ignore_help); } +/* =============================================== */ + +void +xaccComboCellSetAutoPop (gncBoolean auto_pop_combos_arg) +{ + auto_pop_combos = auto_pop_combos_arg; +} + /* =============== end of file =================== */