diff options
author | Christopher James Lahey <clahey@ximian.com> | 2001-09-01 16:03:44 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2001-09-01 16:03:44 +0800 |
commit | 06eb6e23fb44335ffd747d1257dce6deb9a1d756 (patch) | |
tree | e4c025d189c07513c9f93bac25cd9a187e608acd /widgets/table | |
parent | b529ceb8fe7886c93633295097ab36500d4e8ba1 (diff) | |
download | gsoc2013-evolution-06eb6e23fb44335ffd747d1257dce6deb9a1d756.tar.gz gsoc2013-evolution-06eb6e23fb44335ffd747d1257dce6deb9a1d756.tar.zst gsoc2013-evolution-06eb6e23fb44335ffd747d1257dce6deb9a1d756.zip |
Rename these functions from ecn_get_text and ecn_free_text.
2001-09-01 Christopher James Lahey <clahey@ximian.com>
* e-cell-float.c (ecf_get_text, ecf_free_text): Rename these
functions from ecn_get_text and ecn_free_text.
* e-cell-tree.c (ect_height): Make sure the height is a multiple
of two here.
* e-table-header-item.c, e-table-header-item.h: Added a "tree"
argument so that the sorting can be set by right clicking on the
header item.
* e-table-item.c (eti_table_model_rows_deleted): Added some
assertions here.
* e-tree-selection-model.c (etsm_find_node_unless_equals): Fixed
indentation.
* e-tree-table-adapter.c (etta_proxy_node_changed): Rewrote this
to be more readable.
(e_tree_table_adapter_node_set_expanded): Added an assertion.
* e-tree.c, e-tree.h (e_tree_get_spec): Added this function.
(e_tree_setup_header): Set the tree argument on the
ETableHeaderItem here.
svn path=/trunk/; revision=12553
Diffstat (limited to 'widgets/table')
-rw-r--r-- | widgets/table/e-cell-float.c | 8 | ||||
-rw-r--r-- | widgets/table/e-cell-tree.c | 2 | ||||
-rw-r--r-- | widgets/table/e-table-header-item.c | 32 | ||||
-rw-r--r-- | widgets/table/e-table-header-item.h | 2 | ||||
-rw-r--r-- | widgets/table/e-table-item.c | 9 | ||||
-rw-r--r-- | widgets/table/e-tree-selection-model.c | 2 | ||||
-rw-r--r-- | widgets/table/e-tree-table-adapter.c | 18 | ||||
-rw-r--r-- | widgets/table/e-tree.c | 8 | ||||
-rw-r--r-- | widgets/table/e-tree.h | 2 |
9 files changed, 59 insertions, 24 deletions
diff --git a/widgets/table/e-cell-float.c b/widgets/table/e-cell-float.c index c11c8e945c..68d645360c 100644 --- a/widgets/table/e-cell-float.c +++ b/widgets/table/e-cell-float.c @@ -36,7 +36,7 @@ static ECellTextClass *parent_class; static char * -ecn_get_text(ECellText *cell, ETableModel *model, int col, int row) +ecf_get_text(ECellText *cell, ETableModel *model, int col, int row) { gfloat *fvalue; @@ -46,7 +46,7 @@ ecn_get_text(ECellText *cell, ETableModel *model, int col, int row) } static void -ecn_free_text(ECellText *cell, char *text) +ecf_free_text(ECellText *cell, char *text) { g_free(text); } @@ -58,8 +58,8 @@ e_cell_float_class_init (GtkObjectClass *object_class) parent_class = gtk_type_class (PARENT_TYPE); - ectc->get_text = ecn_get_text; - ectc->free_text = ecn_free_text; + ectc->get_text = ecf_get_text; + ectc->free_text = ecf_free_text; } static void diff --git a/widgets/table/e-cell-tree.c b/widgets/table/e-cell-tree.c index af5997eed1..64af817f9b 100644 --- a/widgets/table/e-cell-tree.c +++ b/widgets/table/e-cell-tree.c @@ -396,7 +396,7 @@ ect_height (ECellView *ecell_view, int model_col, int view_col, int row) { ECellTreeView *tree_view = (ECellTreeView *) ecell_view; - return e_cell_height (tree_view->subcell_view, model_col, view_col, row); + return (((e_cell_height (tree_view->subcell_view, model_col, view_col, row)) + 1) / 2) * 2; } /* diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c index 8326087f9d..f2bf4a2928 100644 --- a/widgets/table/e-table-header-item.c +++ b/widgets/table/e-table-header-item.c @@ -81,6 +81,7 @@ enum { ARG_TABLE_FONTSET, ARG_SORT_INFO, ARG_TABLE, + ARG_TREE, }; static void @@ -155,7 +156,6 @@ ethi_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags if (GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->update) (*GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->update)(item, affine, clip_path, flags); - if (ethi->sort_info) ethi->group_indent_width = e_table_sort_info_grouping_get_count(ethi->sort_info) * GROUP_INDENT; else @@ -326,6 +326,12 @@ ethi_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) else ethi->table = NULL; break; + case ARG_TREE: + if (GTK_VALUE_OBJECT(*arg)) + ethi->tree = E_TREE(GTK_VALUE_OBJECT(*arg)); + else + ethi->tree = NULL; + break; } gnome_canvas_item_request_update(item); } @@ -1242,7 +1248,10 @@ apply_changes (ETableConfig *config, ETableHeaderItem *ethi) { char *state = e_table_state_save_to_string (config->state); - e_table_set_state (ethi->table, state); + if (ethi->table) + e_table_set_state (ethi->table, state); + if (ethi->tree) + e_tree_set_state (ethi->tree, state); g_free (state); } @@ -1251,15 +1260,23 @@ ethi_popup_customize_view(GtkWidget *widget, EthiHeaderInfo *info) { ETableHeaderItem *ethi = info->ethi; ETableState *state; + ETableSpecification *spec; if (ethi->config) e_table_config_raise (E_TABLE_CONFIG (ethi->config)); else { - state = e_table_get_state_object(ethi->table); + if (ethi->table) { + state = e_table_get_state_object(ethi->table); + spec = ethi->table->spec; + } else if (ethi->tree) { + state = e_tree_get_state_object(ethi->tree); + spec = e_tree_get_spec (ethi->tree); + } else + return; ethi->config = e_table_config_new ( - _("Configuring view: FIXME"), - ethi->table->spec, state); + _("Configuring view: FIXME"), + spec, state); gtk_signal_connect ( GTK_OBJECT (ethi->config), "destroy", GTK_SIGNAL_FUNC (config_destroyed), ethi); @@ -1302,7 +1319,7 @@ ethi_header_context_menu (ETableHeaderItem *ethi, GdkEventButton *event) e_popup_menu_run (ethi_context_menu, (GdkEvent *) event, 1 + (col->sortable ? 0 : 2) + - (ethi->table ? 0 : 4) + + ((ethi->table || ethi->tree) ? 0 : 4) + ((e_table_header_count (ethi->eth) > 1) ? 0 : 8), ((e_table_sort_info_get_can_group (ethi->sort_info)) ? 0 : 16) + 128, info); @@ -1543,6 +1560,8 @@ ethi_class_init (GtkObjectClass *object_class) GTK_ARG_WRITABLE, ARG_SORT_INFO); gtk_object_add_arg_type ("ETableHeaderItem::table", GTK_TYPE_OBJECT, GTK_ARG_WRITABLE, ARG_TABLE); + gtk_object_add_arg_type ("ETableHeaderItem::tree", E_TREE_TYPE, + GTK_ARG_WRITABLE, ARG_TREE); /* * Create our pixmaps for DnD @@ -1589,6 +1608,7 @@ ethi_init (GnomeCanvasItem *item) ethi->group_indent_width = 0; ethi->table = NULL; + ethi->tree = NULL; } GtkType diff --git a/widgets/table/e-table-header-item.h b/widgets/table/e-table-header-item.h index 6186037d5d..0555585986 100644 --- a/widgets/table/e-table-header-item.h +++ b/widgets/table/e-table-header-item.h @@ -3,6 +3,7 @@ #define _E_TABLE_HEADER_ITEM_H_ #include <gal/e-table/e-table.h> +#include <gal/e-table/e-tree.h> #include <libgnomeui/gnome-canvas.h> #include <gnome-xml/tree.h> #include <gal/e-table/e-table-header.h> @@ -64,6 +65,7 @@ typedef struct { /* For adding fields. */ ETableHeader *full_header; ETable *table; + ETree *tree; void *config; } ETableHeaderItem; diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c index 5e1c669e53..16b8db8277 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -818,10 +818,15 @@ eti_table_model_rows_deleted (ETableModel *table_model, int row, int count, ETab if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED)) return; + g_assert (eti->rows == -1 || row + count <= eti->rows); + eti->rows = e_table_model_row_count (eti->table_model); - if (eti->height_cache) + g_assert (row <= eti->rows); + + if (eti->height_cache) { memmove(eti->height_cache + row, eti->height_cache + row + count, (eti->rows - row) * sizeof(int)); + } eti->needs_compute_height = 1; e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti)); @@ -1196,6 +1201,8 @@ eti_init (GnomeCanvasItem *item) eti->maybe_in_drag = 0; eti->grabbed = 0; + eti->rows = -1; + e_canvas_item_set_reflow_callback (GNOME_CANVAS_ITEM (eti), eti_reflow); } diff --git a/widgets/table/e-tree-selection-model.c b/widgets/table/e-tree-selection-model.c index 70ae105a77..282e0bfb49 100644 --- a/widgets/table/e-tree-selection-model.c +++ b/widgets/table/e-tree-selection-model.c @@ -196,7 +196,7 @@ etsm_find_node_unless_equals (ETreeSelectionModel *etsm, return selection_node->children[position]; } else - return NULL; + return NULL; } else { if (!etsm->priv->root) etsm->priv->root = e_tree_selection_model_node_new(); diff --git a/widgets/table/e-tree-table-adapter.c b/widgets/table/e-tree-table-adapter.c index f432dcc53a..4ee3c6f704 100644 --- a/widgets/table/e-tree-table-adapter.c +++ b/widgets/table/e-tree-table-adapter.c @@ -605,21 +605,18 @@ etta_proxy_node_changed (ETreeModel *etm, ETreePath path, ETreeTableAdapter *ett int row = find_row_num(etta, path); int size; int old_size; + ETreeTableAdapterNode *node; if (row == -1) return; size = array_size_from_path(etta, path); - if (e_tree_model_node_is_expandable(etta->priv->source, path)) { - ETreeTableAdapterNode *node = find_or_create_node(etta, path); + + node = find_node(etta, path); + if (node) old_size = node->num_visible_children + 1; - } else { - ETreeTableAdapterNode *node = find_node(etta, path); - if (node) - old_size = node->num_visible_children + 1; - else - old_size = 1; - } + else + old_size = 1; etta_expand_to(etta, etta->priv->n_map + size - old_size); @@ -932,13 +929,13 @@ void e_tree_table_adapter_node_set_expanded (ETreeTableAdapter *etta, ET return; node = find_or_create_node(etta, path); - row = find_row_num(etta, path); if (expanded != node->expanded) { e_table_model_pre_change (E_TABLE_MODEL(etta)); node->expanded = expanded; + row = find_row_num(etta, path); if (row != -1) { if (etta->priv->root_visible) e_table_model_row_changed(E_TABLE_MODEL(etta), row); @@ -961,6 +958,7 @@ void e_tree_table_adapter_node_set_expanded (ETreeTableAdapter *etta, ET } } else { int num_children = node->num_visible_children; + g_assert (etta->priv->n_map >= row + 1 + num_children); memmove(etta->priv->map_table + row + 1, etta->priv->map_table + row + 1 + num_children, (etta->priv->n_map - row - 1 - num_children) * sizeof (ETreePath)); diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c index 568574f98f..d48773eb95 100644 --- a/widgets/table/e-tree.c +++ b/widgets/table/e-tree.c @@ -418,7 +418,7 @@ e_tree_setup_header (ETree *e_tree) "full_header", e_tree->priv->full_header, "sort_info", e_tree->priv->sort_info, "dnd_code", pointer, - /* "table", e_tree, FIXME*/ + "tree", e_tree, NULL); g_free(pointer); @@ -914,6 +914,12 @@ e_tree_save_state (ETree *e_tree, gtk_object_unref(GTK_OBJECT(state)); } +ETableSpecification * +e_tree_get_spec (ETree *e_tree) +{ + return e_tree->priv->spec; +} + static void et_table_model_changed (ETableModel *model, ETree *et) { diff --git a/widgets/table/e-tree.h b/widgets/table/e-tree.h index 46481a046a..4b73ff9dcb 100644 --- a/widgets/table/e-tree.h +++ b/widgets/table/e-tree.h @@ -9,6 +9,7 @@ #include <gal/widgets/e-printable.h> #include <gal/e-table/e-table-extras.h> +#include <gal/e-table/e-table-specification.h> #include <gal/e-table/e-table-state.h> #include <gal/e-table/e-tree-model.h> @@ -138,6 +139,7 @@ gchar *e_tree_get_state (ETree *e_tree) void e_tree_save_state (ETree *e_tree, const gchar *filename); ETableState *e_tree_get_state_object (ETree *e_tree); +ETableSpecification *e_tree_get_spec (ETree *e_tree); /* note that it is more efficient to provide the state at creation time */ void e_tree_set_state (ETree *e_tree, |