mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Moved options C code to src/guile from src/gnome.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2345 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
ee14e57cd0
commit
8eff9ddb23
@ -59,7 +59,7 @@ motif motif.static: ${MOTIF_OBJS}
|
||||
@cd register && $(MAKE) motif
|
||||
@cd reports && $(MAKE) default
|
||||
@cd g-wrap && $(MAKE) motif
|
||||
@cd guile && $(MAKE) default
|
||||
@cd guile && $(MAKE) motif
|
||||
@cd swig && $(MAKE) motif
|
||||
@cd motif && $(MAKE) $@
|
||||
|
||||
@ -70,7 +70,7 @@ gnome gnome.static: ${GNOME_OBJS}
|
||||
@cd register && $(MAKE) gnome
|
||||
@cd reports && $(MAKE) default
|
||||
@cd g-wrap && $(MAKE) gnome
|
||||
@cd guile && $(MAKE) default
|
||||
@cd guile && $(MAKE) gnome
|
||||
@cd swig && $(MAKE) gnome
|
||||
@cd gnome && $(MAKE) $@
|
||||
|
||||
@ -81,7 +81,7 @@ qt qt.static: $(QT_OBJS)
|
||||
@cd register && $(MAKE) qt
|
||||
@cd reports && $(MAKE) default
|
||||
@cd g-wrap && $(MAKE) qt
|
||||
@cd guile && $(MAKE) default
|
||||
@cd guile && $(MAKE) qt
|
||||
@cd swig && $(MAKE) qt
|
||||
@cd qt && $(MAKE) $@
|
||||
|
||||
|
@ -41,6 +41,7 @@ static short module = MOD_ENGINE;
|
||||
char *
|
||||
xaccAccountTypeEnumAsString(int type) {
|
||||
switch(type) {
|
||||
GNC_RETURN_ENUM_AS_STRING(NO_TYPE);
|
||||
GNC_RETURN_ENUM_AS_STRING(BANK);
|
||||
GNC_RETURN_ENUM_AS_STRING(CASH);
|
||||
GNC_RETURN_ENUM_AS_STRING(CREDIT);
|
||||
|
@ -1189,7 +1189,7 @@ xaccAccountGetParentAccount (Account * acc)
|
||||
int
|
||||
xaccAccountGetType (Account *acc)
|
||||
{
|
||||
if (!acc) return 0;
|
||||
if (!acc) return NO_TYPE;
|
||||
return (acc->type);
|
||||
}
|
||||
|
||||
|
@ -54,6 +54,7 @@ OTHER_OBJS += $(wildcard @top_srcdir@/src/engine/obj/guid/*.o)
|
||||
OTHER_OBJS += $(wildcard @top_srcdir@/src/register/obj/gnome/*.o)
|
||||
OTHER_OBJS += $(wildcard @top_srcdir@/src/reports/obj/*.o)
|
||||
OTHER_OBJS += $(wildcard @top_srcdir@/src/guile/obj/*.o)
|
||||
OTHER_OBJS += $(wildcard @top_srcdir@/src/guile/obj/gnome/*.o)
|
||||
OTHER_OBJS += $(wildcard @top_srcdir@/src/swig/obj/*.o)
|
||||
OTHER_OBJS += $(wildcard @top_srcdir@/src/g-wrap/obj/*.o)
|
||||
OTHER_OBJS += $(wildcard @top_srcdir@/src/g-wrap/obj/gnome/*.o)
|
||||
@ -63,11 +64,11 @@ OTHER_OBJS += $(wildcard @top_srcdir@/src/register/gnome/obj/gnome/*.o)
|
||||
# See Makefile.common for information about these variables.
|
||||
GNOME_SRCS := top-level.c window-main.c window-register.c window-adjust.c \
|
||||
window-help.c cursors.c account-tree.c dialog-budget.c \
|
||||
window-reconcile.c option-util.c window-html.c \
|
||||
window-reconcile.c window-html.c \
|
||||
dialog-options.c dialog-filebox.c dialog-transfer.c \
|
||||
dialog-add.c dialog-edit.c dialog-utils.c \
|
||||
extensions.c query-user.c reconcile-list.c \
|
||||
window-report.c global-options.c gnc-dateedit.c \
|
||||
window-report.c gnc-dateedit.c \
|
||||
dialog-qif-import.c glade-gnc-dialogs.c gnc-datedelta.c \
|
||||
dialog-account-picker.c print-session.c file-history.c \
|
||||
dialog-print-check.c dialog-find-transactions.c
|
||||
|
@ -27,11 +27,14 @@
|
||||
#include "dialog-options.h"
|
||||
#include "dialog-utils.h"
|
||||
#include "option-util.h"
|
||||
#include "guile-util.h"
|
||||
#include "query-user.h"
|
||||
#include "gnc-helpers.h"
|
||||
#include "account-tree.h"
|
||||
#include "gnc-dateedit.h"
|
||||
#include "global-options.h"
|
||||
#include "query-user.h"
|
||||
#include "window-help.h"
|
||||
#include "messages.h"
|
||||
#include "util.h"
|
||||
|
||||
@ -1126,3 +1129,68 @@ gnc_build_options_dialog_contents(GnomePropertyBox *propertybox,
|
||||
if (default_section_name != NULL)
|
||||
free(default_section_name);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gnc_options_dialog_apply_cb(GnomePropertyBox *propertybox,
|
||||
gint arg1, gpointer user_data)
|
||||
{
|
||||
GNCOptionDB *global_options = user_data;
|
||||
|
||||
if (arg1 == -1)
|
||||
gnc_option_db_commit(global_options);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_options_dialog_help_cb(GnomePropertyBox *propertybox,
|
||||
gint arg1, gpointer user_data)
|
||||
{
|
||||
helpWindow(NULL, HELP_STR, HH_GLOBPREFS);
|
||||
}
|
||||
|
||||
/* Options dialog... this should house all of the config options */
|
||||
/* like where the docs reside, and whatever else is deemed necessary */
|
||||
void
|
||||
gnc_show_options_dialog()
|
||||
{
|
||||
static GnomePropertyBox *options_dialog = NULL;
|
||||
GNCOptionDB *global_options;
|
||||
|
||||
global_options = gnc_get_global_options();
|
||||
|
||||
if (gnc_option_db_num_sections(global_options) == 0)
|
||||
{
|
||||
gnc_warning_dialog("No options!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (gnc_option_db_dirty(global_options))
|
||||
{
|
||||
if (options_dialog != NULL)
|
||||
gtk_widget_destroy(GTK_WIDGET(options_dialog));
|
||||
|
||||
options_dialog = NULL;
|
||||
}
|
||||
|
||||
if (options_dialog == NULL)
|
||||
{
|
||||
options_dialog = GNOME_PROPERTY_BOX(gnome_property_box_new());
|
||||
gnome_dialog_close_hides(GNOME_DIALOG(options_dialog), TRUE);
|
||||
|
||||
gnc_build_options_dialog_contents(options_dialog, global_options);
|
||||
gnc_option_db_clean(global_options);
|
||||
|
||||
gtk_window_set_title(GTK_WINDOW(options_dialog), GNC_PREFS);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(options_dialog), "apply",
|
||||
GTK_SIGNAL_FUNC(gnc_options_dialog_apply_cb),
|
||||
global_options);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(options_dialog), "help",
|
||||
GTK_SIGNAL_FUNC(gnc_options_dialog_help_cb),
|
||||
global_options);
|
||||
}
|
||||
|
||||
gtk_widget_show(GTK_WIDGET(options_dialog));
|
||||
gdk_window_raise(GTK_WIDGET(options_dialog)->window);
|
||||
}
|
||||
|
@ -28,12 +28,9 @@
|
||||
|
||||
#include "option-util.h"
|
||||
|
||||
void gnc_show_options_dialog();
|
||||
|
||||
void gnc_build_options_dialog_contents(GnomePropertyBox *propertybox,
|
||||
GNCOptionDB *odb);
|
||||
|
||||
SCM gnc_option_get_ui_value(GNCOption *option);
|
||||
void gnc_option_set_ui_value(GNCOption *option, gboolean use_default);
|
||||
|
||||
|
||||
#endif /* __OPTIONS_DIALOG_H__ */
|
||||
|
@ -1,398 +0,0 @@
|
||||
/********************************************************************\
|
||||
* global-options.c -- GNOME global option handling *
|
||||
* Copyright (C) 1998,1999 Linas Vepstas *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation; either version 2 of *
|
||||
* the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License*
|
||||
* along with this program; if not, contact: *
|
||||
* *
|
||||
* Free Software Foundation Voice: +1-617-542-5942 *
|
||||
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
|
||||
* Boston, MA 02111-1307, USA gnu@gnu.org *
|
||||
\********************************************************************/
|
||||
|
||||
#include "top-level.h"
|
||||
|
||||
#include <gnome.h>
|
||||
|
||||
#include "global-options.h"
|
||||
#include "dialog-options.h"
|
||||
#include "dialog-utils.h"
|
||||
#include "option-util.h"
|
||||
#include "query-user.h"
|
||||
#include "guile-util.h"
|
||||
#include "window-help.h"
|
||||
#include "messages.h"
|
||||
#include "util.h"
|
||||
|
||||
/* This static indicates the debugging module that this .o belongs to. */
|
||||
static short module = MOD_GUI;
|
||||
|
||||
static GNCOptionDB *global_options = NULL;
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_options_init *
|
||||
* initialize the options structures from the guile side *
|
||||
* *
|
||||
* Args: none *
|
||||
* Returns: nothing *
|
||||
\********************************************************************/
|
||||
void
|
||||
gnc_options_init()
|
||||
{
|
||||
SCM func = gh_eval_str("gnc:send-global-options");
|
||||
SCM options;
|
||||
|
||||
if (gh_procedure_p(func))
|
||||
options = gh_call0(func);
|
||||
else
|
||||
{
|
||||
PERR("gnc_options_init: no guile options!");
|
||||
return;
|
||||
}
|
||||
|
||||
global_options = gnc_option_db_new(options);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_options_shutdown *
|
||||
* unregister the scheme options and free the structure memory *
|
||||
* *
|
||||
* Args: none *
|
||||
* Returns: nothing *
|
||||
\********************************************************************/
|
||||
void
|
||||
gnc_options_shutdown()
|
||||
{
|
||||
gnc_option_db_destroy(global_options);
|
||||
global_options = NULL;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_register_option_change_callback *
|
||||
* register a callback to be called whenever an option changes *
|
||||
* *
|
||||
* Args: callback - the callback function *
|
||||
* user_data - the user data for the callback *
|
||||
* section - the section to get callbacks for. *
|
||||
* If NULL, get callbacks for any section changes.*
|
||||
* name - the option name to get callbacks for. *
|
||||
* If NULL, get callbacks for any option in the *
|
||||
* section. Only used if section is non-NULL. *
|
||||
* Returns: SCM handle for unregistering *
|
||||
\********************************************************************/
|
||||
SCM
|
||||
gnc_register_option_change_callback(OptionChangeCallback callback,
|
||||
void *user_data,
|
||||
char *section,
|
||||
char *name)
|
||||
{
|
||||
return gnc_option_db_register_change_callback(global_options, callback,
|
||||
user_data, section, name);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_unregister_option_change_callback_id *
|
||||
* unregister the change callback associated with the given id *
|
||||
* *
|
||||
* Args: callback_id - the callback function id *
|
||||
* Returns: nothing *
|
||||
\********************************************************************/
|
||||
void
|
||||
gnc_unregister_option_change_callback_id(SCM callback_id)
|
||||
{
|
||||
gnc_option_db_unregister_change_callback_id(global_options, callback_id);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_get_option_by_name *
|
||||
* returns an option given section name and name *
|
||||
* *
|
||||
* Args: section_name - name of section to search for *
|
||||
* name - name to search for *
|
||||
* Returns: given option, or NULL if none *
|
||||
\********************************************************************/
|
||||
GNCOption *
|
||||
gnc_get_option_by_name(const char *section_name, const char *name)
|
||||
{
|
||||
return gnc_option_db_get_option_by_name(global_options,
|
||||
section_name, name);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_get_option_by_SCM *
|
||||
* returns an option given SCM handle. Uses section and name. *
|
||||
* *
|
||||
* Args: guile_option - SCM handle of option *
|
||||
* Returns: given option, or NULL if none *
|
||||
\********************************************************************/
|
||||
GNCOption *
|
||||
gnc_get_option_by_SCM(SCM guile_option)
|
||||
{
|
||||
return gnc_option_db_get_option_by_SCM(global_options, guile_option);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_lookup_boolean_option *
|
||||
* looks up a boolean option. If present, returns its value, *
|
||||
* otherwise returns the default. *
|
||||
* *
|
||||
* Args: section - section name of option *
|
||||
* name - name of option *
|
||||
* default - default value if not found *
|
||||
* Return: gboolean option value *
|
||||
\********************************************************************/
|
||||
gboolean
|
||||
gnc_lookup_boolean_option(const char *section, const char *name,
|
||||
gboolean default_value)
|
||||
{
|
||||
return gnc_option_db_lookup_boolean_option(global_options, section,
|
||||
name, default_value);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_lookup_string_option *
|
||||
* looks up a string option. If present, returns its malloc'ed *
|
||||
* value, otherwise returns the strdup'ed default, or NULL if *
|
||||
* default was NULL. *
|
||||
* *
|
||||
* Args: section - section name of option *
|
||||
* name - name of option *
|
||||
* default - default value if not found *
|
||||
* Return: char * option value *
|
||||
\********************************************************************/
|
||||
char *
|
||||
gnc_lookup_string_option(const char *section, const char *name,
|
||||
char *default_value)
|
||||
{
|
||||
return gnc_option_db_lookup_string_option(global_options, section,
|
||||
name, default_value);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_lookup_multichoice_option *
|
||||
* looks up a multichoice option. If present, returns its *
|
||||
* name as a malloc'ed string *
|
||||
* value, otherwise returns the strdup'ed default, or NULL if *
|
||||
* default was NULL. *
|
||||
* *
|
||||
* Args: section - section name of option *
|
||||
* name - name of option *
|
||||
* default - default value if not found *
|
||||
* Return: char * option value *
|
||||
\********************************************************************/
|
||||
char *
|
||||
gnc_lookup_multichoice_option(const char *section, const char *name,
|
||||
char *default_value)
|
||||
{
|
||||
return gnc_option_db_lookup_multichoice_option(global_options, section,
|
||||
name, default_value);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_lookup_number_option *
|
||||
* looks up a number option. If present, return its value *
|
||||
* as a gdouble, otherwise returns default_value. *
|
||||
* *
|
||||
* Args: section - section name of option *
|
||||
* name - name of option *
|
||||
* default - default value if not found *
|
||||
* Return: char * option value *
|
||||
\********************************************************************/
|
||||
gdouble
|
||||
gnc_lookup_number_option(const char *section, const char *name,
|
||||
gdouble default_value)
|
||||
{
|
||||
return gnc_option_db_lookup_number_option(global_options, section,
|
||||
name, default_value);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_lookup_color_option *
|
||||
* looks up a color option. If present, returns its value in the *
|
||||
* color variable, otherwise leaves the color variable alone. *
|
||||
* *
|
||||
* Args: section - section name of option *
|
||||
* name - name of option *
|
||||
* red - where to store the red value *
|
||||
* blue - where to store the blue value *
|
||||
* green - where to store the green value *
|
||||
* alpha - where to store the alpha value *
|
||||
* Return: true if option was found *
|
||||
\********************************************************************/
|
||||
gboolean gnc_lookup_color_option(const char *section, const char *name,
|
||||
gdouble *red, gdouble *green,
|
||||
gdouble *blue, gdouble *alpha)
|
||||
{
|
||||
return gnc_option_db_lookup_color_option(global_options, section, name,
|
||||
red, green, blue, alpha);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_lookup_color_option_argb *
|
||||
* looks up a color option. If present, returns its argb value, *
|
||||
* otherwise returns the given default value. *
|
||||
* *
|
||||
* Args: odb - option database to search in *
|
||||
* section - section name of option *
|
||||
* name - name of option *
|
||||
* default_value - default value to return if problem *
|
||||
* Return: argb value *
|
||||
\********************************************************************/
|
||||
uint32
|
||||
gnc_lookup_color_option_argb(const char *section, const char *name,
|
||||
uint32 default_value)
|
||||
{
|
||||
return gnc_option_db_lookup_color_option_argb(global_options, section, name,
|
||||
default_value);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_lookup_list_option *
|
||||
* looks up a list option. If present, returns its value as a *
|
||||
* list of strings representing the symbols. *
|
||||
* *
|
||||
* Args: section - section name of option *
|
||||
* name - name of option *
|
||||
* default_value - default value to return if problem *
|
||||
* Return: list of values *
|
||||
\********************************************************************/
|
||||
GSList *
|
||||
gnc_lookup_list_option(const char *section, const char *name,
|
||||
GSList *default_value)
|
||||
{
|
||||
return gnc_option_db_lookup_list_option(global_options, section, name,
|
||||
default_value);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_set_option_default *
|
||||
* set the option to its default value *
|
||||
* *
|
||||
* Args: section - section name of option *
|
||||
* name - name of option *
|
||||
* Returns: nothing *
|
||||
\********************************************************************/
|
||||
void
|
||||
gnc_set_option_default(const char *section, const char *name)
|
||||
{
|
||||
gnc_option_db_set_option_default(global_options, section, name);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_set_number_option *
|
||||
* sets the number option to the given value. If successful *
|
||||
* returns TRUE, otherwise FALSE. *
|
||||
* *
|
||||
* Args: section - section name of option *
|
||||
* name - name of option *
|
||||
* value - value to set to *
|
||||
* Return: success indicator *
|
||||
\********************************************************************/
|
||||
gboolean
|
||||
gnc_set_number_option(const char *section, const char *name, gdouble value)
|
||||
{
|
||||
return gnc_option_db_set_number_option(global_options, section, name, value);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* _gnc_option_refresh_ui *
|
||||
* sets the GUI representation of an option with its current *
|
||||
* current guile value. this is intended for use by guile only *
|
||||
* *
|
||||
* Args: option - SCM handle to option *
|
||||
* Return: nothing *
|
||||
\********************************************************************/
|
||||
void
|
||||
_gnc_option_refresh_ui(SCM guile_option)
|
||||
{
|
||||
GNCOption *option;
|
||||
|
||||
option = gnc_option_db_get_option_by_SCM(global_options, guile_option);
|
||||
gnc_option_set_ui_value(option, FALSE);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gnc_options_dialog_apply_cb(GnomePropertyBox *propertybox,
|
||||
gint arg1, gpointer user_data)
|
||||
{
|
||||
if (arg1 == -1)
|
||||
gnc_option_db_commit(global_options);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_options_dialog_help_cb(GnomePropertyBox *propertybox,
|
||||
gint arg1, gpointer user_data)
|
||||
{
|
||||
helpWindow(NULL, HELP_STR, HH_GLOBPREFS);
|
||||
}
|
||||
|
||||
/* Options dialog... this should house all of the config options */
|
||||
/* like where the docs reside, and whatever else is deemed necessary */
|
||||
void
|
||||
gnc_show_options_dialog()
|
||||
{
|
||||
static GnomePropertyBox *options_dialog = NULL;
|
||||
|
||||
if (gnc_option_db_num_sections(global_options) == 0)
|
||||
{
|
||||
gnc_warning_dialog("No options!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (gnc_option_db_dirty(global_options))
|
||||
{
|
||||
if (options_dialog != NULL)
|
||||
gtk_widget_destroy(GTK_WIDGET(options_dialog));
|
||||
|
||||
options_dialog = NULL;
|
||||
}
|
||||
|
||||
if (options_dialog == NULL)
|
||||
{
|
||||
options_dialog = GNOME_PROPERTY_BOX(gnome_property_box_new());
|
||||
gnome_dialog_close_hides(GNOME_DIALOG(options_dialog), TRUE);
|
||||
|
||||
gnc_build_options_dialog_contents(options_dialog, global_options);
|
||||
gnc_option_db_clean(global_options);
|
||||
|
||||
gtk_window_set_title(GTK_WINDOW(options_dialog), GNC_PREFS);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(options_dialog), "apply",
|
||||
GTK_SIGNAL_FUNC(gnc_options_dialog_apply_cb),
|
||||
NULL);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(options_dialog), "help",
|
||||
GTK_SIGNAL_FUNC(gnc_options_dialog_help_cb),
|
||||
NULL);
|
||||
}
|
||||
|
||||
gtk_widget_show(GTK_WIDGET(options_dialog));
|
||||
gdk_window_raise(GTK_WIDGET(options_dialog)->window);
|
||||
}
|
@ -1,80 +0,0 @@
|
||||
/********************************************************************\
|
||||
* global-options.h -- GNOME global option handling *
|
||||
* Copyright (C) 1998,1999 Linas Vepstas *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation; either version 2 of *
|
||||
* the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License*
|
||||
* along with this program; if not, contact: *
|
||||
* *
|
||||
* Free Software Foundation Voice: +1-617-542-5942 *
|
||||
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
|
||||
* Boston, MA 02111-1307, USA gnu@gnu.org *
|
||||
\********************************************************************/
|
||||
|
||||
#ifndef __GLOBAL_OPTIONS_H__
|
||||
#define __GLOBAL_OPTIONS_H__
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gnome.h>
|
||||
|
||||
#include "gnc-common.h"
|
||||
#include "option-util.h"
|
||||
|
||||
|
||||
void gnc_options_init();
|
||||
void gnc_options_shutdown();
|
||||
void gnc_show_options_dialog();
|
||||
|
||||
SCM gnc_register_option_change_callback(OptionChangeCallback callback,
|
||||
void *user_data,
|
||||
char *section,
|
||||
char *name);
|
||||
|
||||
void gnc_unregister_option_change_callback_id(SCM callback_id);
|
||||
|
||||
GNCOption * gnc_get_option_by_name(const char *section_name, const char *name);
|
||||
GNCOption * gnc_get_option_by_SCM(SCM guile_option);
|
||||
|
||||
gboolean gnc_lookup_boolean_option(const char *section, const char *name,
|
||||
gboolean default_value);
|
||||
|
||||
char * gnc_lookup_string_option(const char *section, const char *name,
|
||||
char *default_value);
|
||||
|
||||
char * gnc_lookup_multichoice_option(const char *section, const char *name,
|
||||
char *default_value);
|
||||
|
||||
gdouble gnc_lookup_number_option(const char *section, const char *name,
|
||||
gdouble default_value);
|
||||
|
||||
gboolean gnc_lookup_color_option(const char *section, const char *name,
|
||||
gdouble *red, gdouble *green,
|
||||
gdouble *blue, gdouble *alpha);
|
||||
|
||||
uint32 gnc_lookup_color_option_argb(const char *section, const char *name,
|
||||
uint32 default_value);
|
||||
|
||||
GSList * gnc_lookup_list_option(const char *section, const char *name,
|
||||
GSList *default_value);
|
||||
|
||||
void gnc_set_option_default(const char *section, const char *name);
|
||||
|
||||
gboolean gnc_set_number_option(const char *section, const char *name,
|
||||
gdouble value);
|
||||
|
||||
/* private */
|
||||
|
||||
void _gnc_option_refresh_ui(SCM option);
|
||||
|
||||
|
||||
#endif /* __GLOBAL_OPTIONS_H__ */
|
File diff suppressed because it is too large
Load Diff
@ -1,200 +0,0 @@
|
||||
/********************************************************************\
|
||||
* option-util.h -- GNOME<->guile option interface *
|
||||
* Copyright (C) 1998,1999 Linas Vepstas *
|
||||
* Copyright (C) 2000 Dave Peticolas *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation; either version 2 of *
|
||||
* the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License*
|
||||
* along with this program; if not, contact: *
|
||||
* *
|
||||
* Free Software Foundation Voice: +1-617-542-5942 *
|
||||
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
|
||||
* Boston, MA 02111-1307, USA gnu@gnu.org *
|
||||
\********************************************************************/
|
||||
|
||||
#ifndef __OPTION_UTIL_H__
|
||||
#define __OPTION_UTIL_H__
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gnome.h>
|
||||
#include <guile/gh.h>
|
||||
|
||||
#include "gnc-common.h"
|
||||
#include "date.h"
|
||||
|
||||
|
||||
typedef struct _GNCOption GNCOption;
|
||||
struct _GNCOption
|
||||
{
|
||||
/* Handle to the scheme-side option */
|
||||
SCM guile_option;
|
||||
|
||||
/* Flag to indicate change by the UI */
|
||||
gboolean changed;
|
||||
|
||||
/* The widget which is holding this option */
|
||||
GtkWidget *widget;
|
||||
};
|
||||
|
||||
typedef struct _GNCOptionSection GNCOptionSection;
|
||||
typedef struct _GNCOptionDB GNCOptionDB;
|
||||
|
||||
typedef int GNCOptionDBHandle;
|
||||
|
||||
typedef void (*OptionChangeCallback)(void * user_data);
|
||||
|
||||
/***** Prototypes ********************************************************/
|
||||
|
||||
GNCOptionDB * gnc_option_db_new(SCM guile_options);
|
||||
void gnc_option_db_destroy(GNCOptionDB *odb);
|
||||
|
||||
SCM gnc_option_db_register_change_callback(GNCOptionDB *odb,
|
||||
OptionChangeCallback callback,
|
||||
void *data,
|
||||
char *section,
|
||||
char *name);
|
||||
|
||||
void gnc_option_db_unregister_change_callback_id(GNCOptionDB *odb,
|
||||
SCM callback_id);
|
||||
|
||||
char * gnc_option_section(GNCOption *option);
|
||||
char * gnc_option_name(GNCOption *option);
|
||||
char * gnc_option_type(GNCOption *option);
|
||||
char * gnc_option_sort_tag(GNCOption *option);
|
||||
char * gnc_option_documentation(GNCOption *option);
|
||||
SCM gnc_option_getter(GNCOption *option);
|
||||
SCM gnc_option_setter(GNCOption *option);
|
||||
SCM gnc_option_default_getter(GNCOption *option);
|
||||
SCM gnc_option_value_validator(GNCOption *option);
|
||||
|
||||
int gnc_option_num_permissible_values(GNCOption *option);
|
||||
int gnc_option_permissible_value_index(GNCOption *option, SCM value);
|
||||
SCM gnc_option_permissible_value(GNCOption *option, int index);
|
||||
char * gnc_option_permissible_value_name(GNCOption *option, int index);
|
||||
char * gnc_option_permissible_value_description(GNCOption *option, int index);
|
||||
|
||||
gboolean gnc_option_show_time(GNCOption *option);
|
||||
|
||||
gboolean gnc_option_multiple_selection(GNCOption *option);
|
||||
|
||||
gboolean gnc_option_get_range_info(GNCOption *option,
|
||||
double *lower_bound,
|
||||
double *upper_bound,
|
||||
int *num_decimals,
|
||||
double *step_size);
|
||||
|
||||
gdouble gnc_option_color_range(GNCOption *option);
|
||||
gdouble gnc_option_use_alpha(GNCOption *option);
|
||||
uint32 gnc_option_get_color_argb(GNCOption *option);
|
||||
gboolean gnc_option_get_color_info(GNCOption *option,
|
||||
gboolean use_default,
|
||||
gdouble *red,
|
||||
gdouble *green,
|
||||
gdouble *blue,
|
||||
gdouble *alpha);
|
||||
|
||||
void gnc_option_set_default(GNCOption *option);
|
||||
|
||||
guint gnc_option_db_num_sections(GNCOptionDB *odb);
|
||||
|
||||
char * gnc_option_section_name(GNCOptionSection *section);
|
||||
guint gnc_option_section_num_options(GNCOptionSection *section);
|
||||
|
||||
GNCOptionSection * gnc_option_db_get_section(GNCOptionDB *odb, gint i);
|
||||
|
||||
GNCOption * gnc_get_option_section_option(GNCOptionSection *section, int i);
|
||||
|
||||
GNCOption * gnc_option_db_get_option_by_name(GNCOptionDB *odb,
|
||||
const char *section_name,
|
||||
const char *name);
|
||||
|
||||
GNCOption * gnc_option_db_get_option_by_SCM(GNCOptionDB *odb,
|
||||
SCM guile_option);
|
||||
|
||||
gboolean gnc_option_db_dirty(GNCOptionDB *odb);
|
||||
void gnc_option_db_clean(GNCOptionDB *odb);
|
||||
|
||||
void gnc_option_db_commit(GNCOptionDB *odb);
|
||||
|
||||
char * gnc_option_db_get_default_section(GNCOptionDB *odb);
|
||||
|
||||
gboolean gnc_option_db_lookup_boolean_option(GNCOptionDB *odb,
|
||||
const char *section,
|
||||
const char *name,
|
||||
gboolean default_value);
|
||||
|
||||
char * gnc_option_db_lookup_string_option(GNCOptionDB *odb,
|
||||
const char *section,
|
||||
const char *name,
|
||||
const char *default_value);
|
||||
|
||||
char * gnc_option_db_lookup_multichoice_option(GNCOptionDB *odb,
|
||||
const char *section,
|
||||
const char *name,
|
||||
const char *default_value);
|
||||
|
||||
time_t gnc_option_db_lookup_date_option(GNCOptionDB *odb,
|
||||
const char *section,
|
||||
const char *name,
|
||||
Timespec *set_value,
|
||||
Timespec *default_value);
|
||||
|
||||
gdouble gnc_option_db_lookup_number_option(GNCOptionDB *odb,
|
||||
const char *section,
|
||||
const char *name,
|
||||
gdouble default_value);
|
||||
|
||||
gboolean gnc_option_db_lookup_color_option(GNCOptionDB *odb,
|
||||
const char *section,
|
||||
const char *name,
|
||||
gdouble *red,
|
||||
gdouble *green,
|
||||
gdouble *blue,
|
||||
gdouble *alpha);
|
||||
|
||||
uint32 gnc_option_db_lookup_color_option_argb(GNCOptionDB *odb,
|
||||
const char *section,
|
||||
const char *name,
|
||||
uint32 default_value);
|
||||
|
||||
GSList * gnc_option_db_lookup_list_option(GNCOptionDB *odb,
|
||||
const char *section,
|
||||
const char *name,
|
||||
GSList *default_value);
|
||||
|
||||
void gnc_free_list_option_value(GSList *list);
|
||||
|
||||
void gnc_option_db_set_option_default(GNCOptionDB *odb,
|
||||
const char *section,
|
||||
const char *name);
|
||||
|
||||
gboolean gnc_option_db_set_number_option(GNCOptionDB *odb,
|
||||
const char *section,
|
||||
const char *name,
|
||||
gdouble value);
|
||||
|
||||
/* private */
|
||||
|
||||
void _gnc_option_db_register_option(GNCOptionDBHandle handle,
|
||||
SCM guile_option);
|
||||
|
||||
void _gnc_option_invoke_callback(OptionChangeCallback callback, void *data);
|
||||
|
||||
/* These should be in src/guile or src/g-wrap, but they use glib */
|
||||
|
||||
SCM gnc_account_list_to_scm(GList *account_list);
|
||||
GList * gnc_scm_to_account_list(SCM scm_list);
|
||||
|
||||
SCM _gnc_get_current_accounts();
|
||||
|
||||
#endif /* __OPTION_UTIL_H__ */
|
@ -32,11 +32,13 @@
|
||||
#include "AccWindow.h"
|
||||
#include "AdjBWindow.h"
|
||||
#include "global-options.h"
|
||||
#include "dialog-options.h"
|
||||
#include "FileDialog.h"
|
||||
#include "g-wrap.h"
|
||||
#include "gnucash.h"
|
||||
#include "MainWindow.h"
|
||||
#include "Destroy.h"
|
||||
#include "ui-callbacks.h"
|
||||
#include "enriched-messages.h"
|
||||
#include "RegWindow.h"
|
||||
#include "Refresh.h"
|
||||
@ -51,10 +53,10 @@
|
||||
#include "dialog-qif-import.h"
|
||||
#include "dialog-find-transactions.h"
|
||||
#include "file-history.h"
|
||||
#include "EuroUtils.h"
|
||||
#include "Scrub.h"
|
||||
#include "util.h"
|
||||
#include "gnc.h"
|
||||
#include "EuroUtils.h"
|
||||
|
||||
|
||||
/* This static indicates the debugging module that this .o belongs to. */
|
||||
|
@ -32,9 +32,6 @@ void mainWindow(void);
|
||||
|
||||
GNCAccountTree * gnc_get_current_account_tree();
|
||||
|
||||
Account * gnc_get_current_account();
|
||||
GList * gnc_get_current_accounts();
|
||||
|
||||
void gnc_ui_mainWindow_save_size();
|
||||
|
||||
#endif
|
||||
|
@ -26,6 +26,7 @@ INCLPATH = -I@top_srcdir@/ \
|
||||
-I@top_srcdir@/src/engine \
|
||||
-I@top_srcdir@/src/engine/guid \
|
||||
-I@top_srcdir@/src/gnome \
|
||||
-I@top_srcdir@/src/guile \
|
||||
-I@prefix@/include \
|
||||
-I@top_srcdir@/src/register
|
||||
|
||||
|
@ -286,17 +286,3 @@
|
||||
|
||||
;; close the transaction
|
||||
(gnc:transaction-commit-edit trans))))
|
||||
|
||||
|
||||
;; Return a scheme symbol identifying the type of guid passed in.
|
||||
(define gnc:guid-type #f)
|
||||
(let ()
|
||||
(define entity-types (vector 'gnc-id-none
|
||||
'gnc-id-null
|
||||
'gnc-id-group
|
||||
'gnc-id-account
|
||||
'gnc-id-trans
|
||||
'gnc-id-split))
|
||||
(set! gnc:guid-type
|
||||
(lambda (guid)
|
||||
(vector-ref entity-types (gnc:guid-type-helper guid)))))
|
||||
|
@ -84,6 +84,47 @@
|
||||
|
||||
;;;;;; Create default options and config vars
|
||||
|
||||
(define gnc:*debit-strings*
|
||||
(list '(NO_TYPE . "Funds In")
|
||||
'(BANK . "Deposit")
|
||||
'(CASH . "Receive")
|
||||
'(CREDIT . "Payment")
|
||||
'(ASSET . "Appreciation")
|
||||
'(LIABILITY . "Debit")
|
||||
'(STOCK . "Bought")
|
||||
'(MUTUAL . "Bought")
|
||||
'(CURRENCY . "Bought")
|
||||
'(INCOME . "Charge")
|
||||
'(EXPENSE . "Expense")
|
||||
'(EQUITY . "Debit")))
|
||||
|
||||
(define gnc:*credit-strings*
|
||||
(list '(NO_TYPE . "Funds Out")
|
||||
'(BANK . "Payment")
|
||||
'(CASH . "Spend")
|
||||
'(CREDIT . "Charge")
|
||||
'(ASSET . "Depreciation")
|
||||
'(LIABILITY . "Credit")
|
||||
'(STOCK . "Sold")
|
||||
'(MUTUAL . "Sold")
|
||||
'(CURRENCY . "Sold")
|
||||
'(INCOME . "Income")
|
||||
'(EXPENSE . "Rebate")
|
||||
'(EQUITY . "Credit")))
|
||||
|
||||
(if (gnc:debugging?)
|
||||
(let ((thunk (lambda (pair)
|
||||
(gnc:register-translatable-strings (cdr pair)))))
|
||||
(map thunk gnc:*debit-strings*)
|
||||
(map thunk gnc:*credit-strings*)))
|
||||
|
||||
(define (gnc:get-debit-string type)
|
||||
(assoc-ref gnc:*debit-strings* type))
|
||||
|
||||
(define (gnc:get-credit-string type)
|
||||
(assoc-ref gnc:*debit-strings* type))
|
||||
|
||||
|
||||
;; Main Window options
|
||||
|
||||
(gnc:register-configuration-option
|
||||
|
@ -13,13 +13,12 @@
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License*
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* along with this program; if not, contact: *
|
||||
* *
|
||||
* Free Software Foundation Voice: +1-617-542-5942 *
|
||||
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
|
||||
* Boston, MA 02111-1307, USA gnu@gnu.org *
|
||||
* *
|
||||
* Author: Rob Clark *
|
||||
* Internet: rclark@cs.hmc.edu *
|
||||
* Address: 609 8th Street *
|
||||
* Huntington Beach, CA 92648-4632 *
|
||||
\********************************************************************/
|
||||
|
||||
#ifndef __TOP_LEVEL_H__
|
||||
@ -49,14 +48,7 @@
|
||||
|
||||
/** PROTOTYPES ******************************************************/
|
||||
|
||||
/** GLOBALS *********************************************************/
|
||||
extern Session *current_session;
|
||||
|
||||
#if defined(MOTIF)
|
||||
extern gncUIWidget gnc_get_ui_data();
|
||||
#elif defined(GNOME)
|
||||
extern gncUIWidget gnc_get_ui_data();
|
||||
#endif
|
||||
|
||||
extern void gnc_ui_shutdown();
|
||||
|
||||
|
@ -26,7 +26,10 @@
|
||||
#ifndef __UI_CALLBACKS_H__
|
||||
#define __UI_CALLBACKS_H__
|
||||
|
||||
#include <gnc-common.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "top-level.h"
|
||||
|
||||
|
||||
/* Dialog windows ***************************************************/
|
||||
typedef enum
|
||||
@ -69,6 +72,9 @@ void gnc_ui_destroy_all_subwindows( void );
|
||||
void gnc_set_busy_cursor( gncUIWidget w );
|
||||
void gnc_unset_busy_cursor( gncUIWidget w );
|
||||
|
||||
/* Getting main window information **********************************/
|
||||
Account * gnc_get_current_account();
|
||||
GList * gnc_get_current_accounts();
|
||||
|
||||
/* QIF Import Windows ***********************************************/
|
||||
typedef struct _qifimportwindow QIFImportWindow;
|
||||
|
Loading…
Reference in New Issue
Block a user