aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/e-table/e-table-subset.c
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@gnu.org>1999-11-25 16:02:13 +0800
committerArturo Espinosa <unammx@src.gnome.org>1999-11-25 16:02:13 +0800
commit385ccbd512c4c43305dee900f86d0f51f94b1200 (patch)
tree81920b9b2281f21a55ccd417895d0bd3a271cff7 /widgets/e-table/e-table-subset.c
parent858500c40a2bf4485e75e1a056d0310b92625929 (diff)
downloadgsoc2013-evolution-385ccbd512c4c43305dee900f86d0f51f94b1200.tar
gsoc2013-evolution-385ccbd512c4c43305dee900f86d0f51f94b1200.tar.gz
gsoc2013-evolution-385ccbd512c4c43305dee900f86d0f51f94b1200.tar.bz2
gsoc2013-evolution-385ccbd512c4c43305dee900f86d0f51f94b1200.tar.lz
gsoc2013-evolution-385ccbd512c4c43305dee900f86d0f51f94b1200.tar.xz
gsoc2013-evolution-385ccbd512c4c43305dee900f86d0f51f94b1200.tar.zst
gsoc2013-evolution-385ccbd512c4c43305dee900f86d0f51f94b1200.zip
Realize cells.
1999-11-25 Miguel de Icaza <miguel@gnu.org> * e-table-header-item.c (ethi_realize): Realize cells. * e-table-item.c (eti_header_dim_changed): redraw before and after. * e-table-header-item.c (ethi_event): Add continuous resizing. 1999-11-24 Miguel de Icaza <miguel@gnu.org> * e-table-subset.h, e-table-subset.c: New files, used to implement subset tables. * e-table-sorted.h, e-table-sorted.c: Now they derive from e-table-subset. * e-cell.c, e-cell.h: realize method now return per view instance data. svn path=/trunk/; revision=1434
Diffstat (limited to 'widgets/e-table/e-table-subset.c')
-rw-r--r--widgets/e-table/e-table-subset.c114
1 files changed, 92 insertions, 22 deletions
diff --git a/widgets/e-table/e-table-subset.c b/widgets/e-table/e-table-subset.c
index 0b9621ac84..afa1b862b4 100644
--- a/widgets/e-table/e-table-subset.c
+++ b/widgets/e-table/e-table-subset.c
@@ -19,52 +19,122 @@ etss_destroy (GtkObject *object)
{
ETableSubset *etss = E_TABLE_SUBSET (object);
- gtk_object_unref (GTK_OBJECT (etss->source));
- free (ets->subset_table);
+ if (etss->source)
+ gtk_object_unref (GTK_OBJECT (etss->source));
- GTK_OBJECT_CLASS (ets_parent_class)->destroy (object);
+ if (etss->map_table)
+ free (etss->map_table);
+
+ GTK_OBJECT_CLASS (etss_parent_class)->destroy (object);
+}
+
+static int
+etss_column_count (ETableModel *etm)
+{
+ ETableSubset *etss = (ETableSubset *)etm;
+
+ return e_table_model_column_count (etss->source);
+}
+
+static const char *
+etss_column_name (ETableModel *etm, int col)
+{
+ ETableSubset *etss = (ETableSubset *)etm;
+
+ return e_table_model_column_name (etss->source, col);
+}
+
+static int
+etss_row_count (ETableModel *etm)
+{
+ ETableSubset *etss = (ETableSubset *)etm;
+
+ return e_table_model_row_count (etss->source);
+}
+
+static void *
+etss_value_at (ETableModel *etm, int col, int row)
+{
+ ETableSubset *etss = (ETableSubset *)etm;
+
+ return e_table_model_value_at (etss->source, col, etss->map_table [row]);
+}
+
+static void
+etss_set_value_at (ETableModel *etm, int col, int row, void *val)
+{
+ ETableSubset *etss = (ETableSubset *)etm;
+
+ return e_table_model_set_value_at (etss->source, col, etss->map_table [row], val);
+}
+
+static gboolean
+etss_is_cell_editable (ETableModel *etm, int col, int row)
+{
+ ETableSubset *etss = (ETableSubset *)etm;
+
+ return e_table_model_is_cell_editable (etss->source, col, etss->map_table [row]);
+}
+
+static int
+etss_row_height (ETableModel *etm, int row)
+{
+ ETableSubset *etss = (ETableSubset *)etm;
+
+ return e_table_model_row_height (etss->source, etss->map_table [row]);
}
static void
etss_class_init (GtkObjectClass *klass)
{
+ ETableModelClass *table_class = (ETableModelClass *) klass;
+
etss_parent_class = gtk_type_class (PARENT_TYPE);
klass->destroy = etss_destroy;
+
+ table_class->column_count = etss_column_count;
+ table_class->column_name = etss_column_name;
+ table_class->row_count = etss_row_count;
+ table_class->value_at = etss_value_at;
+ table_class->set_value_at = etss_set_value_at;
+ table_class->is_cell_editable = etss_is_cell_editable;
+ table_class->row_height = etss_row_height;
+
}
E_MAKE_TYPE(e_table_subset, "ETableSubset", ETableSubset, etss_class_init, NULL, PARENT_TYPE);
ETableModel *
-e_table_subset_new (ETableModel *source, ETableHeader *header, short sort_field)
+e_table_subset_construct (ETableSubset *etss, ETableModel *source, int nvals)
{
- ETableSorted *ets = gtk_type_new (E_TABLE_SORTED_TYPE);
- const int nvals = e_table_model_row_count (source);
unsigned int *buffer;
int i;
- buffer = malloc (sizeof (unsigned int *) * nvals);
+ buffer = (unsigned int *) malloc (sizeof (unsigned int *) * nvals);
if (buffer = NULL)
return NULL;
- ets->map_table = buffer;
- ets->n_map = nvals;
- ets->source = source;
- ets->header = header;
- ets->sort_col = e_table_header_get_column (header, sort_field);
- ets->sort_idx = sort_field;
+ etss->map_table = buffer;
+ etss->n_map = nvals;
+ etss->source = source;
gtk_object_ref (GTK_OBJECT (source));
- gtk_object_ref (GTK_OBJECT (header));
/* Init */
for (i = 0; i < nvals; i++)
- ets->map_table [i] = i;
+ etss->map_table [i] = i;
- /* Sort */
- g_assert (sort_ets == NULL);
- sort_ets = ets;
- qsort (ets->map_table, nvals, sizeof (unsigned int), my_sort);
- sort_ets = NULL;
-
- return (ETableModel *) ets;
+}
+
+ETableModel *
+e_table_subset_new (ETableModel *source, const int nvals)
+{
+ ETableSubset *etss = gtk_type_new (E_TABLE_SUBSET_TYPE);
+
+ if (e_table_subset_construct (etss, source, nvals) == NULL){
+ gtk_object_destroy (GTK_OBJECT (etss));
+ return NULL;
+ }
+
+ return (ETableModel *) etss;
}