aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--widgets/table/e-table-memory-store.c12
-rw-r--r--widgets/table/e-table-memory-store.h3
-rw-r--r--widgets/table/e-table-specification.c3
-rw-r--r--widgets/table/e-table-specification.h1
-rw-r--r--widgets/table/e-table.c87
-rw-r--r--widgets/table/e-table.h1
6 files changed, 69 insertions, 38 deletions
diff --git a/widgets/table/e-table-memory-store.c b/widgets/table/e-table-memory-store.c
index 276bb99104..5cf59a7033 100644
--- a/widgets/table/e-table-memory-store.c
+++ b/widgets/table/e-table-memory-store.c
@@ -41,6 +41,9 @@ duplicate_value (ETableMemoryStore *etms, int col, const void *val)
switch (etms->priv->columns[col].type) {
case E_TABLE_MEMORY_STORE_COLUMN_TYPE_STRING:
return g_strdup (val);
+ case E_TABLE_MEMORY_STORE_COLUMN_TYPE_PIXBUF:
+ gdk_pixbuf_ref ((GdkPixbuf *) val);
+ return (GdkPixbuf *) val;
case E_TABLE_MEMORY_STORE_COLUMN_TYPE_CUSTOM:
if (etms->priv->columns[col].custom.duplicate_value)
return etms->priv->columns[col].custom.duplicate_value (E_TABLE_MODEL (etms), col, val, NULL);
@@ -103,6 +106,9 @@ etms_free_value (ETableModel *etm, int col, void *value)
case E_TABLE_MEMORY_STORE_COLUMN_TYPE_STRING:
g_free (value);
break;
+ case E_TABLE_MEMORY_STORE_COLUMN_TYPE_PIXBUF:
+ gdk_pixbuf_unref (value);
+ break;
case E_TABLE_MEMORY_STORE_COLUMN_TYPE_CUSTOM:
if (etms->priv->columns[col].custom.free_value)
etms->priv->columns[col].custom.free_value (E_TABLE_MODEL (etms), col, value, NULL);
@@ -120,6 +126,8 @@ etms_initialize_value (ETableModel *etm, int col)
switch (etms->priv->columns[col].type) {
case E_TABLE_MEMORY_STORE_COLUMN_TYPE_STRING:
return g_strdup ("");
+ case E_TABLE_MEMORY_STORE_COLUMN_TYPE_PIXBUF:
+ return NULL;
case E_TABLE_MEMORY_STORE_COLUMN_TYPE_CUSTOM:
if (etms->priv->columns[col].custom.initialize_value)
return etms->priv->columns[col].custom.initialize_value (E_TABLE_MODEL (etms), col, NULL);
@@ -138,6 +146,8 @@ etms_value_is_empty (ETableModel *etm, int col, const void *value)
switch (etms->priv->columns[col].type) {
case E_TABLE_MEMORY_STORE_COLUMN_TYPE_STRING:
return !(value && *(char *) value);
+ case E_TABLE_MEMORY_STORE_COLUMN_TYPE_PIXBUF:
+ return value == NULL;
case E_TABLE_MEMORY_STORE_COLUMN_TYPE_CUSTOM:
if (etms->priv->columns[col].custom.value_is_empty)
return etms->priv->columns[col].custom.value_is_empty (E_TABLE_MODEL (etms), col, value, NULL);
@@ -156,6 +166,8 @@ etms_value_to_string (ETableModel *etm, int col, const void *value)
switch (etms->priv->columns[col].type) {
case E_TABLE_MEMORY_STORE_COLUMN_TYPE_STRING:
return g_strdup (value);
+ case E_TABLE_MEMORY_STORE_COLUMN_TYPE_PIXBUF:
+ return g_strdup ("");
case E_TABLE_MEMORY_STORE_COLUMN_TYPE_CUSTOM:
if (etms->priv->columns[col].custom.value_is_empty)
return etms->priv->columns[col].custom.value_to_string (E_TABLE_MODEL (etms), col, value, NULL);
diff --git a/widgets/table/e-table-memory-store.h b/widgets/table/e-table-memory-store.h
index 33a84a2b1b..3a68e6df94 100644
--- a/widgets/table/e-table-memory-store.h
+++ b/widgets/table/e-table-memory-store.h
@@ -40,6 +40,7 @@ typedef enum {
E_TABLE_MEMORY_STORE_COLUMN_TYPE_TERMINATOR,
E_TABLE_MEMORY_STORE_COLUMN_TYPE_INTEGER,
E_TABLE_MEMORY_STORE_COLUMN_TYPE_STRING,
+ E_TABLE_MEMORY_STORE_COLUMN_TYPE_PIXBUF,
E_TABLE_MEMORY_STORE_COLUMN_TYPE_CUSTOM
} ETableMemoryStoreColumnType;
@@ -60,6 +61,7 @@ typedef struct {
#define E_TABLE_MEMORY_STORE_TERMINATOR { E_TABLE_MEMORY_STORE_COLUMN_TYPE_TERMINATOR, { NULL }, FALSE }
#define E_TABLE_MEMORY_STORE_INTEGER { E_TABLE_MEMORY_STORE_COLUMN_TYPE_INTEGER, { NULL }, FALSE }
#define E_TABLE_MEMORY_STORE_STRING { E_TABLE_MEMORY_STORE_COLUMN_TYPE_STRING, { NULL }, FALSE }
+#define E_TABLE_MEMORY_STORE_PIXBUF { E_TABLE_MEMORY_STORE_COLUMN_TYPE_PIXBUF, { NULL }, FALSE }
#define E_TABLE_MEMORY_STORE_EDITABLE_STRING { E_TABLE_MEMORY_STORE_COLUMN_TYPE_STRING, { NULL }, TRUE }
#define E_TABLE_MEMORY_STORE_CUSTOM(editable, duplicate, free, initialize, empty, string) \
{ E_TABLE_MEMORY_STORE_COLUMN_TYPE_CUSTOM, \
@@ -106,4 +108,3 @@ void e_table_memory_store_clear (ETableMemoryStore
END_GNOME_DECLS
#endif /* _E_TABLE_MEMORY_STORE_H_ */
-
diff --git a/widgets/table/e-table-specification.c b/widgets/table/e-table-specification.c
index 81456dbac4..cabd5b9084 100644
--- a/widgets/table/e-table-specification.c
+++ b/widgets/table/e-table-specification.c
@@ -83,6 +83,7 @@ etsp_init (ETableSpecification *etsp)
etsp->vertical_draw_grid = FALSE;
etsp->draw_focus = TRUE;
etsp->horizontal_scrolling = FALSE;
+ etsp->horizontal_resize = FALSE;
etsp->allow_grouping = TRUE;
etsp->cursor_mode = E_CURSOR_SIMPLE;
@@ -191,6 +192,7 @@ e_table_specification_load_from_node (ETableSpecification *specification,
}
specification->draw_focus = e_xml_get_bool_prop_by_name_with_default (node, "draw-focus", TRUE);
specification->horizontal_scrolling = e_xml_get_bool_prop_by_name_with_default (node, "horizontal-scrolling", FALSE);
+ specification->horizontal_resize = e_xml_get_bool_prop_by_name_with_default (node, "horizontal-resize", FALSE);
specification->allow_grouping = e_xml_get_bool_prop_by_name_with_default (node, "allow-grouping", TRUE);
specification->selection_mode = GTK_SELECTION_MULTIPLE;
@@ -335,6 +337,7 @@ e_table_specification_save_to_node (ETableSpecification *specification,
e_xml_set_bool_prop_by_name (node, "vertical-draw-grid", specification->vertical_draw_grid);
e_xml_set_bool_prop_by_name (node, "draw-focus", specification->draw_focus);
e_xml_set_bool_prop_by_name (node, "horizontal-scrolling", specification->horizontal_scrolling);
+ e_xml_set_bool_prop_by_name (node, "horizontal-resize", specification->horizontal_resize);
e_xml_set_bool_prop_by_name (node, "allow-grouping", specification->allow_grouping);
switch (specification->selection_mode){
diff --git a/widgets/table/e-table-specification.h b/widgets/table/e-table-specification.h
index 0a9a9df1b9..35425fe0af 100644
--- a/widgets/table/e-table-specification.h
+++ b/widgets/table/e-table-specification.h
@@ -55,6 +55,7 @@ typedef struct {
guint vertical_draw_grid : 1;
guint draw_focus : 1;
guint horizontal_scrolling : 1;
+ guint horizontal_resize : 1;
guint allow_grouping : 1;
GtkSelectionMode selection_mode;
ECursorMode cursor_mode;
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c
index 5b25880b63..02ae76bcc3 100644
--- a/widgets/table/e-table.c
+++ b/widgets/table/e-table.c
@@ -193,15 +193,26 @@ e_table_state_change (ETable *et)
}
static void
-structure_changed (ETableHeader *header, ETable *et)
+e_table_header_change (ETable *et)
{
e_table_state_change (et);
+ if (et->horizontal_resize) {
+ int width = e_table_header_total_width (et->header);
+ gtk_widget_set_usize (GTK_WIDGET (et->header_canvas), width,
+ -2);
+ }
+}
+
+static void
+structure_changed (ETableHeader *header, ETable *et)
+{
+ e_table_header_change (et);
}
static void
expansion_changed (ETableHeader *header, ETable *et)
{
- e_table_state_change (et);
+ e_table_header_change (et);
}
static void
@@ -302,43 +313,44 @@ e_table_init (GtkObject *object)
GTK_WIDGET_SET_FLAGS (e_table, GTK_CAN_FOCUS);
- gtk_table->homogeneous = FALSE;
+ gtk_table->homogeneous = FALSE;
- e_table->sort_info = NULL;
- e_table->group_info_change_id = 0;
- e_table->sort_info_change_id = 0;
- e_table->structure_change_id = 0;
- e_table->expansion_change_id = 0;
- e_table->reflow_idle_id = 0;
- e_table->scroll_idle_id = 0;
+ e_table->sort_info = NULL;
+ e_table->group_info_change_id = 0;
+ e_table->sort_info_change_id = 0;
+ e_table->structure_change_id = 0;
+ e_table->expansion_change_id = 0;
+ e_table->reflow_idle_id = 0;
+ e_table->scroll_idle_id = 0;
- e_table->alternating_row_colors = 1;
- e_table->horizontal_draw_grid = 1;
- e_table->vertical_draw_grid = 1;
- e_table->draw_focus = 1;
- e_table->cursor_mode = E_CURSOR_SIMPLE;
- e_table->length_threshold = 200;
- e_table->uniform_row_height = FALSE;
+ e_table->alternating_row_colors = 1;
+ e_table->horizontal_draw_grid = 1;
+ e_table->vertical_draw_grid = 1;
+ e_table->draw_focus = 1;
+ e_table->cursor_mode = E_CURSOR_SIMPLE;
+ e_table->length_threshold = 200;
+ e_table->uniform_row_height = FALSE;
- e_table->need_rebuild = 0;
- e_table->rebuild_idle_id = 0;
+ e_table->need_rebuild = 0;
+ e_table->rebuild_idle_id = 0;
- e_table->horizontal_scrolling = FALSE;
+ e_table->horizontal_scrolling = FALSE;
+ e_table->horizontal_resize = FALSE;
- e_table->click_to_add_message = NULL;
+ e_table->click_to_add_message = NULL;
- e_table->drag_get_data_row = -1;
- e_table->drag_get_data_col = -1;
- e_table->drop_row = -1;
- e_table->drop_col = -1;
- e_table->site = NULL;
+ e_table->drag_get_data_row = -1;
+ e_table->drag_get_data_col = -1;
+ e_table->drop_row = -1;
+ e_table->drop_col = -1;
+ e_table->site = NULL;
- e_table->do_drag = 0;
+ e_table->do_drag = 0;
- e_table->sorter = NULL;
- e_table->selection = e_table_selection_model_new();
- e_table->cursor_loc = E_TABLE_CURSOR_LOC_NONE;
- e_table->spec = NULL;
+ e_table->sorter = NULL;
+ e_table->selection = e_table_selection_model_new();
+ e_table->cursor_loc = E_TABLE_CURSOR_LOC_NONE;
+ e_table->spec = NULL;
}
/* Grab_focus handler for the ETable */
@@ -401,7 +413,7 @@ header_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc, ETable *e_
header is correct */
if (GTK_WIDGET (e_table->header_canvas)->allocation.height !=
E_TABLE_HEADER_ITEM (e_table->header_item)->height)
- gtk_widget_set_usize (GTK_WIDGET (e_table->header_canvas), -1,
+ gtk_widget_set_usize (GTK_WIDGET (e_table->header_canvas), -2,
E_TABLE_HEADER_ITEM (e_table->header_item)->height);
}
@@ -453,7 +465,7 @@ e_table_setup_header (ETable *e_table)
GTK_OBJECT (e_table->header_canvas), "size_allocate",
GTK_SIGNAL_FUNC (header_canvas_size_allocate), e_table);
- gtk_widget_set_usize (GTK_WIDGET (e_table->header_canvas), -1,
+ gtk_widget_set_usize (GTK_WIDGET (e_table->header_canvas), -2,
E_TABLE_HEADER_ITEM (e_table->header_item)->height);
}
@@ -665,7 +677,7 @@ et_table_row_changed (ETableModel *table_model, int row, ETable *et)
if (!et->need_rebuild) {
if (e_table_group_remove (et->group, row))
e_table_group_add (et->group, row);
- if (et->horizontal_scrolling)
+ if (et->horizontal_scrolling || et->horizontal_resize)
e_table_header_update_horizontal(et->header);
}
}
@@ -687,7 +699,7 @@ et_table_rows_inserted (ETableModel *table_model, int row, int count, ETable *et
e_table_group_increment(et->group, row, count);
for (i = 0; i < count; i++)
e_table_group_add (et->group, row + i);
- if (et->horizontal_scrolling)
+ if (et->horizontal_scrolling || et->horizontal_resize)
e_table_header_update_horizontal(et->header);
}
}
@@ -702,7 +714,7 @@ et_table_rows_deleted (ETableModel *table_model, int row, int count, ETable *et)
e_table_group_remove (et->group, row + i);
if (row != row_count)
e_table_group_decrement(et->group, row, count);
- if (et->horizontal_scrolling)
+ if (et->horizontal_scrolling || et->horizontal_resize)
e_table_header_update_horizontal(et->header);
}
}
@@ -798,7 +810,7 @@ changed_idle (gpointer data)
et->need_rebuild = 0;
et->rebuild_idle_id = 0;
- if (et->horizontal_scrolling)
+ if (et->horizontal_scrolling || et->horizontal_resize)
e_table_header_update_horizontal(et->header);
return FALSE;
@@ -1237,6 +1249,7 @@ et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete,
connect_header (e_table, state);
e_table->horizontal_scrolling = specification->horizontal_scrolling;
+ e_table->horizontal_resize = specification->horizontal_resize;
e_table->allow_grouping = specification->allow_grouping;
e_table->sort_info = state->sort_info;
diff --git a/widgets/table/e-table.h b/widgets/table/e-table.h
index 11e86e1903..c1cc971674 100644
--- a/widgets/table/e-table.h
+++ b/widgets/table/e-table.h
@@ -110,6 +110,7 @@ typedef struct {
guint row_selection_active : 1;
guint horizontal_scrolling : 1;
+ guint horizontal_resize : 1;
guint is_grouped : 1;