Re: [PATCH] rename looses focus after directory change



> +static void
> +nautilus_icon_container_unfreeze_updates (NautilusIconContainer *container)
> +{
> +	NautilusIconContainerClass *klass;
> +
> +	klass = NAUTILUS_ICON_CONTAINER_GET_CLASS (container);
> +	g_return_if_fail (klass->freeze_updates != NULL);

Oops, just seen a copy paste error, that line should be
"klass->unfreeze_updates", corrected patch attached.
Index: libnautilus-private/nautilus-icon-container.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-container.c,v
retrieving revision 1.425
diff -p -u -r1.425 nautilus-icon-container.c
--- libnautilus-private/nautilus-icon-container.c	30 Nov 2006 11:10:31 -0000	1.425
+++ libnautilus-private/nautilus-icon-container.c	3 Dec 2006 13:16:13 -0000
@@ -5566,6 +5566,28 @@ nautilus_icon_container_get_icon_text (N
 }
 
 static void
+nautilus_icon_container_freeze_updates (NautilusIconContainer *container)
+{
+	NautilusIconContainerClass *klass;
+
+	klass = NAUTILUS_ICON_CONTAINER_GET_CLASS (container);
+	g_return_if_fail (klass->freeze_updates != NULL);
+
+	klass->freeze_updates (container);
+}
+
+static void
+nautilus_icon_container_unfreeze_updates (NautilusIconContainer *container)
+{
+	NautilusIconContainerClass *klass;
+
+	klass = NAUTILUS_ICON_CONTAINER_GET_CLASS (container);
+	g_return_if_fail (klass->unfreeze_updates != NULL);
+
+	klass->unfreeze_updates (container);
+}
+
+static void
 nautilus_icon_container_start_monitor_top_left (NautilusIconContainer *container,
 						NautilusIconData *data,
 						gconstpointer client,
@@ -6926,6 +6948,9 @@ nautilus_icon_container_start_renaming_s
 	}
 
 	details->original_text = g_strdup (editable_text);
+	
+	/* Freeze updates so files added while renaming don't cause rename to loose focus, bug #318373 */
+	nautilus_icon_container_freeze_updates (container);
 
 	/* Create text renaming widget, if it hasn't been created already.
 	 * We deal with the broken icon text item widget by keeping it around
@@ -7022,6 +7047,8 @@ end_renaming_mode (NautilusIconContainer
 	/* We are not in renaming mode */
 	container->details->renaming = FALSE;
 	nautilus_icon_canvas_item_set_renaming (icon->item, FALSE);
+	
+	nautilus_icon_container_unfreeze_updates (container);
 
 	if (commit) {
 		set_pending_icon_to_reveal (container, icon);
Index: libnautilus-private/nautilus-icon-container.h
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-container.h,v
retrieving revision 1.95
diff -p -u -r1.95 nautilus-icon-container.h
--- libnautilus-private/nautilus-icon-container.h	6 Nov 2006 19:09:59 -0000	1.95
+++ libnautilus-private/nautilus-icon-container.h	3 Dec 2006 13:16:13 -0000
@@ -146,6 +146,8 @@ typedef struct {
 	int          (* compare_icons_by_name)    (NautilusIconContainer *container,
 						   NautilusIconData *icon_a,
 						   NautilusIconData *icon_b);
+	void         (* freeze_updates)           (NautilusIconContainer *container);
+	void         (* unfreeze_updates)         (NautilusIconContainer *container);
 	void         (* start_monitor_top_left)   (NautilusIconContainer *container,
 						   NautilusIconData *data,
 						   gconstpointer client,
Index: src/file-manager/fm-icon-container.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-icon-container.c,v
retrieving revision 1.20
diff -p -u -r1.20 fm-icon-container.c
--- src/file-manager/fm-icon-container.c	16 May 2006 12:29:40 -0000	1.20
+++ src/file-manager/fm-icon-container.c	3 Dec 2006 13:16:14 -0000
@@ -468,6 +468,24 @@ fm_icon_container_compare_icons_by_name 
 }
 
 static void
+fm_icon_container_freeze_updates (NautilusIconContainer *container)
+{
+	FMIconView *icon_view;
+	icon_view = get_icon_view (container);
+	g_return_if_fail (icon_view != NULL);
+	fm_directory_view_freeze_updates (FM_DIRECTORY_VIEW (icon_view));
+}
+
+static void
+fm_icon_container_unfreeze_updates (NautilusIconContainer *container)
+{
+	FMIconView *icon_view;
+	icon_view = get_icon_view (container);
+	g_return_if_fail (icon_view != NULL);
+	fm_directory_view_unfreeze_updates (FM_DIRECTORY_VIEW (icon_view));
+}
+
+static void
 fm_icon_container_dispose (GObject *object)
 {
 	FMIconContainer *icon_container;
@@ -495,6 +513,8 @@ fm_icon_container_class_init (FMIconCont
 
 	ic_class->compare_icons = fm_icon_container_compare_icons;
 	ic_class->compare_icons_by_name = fm_icon_container_compare_icons_by_name;
+	ic_class->freeze_updates = fm_icon_container_freeze_updates;
+	ic_class->unfreeze_updates = fm_icon_container_unfreeze_updates;
 
 	G_OBJECT_CLASS (klass)->dispose = fm_icon_container_dispose;
 }


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