From bfccd5b470c3bcc0d23d619e9c0d93f0fdc80cce Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Fri, 14 Jun 2002 22:26:43 +0000 Subject: Don't draw or interact with the popup button if a cell isn't editable 2002-06-14 Christopher James Lahey * e-cell-popup.c (ecp_draw, ecp_event): Don't draw or interact with the popup button if a cell isn't editable (based on a patch by JPR.) * e-table-col.c, e-table-col.h: Added the compare_col field to this structure. Added a GtkArg to set it. * e-table-column-specification.c, e-table-column-specification.h: Added the compare_col field here. Made it load properly from xml. * e-table-sorting-utils.c: Sort based on the compare_col in the ETableCol instead of the col_idx. * e-table-utils.c (et_col_spec_to_col): Set the compare_col field in the ETableCol properly. * e-table.c, e-table.h: Removed the drag_get_data_row and drag_get_data_col fields since they're not used any longer. (e_table_construct): If specification loading fails, return a NULL ETable instead of just ignoring it. (e_table_drag_highlight): Only destroy table->drop_highlight if it exists. svn path=/trunk/; revision=17190 --- widgets/table/e-cell-popup.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'widgets/table/e-cell-popup.c') diff --git a/widgets/table/e-cell-popup.c b/widgets/table/e-cell-popup.c index b2a0f3bf03..96eebfb6f0 100644 --- a/widgets/table/e-cell-popup.c +++ b/widgets/table/e-cell-popup.c @@ -264,17 +264,18 @@ ecp_draw (ECellView *ecv, GdkDrawable *drawable, GtkWidget *canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (ecv->e_table_item_view)->canvas); GtkShadowType shadow; GdkRectangle rect; - gboolean show_popup_arrow = FALSE; + gboolean show_popup_arrow; /* Display the popup arrow if we are the cursor cell, or the popup is shown for this cell. */ - if (flags & E_CELL_CURSOR) { - show_popup_arrow = TRUE; - ecp->popup_arrow_shown = TRUE; - } else if (ecp->popup_shown && ecp->popup_view_col == view_col - && ecp->popup_row == row && ecp->popup_model == ((ECellView *) ecp_view)->e_table_model) { - show_popup_arrow = TRUE; - } + show_popup_arrow = e_table_model_is_cell_editable (ecv->e_table_model, model_col, row) && + (flags & E_CELL_CURSOR || + (ecp->popup_shown && ecp->popup_view_col == view_col + && ecp->popup_row == row + && ecp->popup_model == ((ECellView *) ecp_view)->e_table_model)); + + if (flags & E_CELL_CURSOR) + ecp->popup_arrow_shown = show_popup_arrow; #if 0 g_print ("In ecp_draw row:%i col: %i %i,%i %i,%i Show Arrow:%i\n", @@ -329,7 +330,8 @@ ecp_event (ECellView *ecv, GdkEvent *event, int model_col, int view_col, switch (event->type) { case GDK_BUTTON_PRESS: - if (flags & E_CELL_CURSOR + if (e_table_model_is_cell_editable (ecv->e_table_model, model_col, row) && + flags & E_CELL_CURSOR && ecp->popup_arrow_shown) { width = e_table_header_col_diff (eti->header, view_col, view_col + 1); @@ -344,10 +346,9 @@ ecp_event (ECellView *ecv, GdkEvent *event, int model_col, int view_col, } } break; - case GDK_BUTTON_RELEASE: - break; case GDK_KEY_PRESS: - if (event->key.state & GDK_MOD1_MASK + if (e_table_model_is_cell_editable (ecv->e_table_model, model_col, row) && + event->key.state & GDK_MOD1_MASK && event->key.keyval == GDK_Down) { g_print ("## Alt-Down pressed\n"); return e_cell_popup_do_popup (ecp_view, event, row, view_col); -- cgit v1.2.3