From d3a1294923e0308ae76a25eb5b12b2dfdae36442 Mon Sep 17 00:00:00 2001 From: Kristian Rietveld Date: Fri, 19 Apr 2002 14:31:54 +0000 Subject: [PATCH] rename last_single_clicked{,_2} to last_button_press{,_2}, as the latter Fri Apr 19 16:30:09 2002 Kristian Rietveld * gtk/gtktreeprivate.h, gtk/gtktreeview.c: rename last_single_clicked{,_2} to last_button_press{,_2}, as the latter is a more sane name. * gtk/gtktreeview.c (gtk_tree_view_button_press): use ->priv->anchor instead of ->priv->cursor, check for the anchor at another place, as you can go in edit mode without having an anchor. --- ChangeLog | 10 ++++++ ChangeLog.pre-2-10 | 10 ++++++ ChangeLog.pre-2-2 | 10 ++++++ ChangeLog.pre-2-4 | 10 ++++++ ChangeLog.pre-2-6 | 10 ++++++ ChangeLog.pre-2-8 | 10 ++++++ gtk/gtktreeprivate.h | 4 +-- gtk/gtktreeview.c | 83 +++++++++++++++++++++++--------------------- 8 files changed, 106 insertions(+), 41 deletions(-) diff --git a/ChangeLog b/ChangeLog index 782d77c6bf..10fa712f22 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Fri Apr 19 16:30:09 2002 Kristian Rietveld + + * gtk/gtktreeprivate.h, gtk/gtktreeview.c: rename + last_single_clicked{,_2} to last_button_press{,_2}, as the latter + is a more sane name. + + * gtk/gtktreeview.c (gtk_tree_view_button_press): use ->priv->anchor + instead of ->priv->cursor, check for the anchor at another place, as + you can go in edit mode without having an anchor. + 2002-04-18 Matthias Clasen * gtk/gtkitemfactory.c: diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 782d77c6bf..10fa712f22 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,13 @@ +Fri Apr 19 16:30:09 2002 Kristian Rietveld + + * gtk/gtktreeprivate.h, gtk/gtktreeview.c: rename + last_single_clicked{,_2} to last_button_press{,_2}, as the latter + is a more sane name. + + * gtk/gtktreeview.c (gtk_tree_view_button_press): use ->priv->anchor + instead of ->priv->cursor, check for the anchor at another place, as + you can go in edit mode without having an anchor. + 2002-04-18 Matthias Clasen * gtk/gtkitemfactory.c: diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 782d77c6bf..10fa712f22 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,13 @@ +Fri Apr 19 16:30:09 2002 Kristian Rietveld + + * gtk/gtktreeprivate.h, gtk/gtktreeview.c: rename + last_single_clicked{,_2} to last_button_press{,_2}, as the latter + is a more sane name. + + * gtk/gtktreeview.c (gtk_tree_view_button_press): use ->priv->anchor + instead of ->priv->cursor, check for the anchor at another place, as + you can go in edit mode without having an anchor. + 2002-04-18 Matthias Clasen * gtk/gtkitemfactory.c: diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 782d77c6bf..10fa712f22 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,13 @@ +Fri Apr 19 16:30:09 2002 Kristian Rietveld + + * gtk/gtktreeprivate.h, gtk/gtktreeview.c: rename + last_single_clicked{,_2} to last_button_press{,_2}, as the latter + is a more sane name. + + * gtk/gtktreeview.c (gtk_tree_view_button_press): use ->priv->anchor + instead of ->priv->cursor, check for the anchor at another place, as + you can go in edit mode without having an anchor. + 2002-04-18 Matthias Clasen * gtk/gtkitemfactory.c: diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 782d77c6bf..10fa712f22 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,13 @@ +Fri Apr 19 16:30:09 2002 Kristian Rietveld + + * gtk/gtktreeprivate.h, gtk/gtktreeview.c: rename + last_single_clicked{,_2} to last_button_press{,_2}, as the latter + is a more sane name. + + * gtk/gtktreeview.c (gtk_tree_view_button_press): use ->priv->anchor + instead of ->priv->cursor, check for the anchor at another place, as + you can go in edit mode without having an anchor. + 2002-04-18 Matthias Clasen * gtk/gtkitemfactory.c: diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 782d77c6bf..10fa712f22 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,13 @@ +Fri Apr 19 16:30:09 2002 Kristian Rietveld + + * gtk/gtktreeprivate.h, gtk/gtktreeview.c: rename + last_single_clicked{,_2} to last_button_press{,_2}, as the latter + is a more sane name. + + * gtk/gtktreeview.c (gtk_tree_view_button_press): use ->priv->anchor + instead of ->priv->cursor, check for the anchor at another place, as + you can go in edit mode without having an anchor. + 2002-04-18 Matthias Clasen * gtk/gtkitemfactory.c: diff --git a/gtk/gtktreeprivate.h b/gtk/gtktreeprivate.h index 868d5cd4b7..7f50f9fd2a 100644 --- a/gtk/gtktreeprivate.h +++ b/gtk/gtktreeprivate.h @@ -101,8 +101,8 @@ struct _GtkTreeViewPrivate GdkWindow *drag_highlight_window; GtkTreeViewColumn *drag_column; - GtkTreeRowReference *last_single_clicked; - GtkTreeRowReference *last_single_clicked_2; + GtkTreeRowReference *last_button_press; + GtkTreeRowReference *last_button_press_2; /* bin_window offset */ GtkTreeRowReference *top_row; diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 730493a771..f748c78ed6 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -1102,16 +1102,16 @@ gtk_tree_view_destroy (GtkObject *object) tree_view->priv->drag_dest_row = NULL; } - if (tree_view->priv->last_single_clicked != NULL) + if (tree_view->priv->last_button_press != NULL) { - gtk_tree_row_reference_free (tree_view->priv->last_single_clicked); - tree_view->priv->last_single_clicked = NULL; + gtk_tree_row_reference_free (tree_view->priv->last_button_press); + tree_view->priv->last_button_press = NULL; } - if (tree_view->priv->last_single_clicked_2 != NULL) + if (tree_view->priv->last_button_press_2 != NULL) { - gtk_tree_row_reference_free (tree_view->priv->last_single_clicked_2); - tree_view->priv->last_single_clicked_2 = NULL; + gtk_tree_row_reference_free (tree_view->priv->last_button_press_2); + tree_view->priv->last_button_press_2 = NULL; } if (tree_view->priv->top_row != NULL) @@ -1790,20 +1790,25 @@ gtk_tree_view_button_press (GtkWidget *widget, /* decide if we edit */ if (event->type == GDK_BUTTON_PRESS && - !(event->state & gtk_accelerator_get_default_mod_mask ()) && - tree_view->priv->cursor) + !(event->state & gtk_accelerator_get_default_mod_mask ())) { - GtkTreePath *cursor = gtk_tree_row_reference_get_path (tree_view->priv->cursor); + GtkTreePath *anchor; GtkTreeIter iter; - gtk_tree_model_get_iter (tree_view->priv->model, &iter, path); - gtk_tree_view_column_cell_set_cell_data (column, - tree_view->priv->model, - &iter, - GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_PARENT), - node->children?TRUE:FALSE); + if (tree_view->priv->anchor) + { + anchor = gtk_tree_row_reference_get_path (tree_view->priv->anchor); + gtk_tree_model_get_iter (tree_view->priv->model, &iter, path); + gtk_tree_view_column_cell_set_cell_data (column, + tree_view->priv->model, + &iter, + GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_PARENT), + node->children?TRUE:FALSE); + } + else + anchor = NULL; - if ((cursor && !gtk_tree_path_compare (cursor, path)) + if ((anchor && !gtk_tree_path_compare (anchor, path)) || !_gtk_tree_view_column_has_editable_cell (column)) { GtkCellEditable *cell_editable = NULL; @@ -1839,15 +1844,15 @@ gtk_tree_view_button_press (GtkWidget *widget, (GdkEvent *)event, flags); gtk_tree_path_free (path); - gtk_tree_path_free (cursor); + gtk_tree_path_free (anchor); return TRUE; } column_handled_click = TRUE; } g_free (path_string); } - if (cursor) - gtk_tree_path_free (cursor); + if (anchor) + gtk_tree_path_free (anchor); } /* select */ @@ -1890,18 +1895,18 @@ gtk_tree_view_button_press (GtkWidget *widget, } if (event->button == 1 && event->type == GDK_2BUTTON_PRESS && - tree_view->priv->last_single_clicked) + tree_view->priv->last_button_press) { GtkTreePath *lsc; - lsc = gtk_tree_row_reference_get_path (tree_view->priv->last_single_clicked); + lsc = gtk_tree_row_reference_get_path (tree_view->priv->last_button_press); - if (tree_view->priv->last_single_clicked) - gtk_tree_row_reference_free (tree_view->priv->last_single_clicked); - if (tree_view->priv->last_single_clicked_2) - gtk_tree_row_reference_free (tree_view->priv->last_single_clicked_2); - tree_view->priv->last_single_clicked = NULL; - tree_view->priv->last_single_clicked_2 = NULL; + if (tree_view->priv->last_button_press) + gtk_tree_row_reference_free (tree_view->priv->last_button_press); + if (tree_view->priv->last_button_press_2) + gtk_tree_row_reference_free (tree_view->priv->last_button_press_2); + tree_view->priv->last_button_press = NULL; + tree_view->priv->last_button_press_2 = NULL; if (lsc) { @@ -1912,10 +1917,10 @@ gtk_tree_view_button_press (GtkWidget *widget, } else if (event->button == 1 && event->type == GDK_BUTTON_PRESS) { - if (tree_view->priv->last_single_clicked) - gtk_tree_row_reference_free (tree_view->priv->last_single_clicked); - tree_view->priv->last_single_clicked = tree_view->priv->last_single_clicked_2; - tree_view->priv->last_single_clicked_2 = gtk_tree_row_reference_new_proxy (G_OBJECT (tree_view), tree_view->priv->model, path); + if (tree_view->priv->last_button_press) + gtk_tree_row_reference_free (tree_view->priv->last_button_press); + tree_view->priv->last_button_press = tree_view->priv->last_button_press_2; + tree_view->priv->last_button_press_2 = gtk_tree_row_reference_new_proxy (G_OBJECT (tree_view), tree_view->priv->model, path); } GTK_TREE_VIEW_UNSET_FLAG (tree_view, GTK_TREE_VIEW_DRAW_KEYFOCUS); @@ -8871,24 +8876,24 @@ gtk_tree_view_real_collapse_row (GtkTreeView *tree_view, gtk_tree_path_free (anchor_path); } - if (gtk_tree_row_reference_valid (tree_view->priv->last_single_clicked)) + if (gtk_tree_row_reference_valid (tree_view->priv->last_button_press)) { - GtkTreePath *lsc = gtk_tree_row_reference_get_path (tree_view->priv->last_single_clicked); + GtkTreePath *lsc = gtk_tree_row_reference_get_path (tree_view->priv->last_button_press); if (gtk_tree_path_is_ancestor (path, lsc)) { - gtk_tree_row_reference_free (tree_view->priv->last_single_clicked); - tree_view->priv->last_single_clicked = NULL; + gtk_tree_row_reference_free (tree_view->priv->last_button_press); + tree_view->priv->last_button_press = NULL; } gtk_tree_path_free (lsc); } - if (gtk_tree_row_reference_valid (tree_view->priv->last_single_clicked_2)) + if (gtk_tree_row_reference_valid (tree_view->priv->last_button_press_2)) { - GtkTreePath *lsc = gtk_tree_row_reference_get_path (tree_view->priv->last_single_clicked_2); + GtkTreePath *lsc = gtk_tree_row_reference_get_path (tree_view->priv->last_button_press_2); if (gtk_tree_path_is_ancestor (path, lsc)) { - gtk_tree_row_reference_free (tree_view->priv->last_single_clicked_2); - tree_view->priv->last_single_clicked_2 = NULL; + gtk_tree_row_reference_free (tree_view->priv->last_button_press_2); + tree_view->priv->last_button_press_2 = NULL; } gtk_tree_path_free (lsc); }