aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--widgets/misc/e-canvas-vbox.c25
-rw-r--r--widgets/misc/e-canvas-vbox.h2
-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.c24
-rw-r--r--widgets/table/e-table.h1
6 files changed, 50 insertions, 6 deletions
diff --git a/widgets/misc/e-canvas-vbox.c b/widgets/misc/e-canvas-vbox.c
index 5879d4f672..465548b885 100644
--- a/widgets/misc/e-canvas-vbox.c
+++ b/widgets/misc/e-canvas-vbox.c
@@ -41,6 +41,7 @@ static void e_canvas_vbox_realize (GnomeCanvasItem *item);
static void e_canvas_vbox_reflow (GnomeCanvasItem *item, int flags);
static void e_canvas_vbox_real_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item);
+static void e_canvas_vbox_real_add_item_start(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item);
static void e_canvas_vbox_resize_children (GnomeCanvasItem *item);
static GnomeCanvasGroupClass *parent_class = NULL;
@@ -100,6 +101,7 @@ e_canvas_vbox_class_init (ECanvasVboxClass *klass)
GTK_ARG_READWRITE, ARG_SPACING);
klass->add_item = e_canvas_vbox_real_add_item;
+ klass->add_item_start = e_canvas_vbox_real_add_item_start;
object_class->set_arg = e_canvas_vbox_set_arg;
object_class->get_arg = e_canvas_vbox_get_arg;
@@ -265,6 +267,21 @@ e_canvas_vbox_real_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item)
}
}
+
+static void
+e_canvas_vbox_real_add_item_start(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item)
+{
+ e_canvas_vbox->items = g_list_prepend(e_canvas_vbox->items, item);
+ gtk_signal_connect(GTK_OBJECT(item), "destroy",
+ GTK_SIGNAL_FUNC(e_canvas_vbox_remove_item), e_canvas_vbox);
+ if ( GTK_OBJECT_FLAGS( e_canvas_vbox ) & GNOME_CANVAS_ITEM_REALIZED ) {
+ gnome_canvas_item_set(item,
+ "width", (double) e_canvas_vbox->minimum_width,
+ NULL);
+ e_canvas_item_request_reflow(item);
+ }
+}
+
static void
e_canvas_vbox_resize_children (GnomeCanvasItem *item)
{
@@ -348,3 +365,11 @@ e_canvas_vbox_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item)
if (E_CANVAS_VBOX_CLASS(GTK_OBJECT(e_canvas_vbox)->klass)->add_item)
(E_CANVAS_VBOX_CLASS(GTK_OBJECT(e_canvas_vbox)->klass)->add_item) (e_canvas_vbox, item);
}
+
+void
+e_canvas_vbox_add_item_start(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item)
+{
+ if (E_CANVAS_VBOX_CLASS(GTK_OBJECT(e_canvas_vbox)->klass)->add_item_start)
+ (E_CANVAS_VBOX_CLASS(GTK_OBJECT(e_canvas_vbox)->klass)->add_item_start) (e_canvas_vbox, item);
+}
+
diff --git a/widgets/misc/e-canvas-vbox.h b/widgets/misc/e-canvas-vbox.h
index 1dfaf7a726..3a98264cd1 100644
--- a/widgets/misc/e-canvas-vbox.h
+++ b/widgets/misc/e-canvas-vbox.h
@@ -69,6 +69,7 @@ struct _ECanvasVboxClass
/* Virtual methods. */
void (* add_item) (ECanvasVbox *CanvasVbox, GnomeCanvasItem *item);
+ void (* add_item_start) (ECanvasVbox *CanvasVbox, GnomeCanvasItem *item);
};
/*
@@ -78,6 +79,7 @@ struct _ECanvasVboxClass
* changes.
*/
void e_canvas_vbox_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item);
+void e_canvas_vbox_add_item_start(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item);
GtkType e_canvas_vbox_get_type (void);
#ifdef __cplusplus
diff --git a/widgets/table/e-table-specification.c b/widgets/table/e-table-specification.c
index 487f3113ad..1a2aefd9c9 100644
--- a/widgets/table/e-table-specification.c
+++ b/widgets/table/e-table-specification.c
@@ -65,6 +65,7 @@ etsp_init (ETableSpecification *etsp)
etsp->alternating_row_colors = TRUE;
etsp->no_headers = FALSE;
etsp->click_to_add = FALSE;
+ etsp->click_to_add_end = FALSE;
etsp->horizontal_draw_grid = FALSE;
etsp->vertical_draw_grid = FALSE;
etsp->draw_focus = TRUE;
@@ -165,6 +166,7 @@ e_table_specification_load_from_node (ETableSpecification *specification,
specification->no_headers = e_xml_get_bool_prop_by_name (node, "no-headers");
specification->click_to_add = e_xml_get_bool_prop_by_name (node, "click-to-add");
+ specification->click_to_add_end = e_xml_get_bool_prop_by_name (node, "click-to-add-end") && specification->click_to_add;
specification->alternating_row_colors = e_xml_get_bool_prop_by_name_with_default (node, "alternating-row-colors", TRUE);
specification->horizontal_draw_grid = e_xml_get_bool_prop_by_name (node, "horizontal-draw-grid");
specification->vertical_draw_grid = e_xml_get_bool_prop_by_name (node, "vertical-draw-grid");
@@ -311,6 +313,7 @@ e_table_specification_save_to_node (ETableSpecification *specification,
node = xmlNewNode (NULL, "ETableSpecification");
e_xml_set_bool_prop_by_name (node, "no-headers", specification->no_headers);
e_xml_set_bool_prop_by_name (node, "click-to-add", specification->click_to_add);
+ e_xml_set_bool_prop_by_name (node, "click-to-add-end", specification->click_to_add_end && specification->click_to_add);
e_xml_set_bool_prop_by_name (node, "alternating-row-colors", specification->alternating_row_colors);
e_xml_set_bool_prop_by_name (node, "horizontal-draw-grid", specification->horizontal_draw_grid);
e_xml_set_bool_prop_by_name (node, "vertical-draw-grid", specification->vertical_draw_grid);
diff --git a/widgets/table/e-table-specification.h b/widgets/table/e-table-specification.h
index b2941f38d3..c50989eeb0 100644
--- a/widgets/table/e-table-specification.h
+++ b/widgets/table/e-table-specification.h
@@ -28,6 +28,7 @@ typedef struct {
guint alternating_row_colors : 1;
guint no_headers : 1;
guint click_to_add : 1;
+ guint click_to_add_end : 1;
guint horizontal_draw_grid : 1;
guint vertical_draw_grid : 1;
guint draw_focus : 1;
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c
index 1bbd37f772..bde2f990bc 100644
--- a/widgets/table/e-table.c
+++ b/widgets/table/e-table.c
@@ -595,7 +595,12 @@ et_build_groups (ETable *et)
et->model,
et->sort_info,
0);
- e_canvas_vbox_add_item(E_CANVAS_VBOX(et->canvas_vbox), GNOME_CANVAS_ITEM(et->group));
+
+ if (et->use_click_to_add_end)
+ e_canvas_vbox_add_item_start(E_CANVAS_VBOX(et->canvas_vbox), GNOME_CANVAS_ITEM(et->group));
+ else
+ e_canvas_vbox_add_item(E_CANVAS_VBOX(et->canvas_vbox), GNOME_CANVAS_ITEM(et->group));
+
gnome_canvas_item_set(GNOME_CANVAS_ITEM(et->group),
"alternating_row_colors", et->alternating_row_colors,
"horizontal_draw_grid", et->horizontal_draw_grid,
@@ -760,6 +765,8 @@ e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *h
"spacing", 10.0,
NULL);
+ et_build_groups(e_table);
+
if (e_table->use_click_to_add) {
e_table->click_to_add = gnome_canvas_item_new (
GNOME_CANVAS_GROUP(e_table->canvas_vbox),
@@ -769,15 +776,19 @@ e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *h
"message", e_table->click_to_add_message,
NULL);
- e_canvas_vbox_add_item (
- E_CANVAS_VBOX(e_table->canvas_vbox),
- e_table->click_to_add);
+ if (e_table->use_click_to_add_end)
+ e_canvas_vbox_add_item (
+ E_CANVAS_VBOX(e_table->canvas_vbox),
+ e_table->click_to_add);
+ else
+ e_canvas_vbox_add_item_start (
+ E_CANVAS_VBOX(e_table->canvas_vbox),
+ e_table->click_to_add);
+
gtk_signal_connect (
GTK_OBJECT (e_table->click_to_add), "cursor_change",
GTK_SIGNAL_FUNC(click_to_add_cursor_change), e_table);
}
-
- et_build_groups(e_table);
}
static void
@@ -974,6 +985,7 @@ et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete,
ete = e_table_extras_new();
e_table->use_click_to_add = specification->click_to_add;
+ e_table->use_click_to_add_end = specification->click_to_add_end;
e_table->click_to_add_message = e_utf8_from_locale_string (gettext (specification->click_to_add_message));
e_table->alternating_row_colors = specification->alternating_row_colors;
e_table->horizontal_draw_grid = specification->horizontal_draw_grid;
diff --git a/widgets/table/e-table.h b/widgets/table/e-table.h
index f0656e7790..b5b9dd5f0a 100644
--- a/widgets/table/e-table.h
+++ b/widgets/table/e-table.h
@@ -89,6 +89,7 @@ typedef struct {
char *click_to_add_message;
GnomeCanvasItem *click_to_add;
gboolean use_click_to_add;
+ gboolean use_click_to_add_end;
ECursorMode cursor_mode;