Commit 165fab76 authored by Lars Hamann's avatar Lars Hamann

test for node != NULL (gtk_ctree_is_visible) (gtk_ctree_realize)

* gtk/gtkctree.c (gtk_ctree_sort_recursive)
  (gtk_ctree_sort_recursive): test for node != NULL
  (gtk_ctree_is_visible) (gtk_ctree_realize) (gtk_ctree_unrealize)
  (gtk_ctree_last) : added sanity checks
* gtk/gtkclist.c (gtk_clist_button_press): removed "no_focus_row"
parent f970ecf8
Sat Jul 25 02:25:03 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_sort_recursive)
(gtk_ctree_sort_recursive): test for node != NULL
(gtk_ctree_is_visible) (gtk_ctree_realize) (gtk_ctree_unrealize)
(gtk_ctree_last) : added sanity checks
* gtk/gtkclist.c (gtk_clist_button_press): removed "no_focus_row"
Fri Jul 24 18:15:49 1998 Lars Hamann <lars@gtk.org> Fri Jul 24 18:15:49 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (toggle_focus_row): mini code cleanup * gtk/gtkclist.c (toggle_focus_row): mini code cleanup
......
Sat Jul 25 02:25:03 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_sort_recursive)
(gtk_ctree_sort_recursive): test for node != NULL
(gtk_ctree_is_visible) (gtk_ctree_realize) (gtk_ctree_unrealize)
(gtk_ctree_last) : added sanity checks
* gtk/gtkclist.c (gtk_clist_button_press): removed "no_focus_row"
Fri Jul 24 18:15:49 1998 Lars Hamann <lars@gtk.org> Fri Jul 24 18:15:49 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (toggle_focus_row): mini code cleanup * gtk/gtkclist.c (toggle_focus_row): mini code cleanup
......
Sat Jul 25 02:25:03 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_sort_recursive)
(gtk_ctree_sort_recursive): test for node != NULL
(gtk_ctree_is_visible) (gtk_ctree_realize) (gtk_ctree_unrealize)
(gtk_ctree_last) : added sanity checks
* gtk/gtkclist.c (gtk_clist_button_press): removed "no_focus_row"
Fri Jul 24 18:15:49 1998 Lars Hamann <lars@gtk.org> Fri Jul 24 18:15:49 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (toggle_focus_row): mini code cleanup * gtk/gtkclist.c (toggle_focus_row): mini code cleanup
......
Sat Jul 25 02:25:03 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_sort_recursive)
(gtk_ctree_sort_recursive): test for node != NULL
(gtk_ctree_is_visible) (gtk_ctree_realize) (gtk_ctree_unrealize)
(gtk_ctree_last) : added sanity checks
* gtk/gtkclist.c (gtk_clist_button_press): removed "no_focus_row"
Fri Jul 24 18:15:49 1998 Lars Hamann <lars@gtk.org> Fri Jul 24 18:15:49 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (toggle_focus_row): mini code cleanup * gtk/gtkclist.c (toggle_focus_row): mini code cleanup
......
Sat Jul 25 02:25:03 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_sort_recursive)
(gtk_ctree_sort_recursive): test for node != NULL
(gtk_ctree_is_visible) (gtk_ctree_realize) (gtk_ctree_unrealize)
(gtk_ctree_last) : added sanity checks
* gtk/gtkclist.c (gtk_clist_button_press): removed "no_focus_row"
Fri Jul 24 18:15:49 1998 Lars Hamann <lars@gtk.org> Fri Jul 24 18:15:49 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (toggle_focus_row): mini code cleanup * gtk/gtkclist.c (toggle_focus_row): mini code cleanup
......
Sat Jul 25 02:25:03 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_sort_recursive)
(gtk_ctree_sort_recursive): test for node != NULL
(gtk_ctree_is_visible) (gtk_ctree_realize) (gtk_ctree_unrealize)
(gtk_ctree_last) : added sanity checks
* gtk/gtkclist.c (gtk_clist_button_press): removed "no_focus_row"
Fri Jul 24 18:15:49 1998 Lars Hamann <lars@gtk.org> Fri Jul 24 18:15:49 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (toggle_focus_row): mini code cleanup * gtk/gtkclist.c (toggle_focus_row): mini code cleanup
......
Sat Jul 25 02:25:03 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_sort_recursive)
(gtk_ctree_sort_recursive): test for node != NULL
(gtk_ctree_is_visible) (gtk_ctree_realize) (gtk_ctree_unrealize)
(gtk_ctree_last) : added sanity checks
* gtk/gtkclist.c (gtk_clist_button_press): removed "no_focus_row"
Fri Jul 24 18:15:49 1998 Lars Hamann <lars@gtk.org> Fri Jul 24 18:15:49 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (toggle_focus_row): mini code cleanup * gtk/gtkclist.c (toggle_focus_row): mini code cleanup
......
...@@ -2604,13 +2604,9 @@ gtk_clist_button_press (GtkWidget * widget, ...@@ -2604,13 +2604,9 @@ gtk_clist_button_press (GtkWidget * widget,
if (get_selection_info (clist, x, y, &row, &column)) if (get_selection_info (clist, x, y, &row, &column))
{ {
gint old_row = clist->focus_row; gint old_row = clist->focus_row;
gboolean no_focus_row = FALSE;
if (clist->focus_row == -1) if (clist->focus_row == -1)
{
old_row = row; old_row = row;
no_focus_row = TRUE;
}
if (event->type == GDK_BUTTON_PRESS) if (event->type == GDK_BUTTON_PRESS)
{ {
......
...@@ -457,10 +457,13 @@ gtk_ctree_realize (GtkWidget *widget) ...@@ -457,10 +457,13 @@ gtk_ctree_realize (GtkWidget *widget)
GtkCTree *ctree; GtkCTree *ctree;
GdkGCValues values; GdkGCValues values;
ctree = GTK_CTREE (widget); g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_CTREE (widget));
(* GTK_WIDGET_CLASS (parent_class)->realize) (widget); (* GTK_WIDGET_CLASS (parent_class)->realize) (widget);
ctree = GTK_CTREE (widget);
values.foreground = widget->style->fg[GTK_STATE_NORMAL]; values.foreground = widget->style->fg[GTK_STATE_NORMAL];
values.background = widget->style->bg[GTK_STATE_NORMAL]; values.background = widget->style->bg[GTK_STATE_NORMAL];
values.subwindow_mode = GDK_INCLUDE_INFERIORS; values.subwindow_mode = GDK_INCLUDE_INFERIORS;
...@@ -488,10 +491,13 @@ gtk_ctree_unrealize (GtkWidget *widget) ...@@ -488,10 +491,13 @@ gtk_ctree_unrealize (GtkWidget *widget)
{ {
GtkCTree *ctree; GtkCTree *ctree;
ctree = GTK_CTREE (widget); g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_CTREE (widget));
(* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget); (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
ctree = GTK_CTREE (widget);
gdk_gc_destroy (ctree->lines_gc); gdk_gc_destroy (ctree->lines_gc);
if (ctree->reorderable) if (ctree->reorderable)
...@@ -2443,7 +2449,7 @@ gtk_ctree_link (GtkCTree *ctree, ...@@ -2443,7 +2449,7 @@ gtk_ctree_link (GtkCTree *ctree,
clist = GTK_CLIST (ctree); clist = GTK_CLIST (ctree);
if (update_focus_row && clist->selection_mode == GTK_SELECTION_BROWSE) if (update_focus_row && clist->selection_mode == GTK_SELECTION_EXTENDED)
{ {
if (clist->anchor != -1) if (clist->anchor != -1)
GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL); GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
...@@ -2581,7 +2587,7 @@ gtk_ctree_unlink (GtkCTree *ctree, ...@@ -2581,7 +2587,7 @@ gtk_ctree_unlink (GtkCTree *ctree,
clist = GTK_CLIST (ctree); clist = GTK_CLIST (ctree);
if (update_focus_row && clist->selection_mode == GTK_SELECTION_BROWSE) if (update_focus_row && clist->selection_mode == GTK_SELECTION_EXTENDED)
{ {
if (clist->anchor != -1) if (clist->anchor != -1)
GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL); GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
...@@ -2708,7 +2714,7 @@ real_tree_move (GtkCTree *ctree, ...@@ -2708,7 +2714,7 @@ real_tree_move (GtkCTree *ctree,
clist = GTK_CLIST (ctree); clist = GTK_CLIST (ctree);
if (clist->selection_mode == GTK_SELECTION_BROWSE) if (clist->selection_mode == GTK_SELECTION_EXTENDED)
{ {
if (clist->anchor != -1) if (clist->anchor != -1)
GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL); GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
...@@ -3338,6 +3344,7 @@ real_tree_select (GtkCTree *ctree, ...@@ -3338,6 +3344,7 @@ real_tree_select (GtkCTree *ctree,
gboolean node_selected; gboolean node_selected;
g_return_if_fail (ctree != NULL); g_return_if_fail (ctree != NULL);
g_return_if_fail (GTK_IS_CTREE (ctree));
if (!node) if (!node)
return; return;
...@@ -3392,6 +3399,7 @@ real_tree_unselect (GtkCTree *ctree, ...@@ -3392,6 +3399,7 @@ real_tree_unselect (GtkCTree *ctree,
GtkCList *clist; GtkCList *clist;
g_return_if_fail (ctree != NULL); g_return_if_fail (ctree != NULL);
g_return_if_fail (GTK_IS_CTREE (ctree));
if (!node) if (!node)
return; return;
...@@ -3430,7 +3438,7 @@ tree_toggle_selection (GtkCTree *ctree, ...@@ -3430,7 +3438,7 @@ tree_toggle_selection (GtkCTree *ctree,
if (node && GTK_CTREE_ROW (node)->row.state == GTK_STATE_SELECTED) if (node && GTK_CTREE_ROW (node)->row.state == GTK_STATE_SELECTED)
gtk_signal_emit (GTK_OBJECT (ctree), ctree_signals[TREE_UNSELECT_ROW], gtk_signal_emit (GTK_OBJECT (ctree), ctree_signals[TREE_UNSELECT_ROW],
node, column); node, column);
else else if (node)
gtk_signal_emit (GTK_OBJECT (ctree), ctree_signals[TREE_SELECT_ROW], gtk_signal_emit (GTK_OBJECT (ctree), ctree_signals[TREE_SELECT_ROW],
node, column); node, column);
break; break;
...@@ -3951,6 +3959,10 @@ gtk_ctree_is_visible (GtkCTree *ctree, ...@@ -3951,6 +3959,10 @@ gtk_ctree_is_visible (GtkCTree *ctree,
{ {
GtkCTreeRow *work; GtkCTreeRow *work;
g_return_val_if_fail (ctree != NULL, FALSE);
g_return_val_if_fail (GTK_IS_CTREE (ctree), FALSE);
g_return_val_if_fail (node != NULL, FALSE);
work = GTK_CTREE_ROW (node); work = GTK_CTREE_ROW (node);
while (work->parent && GTK_CTREE_ROW (work->parent)->expanded) while (work->parent && GTK_CTREE_ROW (work->parent)->expanded)
...@@ -3966,6 +3978,9 @@ GList * ...@@ -3966,6 +3978,9 @@ GList *
gtk_ctree_last (GtkCTree *ctree, gtk_ctree_last (GtkCTree *ctree,
GList *node) GList *node)
{ {
g_return_val_if_fail (ctree != NULL, NULL);
g_return_val_if_fail (GTK_IS_CTREE (ctree), NULL);
if (!node) if (!node)
return NULL; return NULL;
...@@ -4078,6 +4093,7 @@ gtk_ctree_move (GtkCTree *ctree, ...@@ -4078,6 +4093,7 @@ gtk_ctree_move (GtkCTree *ctree,
GList *new_sibling) GList *new_sibling)
{ {
g_return_if_fail (ctree != NULL); g_return_if_fail (ctree != NULL);
g_return_if_fail (GTK_IS_CTREE (ctree));
g_return_if_fail (node != NULL); g_return_if_fail (node != NULL);
gtk_signal_emit (GTK_OBJECT (ctree), ctree_signals[TREE_MOVE], node, gtk_signal_emit (GTK_OBJECT (ctree), ctree_signals[TREE_MOVE], node,
...@@ -4089,6 +4105,7 @@ gtk_ctree_expand (GtkCTree *ctree, ...@@ -4089,6 +4105,7 @@ gtk_ctree_expand (GtkCTree *ctree,
GList *node) GList *node)
{ {
g_return_if_fail (ctree != NULL); g_return_if_fail (ctree != NULL);
g_return_if_fail (GTK_IS_CTREE (ctree));
g_return_if_fail (node != NULL); g_return_if_fail (node != NULL);
if (GTK_CTREE_ROW (node)->is_leaf) if (GTK_CTREE_ROW (node)->is_leaf)
...@@ -4160,6 +4177,7 @@ gtk_ctree_collapse (GtkCTree *ctree, ...@@ -4160,6 +4177,7 @@ gtk_ctree_collapse (GtkCTree *ctree,
GList *node) GList *node)
{ {
g_return_if_fail (ctree != NULL); g_return_if_fail (ctree != NULL);
g_return_if_fail (GTK_IS_CTREE (ctree));
g_return_if_fail (node != NULL); g_return_if_fail (node != NULL);
if (GTK_CTREE_ROW (node)->is_leaf) if (GTK_CTREE_ROW (node)->is_leaf)
...@@ -4232,6 +4250,7 @@ gtk_ctree_toggle_expansion (GtkCTree *ctree, ...@@ -4232,6 +4250,7 @@ gtk_ctree_toggle_expansion (GtkCTree *ctree,
GList *node) GList *node)
{ {
g_return_if_fail (ctree != NULL); g_return_if_fail (ctree != NULL);
g_return_if_fail (GTK_IS_CTREE (ctree));
g_return_if_fail (node != NULL); g_return_if_fail (node != NULL);
if (GTK_CTREE_ROW (node)->is_leaf) if (GTK_CTREE_ROW (node)->is_leaf)
...@@ -4248,6 +4267,7 @@ gtk_ctree_toggle_expansion_recursive (GtkCTree *ctree, ...@@ -4248,6 +4267,7 @@ gtk_ctree_toggle_expansion_recursive (GtkCTree *ctree,
gboolean thaw = FALSE; gboolean thaw = FALSE;
g_return_if_fail (ctree != NULL); g_return_if_fail (ctree != NULL);
g_return_if_fail (GTK_IS_CTREE (ctree));
if (node && GTK_CTREE_ROW (node)->is_leaf) if (node && GTK_CTREE_ROW (node)->is_leaf)
return; return;
...@@ -4273,6 +4293,7 @@ gtk_ctree_select (GtkCTree *ctree, ...@@ -4273,6 +4293,7 @@ gtk_ctree_select (GtkCTree *ctree,
GList *node) GList *node)
{ {
g_return_if_fail (ctree != NULL); g_return_if_fail (ctree != NULL);
g_return_if_fail (GTK_IS_CTREE (ctree));
g_return_if_fail (node != NULL); g_return_if_fail (node != NULL);
gtk_signal_emit (GTK_OBJECT (ctree), ctree_signals[TREE_SELECT_ROW], gtk_signal_emit (GTK_OBJECT (ctree), ctree_signals[TREE_SELECT_ROW],
...@@ -4284,6 +4305,7 @@ gtk_ctree_unselect (GtkCTree *ctree, ...@@ -4284,6 +4305,7 @@ gtk_ctree_unselect (GtkCTree *ctree,
GList *node) GList *node)
{ {
g_return_if_fail (ctree != NULL); g_return_if_fail (ctree != NULL);
g_return_if_fail (GTK_IS_CTREE (ctree));
g_return_if_fail (node != NULL); g_return_if_fail (node != NULL);
gtk_signal_emit (GTK_OBJECT (ctree), ctree_signals[TREE_UNSELECT_ROW], gtk_signal_emit (GTK_OBJECT (ctree), ctree_signals[TREE_UNSELECT_ROW],
...@@ -4313,6 +4335,7 @@ gtk_ctree_real_select_recursive (GtkCTree *ctree, ...@@ -4313,6 +4335,7 @@ gtk_ctree_real_select_recursive (GtkCTree *ctree,
gboolean thaw = FALSE; gboolean thaw = FALSE;
g_return_if_fail (ctree != NULL); g_return_if_fail (ctree != NULL);
g_return_if_fail (GTK_IS_CTREE (ctree));
clist = GTK_CLIST (ctree); clist = GTK_CLIST (ctree);
...@@ -4902,7 +4925,7 @@ gtk_ctree_sort_recursive (GtkCTree *ctree, ...@@ -4902,7 +4925,7 @@ gtk_ctree_sort_recursive (GtkCTree *ctree,
thaw = TRUE; thaw = TRUE;
} }
if (clist->selection_mode == GTK_SELECTION_BROWSE) if (clist->selection_mode == GTK_SELECTION_EXTENDED)
{ {
if (clist->anchor != -1) if (clist->anchor != -1)
GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL); GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
...@@ -4913,7 +4936,7 @@ gtk_ctree_sort_recursive (GtkCTree *ctree, ...@@ -4913,7 +4936,7 @@ gtk_ctree_sort_recursive (GtkCTree *ctree,
clist->undo_unselection = NULL; clist->undo_unselection = NULL;
} }
if (gtk_ctree_is_visible (ctree, node)) if (node && gtk_ctree_is_visible (ctree, node))
focus_node = g_list_nth (clist->row_list, clist->focus_row); focus_node = g_list_nth (clist->row_list, clist->focus_row);
gtk_ctree_post_recursive (ctree, node, GTK_CTREE_FUNC (tree_sort), NULL); gtk_ctree_post_recursive (ctree, node, GTK_CTREE_FUNC (tree_sort), NULL);
...@@ -4947,7 +4970,7 @@ gtk_ctree_sort (GtkCTree *ctree, ...@@ -4947,7 +4970,7 @@ gtk_ctree_sort (GtkCTree *ctree,
thaw = TRUE; thaw = TRUE;
} }
if (clist->selection_mode == GTK_SELECTION_BROWSE) if (clist->selection_mode == GTK_SELECTION_EXTENDED)
{ {
if (clist->anchor != -1) if (clist->anchor != -1)
GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL); GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
...@@ -4958,7 +4981,7 @@ gtk_ctree_sort (GtkCTree *ctree, ...@@ -4958,7 +4981,7 @@ gtk_ctree_sort (GtkCTree *ctree,
clist->undo_unselection = NULL; clist->undo_unselection = NULL;
} }
if (gtk_ctree_is_visible (ctree, node)) if (node && gtk_ctree_is_visible (ctree, node))
focus_node = g_list_nth (clist->row_list, clist->focus_row); focus_node = g_list_nth (clist->row_list, clist->focus_row);
tree_sort (ctree, node, NULL); tree_sort (ctree, node, NULL);
...@@ -5029,6 +5052,9 @@ resync_selection (GtkCList *clist, GdkEvent *event) ...@@ -5029,6 +5052,9 @@ resync_selection (GtkCList *clist, GdkEvent *event)
gboolean thaw = FALSE; gboolean thaw = FALSE;
gboolean unselect; gboolean unselect;
g_return_if_fail (clist != NULL);
g_return_if_fail (GTK_IS_CTREE (clist));
if (clist->anchor < 0) if (clist->anchor < 0)
return; return;
...@@ -5109,9 +5135,8 @@ real_undo_selection (GtkCList *clist) ...@@ -5109,9 +5135,8 @@ real_undo_selection (GtkCList *clist)
GtkCTree *ctree; GtkCTree *ctree;
GList *work; GList *work;
g_return_if_fail (clist != NULL); g_return_if_fail (clist != NULL);
g_return_if_fail (GTK_IS_CLIST (clist)); g_return_if_fail (GTK_IS_CTREE (clist));
if (clist->selection_mode != GTK_SELECTION_EXTENDED) if (clist->selection_mode != GTK_SELECTION_EXTENDED)
return; return;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment