aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2002-06-04 05:54:37 +0800
committerChris Lahey <clahey@src.gnome.org>2002-06-04 05:54:37 +0800
commitccc7bafebeb202b0f7f7f19b23f76a2105bf2068 (patch)
tree25996cd7397728c97ebbc6113ac947a8ab66059a /widgets/table
parentbf0fa9c240d89229fb33f5a02e0360e248d83f7b (diff)
downloadgsoc2013-evolution-ccc7bafebeb202b0f7f7f19b23f76a2105bf2068.tar
gsoc2013-evolution-ccc7bafebeb202b0f7f7f19b23f76a2105bf2068.tar.gz
gsoc2013-evolution-ccc7bafebeb202b0f7f7f19b23f76a2105bf2068.tar.bz2
gsoc2013-evolution-ccc7bafebeb202b0f7f7f19b23f76a2105bf2068.tar.lz
gsoc2013-evolution-ccc7bafebeb202b0f7f7f19b23f76a2105bf2068.tar.xz
gsoc2013-evolution-ccc7bafebeb202b0f7f7f19b23f76a2105bf2068.tar.zst
gsoc2013-evolution-ccc7bafebeb202b0f7f7f19b23f76a2105bf2068.zip
Get the font from the style again when the style changes. (init): Checks
2002-06-03 Christopher James Lahey <clahey@ximian.com> * e-cell-text.c (ect_style_set): Get the font from the style again when the style changes. (init): Checks for the environment variable GAL_ELLIPSIS and uses that instead of ... if it is set. * e-table-click-to-add.c (finish_editing): e_table_item_leave_edit before committing. (etcta_event): Added a missing break; here. * e-table-item.c (eti_style_set): On style set, free the height cache, request a reflow and a redraw, and call eti_idle_maybe_show_cursor. (e_table_item_compute_location): Don't call eti_get_height here, just use the cached value. * e-tree.c, e-tree.h (e_tree_get_table_adapter): Added this simple accessor function. svn path=/trunk/; revision=17088
Diffstat (limited to 'widgets/table')
-rw-r--r--widgets/table/e-cell-text.c34
-rw-r--r--widgets/table/e-table-click-to-add.c2
-rw-r--r--widgets/table/e-table-item.c14
-rw-r--r--widgets/table/e-tree.c17
-rw-r--r--widgets/table/e-tree.h3
5 files changed, 64 insertions, 6 deletions
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c
index 6f5ddcc7c1..ee1b333244 100644
--- a/widgets/table/e-cell-text.c
+++ b/widgets/table/e-cell-text.c
@@ -402,7 +402,6 @@ ect_realize (ECellView *ecell_view)
text_view->font = e_font_from_gdk_name (ect->font_name);
}
if (!text_view->font){
- gdk_font_ref (GTK_WIDGET (text_view->canvas)->style->font);
text_view->font = e_font_from_gdk_font (GTK_WIDGET (text_view->canvas)->style->font);
}
@@ -749,7 +748,20 @@ ect_get_bg_color(ECellView *ecell_view, int row)
return color_spec;
}
-
+
+
+static void
+ect_style_set(ECellView *ecell_view, GtkStyle *old_style)
+{
+ ECellTextView *text_view = (ECellTextView *) ecell_view;
+ ECellText *ect = (ECellText *) ecell_view->ecell;
+
+ if (!ect->font_name) {
+ e_font_unref (text_view->font);
+ text_view->font = e_font_from_gdk_font (GTK_WIDGET (text_view->canvas)->style->font);
+ }
+}
+
/*
@@ -1510,11 +1522,15 @@ ect_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
}
}
+static char *ellipsis_default = NULL;
+static gboolean use_ellipsis_default = TRUE;
+
static void
e_cell_text_class_init (GtkObjectClass *object_class)
{
ECellClass *ecc = (ECellClass *) object_class;
ECellTextClass *ectc = (ECellTextClass *) object_class;
+ char *ellipsis_env;
object_class->destroy = ect_destroy;
@@ -1536,6 +1552,7 @@ e_cell_text_class_init (GtkObjectClass *object_class)
ecc->max_width_by_row = ect_max_width_by_row;
ecc->show_tooltip = ect_show_tooltip;
ecc->get_bg_color = ect_get_bg_color;
+ ecc->style_set = ect_style_set;
ectc->get_text = ect_real_get_text;
ectc->free_text = ect_real_free_text;
@@ -1559,13 +1576,22 @@ e_cell_text_class_init (GtkObjectClass *object_class)
if (!clipboard_atom)
clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
+
+ ellipsis_env = getenv ("GAL_ELLIPSIS");
+ if (ellipsis_env) {
+ if (*ellipsis_env) {
+ ellipsis_default = g_strdup (ellipsis_env);
+ } else {
+ use_ellipsis_default = FALSE;
+ }
+ }
}
static void
e_cell_text_init (ECellText *ect)
{
- ect->ellipsis = NULL;
- ect->use_ellipsis = TRUE;
+ ect->ellipsis = g_strdup (ellipsis_default);
+ ect->use_ellipsis = use_ellipsis_default;
ect->strikeout_column = -1;
ect->bold_column = -1;
ect->color_column = -1;
diff --git a/widgets/table/e-table-click-to-add.c b/widgets/table/e-table-click-to-add.c
index d0fa452f40..12cc466d9e 100644
--- a/widgets/table/e-table-click-to-add.c
+++ b/widgets/table/e-table-click-to-add.c
@@ -301,6 +301,7 @@ finish_editing (ETableClickToAdd *etcta)
if (etcta->row) {
ETableModel *one;
+ e_table_item_leave_edit (E_TABLE_ITEM (etcta->row));
e_table_one_commit(E_TABLE_ONE(etcta->one));
etcta_drop_one (etcta);
gtk_object_destroy(GTK_OBJECT(etcta->row));
@@ -388,6 +389,7 @@ etcta_event (GnomeCanvasItem *item, GdkEvent *e)
return FALSE;
break;
}
+ break;
default:
return FALSE;
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index 80b557251a..cffe146622 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -2779,6 +2779,9 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
static void
eti_style_set (ETableItem *eti, GtkStyle *previous_style)
{
+ if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED))
+ return;
+
if (eti->cell_views_realized) {
int i;
int n_cells = eti->n_cells;
@@ -2787,6 +2790,15 @@ eti_style_set (ETableItem *eti, GtkStyle *previous_style)
e_cell_style_set (eti->cell_views[i], previous_style);
}
}
+
+ eti->needs_compute_height = 1;
+ e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti));
+ eti->needs_redraw = 1;
+ gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
+
+ free_height_cache (eti);
+
+ eti_idle_maybe_show_cursor(eti);
}
static void
@@ -3173,7 +3185,7 @@ e_table_item_compute_location (ETableItem *eti,
eti->grabbed_row = -1;
if (!find_cell (eti, *x, *y, col, row, NULL, NULL)) {
- *y -= eti_get_height(eti);
+ *y -= eti->height;
}
eti->grabbed_row = grabbed_row;
diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c
index 5e5c2d10da..512d833bd8 100644
--- a/widgets/table/e-tree.c
+++ b/widgets/table/e-tree.c
@@ -2077,6 +2077,23 @@ e_tree_get_selection_model (ETree *et)
return et->priv->selection;
}
+/**
+ * e_tree_get_table_adapter:
+ * @et: the ETree
+ *
+ * Returns the table adapter this ETree uses.
+ *
+ * Returns: the model
+ **/
+ETreeTableAdapter *
+e_tree_get_table_adapter (ETree *et)
+{
+ g_return_val_if_fail (et != NULL, NULL);
+ g_return_val_if_fail (E_IS_TREE (et), NULL);
+
+ return et->priv->etta;
+}
+
struct _ETreeDragSourceSite
{
diff --git a/widgets/table/e-tree.h b/widgets/table/e-tree.h
index 56ad205f63..32c3d0689d 100644
--- a/widgets/table/e-tree.h
+++ b/widgets/table/e-tree.h
@@ -34,6 +34,7 @@
#include <gal/e-table/e-table-specification.h>
#include <gal/e-table/e-table-state.h>
#include <gal/e-table/e-tree-model.h>
+#include <gal/e-table/e-tree-table-adapter.h>
#include <libgnome/gnome-defs.h>
#define E_TREE_USE_TREE_SELECTION
@@ -49,7 +50,6 @@ BEGIN_GNOME_DECLS
#define E_TREE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TREE_TYPE, ETreeClass))
#define E_IS_TREE(o) (GTK_CHECK_TYPE ((o), E_TREE_TYPE))
#define E_IS_TREE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TREE_TYPE))
-
typedef struct _ETreeDragSourceSite ETreeDragSourceSite;
typedef struct ETreePriv ETreePriv;
@@ -215,6 +215,7 @@ void e_tree_get_cell_geometry (ETree *tree,
/* Useful accessors */
ETreeModel * e_tree_get_model (ETree *et);
ESelectionModel *e_tree_get_selection_model (ETree *et);
+ETreeTableAdapter *e_tree_get_table_adapter (ETree *et);
/* Drag & drop stuff. */
/* Target */