aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-table-header-item.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-04-06 16:00:35 +0800
committerChris Lahey <clahey@src.gnome.org>2000-04-06 16:00:35 +0800
commitfe016cce581d311c97652e08fbd7bfcb4042bbe4 (patch)
tree8868c23051b29368e66a0801f819066dd02bcfa4 /widgets/table/e-table-header-item.c
parented50119936e0f078a21ea35e6bbe15b503063574 (diff)
downloadgsoc2013-evolution-fe016cce581d311c97652e08fbd7bfcb4042bbe4.tar
gsoc2013-evolution-fe016cce581d311c97652e08fbd7bfcb4042bbe4.tar.gz
gsoc2013-evolution-fe016cce581d311c97652e08fbd7bfcb4042bbe4.tar.bz2
gsoc2013-evolution-fe016cce581d311c97652e08fbd7bfcb4042bbe4.tar.lz
gsoc2013-evolution-fe016cce581d311c97652e08fbd7bfcb4042bbe4.tar.xz
gsoc2013-evolution-fe016cce581d311c97652e08fbd7bfcb4042bbe4.tar.zst
gsoc2013-evolution-fe016cce581d311c97652e08fbd7bfcb4042bbe4.zip
Got rid of some warnings.
2000-04-06 Christopher James Lahey <clahey@helixcode.com> * test-cols.c, test-table.c: Got rid of some warnings. * e-table-group-container.c, e-table-group-container.h, e-table-group-leaf.c, e-table-group-leaf.h, e-table-group.c, e-table-group.h, e-table-header-item.c, e-table-header-item.h, e-table-sort-info.c, e-table-sort-info.h, e-table-sorted-variable.c, e-table-sorted-variable.h, e-table.c, e-table.h: Changed ETableSortInfo to not use xml internally. svn path=/trunk/; revision=2305
Diffstat (limited to 'widgets/table/e-table-header-item.c')
-rw-r--r--widgets/table/e-table-header-item.c127
1 files changed, 74 insertions, 53 deletions
diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c
index 77ed032999..966ad257ad 100644
--- a/widgets/table/e-table-header-item.c
+++ b/widgets/table/e-table-header-item.c
@@ -79,6 +79,8 @@ ethi_destroy (GtkObject *object){
if (ethi->sort_info){
if (ethi->sort_info_changed_id)
gtk_signal_disconnect (GTK_OBJECT(ethi->sort_info), ethi->sort_info_changed_id);
+ if (ethi->group_info_changed_id)
+ gtk_signal_disconnect (GTK_OBJECT(ethi->sort_info), ethi->group_info_changed_id);
gtk_object_unref (GTK_OBJECT(ethi->sort_info));
}
@@ -210,12 +212,16 @@ ethi_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
if (ethi->sort_info){
if (ethi->sort_info_changed_id)
gtk_signal_disconnect (GTK_OBJECT(ethi->sort_info), ethi->sort_info_changed_id);
+ if (ethi->group_info_changed_id)
+ gtk_signal_disconnect (GTK_OBJECT(ethi->sort_info), ethi->group_info_changed_id);
gtk_object_unref (GTK_OBJECT(ethi->sort_info));
}
ethi->sort_info = GTK_VALUE_POINTER (*arg);
gtk_object_ref (GTK_OBJECT(ethi->sort_info));
ethi->sort_info_changed_id = gtk_signal_connect (GTK_OBJECT(ethi->sort_info), "sort_info_changed",
- GTK_SIGNAL_FUNC(ethi_sort_info_changed), ethi);
+ GTK_SIGNAL_FUNC(ethi_sort_info_changed), ethi);
+ ethi->group_info_changed_id = gtk_signal_connect (GTK_OBJECT(ethi->sort_info), "group_info_changed",
+ GTK_SIGNAL_FUNC(ethi_sort_info_changed), ethi);
break;
}
@@ -603,7 +609,6 @@ ethi_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width
int x1, x2;
int col;
GHashTable *arrows = g_hash_table_new (NULL, NULL);
- xmlNode *node;
gint group_indent = 0;
#if 0
@@ -612,24 +617,26 @@ ethi_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width
#endif
if (ethi->sort_info) {
- xmlNode *grouping;
- gtk_object_get (GTK_OBJECT(ethi->sort_info),
- "grouping", &grouping,
- NULL);
- for (node = grouping->childs; node && strcmp (node->name, "leaf"); node = node->childs) {
+ int length = e_table_sort_info_grouping_get_count(ethi->sort_info);
+ int i;
+ for (i = 0; i < length; i++) {
+ ETableSortColumn column = e_table_sort_info_grouping_get_nth(ethi->sort_info, i);
group_indent ++;
g_hash_table_insert (arrows,
- (gpointer) e_xml_get_integer_prop_by_name (node, "column"),
- (gpointer) (e_xml_get_integer_prop_by_name (node, "ascending") ?
- E_TABLE_COL_ARROW_DOWN :
- E_TABLE_COL_ARROW_UP));
+ (gpointer) column.column,
+ (gpointer) (column.ascending ?
+ E_TABLE_COL_ARROW_DOWN :
+ E_TABLE_COL_ARROW_UP));
}
- if (node)
+ length = e_table_sort_info_sorting_get_count(ethi->sort_info);
+ for (i = 0; i < length; i++) {
+ ETableSortColumn column = e_table_sort_info_sorting_get_nth(ethi->sort_info, i);
g_hash_table_insert (arrows,
- (gpointer) e_xml_get_integer_prop_by_name (node, "column"),
- (gpointer) (e_xml_get_integer_prop_by_name (node, "ascending") ?
- E_TABLE_COL_ARROW_DOWN :
- E_TABLE_COL_ARROW_UP));
+ (gpointer) column.column,
+ (gpointer) (column.ascending ?
+ E_TABLE_COL_ARROW_DOWN :
+ E_TABLE_COL_ARROW_UP));
+ }
}
ethi->group_indent_width = group_indent * GROUP_INDENT;
@@ -767,8 +774,8 @@ ethi_start_drag (ETableHeaderItem *ethi, GdkEvent *event)
int col_width;
GdkPixmap *pixmap;
GdkGC *gc;
+ int group_indent = 0;
GHashTable *arrows = g_hash_table_new (NULL, NULL);
- xmlNode *node;
ethi->drag_col = ethi_find_col_by_x (ethi, event->motion.x);
if (ethi->drag_col < ethi->eth->frozen_count && ethi->drag_col >= 0){
@@ -780,23 +787,26 @@ ethi_start_drag (ETableHeaderItem *ethi, GdkEvent *event)
if (ethi->sort_info) {
- xmlNode *grouping;
- gtk_object_get (GTK_OBJECT(ethi->sort_info),
- "grouping", &grouping,
- NULL);
- for (node = grouping->childs; node && strcmp (node->name, "leaf"); node = node->childs) {
+ int length = e_table_sort_info_grouping_get_count(ethi->sort_info);
+ int i;
+ for (i = 0; i < length; i++) {
+ ETableSortColumn column = e_table_sort_info_grouping_get_nth(ethi->sort_info, i);
+ group_indent ++;
g_hash_table_insert (arrows,
- (gpointer) e_xml_get_integer_prop_by_name (node, "column"),
- (gpointer) (e_xml_get_integer_prop_by_name (node, "ascending") ?
- E_TABLE_COL_ARROW_DOWN :
- E_TABLE_COL_ARROW_UP));
+ (gpointer) column.column,
+ (gpointer) (column.ascending ?
+ E_TABLE_COL_ARROW_DOWN :
+ E_TABLE_COL_ARROW_UP));
}
- if (node)
+ length = e_table_sort_info_sorting_get_count(ethi->sort_info);
+ for (i = 0; i < length; i++) {
+ ETableSortColumn column = e_table_sort_info_sorting_get_nth(ethi->sort_info, i);
g_hash_table_insert (arrows,
- (gpointer) e_xml_get_integer_prop_by_name (node, "column"),
- (gpointer) (e_xml_get_integer_prop_by_name (node, "ascending") ?
- E_TABLE_COL_ARROW_DOWN :
- E_TABLE_COL_ARROW_UP));
+ (gpointer) column.column,
+ (gpointer) (column.ascending ?
+ E_TABLE_COL_ARROW_DOWN :
+ E_TABLE_COL_ARROW_UP));
+ }
}
list = gtk_target_list_new (ethi_drag_types, ELEMENTS (ethi_drag_types));
@@ -927,36 +937,46 @@ ethi_event (GnomeCanvasItem *item, GdkEvent *e)
} else if (ethi->maybe_drag && ethi->sort_info) {
ETableCol *col;
int model_col;
- xmlNode *node;
- xmlNode *grouping;
-
- gtk_object_get (GTK_OBJECT(ethi->sort_info),
- "grouping", &grouping,
- NULL);
+ int length;
+ int i;
+ int found = FALSE;
col = e_table_header_get_column (ethi->eth, ethi_find_col_by_x (ethi, e->button.x));
model_col = col->col_idx;
- for (node = grouping->childs; node->childs && strcmp (node->name, "leaf"); node = node->childs) {
- if (model_col == e_xml_get_integer_prop_by_name (node, "column")){
- int ascending = e_xml_get_integer_prop_by_name (node, "ascending");
+
+ length = e_table_sort_info_grouping_get_count(ethi->sort_info);
+ for (i = 0; i < length; i++) {
+ ETableSortColumn column = e_table_sort_info_grouping_get_nth(ethi->sort_info, i);
+ if (model_col == column.column){
+ int ascending = column.ascending;
ascending = ! ascending;
- e_xml_set_integer_prop_by_name (node, "ascending", ascending);
+ column.ascending = ascending;
+ e_table_sort_info_grouping_set_nth(ethi->sort_info, i, column);
+ found = 1;
break;
}
}
- if (!node){
- }
- if (node && !strcmp (node->name, "leaf")){
- if (model_col == e_xml_get_integer_prop_by_name (node, "column")){
- int ascending = e_xml_get_integer_prop_by_name (node, "ascending");
- ascending = ! ascending;
- e_xml_set_integer_prop_by_name (node, "ascending", ascending);
- } else {
- e_xml_set_integer_prop_by_name (node, "ascending", 1);
- e_xml_set_integer_prop_by_name (node, "column", model_col);
+ if (!found) {
+ length = e_table_sort_info_sorting_get_count(ethi->sort_info);
+ for (i = 0; i < length; i++) {
+ ETableSortColumn column = e_table_sort_info_sorting_get_nth(ethi->sort_info, i);
+ if (model_col == column.column){
+ int ascending = column.ascending;
+ ascending = ! ascending;
+ column.ascending = ascending;
+ e_table_sort_info_sorting_set_nth(ethi->sort_info, i, column);
+ found = 1;
+ break;
+ }
}
}
- e_table_sort_info_changed (ethi->sort_info);
+ if (!found) {
+ ETableSortColumn column = { model_col, 1 };
+ length = e_table_sort_info_sorting_get_count(ethi->sort_info);
+ if (length == 0)
+ length++;
+ e_table_sort_info_sorting_set_nth(ethi->sort_info, length - 1, column);
+ }
}
if (needs_ungrab)
gnome_canvas_item_ungrab (item, e->button.time);
@@ -996,7 +1016,7 @@ ethi_class_init (GtkObjectClass *object_class)
GTK_ARG_WRITABLE, ARG_TABLE_Y);
gtk_object_add_arg_type ("ETableHeaderItem::fontset", GTK_TYPE_STRING,
GTK_ARG_WRITABLE, ARG_TABLE_FONTSET);
- gtk_object_add_arg_type ("ETableHeaderItem::sort_info", GTK_TYPE_POINTER,
+ gtk_object_add_arg_type ("ETableHeaderItem::sort_info", GTK_TYPE_OBJECT,
GTK_ARG_WRITABLE, ARG_SORT_INFO);
/*
@@ -1030,6 +1050,7 @@ ethi_init (GnomeCanvasItem *item)
ethi->sort_info = NULL;
ethi->sort_info_changed_id = 0;
+ ethi->group_info_changed_id = 0;
ethi->group_indent_width = 0;
}