aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@gnu.org>1999-12-03 16:02:36 +0800
committerArturo Espinosa <unammx@src.gnome.org>1999-12-03 16:02:36 +0800
commit50006218b6fce73920132f43569f410e6d6c6ae4 (patch)
tree7fd9b0947b1393b157d6e7217d4819b78806a638
parent2e132a09abe8303d10d25b80d1fe23e3b18c6a62 (diff)
downloadgsoc2013-evolution-50006218b6fce73920132f43569f410e6d6c6ae4.tar
gsoc2013-evolution-50006218b6fce73920132f43569f410e6d6c6ae4.tar.gz
gsoc2013-evolution-50006218b6fce73920132f43569f410e6d6c6ae4.tar.bz2
gsoc2013-evolution-50006218b6fce73920132f43569f410e6d6c6ae4.tar.lz
gsoc2013-evolution-50006218b6fce73920132f43569f410e6d6c6ae4.tar.xz
gsoc2013-evolution-50006218b6fce73920132f43569f410e6d6c6ae4.tar.zst
gsoc2013-evolution-50006218b6fce73920132f43569f410e6d6c6ae4.zip
fixed api.
1999-12-02 Miguel de Icaza <miguel@gnu.org> * e-table-header.c (e_table_header_index): fixed api. 1999-12-01 Miguel de Icaza <miguel@gnu.org> * test-cols.c (multi_cols_test): Update to simplified API. * test-check.c (check_test): ditto * test-table.c (table_browser_test): ditto * e-table-simple.c (e_table_simple_class_init): Kill column_name method. * e-table-model.h: Kill column_name method. * e-table-col.c (e_table_col_new): Instead of using a column name, use a column index. svn path=/trunk/; revision=1459
-rw-r--r--widgets/ChangeLog15
-rw-r--r--widgets/e-table-col.c7
-rw-r--r--widgets/e-table-col.h6
-rw-r--r--widgets/e-table-header-item.c4
-rw-r--r--widgets/e-table-header.c17
-rw-r--r--widgets/e-table-header.h2
-rw-r--r--widgets/e-table-model.c8
-rw-r--r--widgets/e-table-model.h1
-rw-r--r--widgets/e-table-simple.c11
-rw-r--r--widgets/e-table-simple.h3
-rw-r--r--widgets/e-table/ChangeLog15
-rw-r--r--widgets/e-table/e-table-col.c7
-rw-r--r--widgets/e-table/e-table-col.h6
-rw-r--r--widgets/e-table/e-table-header-item.c4
-rw-r--r--widgets/e-table/e-table-header.c17
-rw-r--r--widgets/e-table/e-table-header.h2
-rw-r--r--widgets/e-table/e-table-model.c8
-rw-r--r--widgets/e-table/e-table-model.h1
-rw-r--r--widgets/e-table/e-table-simple.c11
-rw-r--r--widgets/e-table/e-table-simple.h3
-rw-r--r--widgets/e-table/test-check.c17
-rw-r--r--widgets/e-table/test-cols.c17
-rw-r--r--widgets/e-table/test-table.c12
-rw-r--r--widgets/table/e-table-col.c7
-rw-r--r--widgets/table/e-table-col.h6
-rw-r--r--widgets/table/e-table-header-item.c4
-rw-r--r--widgets/table/e-table-header.c17
-rw-r--r--widgets/table/e-table-header.h2
-rw-r--r--widgets/table/e-table-model.c8
-rw-r--r--widgets/table/e-table-model.h1
-rw-r--r--widgets/table/e-table-simple.c11
-rw-r--r--widgets/table/e-table-simple.h3
-rw-r--r--widgets/table/test-check.c17
-rw-r--r--widgets/table/test-cols.c17
-rw-r--r--widgets/table/test-table.c12
-rw-r--r--widgets/test-check.c17
-rw-r--r--widgets/test-cols.c17
-rw-r--r--widgets/test-table.c12
38 files changed, 93 insertions, 252 deletions
diff --git a/widgets/ChangeLog b/widgets/ChangeLog
index 76e918b61d..be5207f31b 100644
--- a/widgets/ChangeLog
+++ b/widgets/ChangeLog
@@ -1,5 +1,20 @@
+1999-12-02 Miguel de Icaza <miguel@gnu.org>
+
+ * e-table-header.c (e_table_header_index): fixed api.
+
1999-12-01 Miguel de Icaza <miguel@gnu.org>
+ * test-cols.c (multi_cols_test): Update to simplified API.
+ * test-check.c (check_test): ditto
+ * test-table.c (table_browser_test): ditto
+
+ * e-table-simple.c (e_table_simple_class_init): Kill column_name method.
+
+ * e-table-model.h: Kill column_name method.
+
+ * e-table-col.c (e_table_col_new): Instead of using a column name,
+ use a column index.
+
* e-cell-text.c (ect_draw): Keep track of the originally allocated
piece of code.
diff --git a/widgets/e-table-col.c b/widgets/e-table-col.c
index cca7bd13d6..86392a9419 100644
--- a/widgets/e-table-col.c
+++ b/widgets/e-table-col.c
@@ -21,8 +21,6 @@ etc_destroy (GtkObject *object)
{
ETableCol *etc = E_TABLE_COL (object);
- printf ("Destroying columns: %s %s\n", etc->id, etc->text);
- g_free (etc->id);
g_free (etc->text);
(*parent_class->destroy)(object);
@@ -38,12 +36,11 @@ e_table_col_class_init (GtkObjectClass *object_class)
E_MAKE_TYPE(e_table_col, "ETableCol", ETableCol, e_table_col_class_init, NULL, PARENT_TYPE);
ETableCol *
-e_table_col_new (const char *id, const char *text, int width, int min_width,
+e_table_col_new (int col_idx, const char *text, int width, int min_width,
ECell *ecell, GCompareFunc compare, gboolean resizable)
{
ETableCol *etc;
- g_return_val_if_fail (id != NULL, NULL);
g_return_val_if_fail (width >= 0, NULL);
g_return_val_if_fail (min_width >= 0, NULL);
g_return_val_if_fail (width >= min_width, NULL);
@@ -51,7 +48,7 @@ e_table_col_new (const char *id, const char *text, int width, int min_width,
etc = gtk_type_new (E_TABLE_COL_TYPE);
- etc->id = g_strdup (id);
+ etc->col_idx = col_idx;
etc->text = g_strdup (text);
etc->width = width;
etc->min_width = min_width;
diff --git a/widgets/e-table-col.h b/widgets/e-table-col.h
index c8fa6dd581..54f03ae237 100644
--- a/widgets/e-table-col.h
+++ b/widgets/e-table-col.h
@@ -16,14 +16,14 @@ typedef struct _ETableCol ETableCol;
*/
struct _ETableCol {
GtkObject base;
- char *id, *text;
+ char *text;
short width;
short min_width;
short x;
GCompareFunc compare;
unsigned int selected:1;
unsigned int resizeable:1;
-
+ int col_idx;
ECell *ecell;
};
@@ -33,7 +33,7 @@ typedef struct {
} ETableColClass;
GtkType e_table_col_get_type (void);
-ETableCol *e_table_col_new (const char *id, const char *text,
+ETableCol *e_table_col_new (int col_idx, const char *text,
int width, int min_width,
ECell *ecell, GCompareFunc compare,
gboolean resizable);
diff --git a/widgets/e-table-header-item.c b/widgets/e-table-header-item.c
index 378bdf4447..5368f10602 100644
--- a/widgets/e-table-header-item.c
+++ b/widgets/e-table-header-item.c
@@ -213,7 +213,7 @@ draw_button (ETableHeaderItem *ethi, ETableCol *col,
gdk_gc_set_clip_rectangle (ethi->gc, &clip);
/* Center the thing */
- xtra = (clip.width - gdk_string_measure (ethi->font, col->id))/2;
+ xtra = (clip.width - gdk_string_measure (ethi->font, col->text))/2;
if (xtra < 0)
xtra = 0;
@@ -224,7 +224,7 @@ draw_button (ETableHeaderItem *ethi, ETableCol *col,
gdk_draw_text (
drawable, ethi->font,
ethi->gc, x, y + ethi->height - PADDING,
- col->id, strlen (col->id));
+ col->text, strlen (col->text));
}
static void
diff --git a/widgets/e-table-header.c b/widgets/e-table-header.c
index e91113bbb9..576f609deb 100644
--- a/widgets/e-table-header.c
+++ b/widgets/e-table-header.c
@@ -170,22 +170,15 @@ e_table_header_count (ETableHeader *eth)
}
int
-e_table_header_index (ETableHeader *eth, const char *identifier)
+e_table_header_index (ETableHeader *eth, int col)
{
int i;
- g_return_val_if_fail (eth != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_HEADER (eth), 0);
- g_return_val_if_fail (identifier != NULL, 0);
+ g_return_val_if_fail (eth != NULL, -1);
+ g_return_val_if_fail (E_IS_TABLE_HEADER (eth), -1);
+ g_return_val_if_fail (col < eth->col_count, -1);
- for (i = 0; i < eth->col_count; i++){
- ETableCol *tc = eth->columns [i];
-
- if (strcmp (tc->id, identifier) == 0)
- return i;
- }
-
- return -1;
+ return eth->columns [col]->col_idx;
}
int
diff --git a/widgets/e-table-header.h b/widgets/e-table-header.h
index c263c36ad3..8965dee5c6 100644
--- a/widgets/e-table-header.h
+++ b/widgets/e-table-header.h
@@ -40,7 +40,7 @@ ETableCol * e_table_header_get_column (ETableHeader *eth,
int column);
int e_table_header_count (ETableHeader *eth);
int e_table_header_index (ETableHeader *eth,
- const char *identifier);
+ int col);
int e_table_header_get_index_at (ETableHeader *eth,
int x_offset);
ETableCol **e_table_header_get_columns (ETableHeader *eth);
diff --git a/widgets/e-table-model.c b/widgets/e-table-model.c
index 103bb31b57..60f762214f 100644
--- a/widgets/e-table-model.c
+++ b/widgets/e-table-model.c
@@ -33,14 +33,6 @@ e_table_model_column_count (ETableModel *e_table_model)
return ETM_CLASS (e_table_model)->column_count (e_table_model);
}
-const char *
-e_table_model_column_name (ETableModel *e_table_model, int col)
-{
- g_return_val_if_fail (e_table_model != NULL, NULL);
- g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), NULL);
-
- return ETM_CLASS (e_table_model)->column_name (e_table_model, col);
-}
int
e_table_model_row_count (ETableModel *e_table_model)
diff --git a/widgets/e-table-model.h b/widgets/e-table-model.h
index 22339ae484..0749a39758 100644
--- a/widgets/e-table-model.h
+++ b/widgets/e-table-model.h
@@ -20,7 +20,6 @@ typedef struct {
* Virtual methods
*/
int (*column_count) (ETableModel *etm);
- const char *(*column_name) (ETableModel *etm, int col);
int (*row_count) (ETableModel *etm);
void *(*value_at) (ETableModel *etm, int col, int row);
void (*set_value_at) (ETableModel *etm, int col, int row, const void *value);
diff --git a/widgets/e-table-simple.c b/widgets/e-table-simple.c
index 2076e06cef..943a3291e9 100644
--- a/widgets/e-table-simple.c
+++ b/widgets/e-table-simple.c
@@ -22,14 +22,6 @@ simple_column_count (ETableModel *etm)
return simple->col_count (etm, simple->data);
}
-static const char *
-simple_column_name (ETableModel *etm, int col)
-{
- ETableSimple *simple = (ETableSimple *)etm;
-
- return simple->col_name (etm, col, simple->data);
-}
-
static int
simple_row_count (ETableModel *etm)
{
@@ -68,7 +60,6 @@ e_table_simple_class_init (GtkObjectClass *object_class)
ETableModelClass *model_class = (ETableModelClass *) object_class;
model_class->column_count = simple_column_count;
- model_class->column_name = simple_column_name;
model_class->row_count = simple_row_count;
model_class->value_at = simple_value_at;
model_class->set_value_at = simple_set_value_at;
@@ -100,7 +91,6 @@ e_table_simple_get_type (void)
ETableModel *
e_table_simple_new (ETableSimpleColumnCountFn col_count,
- ETableSimpleColumnNameFn col_name,
ETableSimpleRowCountFn row_count,
ETableSimpleValueAtFn value_at,
ETableSimpleSetValueAtFn set_value_at,
@@ -112,7 +102,6 @@ e_table_simple_new (ETableSimpleColumnCountFn col_count,
et = gtk_type_new (e_table_simple_get_type ());
et->col_count = col_count;
- et->col_name = col_name;
et->row_count = row_count;
et->value_at = value_at;
et->set_value_at = set_value_at;
diff --git a/widgets/e-table-simple.h b/widgets/e-table-simple.h
index 1f7a17aeff..d890245386 100644
--- a/widgets/e-table-simple.h
+++ b/widgets/e-table-simple.h
@@ -4,7 +4,6 @@
#include "e-table-model.h"
typedef int (*ETableSimpleColumnCountFn) (ETableModel *etm, void *data);
-typedef const char *(*ETableSimpleColumnNameFn) (ETableModel *etm, int col, void *data);
typedef int (*ETableSimpleRowCountFn) (ETableModel *etm, void *data);
typedef void *(*ETableSimpleValueAtFn) (ETableModel *etm, int col, int row, void *data);
typedef void (*ETableSimpleSetValueAtFn) (ETableModel *etm, int col, int row, const void *val, void *data);
@@ -14,7 +13,6 @@ typedef struct {
ETableModel parent;
ETableSimpleColumnCountFn col_count;
- ETableSimpleColumnNameFn col_name;
ETableSimpleRowCountFn row_count;
ETableSimpleValueAtFn value_at;
ETableSimpleSetValueAtFn set_value_at;
@@ -29,7 +27,6 @@ typedef struct {
GtkType e_table_simple_get_type (void);
ETableModel *e_table_simple_new (ETableSimpleColumnCountFn col_count,
- ETableSimpleColumnNameFn col_name,
ETableSimpleRowCountFn row_count,
ETableSimpleValueAtFn value_at,
ETableSimpleSetValueAtFn set_value_at,
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog
index 76e918b61d..be5207f31b 100644
--- a/widgets/e-table/ChangeLog
+++ b/widgets/e-table/ChangeLog
@@ -1,5 +1,20 @@
+1999-12-02 Miguel de Icaza <miguel@gnu.org>
+
+ * e-table-header.c (e_table_header_index): fixed api.
+
1999-12-01 Miguel de Icaza <miguel@gnu.org>
+ * test-cols.c (multi_cols_test): Update to simplified API.
+ * test-check.c (check_test): ditto
+ * test-table.c (table_browser_test): ditto
+
+ * e-table-simple.c (e_table_simple_class_init): Kill column_name method.
+
+ * e-table-model.h: Kill column_name method.
+
+ * e-table-col.c (e_table_col_new): Instead of using a column name,
+ use a column index.
+
* e-cell-text.c (ect_draw): Keep track of the originally allocated
piece of code.
diff --git a/widgets/e-table/e-table-col.c b/widgets/e-table/e-table-col.c
index cca7bd13d6..86392a9419 100644
--- a/widgets/e-table/e-table-col.c
+++ b/widgets/e-table/e-table-col.c
@@ -21,8 +21,6 @@ etc_destroy (GtkObject *object)
{
ETableCol *etc = E_TABLE_COL (object);
- printf ("Destroying columns: %s %s\n", etc->id, etc->text);
- g_free (etc->id);
g_free (etc->text);
(*parent_class->destroy)(object);
@@ -38,12 +36,11 @@ e_table_col_class_init (GtkObjectClass *object_class)
E_MAKE_TYPE(e_table_col, "ETableCol", ETableCol, e_table_col_class_init, NULL, PARENT_TYPE);
ETableCol *
-e_table_col_new (const char *id, const char *text, int width, int min_width,
+e_table_col_new (int col_idx, const char *text, int width, int min_width,
ECell *ecell, GCompareFunc compare, gboolean resizable)
{
ETableCol *etc;
- g_return_val_if_fail (id != NULL, NULL);
g_return_val_if_fail (width >= 0, NULL);
g_return_val_if_fail (min_width >= 0, NULL);
g_return_val_if_fail (width >= min_width, NULL);
@@ -51,7 +48,7 @@ e_table_col_new (const char *id, const char *text, int width, int min_width,
etc = gtk_type_new (E_TABLE_COL_TYPE);
- etc->id = g_strdup (id);
+ etc->col_idx = col_idx;
etc->text = g_strdup (text);
etc->width = width;
etc->min_width = min_width;
diff --git a/widgets/e-table/e-table-col.h b/widgets/e-table/e-table-col.h
index c8fa6dd581..54f03ae237 100644
--- a/widgets/e-table/e-table-col.h
+++ b/widgets/e-table/e-table-col.h
@@ -16,14 +16,14 @@ typedef struct _ETableCol ETableCol;
*/
struct _ETableCol {
GtkObject base;
- char *id, *text;
+ char *text;
short width;
short min_width;
short x;
GCompareFunc compare;
unsigned int selected:1;
unsigned int resizeable:1;
-
+ int col_idx;
ECell *ecell;
};
@@ -33,7 +33,7 @@ typedef struct {
} ETableColClass;
GtkType e_table_col_get_type (void);
-ETableCol *e_table_col_new (const char *id, const char *text,
+ETableCol *e_table_col_new (int col_idx, const char *text,
int width, int min_width,
ECell *ecell, GCompareFunc compare,
gboolean resizable);
diff --git a/widgets/e-table/e-table-header-item.c b/widgets/e-table/e-table-header-item.c
index 378bdf4447..5368f10602 100644
--- a/widgets/e-table/e-table-header-item.c
+++ b/widgets/e-table/e-table-header-item.c
@@ -213,7 +213,7 @@ draw_button (ETableHeaderItem *ethi, ETableCol *col,
gdk_gc_set_clip_rectangle (ethi->gc, &clip);
/* Center the thing */
- xtra = (clip.width - gdk_string_measure (ethi->font, col->id))/2;
+ xtra = (clip.width - gdk_string_measure (ethi->font, col->text))/2;
if (xtra < 0)
xtra = 0;
@@ -224,7 +224,7 @@ draw_button (ETableHeaderItem *ethi, ETableCol *col,
gdk_draw_text (
drawable, ethi->font,
ethi->gc, x, y + ethi->height - PADDING,
- col->id, strlen (col->id));
+ col->text, strlen (col->text));
}
static void
diff --git a/widgets/e-table/e-table-header.c b/widgets/e-table/e-table-header.c
index e91113bbb9..576f609deb 100644
--- a/widgets/e-table/e-table-header.c
+++ b/widgets/e-table/e-table-header.c
@@ -170,22 +170,15 @@ e_table_header_count (ETableHeader *eth)
}
int
-e_table_header_index (ETableHeader *eth, const char *identifier)
+e_table_header_index (ETableHeader *eth, int col)
{
int i;
- g_return_val_if_fail (eth != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_HEADER (eth), 0);
- g_return_val_if_fail (identifier != NULL, 0);
+ g_return_val_if_fail (eth != NULL, -1);
+ g_return_val_if_fail (E_IS_TABLE_HEADER (eth), -1);
+ g_return_val_if_fail (col < eth->col_count, -1);
- for (i = 0; i < eth->col_count; i++){
- ETableCol *tc = eth->columns [i];
-
- if (strcmp (tc->id, identifier) == 0)
- return i;
- }
-
- return -1;
+ return eth->columns [col]->col_idx;
}
int
diff --git a/widgets/e-table/e-table-header.h b/widgets/e-table/e-table-header.h
index c263c36ad3..8965dee5c6 100644
--- a/widgets/e-table/e-table-header.h
+++ b/widgets/e-table/e-table-header.h
@@ -40,7 +40,7 @@ ETableCol * e_table_header_get_column (ETableHeader *eth,
int column);
int e_table_header_count (ETableHeader *eth);
int e_table_header_index (ETableHeader *eth,
- const char *identifier);
+ int col);
int e_table_header_get_index_at (ETableHeader *eth,
int x_offset);
ETableCol **e_table_header_get_columns (ETableHeader *eth);
diff --git a/widgets/e-table/e-table-model.c b/widgets/e-table/e-table-model.c
index 103bb31b57..60f762214f 100644
--- a/widgets/e-table/e-table-model.c
+++ b/widgets/e-table/e-table-model.c
@@ -33,14 +33,6 @@ e_table_model_column_count (ETableModel *e_table_model)
return ETM_CLASS (e_table_model)->column_count (e_table_model);
}
-const char *
-e_table_model_column_name (ETableModel *e_table_model, int col)
-{
- g_return_val_if_fail (e_table_model != NULL, NULL);
- g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), NULL);
-
- return ETM_CLASS (e_table_model)->column_name (e_table_model, col);
-}
int
e_table_model_row_count (ETableModel *e_table_model)
diff --git a/widgets/e-table/e-table-model.h b/widgets/e-table/e-table-model.h
index 22339ae484..0749a39758 100644
--- a/widgets/e-table/e-table-model.h
+++ b/widgets/e-table/e-table-model.h
@@ -20,7 +20,6 @@ typedef struct {
* Virtual methods
*/
int (*column_count) (ETableModel *etm);
- const char *(*column_name) (ETableModel *etm, int col);
int (*row_count) (ETableModel *etm);
void *(*value_at) (ETableModel *etm, int col, int row);
void (*set_value_at) (ETableModel *etm, int col, int row, const void *value);
diff --git a/widgets/e-table/e-table-simple.c b/widgets/e-table/e-table-simple.c
index 2076e06cef..943a3291e9 100644
--- a/widgets/e-table/e-table-simple.c
+++ b/widgets/e-table/e-table-simple.c
@@ -22,14 +22,6 @@ simple_column_count (ETableModel *etm)
return simple->col_count (etm, simple->data);
}
-static const char *
-simple_column_name (ETableModel *etm, int col)
-{
- ETableSimple *simple = (ETableSimple *)etm;
-
- return simple->col_name (etm, col, simple->data);
-}
-
static int
simple_row_count (ETableModel *etm)
{
@@ -68,7 +60,6 @@ e_table_simple_class_init (GtkObjectClass *object_class)
ETableModelClass *model_class = (ETableModelClass *) object_class;
model_class->column_count = simple_column_count;
- model_class->column_name = simple_column_name;
model_class->row_count = simple_row_count;
model_class->value_at = simple_value_at;
model_class->set_value_at = simple_set_value_at;
@@ -100,7 +91,6 @@ e_table_simple_get_type (void)
ETableModel *
e_table_simple_new (ETableSimpleColumnCountFn col_count,
- ETableSimpleColumnNameFn col_name,
ETableSimpleRowCountFn row_count,
ETableSimpleValueAtFn value_at,
ETableSimpleSetValueAtFn set_value_at,
@@ -112,7 +102,6 @@ e_table_simple_new (ETableSimpleColumnCountFn col_count,
et = gtk_type_new (e_table_simple_get_type ());
et->col_count = col_count;
- et->col_name = col_name;
et->row_count = row_count;
et->value_at = value_at;
et->set_value_at = set_value_at;
diff --git a/widgets/e-table/e-table-simple.h b/widgets/e-table/e-table-simple.h
index 1f7a17aeff..d890245386 100644
--- a/widgets/e-table/e-table-simple.h
+++ b/widgets/e-table/e-table-simple.h
@@ -4,7 +4,6 @@
#include "e-table-model.h"
typedef int (*ETableSimpleColumnCountFn) (ETableModel *etm, void *data);
-typedef const char *(*ETableSimpleColumnNameFn) (ETableModel *etm, int col, void *data);
typedef int (*ETableSimpleRowCountFn) (ETableModel *etm, void *data);
typedef void *(*ETableSimpleValueAtFn) (ETableModel *etm, int col, int row, void *data);
typedef void (*ETableSimpleSetValueAtFn) (ETableModel *etm, int col, int row, const void *val, void *data);
@@ -14,7 +13,6 @@ typedef struct {
ETableModel parent;
ETableSimpleColumnCountFn col_count;
- ETableSimpleColumnNameFn col_name;
ETableSimpleRowCountFn row_count;
ETableSimpleValueAtFn value_at;
ETableSimpleSetValueAtFn set_value_at;
@@ -29,7 +27,6 @@ typedef struct {
GtkType e_table_simple_get_type (void);
ETableModel *e_table_simple_new (ETableSimpleColumnCountFn col_count,
- ETableSimpleColumnNameFn col_name,
ETableSimpleRowCountFn row_count,
ETableSimpleValueAtFn value_at,
ETableSimpleSetValueAtFn set_value_at,
diff --git a/widgets/e-table/test-check.c b/widgets/e-table/test-check.c
index 4573580562..d0b10d7f32 100644
--- a/widgets/e-table/test-check.c
+++ b/widgets/e-table/test-check.c
@@ -36,17 +36,6 @@ col_count (ETableModel *etc, void *data)
return 2;
}
-static const char *
-col_name (ETableModel *etc, int col, void *data)
-{
- g_assert (col < 2);
-
- if (col == 0)
- return "flag";
- else
- return "text";
-}
-
static int
row_count (ETableModel *etc, void *data)
{
@@ -107,7 +96,7 @@ check_test (void)
gtk_widget_push_colormap (gdk_rgb_get_cmap ());
e_table_model = e_table_simple_new (
- col_count, col_name, row_count, value_at,
+ col_count, row_count, value_at,
set_value_at, is_cell_editable, NULL);
/*
@@ -118,10 +107,10 @@ check_test (void)
cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT);
cell_image_check = e_cell_checkbox_new (e_table_model);
- col_0 = e_table_col_new ("id", "", 18, 18, cell_image_check, g_int_equal, TRUE);
+ col_0 = e_table_col_new (0, "", 18, 18, cell_image_check, g_int_equal, TRUE);
e_table_header_add_column (e_table_header, col_0, 0);
- col_1 = e_table_col_new ("item", "Item Name", 180, 20, cell_left_just, g_str_equal, TRUE);
+ col_1 = e_table_col_new (1, "Item Name", 180, 20, cell_left_just, g_str_equal, TRUE);
e_table_header_add_column (e_table_header, col_1, 1);
/*
diff --git a/widgets/e-table/test-cols.c b/widgets/e-table/test-cols.c
index c4ce0e1b75..63033df569 100644
--- a/widgets/e-table/test-cols.c
+++ b/widgets/e-table/test-cols.c
@@ -36,17 +36,6 @@ col_count (ETableModel *etc, void *data)
return 2;
}
-static const char *
-col_name (ETableModel *etc, int col, void *data)
-{
- g_assert (col < 2);
-
- if (col == 0)
- return "flag";
- else
- return "text";
-}
-
static int
row_count (ETableModel *etc, void *data)
{
@@ -107,7 +96,7 @@ multi_cols_test (void)
gtk_widget_push_colormap (gdk_rgb_get_cmap ());
e_table_model = e_table_simple_new (
- col_count, col_name, row_count, value_at,
+ col_count, row_count, value_at,
set_value_at, is_cell_editable, NULL);
/*
@@ -133,10 +122,10 @@ multi_cols_test (void)
g_free (images);
}
- col_0 = e_table_col_new ("id", "A", 48, 48, cell_image_toggle, g_int_equal, TRUE);
+ col_0 = e_table_col_new (0, "A", 48, 48, cell_image_toggle, g_int_equal, TRUE);
e_table_header_add_column (e_table_header, col_0, 0);
- col_1 = e_table_col_new ("item", "Item Name", 180, 20, cell_left_just, g_str_equal, TRUE);
+ col_1 = e_table_col_new (1, "Item Name", 180, 20, cell_left_just, g_str_equal, TRUE);
e_table_header_add_column (e_table_header, col_1, 1);
diff --git a/widgets/e-table/test-table.c b/widgets/e-table/test-table.c
index be1a1059db..04c40959af 100644
--- a/widgets/e-table/test-table.c
+++ b/widgets/e-table/test-table.c
@@ -127,14 +127,6 @@ col_count (ETableModel *etc, void *data)
return cols;
}
-static const char *
-col_name (ETableModel *etc, int col, void *data)
-{
- g_assert (col < cols);
-
- return column_labels [col];
-}
-
static int
row_count (ETableModel *etc, void *data)
{
@@ -189,7 +181,7 @@ table_browser_test (void)
* Data model
*/
e_table_model = e_table_simple_new (
- col_count, col_name, row_count, value_at,
+ col_count, row_count, value_at,
set_value_at, is_cell_editable, NULL);
/*
@@ -200,7 +192,7 @@ table_browser_test (void)
for (i = 0; i < cols; i++){
ETableCol *ecol = e_table_col_new (
- column_labels [i], column_labels [i],
+ i, column_labels [i],
80, 20, cell_left_just,
g_str_equal, TRUE);
diff --git a/widgets/table/e-table-col.c b/widgets/table/e-table-col.c
index cca7bd13d6..86392a9419 100644
--- a/widgets/table/e-table-col.c
+++ b/widgets/table/e-table-col.c
@@ -21,8 +21,6 @@ etc_destroy (GtkObject *object)
{
ETableCol *etc = E_TABLE_COL (object);
- printf ("Destroying columns: %s %s\n", etc->id, etc->text);
- g_free (etc->id);
g_free (etc->text);
(*parent_class->destroy)(object);
@@ -38,12 +36,11 @@ e_table_col_class_init (GtkObjectClass *object_class)
E_MAKE_TYPE(e_table_col, "ETableCol", ETableCol, e_table_col_class_init, NULL, PARENT_TYPE);
ETableCol *
-e_table_col_new (const char *id, const char *text, int width, int min_width,
+e_table_col_new (int col_idx, const char *text, int width, int min_width,
ECell *ecell, GCompareFunc compare, gboolean resizable)
{
ETableCol *etc;
- g_return_val_if_fail (id != NULL, NULL);
g_return_val_if_fail (width >= 0, NULL);
g_return_val_if_fail (min_width >= 0, NULL);
g_return_val_if_fail (width >= min_width, NULL);
@@ -51,7 +48,7 @@ e_table_col_new (const char *id, const char *text, int width, int min_width,
etc = gtk_type_new (E_TABLE_COL_TYPE);
- etc->id = g_strdup (id);
+ etc->col_idx = col_idx;
etc->text = g_strdup (text);
etc->width = width;
etc->min_width = min_width;
diff --git a/widgets/table/e-table-col.h b/widgets/table/e-table-col.h
index c8fa6dd581..54f03ae237 100644
--- a/widgets/table/e-table-col.h
+++ b/widgets/table/e-table-col.h
@@ -16,14 +16,14 @@ typedef struct _ETableCol ETableCol;
*/
struct _ETableCol {
GtkObject base;
- char *id, *text;
+ char *text;
short width;
short min_width;
short x;
GCompareFunc compare;
unsigned int selected:1;
unsigned int resizeable:1;
-
+ int col_idx;
ECell *ecell;
};
@@ -33,7 +33,7 @@ typedef struct {
} ETableColClass;
GtkType e_table_col_get_type (void);
-ETableCol *e_table_col_new (const char *id, const char *text,
+ETableCol *e_table_col_new (int col_idx, const char *text,
int width, int min_width,
ECell *ecell, GCompareFunc compare,
gboolean resizable);
diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c
index 378bdf4447..5368f10602 100644
--- a/widgets/table/e-table-header-item.c
+++ b/widgets/table/e-table-header-item.c
@@ -213,7 +213,7 @@ draw_button (ETableHeaderItem *ethi, ETableCol *col,
gdk_gc_set_clip_rectangle (ethi->gc, &clip);
/* Center the thing */
- xtra = (clip.width - gdk_string_measure (ethi->font, col->id))/2;
+ xtra = (clip.width - gdk_string_measure (ethi->font, col->text))/2;
if (xtra < 0)
xtra = 0;
@@ -224,7 +224,7 @@ draw_button (ETableHeaderItem *ethi, ETableCol *col,
gdk_draw_text (
drawable, ethi->font,
ethi->gc, x, y + ethi->height - PADDING,
- col->id, strlen (col->id));
+ col->text, strlen (col->text));
}
static void
diff --git a/widgets/table/e-table-header.c b/widgets/table/e-table-header.c
index e91113bbb9..576f609deb 100644
--- a/widgets/table/e-table-header.c
+++ b/widgets/table/e-table-header.c
@@ -170,22 +170,15 @@ e_table_header_count (ETableHeader *eth)
}
int
-e_table_header_index (ETableHeader *eth, const char *identifier)
+e_table_header_index (ETableHeader *eth, int col)
{
int i;
- g_return_val_if_fail (eth != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_HEADER (eth), 0);
- g_return_val_if_fail (identifier != NULL, 0);
+ g_return_val_if_fail (eth != NULL, -1);
+ g_return_val_if_fail (E_IS_TABLE_HEADER (eth), -1);
+ g_return_val_if_fail (col < eth->col_count, -1);
- for (i = 0; i < eth->col_count; i++){
- ETableCol *tc = eth->columns [i];
-
- if (strcmp (tc->id, identifier) == 0)
- return i;
- }
-
- return -1;
+ return eth->columns [col]->col_idx;
}
int
diff --git a/widgets/table/e-table-header.h b/widgets/table/e-table-header.h
index c263c36ad3..8965dee5c6 100644
--- a/widgets/table/e-table-header.h
+++ b/widgets/table/e-table-header.h
@@ -40,7 +40,7 @@ ETableCol * e_table_header_get_column (ETableHeader *eth,
int column);
int e_table_header_count (ETableHeader *eth);
int e_table_header_index (ETableHeader *eth,
- const char *identifier);
+ int col);
int e_table_header_get_index_at (ETableHeader *eth,
int x_offset);
ETableCol **e_table_header_get_columns (ETableHeader *eth);
diff --git a/widgets/table/e-table-model.c b/widgets/table/e-table-model.c
index 103bb31b57..60f762214f 100644
--- a/widgets/table/e-table-model.c
+++ b/widgets/table/e-table-model.c
@@ -33,14 +33,6 @@ e_table_model_column_count (ETableModel *e_table_model)
return ETM_CLASS (e_table_model)->column_count (e_table_model);
}
-const char *
-e_table_model_column_name (ETableModel *e_table_model, int col)
-{
- g_return_val_if_fail (e_table_model != NULL, NULL);
- g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), NULL);
-
- return ETM_CLASS (e_table_model)->column_name (e_table_model, col);
-}
int
e_table_model_row_count (ETableModel *e_table_model)
diff --git a/widgets/table/e-table-model.h b/widgets/table/e-table-model.h
index 22339ae484..0749a39758 100644
--- a/widgets/table/e-table-model.h
+++ b/widgets/table/e-table-model.h
@@ -20,7 +20,6 @@ typedef struct {
* Virtual methods
*/
int (*column_count) (ETableModel *etm);
- const char *(*column_name) (ETableModel *etm, int col);
int (*row_count) (ETableModel *etm);
void *(*value_at) (ETableModel *etm, int col, int row);
void (*set_value_at) (ETableModel *etm, int col, int row, const void *value);
diff --git a/widgets/table/e-table-simple.c b/widgets/table/e-table-simple.c
index 2076e06cef..943a3291e9 100644
--- a/widgets/table/e-table-simple.c
+++ b/widgets/table/e-table-simple.c
@@ -22,14 +22,6 @@ simple_column_count (ETableModel *etm)
return simple->col_count (etm, simple->data);
}
-static const char *
-simple_column_name (ETableModel *etm, int col)
-{
- ETableSimple *simple = (ETableSimple *)etm;
-
- return simple->col_name (etm, col, simple->data);
-}
-
static int
simple_row_count (ETableModel *etm)
{
@@ -68,7 +60,6 @@ e_table_simple_class_init (GtkObjectClass *object_class)
ETableModelClass *model_class = (ETableModelClass *) object_class;
model_class->column_count = simple_column_count;
- model_class->column_name = simple_column_name;
model_class->row_count = simple_row_count;
model_class->value_at = simple_value_at;
model_class->set_value_at = simple_set_value_at;
@@ -100,7 +91,6 @@ e_table_simple_get_type (void)
ETableModel *
e_table_simple_new (ETableSimpleColumnCountFn col_count,
- ETableSimpleColumnNameFn col_name,
ETableSimpleRowCountFn row_count,
ETableSimpleValueAtFn value_at,
ETableSimpleSetValueAtFn set_value_at,
@@ -112,7 +102,6 @@ e_table_simple_new (ETableSimpleColumnCountFn col_count,
et = gtk_type_new (e_table_simple_get_type ());
et->col_count = col_count;
- et->col_name = col_name;
et->row_count = row_count;
et->value_at = value_at;
et->set_value_at = set_value_at;
diff --git a/widgets/table/e-table-simple.h b/widgets/table/e-table-simple.h
index 1f7a17aeff..d890245386 100644
--- a/widgets/table/e-table-simple.h
+++ b/widgets/table/e-table-simple.h
@@ -4,7 +4,6 @@
#include "e-table-model.h"
typedef int (*ETableSimpleColumnCountFn) (ETableModel *etm, void *data);
-typedef const char *(*ETableSimpleColumnNameFn) (ETableModel *etm, int col, void *data);
typedef int (*ETableSimpleRowCountFn) (ETableModel *etm, void *data);
typedef void *(*ETableSimpleValueAtFn) (ETableModel *etm, int col, int row, void *data);
typedef void (*ETableSimpleSetValueAtFn) (ETableModel *etm, int col, int row, const void *val, void *data);
@@ -14,7 +13,6 @@ typedef struct {
ETableModel parent;
ETableSimpleColumnCountFn col_count;
- ETableSimpleColumnNameFn col_name;
ETableSimpleRowCountFn row_count;
ETableSimpleValueAtFn value_at;
ETableSimpleSetValueAtFn set_value_at;
@@ -29,7 +27,6 @@ typedef struct {
GtkType e_table_simple_get_type (void);
ETableModel *e_table_simple_new (ETableSimpleColumnCountFn col_count,
- ETableSimpleColumnNameFn col_name,
ETableSimpleRowCountFn row_count,
ETableSimpleValueAtFn value_at,
ETableSimpleSetValueAtFn set_value_at,
diff --git a/widgets/table/test-check.c b/widgets/table/test-check.c
index 4573580562..d0b10d7f32 100644
--- a/widgets/table/test-check.c
+++ b/widgets/table/test-check.c
@@ -36,17 +36,6 @@ col_count (ETableModel *etc, void *data)
return 2;
}
-static const char *
-col_name (ETableModel *etc, int col, void *data)
-{
- g_assert (col < 2);
-
- if (col == 0)
- return "flag";
- else
- return "text";
-}
-
static int
row_count (ETableModel *etc, void *data)
{
@@ -107,7 +96,7 @@ check_test (void)
gtk_widget_push_colormap (gdk_rgb_get_cmap ());
e_table_model = e_table_simple_new (
- col_count, col_name, row_count, value_at,
+ col_count, row_count, value_at,
set_value_at, is_cell_editable, NULL);
/*
@@ -118,10 +107,10 @@ check_test (void)
cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT);
cell_image_check = e_cell_checkbox_new (e_table_model);
- col_0 = e_table_col_new ("id", "", 18, 18, cell_image_check, g_int_equal, TRUE);
+ col_0 = e_table_col_new (0, "", 18, 18, cell_image_check, g_int_equal, TRUE);
e_table_header_add_column (e_table_header, col_0, 0);
- col_1 = e_table_col_new ("item", "Item Name", 180, 20, cell_left_just, g_str_equal, TRUE);
+ col_1 = e_table_col_new (1, "Item Name", 180, 20, cell_left_just, g_str_equal, TRUE);
e_table_header_add_column (e_table_header, col_1, 1);
/*
diff --git a/widgets/table/test-cols.c b/widgets/table/test-cols.c
index c4ce0e1b75..63033df569 100644
--- a/widgets/table/test-cols.c
+++ b/widgets/table/test-cols.c
@@ -36,17 +36,6 @@ col_count (ETableModel *etc, void *data)
return 2;
}
-static const char *
-col_name (ETableModel *etc, int col, void *data)
-{
- g_assert (col < 2);
-
- if (col == 0)
- return "flag";
- else
- return "text";
-}
-
static int
row_count (ETableModel *etc, void *data)
{
@@ -107,7 +96,7 @@ multi_cols_test (void)
gtk_widget_push_colormap (gdk_rgb_get_cmap ());
e_table_model = e_table_simple_new (
- col_count, col_name, row_count, value_at,
+ col_count, row_count, value_at,
set_value_at, is_cell_editable, NULL);
/*
@@ -133,10 +122,10 @@ multi_cols_test (void)
g_free (images);
}
- col_0 = e_table_col_new ("id", "A", 48, 48, cell_image_toggle, g_int_equal, TRUE);
+ col_0 = e_table_col_new (0, "A", 48, 48, cell_image_toggle, g_int_equal, TRUE);
e_table_header_add_column (e_table_header, col_0, 0);
- col_1 = e_table_col_new ("item", "Item Name", 180, 20, cell_left_just, g_str_equal, TRUE);
+ col_1 = e_table_col_new (1, "Item Name", 180, 20, cell_left_just, g_str_equal, TRUE);
e_table_header_add_column (e_table_header, col_1, 1);
diff --git a/widgets/table/test-table.c b/widgets/table/test-table.c
index be1a1059db..04c40959af 100644
--- a/widgets/table/test-table.c
+++ b/widgets/table/test-table.c
@@ -127,14 +127,6 @@ col_count (ETableModel *etc, void *data)
return cols;
}
-static const char *
-col_name (ETableModel *etc, int col, void *data)
-{
- g_assert (col < cols);
-
- return column_labels [col];
-}
-
static int
row_count (ETableModel *etc, void *data)
{
@@ -189,7 +181,7 @@ table_browser_test (void)
* Data model
*/
e_table_model = e_table_simple_new (
- col_count, col_name, row_count, value_at,
+ col_count, row_count, value_at,
set_value_at, is_cell_editable, NULL);
/*
@@ -200,7 +192,7 @@ table_browser_test (void)
for (i = 0; i < cols; i++){
ETableCol *ecol = e_table_col_new (
- column_labels [i], column_labels [i],
+ i, column_labels [i],
80, 20, cell_left_just,
g_str_equal, TRUE);
diff --git a/widgets/test-check.c b/widgets/test-check.c
index 4573580562..d0b10d7f32 100644
--- a/widgets/test-check.c
+++ b/widgets/test-check.c
@@ -36,17 +36,6 @@ col_count (ETableModel *etc, void *data)
return 2;
}
-static const char *
-col_name (ETableModel *etc, int col, void *data)
-{
- g_assert (col < 2);
-
- if (col == 0)
- return "flag";
- else
- return "text";
-}
-
static int
row_count (ETableModel *etc, void *data)
{
@@ -107,7 +96,7 @@ check_test (void)
gtk_widget_push_colormap (gdk_rgb_get_cmap ());
e_table_model = e_table_simple_new (
- col_count, col_name, row_count, value_at,
+ col_count, row_count, value_at,
set_value_at, is_cell_editable, NULL);
/*
@@ -118,10 +107,10 @@ check_test (void)
cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT);
cell_image_check = e_cell_checkbox_new (e_table_model);
- col_0 = e_table_col_new ("id", "", 18, 18, cell_image_check, g_int_equal, TRUE);
+ col_0 = e_table_col_new (0, "", 18, 18, cell_image_check, g_int_equal, TRUE);
e_table_header_add_column (e_table_header, col_0, 0);
- col_1 = e_table_col_new ("item", "Item Name", 180, 20, cell_left_just, g_str_equal, TRUE);
+ col_1 = e_table_col_new (1, "Item Name", 180, 20, cell_left_just, g_str_equal, TRUE);
e_table_header_add_column (e_table_header, col_1, 1);
/*
diff --git a/widgets/test-cols.c b/widgets/test-cols.c
index c4ce0e1b75..63033df569 100644
--- a/widgets/test-cols.c
+++ b/widgets/test-cols.c
@@ -36,17 +36,6 @@ col_count (ETableModel *etc, void *data)
return 2;
}
-static const char *
-col_name (ETableModel *etc, int col, void *data)
-{
- g_assert (col < 2);
-
- if (col == 0)
- return "flag";
- else
- return "text";
-}
-
static int
row_count (ETableModel *etc, void *data)
{
@@ -107,7 +96,7 @@ multi_cols_test (void)
gtk_widget_push_colormap (gdk_rgb_get_cmap ());
e_table_model = e_table_simple_new (
- col_count, col_name, row_count, value_at,
+ col_count, row_count, value_at,
set_value_at, is_cell_editable, NULL);
/*
@@ -133,10 +122,10 @@ multi_cols_test (void)
g_free (images);
}
- col_0 = e_table_col_new ("id", "A", 48, 48, cell_image_toggle, g_int_equal, TRUE);
+ col_0 = e_table_col_new (0, "A", 48, 48, cell_image_toggle, g_int_equal, TRUE);
e_table_header_add_column (e_table_header, col_0, 0);
- col_1 = e_table_col_new ("item", "Item Name", 180, 20, cell_left_just, g_str_equal, TRUE);
+ col_1 = e_table_col_new (1, "Item Name", 180, 20, cell_left_just, g_str_equal, TRUE);
e_table_header_add_column (e_table_header, col_1, 1);
diff --git a/widgets/test-table.c b/widgets/test-table.c
index be1a1059db..04c40959af 100644
--- a/widgets/test-table.c
+++ b/widgets/test-table.c
@@ -127,14 +127,6 @@ col_count (ETableModel *etc, void *data)
return cols;
}
-static const char *
-col_name (ETableModel *etc, int col, void *data)
-{
- g_assert (col < cols);
-
- return column_labels [col];
-}
-
static int
row_count (ETableModel *etc, void *data)
{
@@ -189,7 +181,7 @@ table_browser_test (void)
* Data model
*/
e_table_model = e_table_simple_new (
- col_count, col_name, row_count, value_at,
+ col_count, row_count, value_at,
set_value_at, is_cell_editable, NULL);
/*
@@ -200,7 +192,7 @@ table_browser_test (void)
for (i = 0; i < cols; i++){
ETableCol *ecol = e_table_col_new (
- column_labels [i], column_labels [i],
+ i, column_labels [i],
80, 20, cell_left_just,
g_str_equal, TRUE);