Make help strings part of the split register model.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5433 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2001-09-27 08:13:06 +00:00
parent 7ad8ec3541
commit 97ba57c214
17 changed files with 364 additions and 247 deletions

View File

@ -1,5 +1,7 @@
Makefile
Makefile.in
*.lo
*.la
.deps
*.diff
gnc-dir.h

View File

@ -1,2 +1,4 @@
Makefile
Makefile.in
*.lo
*.la

View File

@ -2,6 +2,8 @@ Makefile
Makefile.in
.deps
*.diff
*.lo
*.la
.scm-links
gw-binary-import.c
gw-binary-import.h

View File

@ -1,5 +1,7 @@
Makefile
Makefile.in
.deps
*.lo
*.la
*.diff
gnc-dir.h

View File

@ -23,19 +23,21 @@
#include "config.h"
#include <glib.h>
#include <time.h>
#include "Group.h"
#include "datecell.h"
#include "global-options.h"
#include "gnc-engine-util.h"
#include "gnc-ui.h"
#include "gnc-ui-util.h"
#include "messages.h"
#include "pricecell.h"
#include "recncell.h"
#include "split-register.h"
#include "split-register-model.h"
#include "split-register-model-save.h"
#include "split-register-p.h"
#include "messages.h"
static SplitRegisterColors reg_colors =
@ -621,6 +623,34 @@ gnc_split_register_get_date_entry (VirtualLocation virt_loc,
return gnc_print_date (ts);
}
static char *
gnc_split_register_get_date_help (VirtualLocation virt_loc,
gpointer user_data)
{
SplitRegister *reg = user_data;
BasicCell *cell;
char string[1024];
struct tm *tm;
Timespec ts;
time_t tt;
cell = gnc_table_get_cell (reg->table, virt_loc);
if (!cell)
return NULL;
if (!cell->value || *cell->value == '\0')
return NULL;
gnc_date_cell_get_date ((DateCell *) cell, &ts);
tt = ts.tv_sec;
tm = localtime (&tt);
strftime (string, sizeof (string), "%A %d %B %Y", tm);
return g_strdup (string);
}
static const char *
gnc_split_register_get_num_entry (VirtualLocation virt_loc,
gboolean translate,
@ -637,6 +667,20 @@ gnc_split_register_get_num_entry (VirtualLocation virt_loc,
return xaccTransGetNum (trans);
}
static char *
gnc_split_register_get_num_help (VirtualLocation virt_loc,
gpointer user_data)
{
SplitRegister *reg = user_data;
const char *help;
help = gnc_table_get_entry (reg->table, virt_loc);
if (!help || *help == '\0')
help = _("Enter the transaction number, such as the check number");
return g_strdup (help);
}
static const char *
gnc_split_register_get_desc_entry (VirtualLocation virt_loc,
gboolean translate,
@ -653,6 +697,20 @@ gnc_split_register_get_desc_entry (VirtualLocation virt_loc,
return xaccTransGetDescription (trans);
}
static char *
gnc_split_register_get_desc_help (VirtualLocation virt_loc,
gpointer user_data)
{
SplitRegister *reg = user_data;
const char *help;
help = gnc_table_get_entry (reg->table, virt_loc);
if (!help || *help == '\0')
help = _("Enter a description of the transaction");
return g_strdup (help);
}
static const char *
gnc_split_register_get_notes_entry (VirtualLocation virt_loc,
gboolean translate,
@ -669,6 +727,20 @@ gnc_split_register_get_notes_entry (VirtualLocation virt_loc,
return xaccTransGetNotes (trans);
}
static char *
gnc_split_register_get_notes_help (VirtualLocation virt_loc,
gpointer user_data)
{
SplitRegister *reg = user_data;
const char *help;
help = gnc_table_get_entry (reg->table, virt_loc);
if (!help || *help == '\0')
help = _("Enter notes for the transaction");
return g_strdup (help);
}
static const char *
gnc_split_register_get_recn_entry (VirtualLocation virt_loc,
gboolean translate,
@ -709,6 +781,20 @@ gnc_split_register_get_action_entry (VirtualLocation virt_loc,
return xaccSplitGetAction (split);
}
static char *
gnc_split_register_get_action_help (VirtualLocation virt_loc,
gpointer user_data)
{
SplitRegister *reg = user_data;
const char *help;
help = gnc_table_get_entry (reg->table, virt_loc);
if (!help || *help == '\0')
help = _("Enter the type of transaction, or choose one from the list");
return g_strdup (help);
}
static const char *
gnc_split_register_get_memo_entry (VirtualLocation virt_loc,
gboolean translate,
@ -723,6 +809,20 @@ gnc_split_register_get_memo_entry (VirtualLocation virt_loc,
return xaccSplitGetMemo (split);
}
static char *
gnc_split_register_get_memo_help (VirtualLocation virt_loc,
gpointer user_data)
{
SplitRegister *reg = user_data;
const char *help;
help = gnc_table_get_entry (reg->table, virt_loc);
if (!help || *help == '\0')
help = _("Enter a description of the split");
return g_strdup (help);
}
static const char *
gnc_split_register_get_balance_entry (VirtualLocation virt_loc,
gboolean translate,
@ -784,6 +884,20 @@ gnc_split_register_get_price_entry (VirtualLocation virt_loc,
return xaccPrintAmount (price, gnc_default_price_print_info ());
}
static char *
gnc_split_register_get_price_help (VirtualLocation virt_loc,
gpointer user_data)
{
SplitRegister *reg = user_data;
const char *help;
help = gnc_table_get_entry (reg->table, virt_loc);
if (!help || *help == '\0')
help = _("Enter the effective share price");
return g_strdup (help);
}
static const char *
gnc_split_register_get_shares_entry (VirtualLocation virt_loc,
gboolean translate,
@ -806,6 +920,20 @@ gnc_split_register_get_shares_entry (VirtualLocation virt_loc,
return xaccPrintAmount (shares, gnc_split_amount_print_info (split, FALSE));
}
static char *
gnc_split_register_get_shares_help (VirtualLocation virt_loc,
gpointer user_data)
{
SplitRegister *reg = user_data;
const char *help;
help = gnc_table_get_entry (reg->table, virt_loc);
if (!help || *help == '\0')
help = _("Enter the number of shares bought or sold");
return g_strdup (help);
}
static const char *
gnc_split_register_get_tshares_entry (VirtualLocation virt_loc,
gboolean translate,
@ -845,6 +973,21 @@ gnc_split_register_get_xfrm_entry (VirtualLocation virt_loc,
return name;
}
static char *
gnc_split_register_get_xfrm_help (VirtualLocation virt_loc,
gpointer user_data)
{
SplitRegister *reg = user_data;
const char *help;
help = gnc_table_get_entry (reg->table, virt_loc);
if (!help || *help == '\0')
help = _("Enter the account to transfer from, "
"or choose one from the list");
return g_strdup (help);
}
static const char *
gnc_split_register_get_mxfrm_entry (VirtualLocation virt_loc,
gboolean translate,
@ -873,6 +1016,7 @@ gnc_split_register_get_mxfrm_entry (VirtualLocation virt_loc,
/* For multi-split transactions and stock splits,
* use a special value. */
s = xaccTransGetSplit (xaccSplitGetParent(split), 1);
if (s)
name = g_strdup (SPLIT_TRANS_STR);
else if (safe_strcmp ("stock-split", xaccSplitGetType (split)) == 0)
@ -884,6 +1028,49 @@ gnc_split_register_get_mxfrm_entry (VirtualLocation virt_loc,
return name;
}
static char *
gnc_split_register_get_mxfrm_help (VirtualLocation virt_loc,
gpointer user_data)
{
const char *help;
SplitRegister *reg = user_data;
Split *split;
Split *s;
split = gnc_split_register_get_split (reg, virt_loc.vcell_loc);
if (!split)
return NULL;
s = xaccSplitGetOtherSplit (split);
if (s)
{
help = gnc_split_register_get_mxfrm_entry (virt_loc, FALSE,
NULL, user_data);
if (!help || *help == '\0')
help = _("Enter the account to transfer from, "
"or choose one from the list");
}
else
{
/* For multi-split transactions and stock splits,
* use a special value. */
s = xaccTransGetSplit (xaccSplitGetParent(split), 1);
if (s)
help = _("This transaction has multiple splits; "
"press the Split button to see them all");
else if (safe_strcmp ("stock-split", xaccSplitGetType (split)) == 0)
help = _("This transaction is a stock split; "
"press the Split button to see details");
else
help = "";
}
return g_strdup (help);
}
static const char *
gnc_split_register_get_tdebcred_entry (VirtualLocation virt_loc,
gboolean translate,
@ -1147,6 +1334,20 @@ gnc_template_register_get_fdebt_entry (VirtualLocation virt_loc,
NULL));
}
static char *
gnc_split_register_get_fdebt_help (VirtualLocation virt_loc,
gpointer user_data)
{
SplitRegister *reg = user_data;
const char *help;
help = gnc_table_get_entry (reg->table, virt_loc);
if (!help || *help == '\0')
help = _("Enter debit formula for real transaction");
return g_strdup (help);
}
static const char *
gnc_template_register_get_fcred_entry (VirtualLocation virt_loc,
gboolean translate,
@ -1167,6 +1368,32 @@ gnc_template_register_get_fcred_entry (VirtualLocation virt_loc,
NULL));
}
static char *
gnc_split_register_get_fcred_help (VirtualLocation virt_loc,
gpointer user_data)
{
SplitRegister *reg = user_data;
const char *help;
help = gnc_table_get_entry (reg->table, virt_loc);
if (!help || *help == '\0')
help = _("Enter credit formula for real transaction");
return g_strdup (help);
}
static char *
gnc_split_register_get_default_help (VirtualLocation virt_loc,
gpointer user_data)
{
SplitRegister *reg = user_data;
const char *help;
help = gnc_table_get_entry (reg->table, virt_loc);
return g_strdup (help);
}
static const char *
gnc_template_register_get_debcred_entry (VirtualLocation virt_loc,
gboolean translate,
@ -1405,6 +1632,58 @@ gnc_split_register_model_new (void)
FCRED_CELL);
gnc_table_model_set_default_help_handler
(model, gnc_split_register_get_default_help);
gnc_table_model_set_help_handler (model,
gnc_split_register_get_date_help,
DATE_CELL);
gnc_table_model_set_help_handler (model,
gnc_split_register_get_num_help,
NUM_CELL);
gnc_table_model_set_help_handler (model,
gnc_split_register_get_desc_help,
DESC_CELL);
gnc_table_model_set_help_handler (model,
gnc_split_register_get_price_help,
PRIC_CELL);
gnc_table_model_set_help_handler (model,
gnc_split_register_get_shares_help,
SHRS_CELL);
gnc_table_model_set_help_handler (model,
gnc_split_register_get_action_help,
ACTN_CELL);
gnc_table_model_set_help_handler (model,
gnc_split_register_get_memo_help,
MEMO_CELL);
gnc_table_model_set_help_handler (model,
gnc_split_register_get_notes_help,
NOTES_CELL);
gnc_table_model_set_help_handler (model,
gnc_split_register_get_xfrm_help,
XFRM_CELL);
gnc_table_model_set_help_handler (model,
gnc_split_register_get_mxfrm_help,
MXFRM_CELL);
gnc_table_model_set_help_handler (model,
gnc_split_register_get_fcred_help,
FCRED_CELL);
gnc_table_model_set_help_handler (model,
gnc_split_register_get_fdebt_help,
FDEBT_CELL);
gnc_table_model_set_io_flags_handler
(model,
gnc_split_register_get_standard_io_flags,

View File

@ -1983,71 +1983,21 @@ gnc_split_register_config_action (SplitRegister *reg)
static void
gnc_split_register_config_cells (SplitRegister *reg)
{
/* The num cell is the transaction number */
xaccSetBasicCellBlankHelp (gnc_table_layout_get_cell (reg->table->layout,
NUM_CELL),
_("Enter the transaction number, such as the "
"check number"));
gnc_combo_cell_add_ignore_string
((ComboCell *)
gnc_table_layout_get_cell (reg->table->layout, MXFRM_CELL),
_("-- Split Transaction --"));
/* the xfer cells */
{
const char *help = _("Enter the account to transfer from, or choose "
"one from the list");
xaccSetBasicCellBlankHelp (gnc_table_layout_get_cell (reg->table->layout,
MXFRM_CELL), help);
xaccSetBasicCellBlankHelp (gnc_table_layout_get_cell (reg->table->layout,
XFRM_CELL), help);
}
{
const char *help = _("This transaction has multiple splits; "
"press the Split button to see them all");
gnc_combo_cell_add_ignore_string
((ComboCell *)
gnc_table_layout_get_cell (reg->table->layout, MXFRM_CELL),
_("-- Split Transaction --"), help);
}
{
const char *help = _("This transaction is a stock split; "
"press the Split button to see details");
gnc_combo_cell_add_ignore_string
((ComboCell *)
gnc_table_layout_get_cell (reg->table->layout, MXFRM_CELL),
_("-- Stock Split --"), help);
}
gnc_combo_cell_add_ignore_string
((ComboCell *)
gnc_table_layout_get_cell (reg->table->layout, MXFRM_CELL),
_("-- Stock Split --"));
/* the action cell */
gnc_combo_cell_set_autosize
((ComboCell *)
gnc_table_layout_get_cell (reg->table->layout, ACTN_CELL), TRUE);
/* the memo cell */
xaccSetBasicCellBlankHelp
(gnc_table_layout_get_cell (reg->table->layout, MEMO_CELL),
_("Enter a description of the split"));
/* the desc cell */
xaccSetBasicCellBlankHelp
(gnc_table_layout_get_cell (reg->table->layout, DESC_CELL),
_("Enter a description of the transaction"));
/* the notes cell */
xaccSetBasicCellBlankHelp
(gnc_table_layout_get_cell (reg->table->layout, NOTES_CELL),
_("Enter notes for the transaction"));
/* the formula cells */
xaccSetBasicCellBlankHelp
(gnc_table_layout_get_cell (reg->table->layout, FCRED_CELL),
_("Enter credit formula for real transaction"));
xaccSetBasicCellBlankHelp
(gnc_table_layout_get_cell (reg->table->layout, FDEBT_CELL),
_("Enter debit formula for real transaction"));
/* Use 6 decimal places for prices */
gnc_price_cell_set_fraction
((PriceCell *)
@ -2067,11 +2017,6 @@ gnc_split_register_config_cells (SplitRegister *reg)
((ComboCell *)
gnc_table_layout_get_cell (reg->table->layout, ACTN_CELL), FALSE);
xaccSetBasicCellBlankHelp
(gnc_table_layout_get_cell (reg->table->layout, ACTN_CELL),
_("Enter the type of transaction, or choose "
"one from the list"));
/* number format for share quantities in stock ledgers */
switch (reg->type)
{
@ -2082,14 +2027,6 @@ gnc_split_register_config_cells (SplitRegister *reg)
((PriceCell *)
gnc_table_layout_get_cell (reg->table->layout, PRIC_CELL),
gnc_default_price_print_info ());
xaccSetBasicCellBlankHelp
(gnc_table_layout_get_cell (reg->table->layout, PRIC_CELL),
_("Enter the share price"));
xaccSetBasicCellBlankHelp
(gnc_table_layout_get_cell (reg->table->layout, SHRS_CELL),
_("Enter the number of shares bought or sold"));
break;
default:
@ -2288,7 +2225,7 @@ gnc_split_register_cleanup (SplitRegister *reg)
gnc_resume_gui_refresh ();
}
void
void
gnc_split_register_destroy (SplitRegister *reg)
{
GList *node;

View File

@ -65,18 +65,6 @@ gnc_basic_cell_new (void)
return cell;
}
static char *
BasicCellHelpValue(BasicCell *cell)
{
if ((cell->value != NULL) && (cell->value[0] != 0))
return g_strdup(cell->value);
if (cell->blank_help != NULL)
return g_strdup(cell->blank_help);
return NULL;
}
static void
gnc_basic_cell_clear (BasicCell *cell)
{
@ -90,7 +78,6 @@ gnc_basic_cell_clear (BasicCell *cell)
cell->value_w = NULL;
cell->value_len = 0;
cell->blank_help = NULL;
cell->set_value = NULL;
cell->enter_cell = NULL;
cell->modify_verify = NULL;
@ -99,7 +86,6 @@ gnc_basic_cell_clear (BasicCell *cell)
cell->gui_realize = NULL;
cell->gui_move = NULL;
cell->gui_destroy = NULL;
cell->get_help_value = NULL;
cell->is_popup = FALSE;
@ -117,8 +103,6 @@ gnc_basic_cell_init (BasicCell *cell)
cell->value = g_strdup ("");
cell->value_len = gnc_mbstowcs (&cell->value_w, cell->value);
cell->get_help_value = BasicCellHelpValue;
}
void
@ -138,9 +122,6 @@ gnc_basic_cell_destroy (BasicCell *cell)
g_free (cell->value_w);
cell->value_w = NULL;
g_free (cell->blank_help);
cell->blank_help = NULL;
/* help prevent access to freed memory */
gnc_basic_cell_clear (cell);
@ -259,32 +240,6 @@ gnc_basic_cell_set_conditionally_changed (BasicCell *cell, gboolean changed)
cell->conditionally_changed = changed;
}
void
xaccSetBasicCellBlankHelp (BasicCell *cell, const char *blank_help)
{
if (cell == NULL)
return;
g_free (cell->blank_help);
if (blank_help == NULL)
cell->blank_help = NULL;
else
cell->blank_help = g_strdup (blank_help);
}
char *
xaccBasicCellGetHelp (BasicCell *cell)
{
if (cell == NULL)
return NULL;
if (cell->get_help_value == NULL)
return NULL;
return cell->get_help_value(cell);
}
void
gnc_basic_cell_set_value_internal (BasicCell *cell, const char *value)
{

View File

@ -145,7 +145,7 @@
#include "gnc-ui-common.h"
typedef struct _BasicCell BasicCell;
typedef struct basic_cell BasicCell;
typedef BasicCell * (*CellCreateFunc) (void);
@ -180,8 +180,6 @@ typedef void (*CellMoveFunc) (BasicCell *cell);
typedef void (*CellDestroyFunc) (BasicCell *cell);
typedef char * (*CellGetHelpFunc) (BasicCell *cell);
typedef enum
{
CELL_ALIGN_RIGHT,
@ -189,12 +187,11 @@ typedef enum
CELL_ALIGN_LEFT
} CellAlignment;
struct _BasicCell
struct basic_cell
{
char * cell_name;
char * value; /* current value */
char * blank_help; /* help when value is blank */
GdkWChar * value_w; /* value as wide chars */
@ -213,8 +210,6 @@ struct _BasicCell
CellDirectUpdateFunc direct_update;
CellLeaveFunc leave_cell;
CellGetHelpFunc get_help_value;
/* private, GUI-specific callbacks */
CellRealizeFunc gui_realize;
CellMoveFunc gui_move;
@ -261,9 +256,6 @@ void gnc_basic_cell_set_changed (BasicCell *cell, gboolean changed);
void gnc_basic_cell_set_conditionally_changed (BasicCell *cell,
gboolean changed);
void xaccSetBasicCellBlankHelp (BasicCell *bcell, const char *help);
char * xaccBasicCellGetHelp (BasicCell *bcell);
/* for sub-class use only */
void gnc_basic_cell_set_value_internal (BasicCell *bcell,
const char *value);

View File

@ -52,7 +52,7 @@
#include "basiccell.h"
typedef struct _ComboCell
typedef struct
{
BasicCell cell;
} ComboCell;
@ -75,12 +75,9 @@ void gnc_combo_cell_set_complete_char (ComboCell *cell,
char complete_char);
/* Add a string to a list of strings which, if the cell has that value,
* will cause the cell to be uneditable on 'enter'. If the cell has
* that value, the ignore_help string will be returned by the
* help handler. */
* will cause the cell to be uneditable on 'enter'. */
void gnc_combo_cell_add_ignore_string (ComboCell *cell,
const char *ignore_string,
const char *ignore_help);
const char *ignore_string);
/* Determines whether the popup list autosizes itself or uses
* all available space. FALSE by default. */

View File

@ -37,7 +37,7 @@
#include "basiccell.h"
typedef struct _NumCell
typedef struct
{
BasicCell cell;
long int next_num;

View File

@ -162,24 +162,6 @@ gnc_price_cell_leave (BasicCell *_cell)
gnc_price_cell_parse (cell, TRUE);
}
static char *
PriceHelp (BasicCell *bcell)
{
if ((bcell->value != NULL) && (bcell->value[0] != 0))
{
const char *help_str;
help_str = bcell->value;
return g_strdup (help_str);
}
if (bcell->blank_help != NULL)
return g_strdup (bcell->blank_help);
return NULL;
}
BasicCell *
gnc_price_cell_new (void)
{
@ -209,7 +191,6 @@ gnc_price_cell_init (PriceCell *cell)
cell->cell.modify_verify = gnc_price_cell_modify_verify;
cell->cell.leave_cell = gnc_price_cell_leave;
cell->cell.set_value = gnc_price_cell_set_value_internal;
cell->cell.get_help_value = PriceHelp;
}
static const char *

View File

@ -47,7 +47,7 @@
typedef const char * (*RecnCellStringGetter) (char flag);
typedef gboolean (*RecnCellConfirm) (char old_flag, gpointer data);
typedef struct _RecnCell
typedef struct
{
BasicCell cell;

View File

@ -431,19 +431,22 @@ gnc_table_is_popup (Table *table, VirtualLocation virt_loc)
char *
gnc_table_get_help (Table *table)
{
BasicCell *cell;
TableGetHelpHandler help_handler;
VirtualLocation virt_loc;
const char * cell_name;
if (!table)
return NULL;
virt_loc = table->current_cursor_loc;
cell = gnc_table_get_cell (table, virt_loc);
if (!cell)
return FALSE;
cell_name = gnc_table_get_cell_name (table, virt_loc);
return xaccBasicCellGetHelp (cell);
help_handler = gnc_table_model_get_help_handler (table->model, cell_name);
if (!help_handler)
return NULL;
return help_handler (virt_loc, table->model->handler_user_data);
}
BasicCell *

View File

@ -132,6 +132,7 @@ gnc_table_model_new (void)
model->entry_handlers = gnc_table_model_handler_hash_new ();
model->label_handlers = gnc_table_model_handler_hash_new ();
model->help_handlers = gnc_table_model_handler_hash_new ();
model->io_flags_handlers = gnc_table_model_handler_hash_new ();
model->fg_color_handlers = gnc_table_model_handler_hash_new ();
model->bg_color_handlers = gnc_table_model_handler_hash_new ();
@ -154,6 +155,9 @@ gnc_table_model_destroy (TableModel *model)
gnc_table_model_handler_hash_destroy (model->label_handlers);
model->label_handlers = NULL;
gnc_table_model_handler_hash_destroy (model->help_handlers);
model->help_handlers = NULL;
gnc_table_model_handler_hash_destroy (model->io_flags_handlers);
model->io_flags_handlers = NULL;
@ -238,6 +242,38 @@ gnc_table_model_get_label_handler (TableModel *model, const char * cell_name)
cell_name);
}
void
gnc_table_model_set_help_handler (TableModel *model,
TableGetHelpHandler help_handler,
const char * cell_name)
{
g_return_if_fail (model != NULL);
g_return_if_fail (cell_name != NULL);
gnc_table_model_handler_hash_insert (model->help_handlers,
cell_name,
help_handler);
}
void
gnc_table_model_set_default_help_handler (TableModel *model,
TableGetHelpHandler help_handler)
{
g_return_if_fail (model != NULL);
gnc_table_model_handler_hash_insert (model->help_handlers,
DEFAULT_HANDLER,
help_handler);
}
TableGetHelpHandler
gnc_table_model_get_help_handler (TableModel *model, const char * cell_name)
{
g_return_val_if_fail (model != NULL, NULL);
return gnc_table_model_handler_hash_lookup (model->help_handlers, cell_name);
}
void
gnc_table_model_set_io_flags_handler
(TableModel *model,

View File

@ -64,6 +64,9 @@ typedef const char * (*TableGetEntryHandler) (VirtualLocation virt_loc,
typedef const char * (*TableGetLabelHandler) (VirtualLocation virt_loc,
gpointer user_data);
typedef char * (*TableGetHelpHandler) (VirtualLocation virt_loc,
gpointer user_data);
typedef CellIOFlags (*TableGetCellIOFlagsHandler) (VirtualLocation virt_loc,
gpointer user_data);
@ -92,6 +95,7 @@ typedef struct
{
GHashTable *entry_handlers;
GHashTable *label_handlers;
GHashTable *help_handlers;
GHashTable *io_flags_handlers;
GHashTable *fg_color_handlers;
GHashTable *bg_color_handlers;
@ -137,6 +141,17 @@ TableGetLabelHandler gnc_table_model_get_label_handler
(TableModel *model,
const char * cell_name);
void gnc_table_model_set_help_handler
(TableModel *model,
TableGetHelpHandler help_handler,
const char * cell_name);
void gnc_table_model_set_default_help_handler
(TableModel *model,
TableGetHelpHandler help_handler);
TableGetHelpHandler gnc_table_model_get_help_handler
(TableModel *model,
const char * cell_name);
void gnc_table_model_set_io_flags_handler
(TableModel *model,
TableGetCellIOFlagsHandler io_flags_handler,

View File

@ -70,7 +70,6 @@ typedef struct _PopBox
char complete_char; /* char to be used for auto-completion */
GList *ignore_strings;
GList *ignore_helps;
} PopBox;
@ -137,7 +136,6 @@ gnc_combo_cell_init (ComboCell *cell)
box->complete_char = '\0';
box->ignore_strings = NULL;
box->ignore_helps = NULL;
}
static void
@ -317,15 +315,6 @@ gnc_combo_cell_destroy (BasicCell *bcell)
g_list_free (box->ignore_strings);
box->ignore_strings = NULL;
for (node = box->ignore_helps; node; node = node->next)
{
g_free (node->data);
node->data = NULL;
}
g_list_free (box->ignore_helps);
box->ignore_helps = NULL;
g_free(box);
cell->cell.gui_private = NULL;
}
@ -670,39 +659,6 @@ gnc_combo_cell_direct_update (BasicCell *bcell,
return TRUE;
}
static char *
ComboHelpValue (BasicCell *bcell)
{
ComboCell *cell = (ComboCell *) bcell;
PopBox *box = cell->cell.gui_private;
if ((bcell->value != NULL) && (bcell->value[0] != 0))
{
GList *node;
GList *help_node = box->ignore_helps;
for (node = box->ignore_strings; node;
node = node->next, help_node = help_node->next)
{
if (!node->data)
continue;
if (strcmp (bcell->value, node->data) != 0)
continue;
if (help_node->data != NULL)
return g_strdup (help_node->data);
}
return g_strdup (bcell->value);
}
if (bcell->blank_help != NULL)
return g_strdup (bcell->blank_help);
return NULL;
}
static void
gnc_combo_cell_gui_realize (BasicCell *bcell, gpointer data)
{
@ -727,7 +683,6 @@ gnc_combo_cell_gui_realize (BasicCell *bcell, gpointer data)
cell->cell.gui_destroy = gnc_combo_cell_gui_destroy;
cell->cell.modify_verify = gnc_combo_cell_modify_verify;
cell->cell.direct_update = gnc_combo_cell_direct_update;
cell->cell.get_help_value = ComboHelpValue;
}
static void
@ -895,8 +850,7 @@ gnc_combo_cell_set_complete_char (ComboCell *cell, char complete_char)
void
gnc_combo_cell_add_ignore_string (ComboCell *cell,
const char *ignore_string,
const char *ignore_help)
const char *ignore_string)
{
PopBox *box;
@ -910,8 +864,6 @@ gnc_combo_cell_add_ignore_string (ComboCell *cell,
box->ignore_strings = g_list_prepend (box->ignore_strings,
g_strdup (ignore_string));
box->ignore_helps = g_list_prepend (box->ignore_helps,
g_strdup (ignore_help));
}
void

View File

@ -135,43 +135,6 @@ gnc_date_cell_print_date (DateCell *cell, char *buff)
box->date.tm_year+1900);
}
static char *
DateCellHelpValue (BasicCell *bcell)
{
DateCell *cell = (DateCell *) bcell;
PopBox *box = cell->cell.gui_private;
if ((bcell->value != NULL) && (bcell->value[0] != 0))
{
char string[1024];
struct tm time;
if (bcell->value != NULL)
gnc_parse_date (&time, bcell->value);
else
{
time.tm_mday = box->date.tm_mday;
time.tm_mon = box->date.tm_mon;
time.tm_year = box->date.tm_year;
time.tm_sec = 0;
time.tm_min = 0;
time.tm_hour = 0;
time.tm_isdst = -1;
mktime (&time);
}
strftime (string, sizeof (string), "%A %d %B %Y", &time);
return g_strdup (string);
}
if (bcell->blank_help != NULL)
return g_strdup (bcell->blank_help);
return NULL;
}
static void
gnc_date_cell_init (DateCell *cell)
{
@ -190,7 +153,6 @@ gnc_date_cell_init (DateCell *cell)
cell->cell.modify_verify = gnc_date_cell_modify_verify;
cell->cell.direct_update = gnc_date_cell_direct_update;
cell->cell.set_value = gnc_date_cell_set_value_internal;
cell->cell.get_help_value = DateCellHelpValue;
box = g_new0 (PopBox, 1);