[nautilus] list-view: unfreeze updates on focus out



commit 97b1ff2fa3b4d706969ab40d4bf17adad281e42f
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Fri Feb 25 13:44:38 2011 -0500

    list-view: unfreeze updates on focus out
    
    It's not really right, as GtkTreeView should always emit
    editing-canceled on the right renderer for us, but if you click away
    from the entry, it doesn't, so this is just a workaround until the GTK+
    bug is fixed.

 src/nautilus-list-view.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index f171b9e..0ab7c14 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -1189,6 +1189,17 @@ sort_column_changed_callback (GtkTreeSortable *sortable,
 }
 
 static void
+editable_focus_out_cb (GtkWidget *widget,
+		       GdkEvent *event,
+		       gpointer user_data)
+{
+	NautilusListView *view = user_data;
+
+	nautilus_view_unfreeze_updates (NAUTILUS_VIEW (view));
+	view->details->editable_widget = NULL;
+}
+
+static void
 cell_renderer_editing_started_cb (GtkCellRenderer *renderer,
 				  GtkCellEditable *editable,
 				  const gchar *path_str,
@@ -1208,6 +1219,9 @@ cell_renderer_editing_started_cb (GtkCellRenderer *renderer,
 					&start_offset, &end_offset);
 	gtk_editable_select_region (GTK_EDITABLE (entry), start_offset, end_offset);
 
+	g_signal_connect (entry, "focus-out-event",
+			  G_CALLBACK (editable_focus_out_cb), list_view);
+
 	nautilus_clipboard_set_up_editable
 		(GTK_EDITABLE (entry),
 		 nautilus_view_get_ui_manager (NAUTILUS_VIEW (list_view)),



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]