From c49351c86bfb7168561a7a813a4d9e65e8d69cd9 Mon Sep 17 00:00:00 2001 From: Jonathan Blandford Date: Wed, 31 Oct 2001 19:08:09 +0000 Subject: [PATCH] Added a "cursor_changed" signal, #62850. Wed Oct 31 14:05:17 2001 Jonathan Blandford * gtk/gtktreeview.c (gtk_tree_view_class_init): Added a "cursor_changed" signal, #62850. --- ChangeLog | 5 +++++ ChangeLog.pre-2-0 | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-2 | 5 +++++ ChangeLog.pre-2-4 | 5 +++++ ChangeLog.pre-2-6 | 5 +++++ ChangeLog.pre-2-8 | 5 +++++ gtk/gtktreeview.c | 30 +++++++++++++++++++++--------- gtk/gtktreeview.h | 1 + 9 files changed, 57 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index a1c255d008..dc35752209 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Oct 31 14:05:17 2001 Jonathan Blandford + + * gtk/gtktreeview.c (gtk_tree_view_class_init): Added a + "cursor_changed" signal, #62850. + 2001-10-31 Matt Wilson * gtk/gtktreedatalist.c (_gtk_tree_data_list_alloc): after diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index a1c255d008..dc35752209 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,8 @@ +Wed Oct 31 14:05:17 2001 Jonathan Blandford + + * gtk/gtktreeview.c (gtk_tree_view_class_init): Added a + "cursor_changed" signal, #62850. + 2001-10-31 Matt Wilson * gtk/gtktreedatalist.c (_gtk_tree_data_list_alloc): after diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index a1c255d008..dc35752209 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +Wed Oct 31 14:05:17 2001 Jonathan Blandford + + * gtk/gtktreeview.c (gtk_tree_view_class_init): Added a + "cursor_changed" signal, #62850. + 2001-10-31 Matt Wilson * gtk/gtktreedatalist.c (_gtk_tree_data_list_alloc): after diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index a1c255d008..dc35752209 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,8 @@ +Wed Oct 31 14:05:17 2001 Jonathan Blandford + + * gtk/gtktreeview.c (gtk_tree_view_class_init): Added a + "cursor_changed" signal, #62850. + 2001-10-31 Matt Wilson * gtk/gtktreedatalist.c (_gtk_tree_data_list_alloc): after diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index a1c255d008..dc35752209 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +Wed Oct 31 14:05:17 2001 Jonathan Blandford + + * gtk/gtktreeview.c (gtk_tree_view_class_init): Added a + "cursor_changed" signal, #62850. + 2001-10-31 Matt Wilson * gtk/gtktreedatalist.c (_gtk_tree_data_list_alloc): after diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index a1c255d008..dc35752209 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +Wed Oct 31 14:05:17 2001 Jonathan Blandford + + * gtk/gtktreeview.c (gtk_tree_view_class_init): Added a + "cursor_changed" signal, #62850. + 2001-10-31 Matt Wilson * gtk/gtktreedatalist.c (_gtk_tree_data_list_alloc): after diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index a1c255d008..dc35752209 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +Wed Oct 31 14:05:17 2001 Jonathan Blandford + + * gtk/gtktreeview.c (gtk_tree_view_class_init): Added a + "cursor_changed" signal, #62850. + 2001-10-31 Matt Wilson * gtk/gtktreedatalist.c (_gtk_tree_data_list_alloc): after diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 2a1253817d..ca7c336b9f 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -96,6 +96,7 @@ enum ROW_EXPANDED, ROW_COLLAPSED, COLUMNS_CHANGED, + CURSOR_CHANGED, MOVE_CURSOR, SELECT_ALL, SELECT_CURSOR_ROW, @@ -691,6 +692,15 @@ gtk_tree_view_class_init (GtkTreeViewClass *class) gtk_marshal_NONE__NONE, G_TYPE_NONE, 0); + tree_view_signals[CURSOR_CHANGED] = + g_signal_new ("cursor_changed", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GtkTreeViewClass, cursor_changed), + NULL, NULL, + gtk_marshal_NONE__NONE, + G_TYPE_NONE, 0); + tree_view_signals[MOVE_CURSOR] = g_signal_new ("move_cursor", G_TYPE_FROM_CLASS (object_class), @@ -7989,23 +7999,25 @@ gtk_tree_view_real_set_cursor (GtkTreeView *tree_view, gtk_tree_view_queue_draw_path (tree_view, cursor_path, NULL); gtk_tree_path_free (cursor_path); } - gtk_tree_row_reference_free (tree_view->priv->cursor); + gtk_tree_row_reference_free (tree_view->priv->cursor); gtk_get_current_event_state (&state); tree_view->priv->cursor = gtk_tree_row_reference_new_proxy (G_OBJECT (tree_view), tree_view->priv->model, path); _gtk_tree_view_find_node (tree_view, path, &tree, &node); - if (tree == NULL) - return; + if (tree != NULL) + { + if (clear_and_select && !((state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK)) + _gtk_tree_selection_internal_select_node (tree_view->priv->selection, + node, tree, path, + state); + gtk_tree_view_clamp_node_visible (tree_view, tree, node); + gtk_tree_view_queue_draw_node (tree_view, tree, node, NULL); + } - if (clear_and_select && !((state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK)) - _gtk_tree_selection_internal_select_node (tree_view->priv->selection, - node, tree, path, - state); - gtk_tree_view_clamp_node_visible (tree_view, tree, node); - gtk_tree_view_queue_draw_node (tree_view, tree, node, NULL); + g_signal_emit (G_OBJECT (tree_view), tree_view_signals[CURSOR_CHANGED], 0); } /** diff --git a/gtk/gtktreeview.h b/gtk/gtktreeview.h index 343ceb0100..ee70438859 100644 --- a/gtk/gtktreeview.h +++ b/gtk/gtktreeview.h @@ -84,6 +84,7 @@ struct _GtkTreeViewClass GtkTreeIter *iter, GtkTreePath *path); void (* columns_changed) (GtkTreeView *tree_view); + void (* cursor_changed) (GtkTreeView *tree_view); /* Key Binding signals */ void (* move_cursor) (GtkTreeView *tree_view,