[evolution-patches] 46380: crash launching field picker dialog



This patch fixes a row indexing issue.  Earlier in the 1.4 cycle, I
fixed a bug that was causing disabled model fields to show in the
"available" fields and therefore allowed the user to add them to a view.

That fix broke the direct source_model_col -> row relationship in the
"available" model.  This patch is a brute force hack that steps through
the model spec and maps the source model column onto the available model
row.

-- 
Mike Kestner <mkestner ximian com>
Index: gal/e-table/e-table-config.c
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/e-table-config.c,v
retrieving revision 1.57
diff -u -p -r1.57 e-table-config.c
--- gal/e-table/e-table-config.c	12 Jun 2003 13:35:46 -0000	1.57
+++ gal/e-table/e-table-config.c	25 Jul 2003 20:36:35 -0000
@@ -372,8 +372,13 @@ setup_fields (ETableConfig *config)
 
 	if (config->temp_state) {
 		for (i = 0; i < config->temp_state->col_count; i++) {
-			e_table_subset_variable_add (config->shown_model, config->temp_state->columns[i]);
-			e_table_without_hide (config->available_model, GINT_TO_POINTER(config->temp_state->columns[i]));
+			gint j, idx;
+			for (j = 0, idx = 0; j < config->temp_state->columns[i]; j++)
+				if (!config->source_spec->columns[j]->disabled)
+					idx++;
+
+			e_table_subset_variable_add (config->shown_model, idx);
+			e_table_without_hide (config->available_model, GINT_TO_POINTER(idx));
 		}
 	}
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]