Stop cell editing when disposing the view. Fixes #322821.

2006-01-26  Martin Wehner  <martin.wehner@gmail.com>

	* src/file-manager/fm-list-view.c: (cell_renderer_edited),
	(stop_cell_editing), (fm_list_view_clear), (fm_list_view_dispose):
	Stop cell editing when disposing the view. Fixes #322821.
This commit is contained in:
Martin Wehner 2006-01-26 21:25:07 +00:00 committed by Martin Wehner
parent 9054df1ad0
commit 2477cae8fc
2 changed files with 26 additions and 13 deletions

View file

@ -1,3 +1,9 @@
2006-01-26 Martin Wehner <martin.wehner@gmail.com>
* src/file-manager/fm-list-view.c: (cell_renderer_edited),
(stop_cell_editing), (fm_list_view_clear), (fm_list_view_dispose):
Stop cell editing when disposing the view. Fixes #322821.
2006-01-26 Martin Wehner <martin.wehner@gmail.com>
* libnautilus-private/nautilus-file-operations.c:

View file

@ -952,7 +952,7 @@ cell_renderer_edited (GtkCellRendererText *cell,
GtkTreePath *path;
NautilusFile *file;
GtkTreeIter iter;
/* Don't allow a rename with an empty string. Revert to original
* without notifying the user.
*/
@ -1485,26 +1485,32 @@ fm_list_view_begin_loading (FMDirectoryView *view)
set_column_order_from_metadata_and_preferences (list_view);
}
static void
stop_cell_editing (FMListView *list_view)
{
GtkTreeViewColumn *column;
/* Stop an ongoing rename to commit the name changes when the user
* changes directories without exiting cell edit mode. It also prevents
* the edited handler from being called on the cleared list model.
*/
column = list_view->details->file_name_column;
if (column != NULL && column->editable_widget != NULL &&
GTK_IS_CELL_EDITABLE (column->editable_widget)) {
gtk_cell_editable_editing_done (column->editable_widget);
}
}
static void
fm_list_view_clear (FMDirectoryView *view)
{
FMListView *list_view;
GtkTreeViewColumn *column;
list_view = FM_LIST_VIEW (view);
if (list_view->details->model != NULL) {
/* Stop an ongoing rename to commit the name changes when the user
* changes directories without exiting cell edit mode. It also prevents
* the edited handler from being called on the cleared list model.
*/
column = list_view->details->file_name_column;
if (column != NULL && column->editable_widget != NULL &&
GTK_IS_CELL_EDITABLE (column->editable_widget)) {
gtk_cell_editable_editing_done (column->editable_widget);
}
stop_cell_editing (list_view);
fm_list_model_clear (list_view->details->model);
}
}
@ -2324,6 +2330,7 @@ fm_list_view_dispose (GObject *object)
list_view = FM_LIST_VIEW (object);
if (list_view->details->model) {
stop_cell_editing (list_view);
g_object_unref (list_view->details->model);
list_view->details->model = NULL;
}