diff options
author | Tim Janik <timj@src.gnome.org> | 1998-03-08 03:32:05 +0000 |
---|---|---|
committer | Tim Janik <timj@src.gnome.org> | 1998-03-08 03:32:05 +0000 |
commit | 5fa1bfcf45f3789b3023d610765f8b18db022da3 (patch) | |
tree | a48565456daefdf771613d9b969b44c562b85fa9 /gtk | |
parent | 76d01a826ca213bcd1b7ee71acdf687de9c9d7f0 (diff) | |
download | gtk+-5fa1bfcf45f3789b3023d610765f8b18db022da3.tar.gz |
applied a bunch of patches and removed all the printfs that
raster left over.
-timj
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkclist.c | 22 | ||||
-rw-r--r-- | gtk/gtkclist.h | 7 | ||||
-rw-r--r-- | gtk/gtkfilesel.c | 8 | ||||
-rw-r--r-- | gtk/gtktree.h | 9 |
4 files changed, 35 insertions, 11 deletions
diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c index e6be078af9..7755b86bc0 100644 --- a/gtk/gtkclist.c +++ b/gtk/gtkclist.c @@ -1341,17 +1341,15 @@ void gtk_clist_clear (GtkCList * clist) { GList *list; - GtkCListRow *clist_row; g_return_if_fail (clist != NULL); /* remove all the rows */ - list = clist->row_list; - while (list) + for (list = clist->row_list; list; list = list->next) { - clist_row = list->data; - list = list->next; + GtkCListRow *clist_row; + clist_row = list->data; row_delete (clist, clist_row); } g_list_free (clist->row_list); @@ -1384,6 +1382,15 @@ gtk_clist_set_row_data (GtkCList * clist, gint row, gpointer data) { + gtk_clist_set_row_data_full (clist, row, data, NULL); +} + +void +gtk_clist_set_row_data_full (GtkCList * clist, + gint row, + gpointer data, + GtkDestroyNotify destroy) +{ GtkCListRow *clist_row; g_return_if_fail (clist != NULL); @@ -1393,6 +1400,7 @@ gtk_clist_set_row_data (GtkCList * clist, clist_row = (g_list_nth (clist->row_list, row))->data; clist_row->data = data; + clist_row->destroy = destroy; /* * re-send the selected signal if data is changed/added @@ -3563,6 +3571,7 @@ row_new (GtkCList * clist) clist_row->bg_set = FALSE; clist_row->state = GTK_STATE_NORMAL; clist_row->data = NULL; + clist_row->destroy = NULL; return clist_row; } @@ -3576,6 +3585,9 @@ row_delete (GtkCList * clist, for (i = 0; i < clist->columns; i++) cell_empty (clist, clist_row, i); + if (clist_row->destroy) + clist_row->destroy (clist_row->data); + g_mem_chunk_free (clist->cell_mem_chunk, clist_row->cell); g_mem_chunk_free (clist->row_mem_chunk, clist_row); } diff --git a/gtk/gtkclist.h b/gtk/gtkclist.h index 5c8e9ebbbd..ef306c2668 100644 --- a/gtk/gtkclist.h +++ b/gtk/gtkclist.h @@ -190,6 +190,7 @@ struct _GtkCListRow GdkColor background; gpointer data; + GtkDestroyNotify destroy; gint fg_set : 1; gint bg_set : 1; @@ -443,6 +444,12 @@ void gtk_clist_set_row_data (GtkCList * clist, gint row, gpointer data); +/* sets a data pointer for a given row with destroy notification */ +void gtk_clist_set_row_data_full (GtkCList * clist, + gint row, + gpointer data, + GtkDestroyNotify destroy); + /* returns the data set for a row */ gpointer gtk_clist_get_row_data (GtkCList * clist, gint row); diff --git a/gtk/gtkfilesel.c b/gtk/gtkfilesel.c index d9e1aa20cb..154e4f02bc 100644 --- a/gtk/gtkfilesel.c +++ b/gtk/gtkfilesel.c @@ -1285,15 +1285,15 @@ gtk_file_selection_populate (GtkFileSelection *fs, strcmp (filename, "../") != 0) { row = gtk_clist_append (GTK_CLIST (fs->dir_list), text); - gtk_clist_set_row_data (GTK_CLIST (fs->dir_list), row, - filename); + gtk_clist_set_row_data_full (GTK_CLIST (fs->dir_list), row, + filename, (GtkDestroyNotify) g_free); } } else { row = gtk_clist_append (GTK_CLIST (fs->file_list), text); - gtk_clist_set_row_data (GTK_CLIST (fs->file_list), row, - filename); + gtk_clist_set_row_data_full (GTK_CLIST (fs->file_list), row, + filename ,(GtkDestroyNotify) g_free); } } diff --git a/gtk/gtktree.h b/gtk/gtktree.h index fc4d1ee5c2..94c849b465 100644 --- a/gtk/gtktree.h +++ b/gtk/gtktree.h @@ -85,8 +85,6 @@ void gtk_tree_prepend (GtkTree *tree, void gtk_tree_insert (GtkTree *tree, GtkWidget *child, gint position); -void gtk_tree_remove_item (GtkTree *tree, - GtkWidget *child); void gtk_tree_remove_items (GtkTree *tree, GList *items); void gtk_tree_clear_items (GtkTree *tree, @@ -108,6 +106,13 @@ void gtk_tree_set_view_mode (GtkTree *tree, GtkTreeViewMode mode); void gtk_tree_set_view_lines (GtkTree *tree, guint flag); + +/* deprecated function, use gtk_container_remove instead. + */ +void gtk_tree_remove_item (GtkTree *tree, + GtkWidget *child); + + #ifdef __cplusplus } #endif /* __cplusplus */ |