diff options
author | Christopher James Lahey <clahey@ximian.com> | 2001-10-23 06:10:27 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2001-10-23 06:10:27 +0800 |
commit | 175618ed1efc1ba19645cee9127055bdbd34196b (patch) | |
tree | f495fdc39375fd065645aae9481aa4f64c48d809 | |
parent | b80a058e5534b668e11d7e6b31408acf52bf4bd3 (diff) | |
download | gsoc2013-evolution-175618ed1efc1ba19645cee9127055bdbd34196b.tar.gz gsoc2013-evolution-175618ed1efc1ba19645cee9127055bdbd34196b.tar.zst gsoc2013-evolution-175618ed1efc1ba19645cee9127055bdbd34196b.zip |
Added a disabled field here.
2001-10-22 Christopher James Lahey <clahey@ximian.com>
* e-table-col.c, e-table-col.h, e-table-column-specification.c,
e-table-column-specification.h: Added a disabled field here.
* e-table-config.c, e-table-field-chooser-item.c: Pay attention to
the disabled field here.
* e-table-utils.c: Copy the disabled field from the column
specification to the col.
svn path=/trunk/; revision=13897
-rw-r--r-- | widgets/table/e-table-col.c | 6 | ||||
-rw-r--r-- | widgets/table/e-table-col.h | 33 | ||||
-rw-r--r-- | widgets/table/e-table-column-specification.c | 21 | ||||
-rw-r--r-- | widgets/table/e-table-column-specification.h | 1 | ||||
-rw-r--r-- | widgets/table/e-table-config.c | 10 | ||||
-rw-r--r-- | widgets/table/e-table-field-chooser-item.c | 16 | ||||
-rw-r--r-- | widgets/table/e-table-utils.c | 4 |
7 files changed, 66 insertions, 25 deletions
diff --git a/widgets/table/e-table-col.c b/widgets/table/e-table-col.c index 5eb18ada92..04a90cd193 100644 --- a/widgets/table/e-table-col.c +++ b/widgets/table/e-table-col.c @@ -119,7 +119,7 @@ E_MAKE_TYPE(e_table_col, "ETableCol", ETableCol, e_table_col_class_init, e_table */ ETableCol * e_table_col_new (int col_idx, const char *text, double expansion, int min_width, - ECell *ecell, GCompareFunc compare, gboolean resizable, int priority) + ECell *ecell, GCompareFunc compare, gboolean resizable, gboolean disabled, int priority) { ETableCol *etc; @@ -140,6 +140,7 @@ e_table_col_new (int col_idx, const char *text, double expansion, int min_width, etc->min_width = min_width; etc->ecell = ecell; etc->compare = compare; + etc->disabled = disabled; etc->priority = priority; etc->selected = 0; @@ -178,7 +179,7 @@ e_table_col_new (int col_idx, const char *text, double expansion, int min_width, */ ETableCol * e_table_col_new_with_pixbuf (int col_idx, const char *text, GdkPixbuf *pixbuf, double expansion, int min_width, - ECell *ecell, GCompareFunc compare, gboolean resizable, int priority) + ECell *ecell, GCompareFunc compare, gboolean resizable, gboolean disabled, int priority) { ETableCol *etc; @@ -199,6 +200,7 @@ e_table_col_new_with_pixbuf (int col_idx, const char *text, GdkPixbuf *pixbuf, d etc->min_width = min_width; etc->ecell = ecell; etc->compare = compare; + etc->disabled = disabled; etc->priority = priority; etc->selected = 0; diff --git a/widgets/table/e-table-col.h b/widgets/table/e-table-col.h index 90deb85f3a..80901ede55 100644 --- a/widgets/table/e-table-col.h +++ b/widgets/table/e-table-col.h @@ -36,6 +36,7 @@ typedef struct { unsigned int is_pixbuf:1; unsigned int selected:1; unsigned int resizable:1; + unsigned int disabled:1; unsigned int sortable:1; unsigned int groupable:1; int col_idx; @@ -50,17 +51,27 @@ typedef struct { GtkObjectClass parent_class; } ETableColClass; -GtkType e_table_col_get_type (void); -ETableCol *e_table_col_new (int col_idx, const char *text, - double expansion, int min_width, - ECell *ecell, GCompareFunc compare, - gboolean resizable, int priority); -ETableCol *e_table_col_new_with_pixbuf (int col_idx, const char *text, - GdkPixbuf *pixbuf, - double expansion, int min_width, - ECell *ecell, GCompareFunc compare, - gboolean resizable, int priority); -void e_table_col_destroy (ETableCol *etc); +GtkType e_table_col_get_type (void); +ETableCol *e_table_col_new (int col_idx, + const char *text, + double expansion, + int min_width, + ECell *ecell, + GCompareFunc compare, + gboolean resizable, + gboolean disabled, + int priority); +ETableCol *e_table_col_new_with_pixbuf (int col_idx, + const char *text, + GdkPixbuf *pixbuf, + double expansion, + int min_width, + ECell *ecell, + GCompareFunc compare, + gboolean resizable, + gboolean disabled, + int priority); +void e_table_col_destroy (ETableCol *etc); #ifdef __cplusplus diff --git a/widgets/table/e-table-column-specification.c b/widgets/table/e-table-column-specification.c index ad1122dec9..77db19d1e5 100644 --- a/widgets/table/e-table-column-specification.c +++ b/widgets/table/e-table-column-specification.c @@ -51,12 +51,13 @@ static void etcs_init (ETableColumnSpecification *specification) { specification->model_col = 0; - specification->title = g_strdup(""); + specification->title = g_strdup(""); specification->pixbuf = NULL; specification->expansion = 0; specification->minimum_width = 0; specification->resizable = FALSE; + specification->disabled = FALSE; specification->cell = NULL; specification->compare = NULL; @@ -79,16 +80,17 @@ e_table_column_specification_load_from_node (ETableColumnSpecification *etcs, { free_strings(etcs); - etcs->model_col = e_xml_get_integer_prop_by_name(node, "model_col"); - etcs->title = e_xml_get_string_prop_by_name(node, "_title"); - etcs->pixbuf = e_xml_get_string_prop_by_name(node, "pixbuf"); + etcs->model_col = e_xml_get_integer_prop_by_name (node, "model_col"); + etcs->title = e_xml_get_string_prop_by_name (node, "_title"); + etcs->pixbuf = e_xml_get_string_prop_by_name (node, "pixbuf"); - etcs->expansion = e_xml_get_double_prop_by_name(node, "expansion"); - etcs->minimum_width = e_xml_get_integer_prop_by_name(node, "minimum_width"); - etcs->resizable = e_xml_get_bool_prop_by_name(node, "resizable"); + etcs->expansion = e_xml_get_double_prop_by_name (node, "expansion"); + etcs->minimum_width = e_xml_get_integer_prop_by_name (node, "minimum_width"); + etcs->resizable = e_xml_get_bool_prop_by_name (node, "resizable"); + etcs->disabled = e_xml_get_bool_prop_by_name (node, "disabled"); - etcs->cell = e_xml_get_string_prop_by_name(node, "cell"); - etcs->compare = e_xml_get_string_prop_by_name(node, "compare"); + etcs->cell = e_xml_get_string_prop_by_name (node, "cell"); + etcs->compare = e_xml_get_string_prop_by_name (node, "compare"); etcs->priority = e_xml_get_integer_prop_by_name_with_default (node, "priority", 0); if (etcs->title == NULL) @@ -112,6 +114,7 @@ e_table_column_specification_save_to_node (ETableColumnSpecification *specificat e_xml_set_double_prop_by_name(node, "expansion", specification->expansion); e_xml_set_integer_prop_by_name(node, "minimum_width", specification->minimum_width); e_xml_set_bool_prop_by_name(node, "resizable", specification->resizable); + e_xml_set_bool_prop_by_name(node, "disabled", specification->disabled); e_xml_set_string_prop_by_name(node, "cell", specification->cell); e_xml_set_string_prop_by_name(node, "compare", specification->compare); diff --git a/widgets/table/e-table-column-specification.h b/widgets/table/e-table-column-specification.h index 07a8a41e11..cd238fcb29 100644 --- a/widgets/table/e-table-column-specification.h +++ b/widgets/table/e-table-column-specification.h @@ -26,6 +26,7 @@ typedef struct { double expansion; int minimum_width; guint resizable : 1; + guint disabled : 1; char *cell; char *compare; diff --git a/widgets/table/e-table-config.c b/widgets/table/e-table-config.c index c0e4c7f0c3..b87859ef39 100644 --- a/widgets/table/e-table-config.c +++ b/widgets/table/e-table-config.c @@ -121,6 +121,8 @@ find_column_in_spec (ETableSpecification *spec, int model_col) ETableColumnSpecification **column; for (column = spec->columns; *column; column++){ + if ((*column)->disabled) + continue; if ((*column)->model_col != model_col) continue; @@ -137,6 +139,8 @@ find_model_column_by_name (ETableSpecification *spec, const char *s) for (column = spec->columns; *column; column++){ + if ((*column)->disabled) + continue; if (g_strcasecmp ((*column)->title, s) == 0) return (*column)->model_col; } @@ -321,6 +325,9 @@ config_fields_info_update (ETableConfig *config) for (i = 0; i < config->state->col_count; i++){ for (column = config->source_spec->columns; *column; column++){ + if ((*column)->disabled) + continue; + if (config->state->columns [i] != (*column)->model_col) continue; @@ -766,6 +773,9 @@ e_table_config_construct (ETableConfig *config, for (column = config->source_spec->columns; *column; column++){ char *label = (*column)->title; + if ((*column)->disabled) + continue; + config->column_names = g_slist_append ( config->column_names, label); } diff --git a/widgets/table/e-table-field-chooser-item.c b/widgets/table/e-table-field-chooser-item.c index 9eb649168e..20f3b4b0d8 100644 --- a/widgets/table/e-table-field-chooser-item.c +++ b/widgets/table/e-table-field-chooser-item.c @@ -85,6 +85,8 @@ etfci_find_button (ETableFieldChooserItem *etfci, double loc) ETableCol *ecol; ecol = e_table_header_get_column (etfci->combined_header, i); + if (ecol->disabled) + continue; height += e_table_header_compute_height (ecol, style, etfci->font); if (height > loc) return i; @@ -109,12 +111,16 @@ etfci_rebuild_combined (ETableFieldChooserItem *etfci) count = e_table_header_count (etfci->header); for (i = 0; i < count; i++) { ETableCol *ecol = e_table_header_get_column (etfci->header, i); + if (ecol->disabled) + continue; g_hash_table_insert (hash, GINT_TO_POINTER (ecol->col_idx), GINT_TO_POINTER (1)); } count = e_table_header_count (etfci->full_header); for (i = 0; i < count; i++) { ETableCol *ecol = e_table_header_get_column (etfci->full_header, i); + if (ecol->disabled) + continue; if (! (GPOINTER_TO_INT (g_hash_table_lookup (hash, GINT_TO_POINTER (ecol->col_idx))))) e_table_header_add_column (etfci->combined_header, ecol, -1); } @@ -143,6 +149,8 @@ etfci_reflow (GnomeCanvasItem *item, gint flags) ETableCol *ecol; ecol = e_table_header_get_column (etfci->combined_header, i); + if (ecol->disabled) + continue; height += e_table_header_compute_height (ecol, style, etfci->font); } @@ -457,6 +465,9 @@ etfci_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int widt ecol = e_table_header_get_column (etfci->combined_header, row); + if (ecol->disabled) + continue; + y2 += e_table_header_compute_height (ecol, style, etfci->font); if (y1 > (y + height)) @@ -521,6 +532,9 @@ etfci_start_drag (ETableFieldChooserItem *etfci, GdkEvent *event, double x, doub ecol = e_table_header_get_column (etfci->combined_header, drag_col); + if (ecol->disabled) + return; + etfci->drag_col = ecol->col_idx; etfci_drag_types[0].target = g_strdup_printf("%s-%s", etfci_drag_types[0].target, etfci->dnd_code); @@ -531,7 +545,7 @@ etfci_start_drag (ETableFieldChooserItem *etfci, GdkEvent *event, double x, doub button_height = e_table_header_compute_height (ecol, widget->style, etfci->font); pixmap = gdk_pixmap_new (widget->window, etfci->width, button_height, -1); - e_table_header_draw_button (pixmap, e_table_header_get_column (etfci->combined_header, drag_col), + e_table_header_draw_button (pixmap, ecol, widget->style, etfci->font, GTK_WIDGET_STATE (widget), widget, widget->style->fg_gc[GTK_STATE_NORMAL], 0, 0, diff --git a/widgets/table/e-table-utils.c b/widgets/table/e-table-utils.c index ee4078009e..b483449aa1 100644 --- a/widgets/table/e-table-utils.c +++ b/widgets/table/e-table-utils.c @@ -75,14 +75,14 @@ et_col_spec_to_col (ETableColumnSpecification *col_spec, col_spec->model_col, gettext (col_spec->title), pixbuf, col_spec->expansion, col_spec->minimum_width, - cell, compare, col_spec->resizable, col_spec->priority); + cell, compare, col_spec->resizable, col_spec->disabled, col_spec->priority); } } if (col == NULL && col_spec->title && *col_spec->title) { col = e_table_col_new ( col_spec->model_col, gettext (col_spec->title), col_spec->expansion, col_spec->minimum_width, - cell, compare, col_spec->resizable, col_spec->priority); + cell, compare, col_spec->resizable, col_spec->disabled, col_spec->priority); } } return col; |