diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-06-30 03:22:24 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-06-30 03:22:24 +0800 |
commit | 3649d5dc6d7279d6c218d241232dea73c5c773d2 (patch) | |
tree | 89520e235371866a92f889e885eb30ed09f44b6c | |
parent | f0bcf06559405a3de5271f4aeb3472c8a2b7aeb3 (diff) | |
download | gsoc2013-evolution-3649d5dc6d7279d6c218d241232dea73c5c773d2.tar gsoc2013-evolution-3649d5dc6d7279d6c218d241232dea73c5c773d2.tar.gz gsoc2013-evolution-3649d5dc6d7279d6c218d241232dea73c5c773d2.tar.bz2 gsoc2013-evolution-3649d5dc6d7279d6c218d241232dea73c5c773d2.tar.lz gsoc2013-evolution-3649d5dc6d7279d6c218d241232dea73c5c773d2.tar.xz gsoc2013-evolution-3649d5dc6d7279d6c218d241232dea73c5c773d2.tar.zst gsoc2013-evolution-3649d5dc6d7279d6c218d241232dea73c5c773d2.zip |
From mail:
2000-06-29 Christopher James Lahey <clahey@helixcode.com>
* message-list.c, mail-ops.c: Changed the name of
e_table_select_row to e_table_set_cursor_row.
From widgets/e-table:
2000-06-29 Christopher James Lahey <clahey@helixcode.com>
* e-table-click-to-add.c: Made this appear a bit better.
* e-table-defines.h: Cleaned this up a bit, added
ETableForeachFunc.
* e-table-group-container.c, e-table-group-leaf.c,
e-table-group.c, e-table-group.h, e-table-item.c, e-table-item.h,
e-table.c, e-table.h: Changed e_table_select_row to
e_table_set_cursor_row. Changed e_table_get_selected_view_row to
e_table_get_cursor_row. Added e_table_selected_row_foreach.
* e-table-header-item.c: Fixed some warnings.
* e-table-sorted-variable.c: Removed some unneeded debugging print
statments.
* e-tree-example-1.c: Changed e_table_get_selected_view_row to
e_table_get_cursor_row.
svn path=/trunk/; revision=3799
30 files changed, 404 insertions, 144 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 045e1c5873..d4df3feef1 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,8 @@ +2000-06-29 Christopher James Lahey <clahey@helixcode.com> + + * message-list.c, mail-ops.c: Changed the name of + e_table_select_row to e_table_set_cursor_row. + 2000-06-29 Peter Williams <peterw@helixcode.com> * message-list.c (message_list_init): Set the dnd_code of the diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 7ba935be8a..7889f9acf8 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -642,7 +642,7 @@ delete_msg (GtkWidget *button, gpointer user_data) /* Move the cursor down a row... FIXME: should skip other * deleted messages. */ - e_table_select_row (E_TABLE (ml->etable), ml->selected_row + 1); + e_table_set_cursor_row (E_TABLE (ml->etable), ml->selected_row + 1); } static void real_expunge_folder( gpointer user_data ) diff --git a/mail/message-list.c b/mail/message-list.c index 9a3eba31e6..8d08a91a4e 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -1061,7 +1061,7 @@ on_cursor_change_cmd (ETable *table, static gint idle_select_row (gpointer user_data) { - e_table_select_row (user_data, 0); + e_table_set_cursor_row (user_data, 0); return FALSE; } diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog index 8d9d028ab5..12235123a3 100644 --- a/widgets/e-table/ChangeLog +++ b/widgets/e-table/ChangeLog @@ -1,3 +1,24 @@ +2000-06-29 Christopher James Lahey <clahey@helixcode.com> + + * e-table-click-to-add.c: Made this appear a bit better. + + * e-table-defines.h: Cleaned this up a bit, added + ETableForeachFunc. + + * e-table-group-container.c, e-table-group-leaf.c, + e-table-group.c, e-table-group.h, e-table-item.c, e-table-item.h, + e-table.c, e-table.h: Changed e_table_select_row to + e_table_set_cursor_row. Changed e_table_get_selected_view_row to + e_table_get_cursor_row. Added e_table_selected_row_foreach. + + * e-table-header-item.c: Fixed some warnings. + + * e-table-sorted-variable.c: Removed some unneeded debugging print + statments. + + * e-tree-example-1.c: Changed e_table_get_selected_view_row to + e_table_get_cursor_row. + 2000-06-27 Christopher James Lahey <clahey@helixcode.com> * e-table-header-item.c: Added an unsort command. diff --git a/widgets/e-table/e-table-click-to-add.c b/widgets/e-table/e-table-click-to-add.c index 30bf96b42a..0be15dfd67 100644 --- a/widgets/e-table/e-table-click-to-add.c +++ b/widgets/e-table/e-table-click-to-add.c @@ -20,6 +20,7 @@ #include "e-table-one.h" #include "widgets/e-text/e-text.h" #include "e-util/e-canvas.h" +#include "e-util/e-canvas-utils.h" enum { ROW_SELECTION, @@ -172,7 +173,11 @@ etcta_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) NULL); if (etcta->text) gnome_canvas_item_set(etcta->text, - "width", etcta->width, + "width", etcta->width - 4, + NULL); + if (etcta->rect) + gnome_canvas_item_set(etcta->rect, + "x2", etcta->width - 1, NULL); break; } @@ -216,7 +221,17 @@ etcta_realize (GnomeCanvasItem *item) e_text_get_type(), "text", etcta->message ? etcta->message : "", "anchor", GTK_ANCHOR_NW, - "width", etcta->width, + "width", etcta->width - 4, + NULL); + e_canvas_item_move_absolute (etcta->text, 2, 2); + etcta->rect = gnome_canvas_item_new(GNOME_CANVAS_GROUP(item), + gnome_canvas_rect_get_type(), + "x1", (double) 0, + "y1", (double) 0, + "x2", (double) etcta->width - 1, + "y2", (double) etcta->height - 1, + "outline_color", "black", + "fill_color", NULL, NULL); if (GNOME_CANVAS_ITEM_CLASS (etcta_parent_class)->realize) @@ -253,6 +268,10 @@ etcta_event (GnomeCanvasItem *item, GdkEvent *e) gtk_object_destroy(GTK_OBJECT(etcta->text)); etcta->text = NULL; } + if (etcta->rect) { + gtk_object_destroy(GTK_OBJECT(etcta->rect)); + etcta->rect = NULL; + } if (!etcta->row) { ETableModel *one; @@ -295,17 +314,27 @@ etcta_reflow (GnomeCanvasItem *item, int flags) { ETableClickToAdd *etcta = E_TABLE_CLICK_TO_ADD (item); + double old_height = etcta->height; + if (etcta->text) { gtk_object_get(GTK_OBJECT(etcta->text), "height", &etcta->height, NULL); + etcta->height += 4; } if (etcta->row) { gtk_object_get(GTK_OBJECT(etcta->row), "height", &etcta->height, NULL); } - e_canvas_item_request_parent_reflow(item); + + if (etcta->rect) { + gtk_object_set(GTK_OBJECT(etcta->rect), + "y2", etcta->height - 1, + NULL); + } + if (old_height != etcta->height) + e_canvas_item_request_parent_reflow(item); } static void @@ -404,7 +433,19 @@ e_table_click_to_add_commit (ETableClickToAdd *etcta) e_text_get_type(), "text", etcta->message ? etcta->message : "", "anchor", GTK_ANCHOR_NW, - "width", etcta->width, + "width", etcta->width - 4, + NULL); + e_canvas_item_move_absolute (etcta->text, 2, 2); + } + if (!etcta->rect) { + etcta->rect = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etcta), + gnome_canvas_rect_get_type(), + "x1", (double) 0, + "y1", (double) 0, + "x2", (double) etcta->width - 1, + "y2", (double) etcta->height - 1, + "outline_color", "black", + "fill_color", NULL, NULL); } } diff --git a/widgets/e-table/e-table-defines.h b/widgets/e-table/e-table-defines.h index 14a2c2c4c5..9bb9e107ac 100644 --- a/widgets/e-table/e-table-defines.h +++ b/widgets/e-table/e-table-defines.h @@ -1,3 +1,6 @@ +#ifndef __E_TABLE_DEFINES__ +#define __E_TABLE_DEFINES__ 1 + #define BUTTON_HEIGHT 10 #define BUTTON_PADDING 2 #define GROUP_INDENT (BUTTON_HEIGHT + (BUTTON_PADDING * 2)) @@ -7,3 +10,7 @@ #define MIN_ARROW_SIZE 10 +typedef void (*ETableForeachFunc) (int model_row, + gpointer closure); + +#endif diff --git a/widgets/e-table/e-table-group-container.c b/widgets/e-table/e-table-group-container.c index 6bff77d4ad..f4e10917fb 100644 --- a/widgets/e-table/e-table-group-container.c +++ b/widgets/e-table/e-table-group-container.c @@ -484,7 +484,7 @@ etgc_increment (ETableGroup *etg, gint position, gint amount) } static void -etgc_select_row (ETableGroup *etg, gint row) +etgc_set_cursor_row (ETableGroup *etg, gint row) { ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg); GList *list; @@ -492,7 +492,7 @@ etgc_select_row (ETableGroup *etg, gint row) ETableGroup *group = ((ETableGroupContainerChildNode *)list->data)->child; gint this_count = e_table_group_row_count(group); if (row < this_count) { - e_table_group_select_row(group, row); + e_table_group_set_cursor_row(group, row); return; } row -= this_count; @@ -500,14 +500,14 @@ etgc_select_row (ETableGroup *etg, gint row) } static int -etgc_get_selected_view_row (ETableGroup *etg) +etgc_get_cursor_row (ETableGroup *etg) { ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg); GList *list; int count = 0; for (list = etgc->children; list; list = g_list_next(list)) { ETableGroup *group = ((ETableGroupContainerChildNode *)list->data)->child; - int row = e_table_group_get_selected_view_row(group); + int row = e_table_group_get_cursor_row(group); if (row != -1) return count + row; count += e_table_group_row_count(group); @@ -546,6 +546,30 @@ etgc_get_focus_column (ETableGroup *etg) return 0; } +static void +etgc_selected_row_foreach (ETableGroup *etg, + ETableForeachFunc func, + gpointer closure) +{ + ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg); + if (etgc->children) { + GList *list; + for (list = etgc->children; list; list = list->next) { + ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data; + ETableGroup *child = child_node->child; + e_table_group_selected_row_foreach (child, func, closure); + } + } +} + + + + + + + + + static void etgc_thaw (ETableGroup *etg) { e_canvas_item_request_reflow (GNOME_CANVAS_ITEM(etg)); @@ -669,10 +693,11 @@ etgc_class_init (GtkObjectClass *object_class) e_group_class->increment = etgc_increment; e_group_class->row_count = etgc_row_count; e_group_class->set_focus = etgc_set_focus; - e_group_class->select_row = etgc_select_row; - e_group_class->get_selected_view_row = etgc_get_selected_view_row; + e_group_class->set_cursor_row = etgc_set_cursor_row; + e_group_class->get_cursor_row = etgc_get_cursor_row; e_group_class->get_focus_column = etgc_get_focus_column; e_group_class->get_printable = etgc_get_printable; + e_group_class->selected_row_foreach = etgc_selected_row_foreach; gtk_object_add_arg_type ("ETableGroupContainer::drawgrid", GTK_TYPE_BOOL, GTK_ARG_WRITABLE, ARG_TABLE_DRAW_GRID); diff --git a/widgets/e-table/e-table-group-leaf.c b/widgets/e-table/e-table-group-leaf.c index 0c76129101..08c4c4a475 100644 --- a/widgets/e-table/e-table-group-leaf.c +++ b/widgets/e-table/e-table-group-leaf.c @@ -16,9 +16,6 @@ #include "e-util/e-util.h" #include "e-util/e-canvas.h" -#define TITLE_HEIGHT 16 -#define GROUP_INDENT 10 - #define PARENT_TYPE e_table_group_get_type () static GnomeCanvasGroupClass *etgl_parent_class; @@ -214,7 +211,7 @@ etgl_set_focus (ETableGroup *etg, EFocus direction, gint view_col) } static void -etgl_select_row (ETableGroup *etg, gint row) +etgl_set_cursor_row (ETableGroup *etg, gint row) { ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); gnome_canvas_item_set(GNOME_CANVAS_ITEM(etgl->item), @@ -223,7 +220,7 @@ etgl_select_row (ETableGroup *etg, gint row) } static int -etgl_get_selected_view_row (ETableGroup *etg) +etgl_get_cursor_row (ETableGroup *etg) { ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); int row; @@ -248,6 +245,15 @@ etgl_get_printable (ETableGroup *etg) } static void +etgl_selected_row_foreach(ETableGroup *etg, + ETableForeachFunc func, + gpointer closure) +{ + ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); + e_table_item_selected_row_foreach (etgl->item, func, closure); +} + +static void etgl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) { ETableGroup *etg = E_TABLE_GROUP (object); @@ -355,10 +361,11 @@ etgl_class_init (GtkObjectClass *object_class) e_group_class->increment = etgl_increment; e_group_class->row_count = etgl_row_count; e_group_class->set_focus = etgl_set_focus; - e_group_class->select_row = etgl_select_row; - e_group_class->get_selected_view_row = etgl_get_selected_view_row; + e_group_class->set_cursor_row = etgl_set_cursor_row; + e_group_class->get_cursor_row = etgl_get_cursor_row; e_group_class->get_focus_column = etgl_get_focus_column; e_group_class->get_printable = etgl_get_printable; + e_group_class->selected_row_foreach = etgl_selected_row_foreach; gtk_object_add_arg_type ("ETableGroupLeaf::drawgrid", GTK_TYPE_BOOL, GTK_ARG_WRITABLE, ARG_TABLE_DRAW_GRID); diff --git a/widgets/e-table/e-table-group.c b/widgets/e-table/e-table-group.c index 98ac040037..18f8084b2c 100644 --- a/widgets/e-table/e-table-group.c +++ b/widgets/e-table/e-table-group.c @@ -18,9 +18,6 @@ #include <libgnomeui/gnome-canvas-rect-ellipse.h> #include "e-util/e-util.h" -#define TITLE_HEIGHT 16 -#define GROUP_INDENT 10 - #define PARENT_TYPE gnome_canvas_group_get_type () #define ETG_CLASS(e) (E_TABLE_GROUP_CLASS(GTK_OBJECT(e)->klass)) @@ -172,24 +169,24 @@ e_table_group_set_focus (ETableGroup *etg, } void -e_table_group_select_row (ETableGroup *etg, - gint row) +e_table_group_set_cursor_row (ETableGroup *etg, + gint row) { g_return_if_fail (etg != NULL); g_return_if_fail (E_IS_TABLE_GROUP (etg)); - if (ETG_CLASS (etg)->select_row) - ETG_CLASS (etg)->select_row (etg, row); + if (ETG_CLASS (etg)->set_cursor_row) + ETG_CLASS (etg)->set_cursor_row (etg, row); } int -e_table_group_get_selected_view_row (ETableGroup *etg) +e_table_group_get_cursor_row (ETableGroup *etg) { g_return_val_if_fail (etg != NULL, -1); g_return_val_if_fail (E_IS_TABLE_GROUP (etg), -1); - if (ETG_CLASS (etg)->get_selected_view_row) - return ETG_CLASS (etg)->get_selected_view_row (etg); + if (ETG_CLASS (etg)->get_cursor_row) + return ETG_CLASS (etg)->get_cursor_row (etg); else return -1; } @@ -243,6 +240,20 @@ e_table_group_get_printable (ETableGroup *etg) } void +e_table_group_selected_row_foreach (ETableGroup *etg, + ETableForeachFunc func, + gpointer closure) +{ + g_return_if_fail (etg != NULL); + g_return_if_fail (E_IS_TABLE_GROUP (etg)); + + if (ETG_CLASS (etg)->selected_row_foreach) + ETG_CLASS (etg)->selected_row_foreach (etg, func, closure); +} + + + +void e_table_group_row_selection (ETableGroup *e_table_group, gint row, gboolean selected) { g_return_if_fail (e_table_group != NULL); @@ -366,11 +377,12 @@ etg_class_init (GtkObjectClass *object_class) klass->row_count = NULL; klass->increment = NULL; klass->set_focus = NULL; - klass->select_row = NULL; - klass->get_selected_view_row = NULL; + klass->set_cursor_row = NULL; + klass->get_cursor_row = NULL; klass->get_focus = etg_get_focus; klass->get_ecol = NULL; klass->get_printable = NULL; + klass->selected_row_foreach = NULL; etg_parent_class = gtk_type_class (PARENT_TYPE); diff --git a/widgets/e-table/e-table-group.h b/widgets/e-table/e-table-group.h index a7c04cad5e..ef6be1d35f 100644 --- a/widgets/e-table/e-table-group.h +++ b/widgets/e-table/e-table-group.h @@ -6,6 +6,7 @@ #include "e-table-model.h" #include "e-table-header.h" #include "e-table-sort-info.h" +#include "e-table-defines.h" #include "e-util/e-util.h" #include "e-util/e-printable.h" @@ -44,26 +45,27 @@ typedef struct { GnomeCanvasGroupClass parent_class; /* Signals */ - void (*row_selection) (ETableGroup *etg, int row, gboolean selected); - void (*cursor_change) (ETableGroup *etg, int row); - void (*double_click) (ETableGroup *etg, int row); - gint (*right_click) (ETableGroup *etg, int row, int col, GdkEvent *event); - gint (*key_press) (ETableGroup *etg, int row, int col, GdkEvent *event); + void (*row_selection) (ETableGroup *etg, int row, gboolean selected); + void (*cursor_change) (ETableGroup *etg, int row); + void (*double_click) (ETableGroup *etg, int row); + gint (*right_click) (ETableGroup *etg, int row, int col, GdkEvent *event); + gint (*key_press) (ETableGroup *etg, int row, int col, GdkEvent *event); /* Virtual functions. */ - void (*add) (ETableGroup *etg, gint row); - void (*add_all) (ETableGroup *etg); - gboolean (*remove) (ETableGroup *etg, gint row); - gint (*get_count) (ETableGroup *etg); - gint (*row_count) (ETableGroup *etg); - void (*increment) (ETableGroup *etg, gint position, gint amount); - void (*set_focus) (ETableGroup *etg, EFocus direction, gint view_col); - void (*select_row) (ETableGroup *etg, gint row); - int (*get_selected_view_row) (ETableGroup *etg); - gboolean (*get_focus) (ETableGroup *etg); - gint (*get_focus_column) (ETableGroup *etg); - ETableCol *(*get_ecol) (ETableGroup *etg); - EPrintable *(*get_printable) (ETableGroup *etg); + void (*add) (ETableGroup *etg, gint row); + void (*add_all) (ETableGroup *etg); + gboolean (*remove) (ETableGroup *etg, gint row); + gint (*get_count) (ETableGroup *etg); + gint (*row_count) (ETableGroup *etg); + void (*increment) (ETableGroup *etg, gint position, gint amount); + void (*set_focus) (ETableGroup *etg, EFocus direction, gint view_col); + void (*set_cursor_row) (ETableGroup *etg, gint row); + int (*get_cursor_row) (ETableGroup *etg); + gboolean (*get_focus) (ETableGroup *etg); + gint (*get_focus_column) (ETableGroup *etg); + ETableCol *(*get_ecol) (ETableGroup *etg); + EPrintable *(*get_printable) (ETableGroup *etg); + void (*selected_row_foreach) (ETableGroup *etg, ETableForeachFunc func, gpointer closure); } ETableGroupClass; @@ -81,14 +83,17 @@ gint e_table_group_row_count (ETableGroup *etg); void e_table_group_set_focus (ETableGroup *etg, EFocus direction, gint view_col); -void e_table_group_select_row (ETableGroup *etg, +void e_table_group_set_cursor_row (ETableGroup *etg, gint row); -int e_table_group_get_selected_view_row (ETableGroup *etg); +int e_table_group_get_cursor_row (ETableGroup *etg); gboolean e_table_group_get_focus (ETableGroup *etg); gint e_table_group_get_focus_column (ETableGroup *etg); ETableHeader *e_table_group_get_header (ETableGroup *etg); ETableCol *e_table_group_get_ecol (ETableGroup *etg); EPrintable *e_table_group_get_printable (ETableGroup *etg); +void e_table_group_selected_row_foreach (ETableGroup *etg, + ETableForeachFunc func, + gpointer closure); ETableGroup *e_table_group_new (GnomeCanvasGroup *parent, ETableHeader *full_header, diff --git a/widgets/e-table/e-table-header-item.c b/widgets/e-table/e-table-header-item.c index 3ef0a80b35..7851338c9e 100644 --- a/widgets/e-table/e-table-header-item.c +++ b/widgets/e-table/e-table-header-item.c @@ -1078,9 +1078,6 @@ ethi_popup_sort_descending(GtkWidget *widget, EthiHeaderInfo *info) static void ethi_popup_unsort(GtkWidget *widget, EthiHeaderInfo *info) { - int length; - int i; - int found = FALSE; ETableHeaderItem *ethi = info->ethi; e_table_sort_info_grouping_truncate(ethi->sort_info, 0); diff --git a/widgets/e-table/e-table-item.c b/widgets/e-table/e-table-item.c index 9eca340472..6bf8bb702b 100644 --- a/widgets/e-table/e-table-item.c +++ b/widgets/e-table/e-table-item.c @@ -1617,6 +1617,16 @@ e_table_item_is_row_selected (ETableItem *eti, int row) return FALSE; } +void e_table_item_selected_row_foreach (ETableItem *eti, + ETableForeachFunc func, + gpointer closure) +{ + GSList *list = eti->selection; + for (; list; list = g_slist_next(list)) { + (func) (GPOINTER_TO_INT(list->data), closure); + } +} + static void e_table_item_unselect_row (ETableItem *eti, int row) { diff --git a/widgets/e-table/e-table-item.h b/widgets/e-table/e-table-item.h index 235ab6d764..619db68803 100644 --- a/widgets/e-table/e-table-item.h +++ b/widgets/e-table/e-table-item.h @@ -5,6 +5,7 @@ #include <libgnomeui/gnome-canvas.h> #include "e-table-model.h" #include "e-table-header.h" +#include "e-table-defines.h" #include <e-util/e-printable.h> #define E_TABLE_ITEM_TYPE (e_table_item_get_type ()) @@ -116,6 +117,10 @@ gint e_table_item_get_focused_column (ETableItem *eti); const GSList *e_table_item_get_selection (ETableItem *e_table_Item); gboolean e_table_item_is_row_selected (ETableItem *e_table_Item, int row); + +void e_table_item_selected_row_foreach (ETableItem *eti, + ETableForeachFunc func, + gpointer closure); void e_table_item_leave_edit (ETableItem *eti); void e_table_item_enter_edit (ETableItem *eti, int col, int row); diff --git a/widgets/e-table/e-table-sorted-variable.c b/widgets/e-table/e-table-sorted-variable.c index 4f2985edc6..a5472d7bce 100644 --- a/widgets/e-table/e-table-sorted-variable.c +++ b/widgets/e-table/e-table-sorted-variable.c @@ -295,7 +295,6 @@ etsv_sort(ETableSortedVariable *etsv) cols = e_table_sort_info_sorting_get_count(etsv->sort_info); cols_closure = cols; etsv_closure = etsv; - printf ("starting\n"); vals_closure = g_new(void *, total_rows * cols); ascending_closure = g_new(int, cols); compare_closure = g_new(GCompareFunc, cols); @@ -318,13 +317,10 @@ etsv_sort(ETableSortedVariable *etsv) compare_closure[j] = col->compare; ascending_closure[j] = column.ascending; } - printf("allocated\n"); qsort(E_TABLE_SUBSET(etsv)->map_table, rows, sizeof(int), qsort_callback); - printf ("sorted\n"); g_free(vals_closure); g_free(ascending_closure); g_free(compare_closure); - printf("freed\n"); e_table_model_changed (E_TABLE_MODEL(etsv)); reentering = 0; } diff --git a/widgets/e-table/e-table.c b/widgets/e-table/e-table.c index 83d9422be6..198b1d6bb1 100644 --- a/widgets/e-table/e-table.c +++ b/widgets/e-table/e-table.c @@ -36,8 +36,6 @@ #include "e-table-click-to-add.h" #define COLUMN_HEADER_HEIGHT 16 -#define TITLE_HEIGHT 16 -#define GROUP_INDENT 10 #define PARENT_TYPE gtk_table_get_type () @@ -745,17 +743,28 @@ e_table_save_specification (ETable *e_table, gchar *filename) } void -e_table_select_row (ETable *e_table, int row) +e_table_set_cursor_row (ETable *e_table, int row) { - e_table_group_select_row(e_table->group, row); + e_table_group_set_cursor_row(e_table->group, row); } int -e_table_get_selected_view_row (ETable *e_table) +e_table_get_cursor_row (ETable *e_table) { - return e_table_group_get_selected_view_row(e_table->group); + return e_table_group_get_cursor_row(e_table->group); } +void +e_table_selected_row_foreach (ETable *e_table, + ETableForeachFunc callback, + gpointer closure) +{ + e_table_group_selected_row_foreach(e_table->group, + callback, + closure); +} + + EPrintable * e_table_get_printable (ETable *e_table) { diff --git a/widgets/e-table/e-table.h b/widgets/e-table/e-table.h index c945e48772..9b93326ea1 100644 --- a/widgets/e-table/e-table.h +++ b/widgets/e-table/e-table.h @@ -93,10 +93,13 @@ GtkWidget *e_table_new_from_spec_file (ETableHeader *full_header, gchar *e_table_get_specification (ETable *e_table); void e_table_save_specification (ETable *e_table, gchar *filename); -void e_table_select_row (ETable *e_table, - int row); -/* -1 means no selection. */ -int e_table_get_selected_view_row (ETable *e_table); +void e_table_set_cursor_row (ETable *e_table, + int row); +/* -1 means we don't have the cursor. */ +int e_table_get_cursor_row (ETable *e_table); +void e_table_selected_row_foreach (ETable *e_table, + ETableForeachFunc callback, + gpointer closure); EPrintable *e_table_get_printable (ETable *e_table); END_GNOME_DECLS diff --git a/widgets/e-table/e-tree-example-1.c b/widgets/e-table/e-tree-example-1.c index c98e53c7af..308f462f64 100644 --- a/widgets/e-table/e-tree-example-1.c +++ b/widgets/e-table/e-tree-example-1.c @@ -128,7 +128,7 @@ add_sibling (GtkButton *button, gpointer data) ETreePath *selected_node; ETreePath *parent_node; - selected_row = e_table_get_selected_view_row (E_TABLE (e_table)); + selected_row = e_table_get_cursor_row (E_TABLE (e_table)); if (selected_row == -1) return; @@ -150,7 +150,7 @@ add_child (GtkButton *button, gpointer data) int selected_row; ETreePath *selected_node; - selected_row = e_table_get_selected_view_row (E_TABLE (e_table)); + selected_row = e_table_get_cursor_row (E_TABLE (e_table)); if (selected_row == -1) return; @@ -170,7 +170,7 @@ remove_node (GtkButton *button, gpointer data) char *str; ETreePath *selected_node; - selected_row = e_table_get_selected_view_row (E_TABLE (e_table)); + selected_row = e_table_get_cursor_row (E_TABLE (e_table)); if (selected_row == -1) return; @@ -192,7 +192,7 @@ expand_all (GtkButton *button, gpointer data) int selected_row; ETreePath *selected_node; - selected_row = e_table_get_selected_view_row (E_TABLE (e_table)); + selected_row = e_table_get_cursor_row (E_TABLE (e_table)); if (selected_row == -1) return; @@ -209,7 +209,7 @@ collapse_all (GtkButton *button, gpointer data) int selected_row; ETreePath *selected_node; - selected_row = e_table_get_selected_view_row (E_TABLE (e_table)); + selected_row = e_table_get_cursor_row (E_TABLE (e_table)); if (selected_row == -1) return; diff --git a/widgets/table/e-table-click-to-add.c b/widgets/table/e-table-click-to-add.c index 30bf96b42a..0be15dfd67 100644 --- a/widgets/table/e-table-click-to-add.c +++ b/widgets/table/e-table-click-to-add.c @@ -20,6 +20,7 @@ #include "e-table-one.h" #include "widgets/e-text/e-text.h" #include "e-util/e-canvas.h" +#include "e-util/e-canvas-utils.h" enum { ROW_SELECTION, @@ -172,7 +173,11 @@ etcta_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) NULL); if (etcta->text) gnome_canvas_item_set(etcta->text, - "width", etcta->width, + "width", etcta->width - 4, + NULL); + if (etcta->rect) + gnome_canvas_item_set(etcta->rect, + "x2", etcta->width - 1, NULL); break; } @@ -216,7 +221,17 @@ etcta_realize (GnomeCanvasItem *item) e_text_get_type(), "text", etcta->message ? etcta->message : "", "anchor", GTK_ANCHOR_NW, - "width", etcta->width, + "width", etcta->width - 4, + NULL); + e_canvas_item_move_absolute (etcta->text, 2, 2); + etcta->rect = gnome_canvas_item_new(GNOME_CANVAS_GROUP(item), + gnome_canvas_rect_get_type(), + "x1", (double) 0, + "y1", (double) 0, + "x2", (double) etcta->width - 1, + "y2", (double) etcta->height - 1, + "outline_color", "black", + "fill_color", NULL, NULL); if (GNOME_CANVAS_ITEM_CLASS (etcta_parent_class)->realize) @@ -253,6 +268,10 @@ etcta_event (GnomeCanvasItem *item, GdkEvent *e) gtk_object_destroy(GTK_OBJECT(etcta->text)); etcta->text = NULL; } + if (etcta->rect) { + gtk_object_destroy(GTK_OBJECT(etcta->rect)); + etcta->rect = NULL; + } if (!etcta->row) { ETableModel *one; @@ -295,17 +314,27 @@ etcta_reflow (GnomeCanvasItem *item, int flags) { ETableClickToAdd *etcta = E_TABLE_CLICK_TO_ADD (item); + double old_height = etcta->height; + if (etcta->text) { gtk_object_get(GTK_OBJECT(etcta->text), "height", &etcta->height, NULL); + etcta->height += 4; } if (etcta->row) { gtk_object_get(GTK_OBJECT(etcta->row), "height", &etcta->height, NULL); } - e_canvas_item_request_parent_reflow(item); + + if (etcta->rect) { + gtk_object_set(GTK_OBJECT(etcta->rect), + "y2", etcta->height - 1, + NULL); + } + if (old_height != etcta->height) + e_canvas_item_request_parent_reflow(item); } static void @@ -404,7 +433,19 @@ e_table_click_to_add_commit (ETableClickToAdd *etcta) e_text_get_type(), "text", etcta->message ? etcta->message : "", "anchor", GTK_ANCHOR_NW, - "width", etcta->width, + "width", etcta->width - 4, + NULL); + e_canvas_item_move_absolute (etcta->text, 2, 2); + } + if (!etcta->rect) { + etcta->rect = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etcta), + gnome_canvas_rect_get_type(), + "x1", (double) 0, + "y1", (double) 0, + "x2", (double) etcta->width - 1, + "y2", (double) etcta->height - 1, + "outline_color", "black", + "fill_color", NULL, NULL); } } diff --git a/widgets/table/e-table-defines.h b/widgets/table/e-table-defines.h index 14a2c2c4c5..9bb9e107ac 100644 --- a/widgets/table/e-table-defines.h +++ b/widgets/table/e-table-defines.h @@ -1,3 +1,6 @@ +#ifndef __E_TABLE_DEFINES__ +#define __E_TABLE_DEFINES__ 1 + #define BUTTON_HEIGHT 10 #define BUTTON_PADDING 2 #define GROUP_INDENT (BUTTON_HEIGHT + (BUTTON_PADDING * 2)) @@ -7,3 +10,7 @@ #define MIN_ARROW_SIZE 10 +typedef void (*ETableForeachFunc) (int model_row, + gpointer closure); + +#endif diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c index 6bff77d4ad..f4e10917fb 100644 --- a/widgets/table/e-table-group-container.c +++ b/widgets/table/e-table-group-container.c @@ -484,7 +484,7 @@ etgc_increment (ETableGroup *etg, gint position, gint amount) } static void -etgc_select_row (ETableGroup *etg, gint row) +etgc_set_cursor_row (ETableGroup *etg, gint row) { ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg); GList *list; @@ -492,7 +492,7 @@ etgc_select_row (ETableGroup *etg, gint row) ETableGroup *group = ((ETableGroupContainerChildNode *)list->data)->child; gint this_count = e_table_group_row_count(group); if (row < this_count) { - e_table_group_select_row(group, row); + e_table_group_set_cursor_row(group, row); return; } row -= this_count; @@ -500,14 +500,14 @@ etgc_select_row (ETableGroup *etg, gint row) } static int -etgc_get_selected_view_row (ETableGroup *etg) +etgc_get_cursor_row (ETableGroup *etg) { ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg); GList *list; int count = 0; for (list = etgc->children; list; list = g_list_next(list)) { ETableGroup *group = ((ETableGroupContainerChildNode *)list->data)->child; - int row = e_table_group_get_selected_view_row(group); + int row = e_table_group_get_cursor_row(group); if (row != -1) return count + row; count += e_table_group_row_count(group); @@ -546,6 +546,30 @@ etgc_get_focus_column (ETableGroup *etg) return 0; } +static void +etgc_selected_row_foreach (ETableGroup *etg, + ETableForeachFunc func, + gpointer closure) +{ + ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg); + if (etgc->children) { + GList *list; + for (list = etgc->children; list; list = list->next) { + ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data; + ETableGroup *child = child_node->child; + e_table_group_selected_row_foreach (child, func, closure); + } + } +} + + + + + + + + + static void etgc_thaw (ETableGroup *etg) { e_canvas_item_request_reflow (GNOME_CANVAS_ITEM(etg)); @@ -669,10 +693,11 @@ etgc_class_init (GtkObjectClass *object_class) e_group_class->increment = etgc_increment; e_group_class->row_count = etgc_row_count; e_group_class->set_focus = etgc_set_focus; - e_group_class->select_row = etgc_select_row; - e_group_class->get_selected_view_row = etgc_get_selected_view_row; + e_group_class->set_cursor_row = etgc_set_cursor_row; + e_group_class->get_cursor_row = etgc_get_cursor_row; e_group_class->get_focus_column = etgc_get_focus_column; e_group_class->get_printable = etgc_get_printable; + e_group_class->selected_row_foreach = etgc_selected_row_foreach; gtk_object_add_arg_type ("ETableGroupContainer::drawgrid", GTK_TYPE_BOOL, GTK_ARG_WRITABLE, ARG_TABLE_DRAW_GRID); diff --git a/widgets/table/e-table-group-leaf.c b/widgets/table/e-table-group-leaf.c index 0c76129101..08c4c4a475 100644 --- a/widgets/table/e-table-group-leaf.c +++ b/widgets/table/e-table-group-leaf.c @@ -16,9 +16,6 @@ #include "e-util/e-util.h" #include "e-util/e-canvas.h" -#define TITLE_HEIGHT 16 -#define GROUP_INDENT 10 - #define PARENT_TYPE e_table_group_get_type () static GnomeCanvasGroupClass *etgl_parent_class; @@ -214,7 +211,7 @@ etgl_set_focus (ETableGroup *etg, EFocus direction, gint view_col) } static void -etgl_select_row (ETableGroup *etg, gint row) +etgl_set_cursor_row (ETableGroup *etg, gint row) { ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); gnome_canvas_item_set(GNOME_CANVAS_ITEM(etgl->item), @@ -223,7 +220,7 @@ etgl_select_row (ETableGroup *etg, gint row) } static int -etgl_get_selected_view_row (ETableGroup *etg) +etgl_get_cursor_row (ETableGroup *etg) { ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); int row; @@ -248,6 +245,15 @@ etgl_get_printable (ETableGroup *etg) } static void +etgl_selected_row_foreach(ETableGroup *etg, + ETableForeachFunc func, + gpointer closure) +{ + ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); + e_table_item_selected_row_foreach (etgl->item, func, closure); +} + +static void etgl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) { ETableGroup *etg = E_TABLE_GROUP (object); @@ -355,10 +361,11 @@ etgl_class_init (GtkObjectClass *object_class) e_group_class->increment = etgl_increment; e_group_class->row_count = etgl_row_count; e_group_class->set_focus = etgl_set_focus; - e_group_class->select_row = etgl_select_row; - e_group_class->get_selected_view_row = etgl_get_selected_view_row; + e_group_class->set_cursor_row = etgl_set_cursor_row; + e_group_class->get_cursor_row = etgl_get_cursor_row; e_group_class->get_focus_column = etgl_get_focus_column; e_group_class->get_printable = etgl_get_printable; + e_group_class->selected_row_foreach = etgl_selected_row_foreach; gtk_object_add_arg_type ("ETableGroupLeaf::drawgrid", GTK_TYPE_BOOL, GTK_ARG_WRITABLE, ARG_TABLE_DRAW_GRID); diff --git a/widgets/table/e-table-group.c b/widgets/table/e-table-group.c index 98ac040037..18f8084b2c 100644 --- a/widgets/table/e-table-group.c +++ b/widgets/table/e-table-group.c @@ -18,9 +18,6 @@ #include <libgnomeui/gnome-canvas-rect-ellipse.h> #include "e-util/e-util.h" -#define TITLE_HEIGHT 16 -#define GROUP_INDENT 10 - #define PARENT_TYPE gnome_canvas_group_get_type () #define ETG_CLASS(e) (E_TABLE_GROUP_CLASS(GTK_OBJECT(e)->klass)) @@ -172,24 +169,24 @@ e_table_group_set_focus (ETableGroup *etg, } void -e_table_group_select_row (ETableGroup *etg, - gint row) +e_table_group_set_cursor_row (ETableGroup *etg, + gint row) { g_return_if_fail (etg != NULL); g_return_if_fail (E_IS_TABLE_GROUP (etg)); - if (ETG_CLASS (etg)->select_row) - ETG_CLASS (etg)->select_row (etg, row); + if (ETG_CLASS (etg)->set_cursor_row) + ETG_CLASS (etg)->set_cursor_row (etg, row); } int -e_table_group_get_selected_view_row (ETableGroup *etg) +e_table_group_get_cursor_row (ETableGroup *etg) { g_return_val_if_fail (etg != NULL, -1); g_return_val_if_fail (E_IS_TABLE_GROUP (etg), -1); - if (ETG_CLASS (etg)->get_selected_view_row) - return ETG_CLASS (etg)->get_selected_view_row (etg); + if (ETG_CLASS (etg)->get_cursor_row) + return ETG_CLASS (etg)->get_cursor_row (etg); else return -1; } @@ -243,6 +240,20 @@ e_table_group_get_printable (ETableGroup *etg) } void +e_table_group_selected_row_foreach (ETableGroup *etg, + ETableForeachFunc func, + gpointer closure) +{ + g_return_if_fail (etg != NULL); + g_return_if_fail (E_IS_TABLE_GROUP (etg)); + + if (ETG_CLASS (etg)->selected_row_foreach) + ETG_CLASS (etg)->selected_row_foreach (etg, func, closure); +} + + + +void e_table_group_row_selection (ETableGroup *e_table_group, gint row, gboolean selected) { g_return_if_fail (e_table_group != NULL); @@ -366,11 +377,12 @@ etg_class_init (GtkObjectClass *object_class) klass->row_count = NULL; klass->increment = NULL; klass->set_focus = NULL; - klass->select_row = NULL; - klass->get_selected_view_row = NULL; + klass->set_cursor_row = NULL; + klass->get_cursor_row = NULL; klass->get_focus = etg_get_focus; klass->get_ecol = NULL; klass->get_printable = NULL; + klass->selected_row_foreach = NULL; etg_parent_class = gtk_type_class (PARENT_TYPE); diff --git a/widgets/table/e-table-group.h b/widgets/table/e-table-group.h index a7c04cad5e..ef6be1d35f 100644 --- a/widgets/table/e-table-group.h +++ b/widgets/table/e-table-group.h @@ -6,6 +6,7 @@ #include "e-table-model.h" #include "e-table-header.h" #include "e-table-sort-info.h" +#include "e-table-defines.h" #include "e-util/e-util.h" #include "e-util/e-printable.h" @@ -44,26 +45,27 @@ typedef struct { GnomeCanvasGroupClass parent_class; /* Signals */ - void (*row_selection) (ETableGroup *etg, int row, gboolean selected); - void (*cursor_change) (ETableGroup *etg, int row); - void (*double_click) (ETableGroup *etg, int row); - gint (*right_click) (ETableGroup *etg, int row, int col, GdkEvent *event); - gint (*key_press) (ETableGroup *etg, int row, int col, GdkEvent *event); + void (*row_selection) (ETableGroup *etg, int row, gboolean selected); + void (*cursor_change) (ETableGroup *etg, int row); + void (*double_click) (ETableGroup *etg, int row); + gint (*right_click) (ETableGroup *etg, int row, int col, GdkEvent *event); + gint (*key_press) (ETableGroup *etg, int row, int col, GdkEvent *event); /* Virtual functions. */ - void (*add) (ETableGroup *etg, gint row); - void (*add_all) (ETableGroup *etg); - gboolean (*remove) (ETableGroup *etg, gint row); - gint (*get_count) (ETableGroup *etg); - gint (*row_count) (ETableGroup *etg); - void (*increment) (ETableGroup *etg, gint position, gint amount); - void (*set_focus) (ETableGroup *etg, EFocus direction, gint view_col); - void (*select_row) (ETableGroup *etg, gint row); - int (*get_selected_view_row) (ETableGroup *etg); - gboolean (*get_focus) (ETableGroup *etg); - gint (*get_focus_column) (ETableGroup *etg); - ETableCol *(*get_ecol) (ETableGroup *etg); - EPrintable *(*get_printable) (ETableGroup *etg); + void (*add) (ETableGroup *etg, gint row); + void (*add_all) (ETableGroup *etg); + gboolean (*remove) (ETableGroup *etg, gint row); + gint (*get_count) (ETableGroup *etg); + gint (*row_count) (ETableGroup *etg); + void (*increment) (ETableGroup *etg, gint position, gint amount); + void (*set_focus) (ETableGroup *etg, EFocus direction, gint view_col); + void (*set_cursor_row) (ETableGroup *etg, gint row); + int (*get_cursor_row) (ETableGroup *etg); + gboolean (*get_focus) (ETableGroup *etg); + gint (*get_focus_column) (ETableGroup *etg); + ETableCol *(*get_ecol) (ETableGroup *etg); + EPrintable *(*get_printable) (ETableGroup *etg); + void (*selected_row_foreach) (ETableGroup *etg, ETableForeachFunc func, gpointer closure); } ETableGroupClass; @@ -81,14 +83,17 @@ gint e_table_group_row_count (ETableGroup *etg); void e_table_group_set_focus (ETableGroup *etg, EFocus direction, gint view_col); -void e_table_group_select_row (ETableGroup *etg, +void e_table_group_set_cursor_row (ETableGroup *etg, gint row); -int e_table_group_get_selected_view_row (ETableGroup *etg); +int e_table_group_get_cursor_row (ETableGroup *etg); gboolean e_table_group_get_focus (ETableGroup *etg); gint e_table_group_get_focus_column (ETableGroup *etg); ETableHeader *e_table_group_get_header (ETableGroup *etg); ETableCol *e_table_group_get_ecol (ETableGroup *etg); EPrintable *e_table_group_get_printable (ETableGroup *etg); +void e_table_group_selected_row_foreach (ETableGroup *etg, + ETableForeachFunc func, + gpointer closure); ETableGroup *e_table_group_new (GnomeCanvasGroup *parent, ETableHeader *full_header, diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c index 3ef0a80b35..7851338c9e 100644 --- a/widgets/table/e-table-header-item.c +++ b/widgets/table/e-table-header-item.c @@ -1078,9 +1078,6 @@ ethi_popup_sort_descending(GtkWidget *widget, EthiHeaderInfo *info) static void ethi_popup_unsort(GtkWidget *widget, EthiHeaderInfo *info) { - int length; - int i; - int found = FALSE; ETableHeaderItem *ethi = info->ethi; e_table_sort_info_grouping_truncate(ethi->sort_info, 0); diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c index 9eca340472..6bf8bb702b 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -1617,6 +1617,16 @@ e_table_item_is_row_selected (ETableItem *eti, int row) return FALSE; } +void e_table_item_selected_row_foreach (ETableItem *eti, + ETableForeachFunc func, + gpointer closure) +{ + GSList *list = eti->selection; + for (; list; list = g_slist_next(list)) { + (func) (GPOINTER_TO_INT(list->data), closure); + } +} + static void e_table_item_unselect_row (ETableItem *eti, int row) { diff --git a/widgets/table/e-table-item.h b/widgets/table/e-table-item.h index 235ab6d764..619db68803 100644 --- a/widgets/table/e-table-item.h +++ b/widgets/table/e-table-item.h @@ -5,6 +5,7 @@ #include <libgnomeui/gnome-canvas.h> #include "e-table-model.h" #include "e-table-header.h" +#include "e-table-defines.h" #include <e-util/e-printable.h> #define E_TABLE_ITEM_TYPE (e_table_item_get_type ()) @@ -116,6 +117,10 @@ gint e_table_item_get_focused_column (ETableItem *eti); const GSList *e_table_item_get_selection (ETableItem *e_table_Item); gboolean e_table_item_is_row_selected (ETableItem *e_table_Item, int row); + +void e_table_item_selected_row_foreach (ETableItem *eti, + ETableForeachFunc func, + gpointer closure); void e_table_item_leave_edit (ETableItem *eti); void e_table_item_enter_edit (ETableItem *eti, int col, int row); diff --git a/widgets/table/e-table-sorted-variable.c b/widgets/table/e-table-sorted-variable.c index 4f2985edc6..a5472d7bce 100644 --- a/widgets/table/e-table-sorted-variable.c +++ b/widgets/table/e-table-sorted-variable.c @@ -295,7 +295,6 @@ etsv_sort(ETableSortedVariable *etsv) cols = e_table_sort_info_sorting_get_count(etsv->sort_info); cols_closure = cols; etsv_closure = etsv; - printf ("starting\n"); vals_closure = g_new(void *, total_rows * cols); ascending_closure = g_new(int, cols); compare_closure = g_new(GCompareFunc, cols); @@ -318,13 +317,10 @@ etsv_sort(ETableSortedVariable *etsv) compare_closure[j] = col->compare; ascending_closure[j] = column.ascending; } - printf("allocated\n"); qsort(E_TABLE_SUBSET(etsv)->map_table, rows, sizeof(int), qsort_callback); - printf ("sorted\n"); g_free(vals_closure); g_free(ascending_closure); g_free(compare_closure); - printf("freed\n"); e_table_model_changed (E_TABLE_MODEL(etsv)); reentering = 0; } diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index 83d9422be6..198b1d6bb1 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -36,8 +36,6 @@ #include "e-table-click-to-add.h" #define COLUMN_HEADER_HEIGHT 16 -#define TITLE_HEIGHT 16 -#define GROUP_INDENT 10 #define PARENT_TYPE gtk_table_get_type () @@ -745,17 +743,28 @@ e_table_save_specification (ETable *e_table, gchar *filename) } void -e_table_select_row (ETable *e_table, int row) +e_table_set_cursor_row (ETable *e_table, int row) { - e_table_group_select_row(e_table->group, row); + e_table_group_set_cursor_row(e_table->group, row); } int -e_table_get_selected_view_row (ETable *e_table) +e_table_get_cursor_row (ETable *e_table) { - return e_table_group_get_selected_view_row(e_table->group); + return e_table_group_get_cursor_row(e_table->group); } +void +e_table_selected_row_foreach (ETable *e_table, + ETableForeachFunc callback, + gpointer closure) +{ + e_table_group_selected_row_foreach(e_table->group, + callback, + closure); +} + + EPrintable * e_table_get_printable (ETable *e_table) { diff --git a/widgets/table/e-table.h b/widgets/table/e-table.h index c945e48772..9b93326ea1 100644 --- a/widgets/table/e-table.h +++ b/widgets/table/e-table.h @@ -93,10 +93,13 @@ GtkWidget *e_table_new_from_spec_file (ETableHeader *full_header, gchar *e_table_get_specification (ETable *e_table); void e_table_save_specification (ETable *e_table, gchar *filename); -void e_table_select_row (ETable *e_table, - int row); -/* -1 means no selection. */ -int e_table_get_selected_view_row (ETable *e_table); +void e_table_set_cursor_row (ETable *e_table, + int row); +/* -1 means we don't have the cursor. */ +int e_table_get_cursor_row (ETable *e_table); +void e_table_selected_row_foreach (ETable *e_table, + ETableForeachFunc callback, + gpointer closure); EPrintable *e_table_get_printable (ETable *e_table); END_GNOME_DECLS diff --git a/widgets/table/e-tree-example-1.c b/widgets/table/e-tree-example-1.c index c98e53c7af..308f462f64 100644 --- a/widgets/table/e-tree-example-1.c +++ b/widgets/table/e-tree-example-1.c @@ -128,7 +128,7 @@ add_sibling (GtkButton *button, gpointer data) ETreePath *selected_node; ETreePath *parent_node; - selected_row = e_table_get_selected_view_row (E_TABLE (e_table)); + selected_row = e_table_get_cursor_row (E_TABLE (e_table)); if (selected_row == -1) return; @@ -150,7 +150,7 @@ add_child (GtkButton *button, gpointer data) int selected_row; ETreePath *selected_node; - selected_row = e_table_get_selected_view_row (E_TABLE (e_table)); + selected_row = e_table_get_cursor_row (E_TABLE (e_table)); if (selected_row == -1) return; @@ -170,7 +170,7 @@ remove_node (GtkButton *button, gpointer data) char *str; ETreePath *selected_node; - selected_row = e_table_get_selected_view_row (E_TABLE (e_table)); + selected_row = e_table_get_cursor_row (E_TABLE (e_table)); if (selected_row == -1) return; @@ -192,7 +192,7 @@ expand_all (GtkButton *button, gpointer data) int selected_row; ETreePath *selected_node; - selected_row = e_table_get_selected_view_row (E_TABLE (e_table)); + selected_row = e_table_get_cursor_row (E_TABLE (e_table)); if (selected_row == -1) return; @@ -209,7 +209,7 @@ collapse_all (GtkButton *button, gpointer data) int selected_row; ETreePath *selected_node; - selected_row = e_table_get_selected_view_row (E_TABLE (e_table)); + selected_row = e_table_get_cursor_row (E_TABLE (e_table)); if (selected_row == -1) return; |