[evolution-patches] 48153: field chooser adding wrong fields



field chooser dialog had some issues when the model has disabled
fields.  This bug was an interaction to a previous crash fixing patch.

-- 
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.58
diff -u -p -r1.58 e-table-config.c
--- gal/e-table/e-table-config.c	28 Jul 2003 16:09:08 -0000	1.58
+++ gal/e-table/e-table-config.c	10 Sep 2003 23:52:43 -0000
@@ -94,10 +94,8 @@ config_finalize (GObject *object)
 static void
 e_table_config_changed (ETableConfig *config, ETableState *state)
 {
-	g_return_if_fail (config != NULL);
 	g_return_if_fail (E_IS_TABLE_CONFIG (config));
 
-	
 	g_signal_emit(G_OBJECT(config), e_table_config_signals [CHANGED], 0, state);
 }
 
@@ -510,6 +508,7 @@ do_fields_config_dialog (ETableConfig *c
 
 ETableMemoryStoreColumnInfo store_columns[] = {
 	E_TABLE_MEMORY_STORE_STRING,
+	E_TABLE_MEMORY_STORE_INTEGER,
 	E_TABLE_MEMORY_STORE_TERMINATOR
 };
 
@@ -529,7 +528,7 @@ create_global_store (ETableConfig *confi
 			continue;
 
 		text = g_strdup (dgettext (config->domain, config->source_spec->columns[i]->title));
-		e_table_memory_store_insert_adopt (E_TABLE_MEMORY_STORE (global_store), -1, NULL, text);
+		e_table_memory_store_insert_adopt (E_TABLE_MEMORY_STORE (global_store), -1, NULL, text, i);
 	}
 }
 
@@ -640,6 +639,17 @@ connect_button (ETableConfig *config, Gl
 	}
 }
 
+static gint
+get_source_model_col_index (ETableConfig *config, gint idx)
+{
+	gint visible_index, result;
+	ETableModel *src_model = E_TABLE_SUBSET (config->available_model)->source;
+
+        visible_index = e_table_subset_view_to_model_row (E_TABLE_SUBSET (config->available_model), idx);
+	
+	return GPOINTER_TO_INT (e_table_model_value_at (src_model, 1, visible_index));
+}
+
 static void
 sort_entry_changed (GtkEntry *entry, ETableConfigSortWidgets *sort)
 {
@@ -882,7 +892,7 @@ config_button_add (GtkWidget *widget, ET
 	config->temp_state->expansions = g_renew (double, config->temp_state->expansions, config->temp_state->col_count + count);
 	i = config->temp_state->col_count;
 	for (column = columns; column; column = column->next) {
-		config->temp_state->columns[i] = e_table_subset_view_to_model_row (E_TABLE_SUBSET (config->available_model), GPOINTER_TO_INT (column->data));
+		config->temp_state->columns[i] = get_source_model_col_index (config, GPOINTER_TO_INT (column->data));
 		config->temp_state->expansions[i] = config->source_spec->columns[config->temp_state->columns[i]]->expansion;
 		i++;
 	}


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