summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorLars Hamann <lars@src.gnome.org>1998-07-24 16:22:53 +0000
committerLars Hamann <lars@src.gnome.org>1998-07-24 16:22:53 +0000
commitf970ecf821a6d5c135be68ce529aa4f7ed009fa1 (patch)
tree0c5652fe75e48d7064b09a98c9f4495b754b2329 /gtk
parent7b1a4b5eb5e59ca686f374e6b082a15041b7b8d4 (diff)
downloadgtk+-f970ecf821a6d5c135be68ce529aa4f7ed009fa1.tar.gz
mini code cleanup
* gtk/gtkclist.c (toggle_focus_row): mini code cleanup
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtkclist.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c
index ae07979e8b..59dba75be6 100644
--- a/gtk/gtkclist.c
+++ b/gtk/gtkclist.c
@@ -4966,7 +4966,8 @@ toggle_focus_row (GtkCList *clist)
g_return_if_fail (clist != 0);
g_return_if_fail (GTK_IS_CLIST (clist));
- if (gdk_pointer_is_grabbed ())
+ if (gdk_pointer_is_grabbed () ||
+ clist->focus_row < 0 || clist->focus_row >= clist->rows)
return;
switch (clist->selection_mode)
@@ -4983,23 +4984,16 @@ toggle_focus_row (GtkCList *clist)
clist->undo_selection = NULL;
clist->undo_unselection = NULL;
+ clist->anchor = clist->focus_row;
+ clist->drag_pos = clist->focus_row;
+ clist->undo_anchor = clist->focus_row;
+
if (GTK_CLIST_ADD_MODE (clist))
- {
- clist->anchor = clist->focus_row;
- clist->drag_pos = clist->focus_row;
- clist->undo_anchor = clist->focus_row;
- fake_toggle_row (clist, clist->focus_row);
- GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
- }
+ fake_toggle_row (clist, clist->focus_row);
else
- {
- clist->anchor = clist->focus_row;
- clist->drag_pos = clist->focus_row;
- clist->undo_anchor = clist->focus_row;
- GTK_CLIST_CLASS_FW (clist)->fake_unselect_all (clist,
- clist->focus_row);
- GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
- }
+ GTK_CLIST_CLASS_FW (clist)->fake_unselect_all (clist,clist->focus_row);
+
+ GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL);
break;
default: