Add option to recn cell type to be read only

Use added read only option to make Associate cell read only
This commit is contained in:
Robert Fewell 2016-08-01 12:45:35 +01:00 committed by John Ralls
parent 57666b43ba
commit 5f75f106ee
3 changed files with 15 additions and 0 deletions

View File

@ -83,6 +83,7 @@ gnc_split_register_load_associate_cells (SplitRegister *reg)
/* FIXME: These should get moved to an i18n function */
gnc_recn_cell_set_valid_flags (cell, "fw ", ' ');
gnc_recn_cell_set_flag_order (cell, "fw ");
gnc_recn_cell_set_read_only (cell, TRUE);
}
static void

View File

@ -74,6 +74,9 @@ gnc_recn_cell_enter (BasicCell *_cell,
! (cell->confirm_cb (cell->flag, cell->confirm_data)))
return FALSE;
if (cell->read_only == TRUE)
return FALSE;
/* Find the current flag in the list of flags */
this_flag = strchr (cell->flag_order, cell->flag);
@ -111,6 +114,7 @@ gnc_recn_cell_init (RecnCell *cell)
cell->get_string = NULL;
cell->valid_flags = "";
cell->flag_order = "";
cell->read_only = FALSE;
cell->cell.enter_cell = gnc_recn_cell_enter;
cell->cell.set_value = gnc_recn_cell_set_value;
@ -207,3 +211,10 @@ gnc_recn_cell_set_flag_order (RecnCell *cell, const char *flags)
cell->flag_order = (char *)flags;
}
void
gnc_recn_cell_set_read_only (RecnCell *cell, gboolean read_only)
{
g_return_if_fail (cell != NULL);
cell->read_only = read_only;
}

View File

@ -57,6 +57,7 @@ typedef struct
RecnCellStringGetter get_string;
RecnCellConfirm confirm_cb;
gpointer confirm_data;
gboolean read_only;
} RecnCell;
BasicCell * gnc_recn_cell_new (void);
@ -81,5 +82,7 @@ void gnc_recn_cell_set_string_getter (RecnCell *cell,
void gnc_recn_cell_set_valid_flags (RecnCell *cell, const char *flags,
char default_flag);
void gnc_recn_cell_set_flag_order (RecnCell *cell, const char *flags);
void gnc_recn_cell_set_read_only (RecnCell *cell, gboolean read_only);
/** @} */
#endif