allow cancel to happen.

Mon Jan 14 17:42:28 2002  Jonathan Blandford  <jrb@redhat.com>

	* gtk/gtktreeview.c (gtk_tree_view_stop_editing): allow cancel to
	happen.

	* gtk/gtktreeview.c (install_presize_handler): only install the
	handler if we're realized, #68056
This commit is contained in:
Jonathan Blandford 2002-01-14 22:00:26 +00:00 committed by Jonathan Blandford
parent 6dc3eb34c2
commit cb939843ba
9 changed files with 99 additions and 58 deletions

View File

@ -1,3 +1,11 @@
Mon Jan 14 17:42:28 2002 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_stop_editing): allow cancel to
happen.
* gtk/gtktreeview.c (install_presize_handler): only install the
handler if we're realized, #68056
Mon Jan 14 16:35:58 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_move_resize): Unset
@ -16378,7 +16386,6 @@ Thu Nov 9 11:23:22 2000 Jonathan Blandford <jrb@redhat.com>
2000-11-02 Havoc Pennington <hp@redhat.com>
<<<<<<< ChangeLog
* gtk/gtkfilesel.h, gtk/gtkfilesel.c: Derive from GtkDialog, and
use stock buttons. Should be 100% source compatible, appropriate
@ -17164,10 +17171,6 @@ Mon Oct 23 12:07:57 2000 Owen Taylor <otaylor@redhat.com>
(gtk_dialog_run): block waiting for the dialog, return
the response. Override normal delete_event behavior, so that
delete_event does nothing inside gtk_dialog_run().
=======
>>>>>>> 1.2802
<<<<<<< ChangeLog
* gtk/gtkdialog.h, gtk/gtkdialog.c: Add "response" signal
emitted when an action widget is clicked or the dialog gets
delete_event
@ -24988,6 +24991,5 @@ Sat Feb 27 01:18:47 1999 Tim Janik <timj@gtk.org>
new one.
* configure.in: set gtk+ version to 1.3.0.
=======
* gtk/gtkfilesel.h, gtk/gtkfilesel.c: Derive from GtkDialog,
>>>>>>> 1.2802

View File

@ -1,3 +1,11 @@
Mon Jan 14 17:42:28 2002 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_stop_editing): allow cancel to
happen.
* gtk/gtktreeview.c (install_presize_handler): only install the
handler if we're realized, #68056
Mon Jan 14 16:35:58 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_move_resize): Unset
@ -16378,7 +16386,6 @@ Thu Nov 9 11:23:22 2000 Jonathan Blandford <jrb@redhat.com>
2000-11-02 Havoc Pennington <hp@redhat.com>
<<<<<<< ChangeLog
* gtk/gtkfilesel.h, gtk/gtkfilesel.c: Derive from GtkDialog, and
use stock buttons. Should be 100% source compatible, appropriate
@ -17164,10 +17171,6 @@ Mon Oct 23 12:07:57 2000 Owen Taylor <otaylor@redhat.com>
(gtk_dialog_run): block waiting for the dialog, return
the response. Override normal delete_event behavior, so that
delete_event does nothing inside gtk_dialog_run().
=======
>>>>>>> 1.2802
<<<<<<< ChangeLog
* gtk/gtkdialog.h, gtk/gtkdialog.c: Add "response" signal
emitted when an action widget is clicked or the dialog gets
delete_event
@ -24988,6 +24991,5 @@ Sat Feb 27 01:18:47 1999 Tim Janik <timj@gtk.org>
new one.
* configure.in: set gtk+ version to 1.3.0.
=======
* gtk/gtkfilesel.h, gtk/gtkfilesel.c: Derive from GtkDialog,
>>>>>>> 1.2802

View File

@ -1,3 +1,11 @@
Mon Jan 14 17:42:28 2002 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_stop_editing): allow cancel to
happen.
* gtk/gtktreeview.c (install_presize_handler): only install the
handler if we're realized, #68056
Mon Jan 14 16:35:58 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_move_resize): Unset
@ -16378,7 +16386,6 @@ Thu Nov 9 11:23:22 2000 Jonathan Blandford <jrb@redhat.com>
2000-11-02 Havoc Pennington <hp@redhat.com>
<<<<<<< ChangeLog
* gtk/gtkfilesel.h, gtk/gtkfilesel.c: Derive from GtkDialog, and
use stock buttons. Should be 100% source compatible, appropriate
@ -17164,10 +17171,6 @@ Mon Oct 23 12:07:57 2000 Owen Taylor <otaylor@redhat.com>
(gtk_dialog_run): block waiting for the dialog, return
the response. Override normal delete_event behavior, so that
delete_event does nothing inside gtk_dialog_run().
=======
>>>>>>> 1.2802
<<<<<<< ChangeLog
* gtk/gtkdialog.h, gtk/gtkdialog.c: Add "response" signal
emitted when an action widget is clicked or the dialog gets
delete_event
@ -24988,6 +24991,5 @@ Sat Feb 27 01:18:47 1999 Tim Janik <timj@gtk.org>
new one.
* configure.in: set gtk+ version to 1.3.0.
=======
* gtk/gtkfilesel.h, gtk/gtkfilesel.c: Derive from GtkDialog,
>>>>>>> 1.2802

View File

@ -1,3 +1,11 @@
Mon Jan 14 17:42:28 2002 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_stop_editing): allow cancel to
happen.
* gtk/gtktreeview.c (install_presize_handler): only install the
handler if we're realized, #68056
Mon Jan 14 16:35:58 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_move_resize): Unset
@ -16378,7 +16386,6 @@ Thu Nov 9 11:23:22 2000 Jonathan Blandford <jrb@redhat.com>
2000-11-02 Havoc Pennington <hp@redhat.com>
<<<<<<< ChangeLog
* gtk/gtkfilesel.h, gtk/gtkfilesel.c: Derive from GtkDialog, and
use stock buttons. Should be 100% source compatible, appropriate
@ -17164,10 +17171,6 @@ Mon Oct 23 12:07:57 2000 Owen Taylor <otaylor@redhat.com>
(gtk_dialog_run): block waiting for the dialog, return
the response. Override normal delete_event behavior, so that
delete_event does nothing inside gtk_dialog_run().
=======
>>>>>>> 1.2802
<<<<<<< ChangeLog
* gtk/gtkdialog.h, gtk/gtkdialog.c: Add "response" signal
emitted when an action widget is clicked or the dialog gets
delete_event
@ -24988,6 +24991,5 @@ Sat Feb 27 01:18:47 1999 Tim Janik <timj@gtk.org>
new one.
* configure.in: set gtk+ version to 1.3.0.
=======
* gtk/gtkfilesel.h, gtk/gtkfilesel.c: Derive from GtkDialog,
>>>>>>> 1.2802

View File

@ -1,3 +1,11 @@
Mon Jan 14 17:42:28 2002 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_stop_editing): allow cancel to
happen.
* gtk/gtktreeview.c (install_presize_handler): only install the
handler if we're realized, #68056
Mon Jan 14 16:35:58 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_move_resize): Unset
@ -16378,7 +16386,6 @@ Thu Nov 9 11:23:22 2000 Jonathan Blandford <jrb@redhat.com>
2000-11-02 Havoc Pennington <hp@redhat.com>
<<<<<<< ChangeLog
* gtk/gtkfilesel.h, gtk/gtkfilesel.c: Derive from GtkDialog, and
use stock buttons. Should be 100% source compatible, appropriate
@ -17164,10 +17171,6 @@ Mon Oct 23 12:07:57 2000 Owen Taylor <otaylor@redhat.com>
(gtk_dialog_run): block waiting for the dialog, return
the response. Override normal delete_event behavior, so that
delete_event does nothing inside gtk_dialog_run().
=======
>>>>>>> 1.2802
<<<<<<< ChangeLog
* gtk/gtkdialog.h, gtk/gtkdialog.c: Add "response" signal
emitted when an action widget is clicked or the dialog gets
delete_event
@ -24988,6 +24991,5 @@ Sat Feb 27 01:18:47 1999 Tim Janik <timj@gtk.org>
new one.
* configure.in: set gtk+ version to 1.3.0.
=======
* gtk/gtkfilesel.h, gtk/gtkfilesel.c: Derive from GtkDialog,
>>>>>>> 1.2802

View File

@ -1,3 +1,11 @@
Mon Jan 14 17:42:28 2002 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_stop_editing): allow cancel to
happen.
* gtk/gtktreeview.c (install_presize_handler): only install the
handler if we're realized, #68056
Mon Jan 14 16:35:58 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_move_resize): Unset
@ -16378,7 +16386,6 @@ Thu Nov 9 11:23:22 2000 Jonathan Blandford <jrb@redhat.com>
2000-11-02 Havoc Pennington <hp@redhat.com>
<<<<<<< ChangeLog
* gtk/gtkfilesel.h, gtk/gtkfilesel.c: Derive from GtkDialog, and
use stock buttons. Should be 100% source compatible, appropriate
@ -17164,10 +17171,6 @@ Mon Oct 23 12:07:57 2000 Owen Taylor <otaylor@redhat.com>
(gtk_dialog_run): block waiting for the dialog, return
the response. Override normal delete_event behavior, so that
delete_event does nothing inside gtk_dialog_run().
=======
>>>>>>> 1.2802
<<<<<<< ChangeLog
* gtk/gtkdialog.h, gtk/gtkdialog.c: Add "response" signal
emitted when an action widget is clicked or the dialog gets
delete_event
@ -24988,6 +24991,5 @@ Sat Feb 27 01:18:47 1999 Tim Janik <timj@gtk.org>
new one.
* configure.in: set gtk+ version to 1.3.0.
=======
* gtk/gtkfilesel.h, gtk/gtkfilesel.c: Derive from GtkDialog,
>>>>>>> 1.2802

View File

@ -1,3 +1,11 @@
Mon Jan 14 17:42:28 2002 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_stop_editing): allow cancel to
happen.
* gtk/gtktreeview.c (install_presize_handler): only install the
handler if we're realized, #68056
Mon Jan 14 16:35:58 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_move_resize): Unset
@ -16378,7 +16386,6 @@ Thu Nov 9 11:23:22 2000 Jonathan Blandford <jrb@redhat.com>
2000-11-02 Havoc Pennington <hp@redhat.com>
<<<<<<< ChangeLog
* gtk/gtkfilesel.h, gtk/gtkfilesel.c: Derive from GtkDialog, and
use stock buttons. Should be 100% source compatible, appropriate
@ -17164,10 +17171,6 @@ Mon Oct 23 12:07:57 2000 Owen Taylor <otaylor@redhat.com>
(gtk_dialog_run): block waiting for the dialog, return
the response. Override normal delete_event behavior, so that
delete_event does nothing inside gtk_dialog_run().
=======
>>>>>>> 1.2802
<<<<<<< ChangeLog
* gtk/gtkdialog.h, gtk/gtkdialog.c: Add "response" signal
emitted when an action widget is clicked or the dialog gets
delete_event
@ -24988,6 +24991,5 @@ Sat Feb 27 01:18:47 1999 Tim Janik <timj@gtk.org>
new one.
* configure.in: set gtk+ version to 1.3.0.
=======
* gtk/gtkfilesel.h, gtk/gtkfilesel.c: Derive from GtkDialog,
>>>>>>> 1.2802

View File

@ -384,7 +384,8 @@ static void gtk_tree_view_real_start_editing (GtkTreeView *tree_view,
GdkRectangle *cell_area,
GdkEvent *event,
guint flags);
static void gtk_tree_view_stop_editing (GtkTreeView *tree_view);
static void gtk_tree_view_stop_editing (GtkTreeView *tree_view,
gboolean cancel_editing);
static void gtk_tree_view_real_start_interactive_search (GtkTreeView *tree_view);
@ -1032,7 +1033,7 @@ gtk_tree_view_destroy (GtkObject *object)
GtkWidget *search_dialog;
GList *list;
gtk_tree_view_stop_editing (tree_view);
gtk_tree_view_stop_editing (tree_view, TRUE);
if (tree_view->priv->columns != NULL)
{
@ -1641,7 +1642,7 @@ gtk_tree_view_button_press (GtkWidget *widget,
g_return_val_if_fail (event != NULL, FALSE);
tree_view = GTK_TREE_VIEW (widget);
gtk_tree_view_stop_editing (tree_view);
gtk_tree_view_stop_editing (tree_view, FALSE);
gtk_widget_style_get (widget,
"vertical_separator", &vertical_separator,
"horizontal_separator", &horizontal_separator,
@ -3416,6 +3417,9 @@ presize_handler_callback (gpointer data)
static void
install_presize_handler (GtkTreeView *tree_view)
{
if (! GTK_WIDGET_REALIZED (tree_view))
return;
if (! tree_view->priv->presize_handler_timer)
{
tree_view->priv->presize_handler_timer =
@ -4525,7 +4529,7 @@ gtk_tree_view_focus (GtkWidget *widget,
focus_child = container->focus_child;
gtk_tree_view_stop_editing (GTK_TREE_VIEW (widget));
gtk_tree_view_stop_editing (GTK_TREE_VIEW (widget), FALSE);
/* Case 1. Headers currently have focus. */
if (focus_child)
{
@ -4674,7 +4678,7 @@ gtk_tree_view_real_move_cursor (GtkTreeView *tree_view,
if (tree_view->priv->tree == NULL)
return;
gtk_tree_view_stop_editing (tree_view);
gtk_tree_view_stop_editing (tree_view, FALSE);
GTK_TREE_VIEW_SET_FLAG (tree_view, GTK_TREE_VIEW_DRAW_KEYFOCUS);
gtk_widget_grab_focus (GTK_WIDGET (tree_view));
@ -4782,6 +4786,11 @@ gtk_tree_view_row_changed (GtkTreeModel *model,
g_return_if_fail (path != NULL || iter != NULL);
if (!GTK_WIDGET_REALIZED (tree_view))
/* We can just ignore ::changed signals if we aren't realized, as we don't care about sizes
*/
return;
gtk_widget_style_get (GTK_WIDGET (data), "vertical_separator", &vertical_separator, NULL);
if (path == NULL)
@ -5031,6 +5040,9 @@ gtk_tree_view_row_deleted (GtkTreeModel *model,
/* Ensure we don't have a dangling pointer to a dead node */
ensure_unprelighted (tree_view);
/* Cancel editting if we've started */
gtk_tree_view_stop_editing (tree_view, TRUE);
/* If we have a node expanded/collapsed timeout, remove it */
if (tree_view->priv->expand_collapse_timeout != 0)
{
@ -6436,7 +6448,7 @@ gtk_tree_view_real_start_interactive_search (GtkTreeView *tree_view)
/* yes, we point to the entry's private text thing here, a bit evil */
gtk_object_set_data (GTK_OBJECT (window), "gtk-tree-view-text",
gtk_entry_get_text (GTK_ENTRY (entry)));
(char *) gtk_entry_get_text (GTK_ENTRY (entry)));
gtk_object_set_data (GTK_OBJECT (tree_view),
GTK_TREE_VIEW_SEARCH_DIALOG_KEY, window);
@ -9544,11 +9556,14 @@ gtk_tree_view_real_start_editing (GtkTreeView *tree_view,
}
static void
gtk_tree_view_stop_editing (GtkTreeView *tree_view)
gtk_tree_view_stop_editing (GtkTreeView *tree_view,
gboolean cancel_editing)
{
if (tree_view->priv->edited_column == NULL)
return;
gtk_cell_editable_editing_done (tree_view->priv->edited_column->editable_widget);
if (! cancel_editing)
gtk_cell_editable_editing_done (tree_view->priv->edited_column->editable_widget);
gtk_cell_editable_remove_widget (tree_view->priv->edited_column->editable_widget);
}

View File

@ -51,6 +51,18 @@ enum
NUM_COLUMNS
};
gboolean
select_func (GtkTreeSelection *selection,
GtkTreeModel *model,
GtkTreePath *path,
gboolean path_currently_selected,
gpointer data)
{
if (gtk_tree_path_get_depth (path) > 1)
return TRUE;
return FALSE;
}
int
main (int argc, char *argv[])
{
@ -95,7 +107,7 @@ main (int argc, char *argv[])
ssmodel = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (smodel));
*/
tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
gtk_tree_selection_set_select_function (gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)), select_func, NULL, NULL);
/* 12 iters now, 12 later... */
for (i = 0; data[i].word_1 != NULL; i++)
{