Skip to content

Commit

Permalink
When a resister is read only make whole sheet insensitive.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bob-IT committed Dec 10, 2020
1 parent f3eae75 commit dced40c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions gnucash/register/register-gnome/gnucash-sheet-private.c
Expand Up @@ -408,6 +408,17 @@ draw_cell (GnucashSheet *sheet, SheetBlock *block,
color_type = gnc_table_get_color (table, virt_loc, &hatching);
gnucash_get_style_classes (sheet, stylectxt, color_type, use_neg_class);

if (sheet->read_only)
{
if (!gtk_style_context_has_class (stylectxt, GTK_STYLE_CLASS_BACKGROUND))
gtk_style_context_set_state (stylectxt, GTK_STATE_FLAG_INSENSITIVE);
}
else
{
if (gtk_style_context_has_class (stylectxt, GTK_STYLE_CLASS_BACKGROUND))
gtk_style_context_set_state (stylectxt, GTK_STATE_FLAG_NORMAL);
}

// Are we in a read-only row? Then make the background color somewhat more grey.
if ((virt_loc.phys_row_offset < block->style->nrows)
&& (table->model->dividing_row_upper >= 0)
Expand Down Expand Up @@ -627,6 +638,8 @@ gnucash_sheet_draw_internal (GnucashSheet* sheet, cairo_t* cr,
if (!sheet_block || !sheet_block->style)
return FALSE;

sheet->read_only = gnc_table_model_read_only (sheet->table->model);

for ( ; virt_loc.vcell_loc.virt_row < sheet->num_virt_rows;
virt_loc.vcell_loc.virt_row++ )
{
Expand Down
1 change: 1 addition & 0 deletions gnucash/register/register-gnome/gnucash-sheetP.h
Expand Up @@ -44,6 +44,7 @@ struct _GnucashSheet
gpointer popup_data;

Table *table;
gboolean read_only;

GtkWidget *reg;

Expand Down

0 comments on commit dced40c

Please sign in to comment.