diff --git a/ChangeLog b/ChangeLog index 793d24f36d..c0a38c681b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Feb 21 20:16:42 2000 Lars Hamann + + * gtk/gtkclist.c: applied patch from Guy Harris + to make appends to the list constant. (gtk-guy-990901-0.patch) + 2000-02-19 Havoc Pennington * docs/gtk_tut.sgml: Don't recommend the use of diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 793d24f36d..c0a38c681b 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,8 @@ +Mon Feb 21 20:16:42 2000 Lars Hamann + + * gtk/gtkclist.c: applied patch from Guy Harris + to make appends to the list constant. (gtk-guy-990901-0.patch) + 2000-02-19 Havoc Pennington * docs/gtk_tut.sgml: Don't recommend the use of diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 793d24f36d..c0a38c681b 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +Mon Feb 21 20:16:42 2000 Lars Hamann + + * gtk/gtkclist.c: applied patch from Guy Harris + to make appends to the list constant. (gtk-guy-990901-0.patch) + 2000-02-19 Havoc Pennington * docs/gtk_tut.sgml: Don't recommend the use of diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 793d24f36d..c0a38c681b 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,8 @@ +Mon Feb 21 20:16:42 2000 Lars Hamann + + * gtk/gtkclist.c: applied patch from Guy Harris + to make appends to the list constant. (gtk-guy-990901-0.patch) + 2000-02-19 Havoc Pennington * docs/gtk_tut.sgml: Don't recommend the use of diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 793d24f36d..c0a38c681b 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +Mon Feb 21 20:16:42 2000 Lars Hamann + + * gtk/gtkclist.c: applied patch from Guy Harris + to make appends to the list constant. (gtk-guy-990901-0.patch) + 2000-02-19 Havoc Pennington * docs/gtk_tut.sgml: Don't recommend the use of diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 793d24f36d..c0a38c681b 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +Mon Feb 21 20:16:42 2000 Lars Hamann + + * gtk/gtkclist.c: applied patch from Guy Harris + to make appends to the list constant. (gtk-guy-990901-0.patch) + 2000-02-19 Havoc Pennington * docs/gtk_tut.sgml: Don't recommend the use of diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 793d24f36d..c0a38c681b 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +Mon Feb 21 20:16:42 2000 Lars Hamann + + * gtk/gtkclist.c: applied patch from Guy Harris + to make appends to the list constant. (gtk-guy-990901-0.patch) + 2000-02-19 Havoc Pennington * docs/gtk_tut.sgml: Don't recommend the use of diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c index 2c46ea9f8a..869b61a9dd 100644 --- a/gtk/gtkclist.c +++ b/gtk/gtkclist.c @@ -123,6 +123,12 @@ LIST_WIDTH (GtkCList * clist) return 0; } +/* returns the GList item for the nth row */ +#define ROW_ELEMENT(clist, row) (((row) == (clist)->rows - 1) ? \ + (clist)->row_list_end : \ + g_list_nth ((clist)->row_list, (row))) + + #define GTK_CLIST_CLASS_FW(_widget_) GTK_CLIST_CLASS (((GtkObject*) (_widget_))->klass) /* redraw the list if it's not frozen */ @@ -2175,7 +2181,7 @@ gtk_clist_get_cell_type (GtkCList *clist, if (column < 0 || column >= clist->columns) return -1; - clist_row = (g_list_nth (clist->row_list, row))->data; + clist_row = ROW_ELEMENT (clist, row)->data; return clist_row->cell[column].type; } @@ -2196,7 +2202,7 @@ gtk_clist_set_text (GtkCList *clist, if (column < 0 || column >= clist->columns) return; - clist_row = (g_list_nth (clist->row_list, row))->data; + clist_row = ROW_ELEMENT (clist, row)->data; /* if text is null, then the cell is empty */ GTK_CLIST_CLASS_FW (clist)->set_cell_contents @@ -2226,7 +2232,7 @@ gtk_clist_get_text (GtkCList *clist, if (column < 0 || column >= clist->columns) return 0; - clist_row = (g_list_nth (clist->row_list, row))->data; + clist_row = ROW_ELEMENT (clist, row)->data; if (clist_row->cell[column].type != GTK_CELL_TEXT) return 0; @@ -2254,7 +2260,7 @@ gtk_clist_set_pixmap (GtkCList *clist, if (column < 0 || column >= clist->columns) return; - clist_row = (g_list_nth (clist->row_list, row))->data; + clist_row = ROW_ELEMENT (clist, row)->data; gdk_pixmap_ref (pixmap); @@ -2288,7 +2294,7 @@ gtk_clist_get_pixmap (GtkCList *clist, if (column < 0 || column >= clist->columns) return 0; - clist_row = (g_list_nth (clist->row_list, row))->data; + clist_row = ROW_ELEMENT (clist, row)->data; if (clist_row->cell[column].type != GTK_CELL_PIXMAP) return 0; @@ -2322,7 +2328,7 @@ gtk_clist_set_pixtext (GtkCList *clist, if (column < 0 || column >= clist->columns) return; - clist_row = (g_list_nth (clist->row_list, row))->data; + clist_row = ROW_ELEMENT (clist, row)->data; gdk_pixmap_ref (pixmap); if (mask) gdk_pixmap_ref (mask); @@ -2356,7 +2362,7 @@ gtk_clist_get_pixtext (GtkCList *clist, if (column < 0 || column >= clist->columns) return 0; - clist_row = (g_list_nth (clist->row_list, row))->data; + clist_row = ROW_ELEMENT (clist, row)->data; if (clist_row->cell[column].type != GTK_CELL_PIXTEXT) return 0; @@ -2392,7 +2398,7 @@ gtk_clist_set_shift (GtkCList *clist, if (column < 0 || column >= clist->columns) return; - clist_row = (g_list_nth (clist->row_list, row))->data; + clist_row = ROW_ELEMENT (clist, row)->data; if (clist->column[column].auto_resize && !GTK_CLIST_AUTO_RESIZE_BLOCKED(clist)) @@ -2730,7 +2736,7 @@ real_remove_row (GtkCList *clist, was_selected = 0; /* get the row we're going to delete */ - list = g_list_nth (clist->row_list, row); + list = ROW_ELEMENT (clist, row); g_assert (list != NULL); clist_row = list->data; @@ -2857,7 +2863,7 @@ real_row_move (GtkCList *clist, gtk_clist_freeze (clist); /* unlink source row */ - clist_row = g_list_nth_data (clist->row_list, source_row); + clist_row = ROW_ELEMENT (clist, source_row)->data; if (source_row == clist->rows - 1) clist->row_list_end = clist->row_list_end->prev; clist->row_list = g_list_remove (clist->row_list, clist_row); @@ -3014,7 +3020,7 @@ gtk_clist_set_row_data_full (GtkCList *clist, if (row < 0 || row > (clist->rows - 1)) return; - clist_row = (g_list_nth (clist->row_list, row))->data; + clist_row = ROW_ELEMENT (clist, row)->data; if (clist_row->destroy) clist_row->destroy (clist_row->data); @@ -3035,7 +3041,7 @@ gtk_clist_get_row_data (GtkCList *clist, if (row < 0 || row > (clist->rows - 1)) return NULL; - clist_row = (g_list_nth (clist->row_list, row))->data; + clist_row = ROW_ELEMENT (clist, row)->data; return clist_row->data; } @@ -3144,7 +3150,7 @@ gtk_clist_set_foreground (GtkCList *clist, if (row < 0 || row >= clist->rows) return; - clist_row = (g_list_nth (clist->row_list, row))->data; + clist_row = ROW_ELEMENT (clist, row)->data; if (color) { @@ -3174,7 +3180,7 @@ gtk_clist_set_background (GtkCList *clist, if (row < 0 || row >= clist->rows) return; - clist_row = (g_list_nth (clist->row_list, row))->data; + clist_row = ROW_ELEMENT (clist, row)->data; if (color) { @@ -3215,7 +3221,7 @@ gtk_clist_set_cell_style (GtkCList *clist, if (column < 0 || column >= clist->columns) return; - clist_row = (g_list_nth (clist->row_list, row))->data; + clist_row = ROW_ELEMENT (clist, row)->data; if (clist_row->cell[column].style == style) return; @@ -3267,7 +3273,7 @@ gtk_clist_get_cell_style (GtkCList *clist, if (row < 0 || row >= clist->rows || column < 0 || column >= clist->columns) return NULL; - clist_row = (g_list_nth (clist->row_list, row))->data; + clist_row = ROW_ELEMENT (clist, row)->data; return clist_row->cell[column].style; } @@ -3288,7 +3294,7 @@ gtk_clist_set_row_style (GtkCList *clist, if (row < 0 || row >= clist->rows) return; - clist_row = (g_list_nth (clist->row_list, row))->data; + clist_row = ROW_ELEMENT (clist, row)->data; if (clist_row->style == style) return; @@ -3350,7 +3356,7 @@ gtk_clist_get_row_style (GtkCList *clist, if (row < 0 || row >= clist->rows) return NULL; - clist_row = (g_list_nth (clist->row_list, row))->data; + clist_row = ROW_ELEMENT (clist, row)->data; return clist_row->style; } @@ -3377,7 +3383,7 @@ gtk_clist_set_selectable (GtkCList *clist, if (row < 0 || row >= clist->rows) return; - clist_row = (g_list_nth (clist->row_list, row))->data; + clist_row = ROW_ELEMENT (clist, row)->data; if (selectable == clist_row->selectable) return; @@ -3408,7 +3414,7 @@ gtk_clist_get_selectable (GtkCList *clist, if (row < 0 || row >= clist->rows) return FALSE; - return GTK_CLIST_ROW (g_list_nth (clist->row_list, row))->selectable; + return GTK_CLIST_ROW (ROW_ELEMENT (clist, row))->selectable; } void @@ -3515,7 +3521,7 @@ toggle_row (GtkCList *clist, case GTK_SELECTION_EXTENDED: case GTK_SELECTION_MULTIPLE: case GTK_SELECTION_SINGLE: - clist_row = g_list_nth (clist->row_list, row)->data; + clist_row = ROW_ELEMENT (clist, row)->data; if (!clist_row) return; @@ -3539,7 +3545,7 @@ fake_toggle_row (GtkCList *clist, { GList *work; - work = g_list_nth (clist->row_list, row); + work = ROW_ELEMENT (clist, row); if (!work || !GTK_CLIST_ROW (work)->selectable) return; @@ -3664,7 +3670,7 @@ real_select_row (GtkCList *clist, break; } - clist_row = (g_list_nth (clist->row_list, row))->data; + clist_row = ROW_ELEMENT (clist, row)->data; if (clist_row->state != GTK_STATE_NORMAL || !clist_row->selectable) return; @@ -3699,7 +3705,7 @@ real_unselect_row (GtkCList *clist, if (row < 0 || row > (clist->rows - 1)) return; - clist_row = (g_list_nth (clist->row_list, row))->data; + clist_row = ROW_ELEMENT (clist, row)->data; if (clist_row->state == GTK_STATE_SELECTED) { @@ -3821,7 +3827,7 @@ fake_unselect_all (GtkCList *clist, GList *work; gint i; - if (row >= 0 && (work = g_list_nth (clist->row_list, row))) + if (row >= 0 && (work = ROW_ELEMENT (clist, row))) { if (GTK_CLIST_ROW (work)->state == GTK_STATE_NORMAL && GTK_CLIST_ROW (work)->selectable) @@ -3838,7 +3844,7 @@ fake_unselect_all (GtkCList *clist, clist->undo_selection = clist->selection; clist->selection = NULL; clist->selection_end = NULL; - + for (list = clist->undo_selection; list; list = list->next) { if ((i = GPOINTER_TO_INT (list->data)) == row || @@ -5667,7 +5673,7 @@ draw_row (GtkCList *clist, /* if the function is passed the pointer to the row instead of null, * it avoids this expensive lookup */ if (!clist_row) - clist_row = (g_list_nth (clist->row_list, row))->data; + clist_row = ROW_ELEMENT (clist, row)->data; /* rectangle of the entire row */ row_rectangle.x = 0; @@ -5944,7 +5950,7 @@ draw_rows (GtkCList *clist, if (clist->rows == first_row) first_row--; - list = g_list_nth (clist->row_list, first_row); + list = ROW_ELEMENT (clist, first_row); i = first_row; while (list) {