[PATCH] double-click doesn't open half-shown items



Hi!,
I've made a patch for http://bugs.gnome.org/347423 , the patch retards
the reveal of the icon one second, so there's enough time for double
clicking before the icon moves. This is what windows explorer does and
seems the best solution. Patch attached.
Index: libnautilus-private/nautilus-icon-container.c
===================================================================
--- libnautilus-private/nautilus-icon-container.c	(revisión: 13349)
+++ libnautilus-private/nautilus-icon-container.c	(copia de trabajo)
@@ -162,6 +162,11 @@
 	char *action_descriptions[LAST_ACTION];
 } NautilusIconContainerAccessiblePrivate;
 
+typedef struct {
+	NautilusIconContainer *container;
+	NautilusIcon *icon_to_select;
+} RevealIconData;
+
 static GType         nautilus_icon_container_accessible_get_type (void);
 
 static void          activate_selected_items                        (NautilusIconContainer *container);
@@ -205,6 +210,10 @@
 static void          nautilus_icon_container_update_visible_icons   (NautilusIconContainer *container);
 static void          reveal_icon                                    (NautilusIconContainer *container,
 								     NautilusIcon *icon);
+static gboolean      reveal_icon_timeout_callback (gpointer data);
+static gboolean      select_one_unselect_others2 (	NautilusIconContainer *container,
+							NautilusIcon *icon_to_select, 
+							gboolean retard_reveal_icon);
 
 
 static gpointer accessible_parent_class;
@@ -1821,9 +1830,18 @@
 select_one_unselect_others (NautilusIconContainer *container,
 			    NautilusIcon *icon_to_select)
 {
+	return select_one_unselect_others2 (container, icon_to_select, FALSE);
+}
+
+static gboolean
+select_one_unselect_others2 (NautilusIconContainer *container,
+			    NautilusIcon *icon_to_select, 
+			    gboolean retard_reveal_icon)
+{
 	gboolean selection_changed;
 	GList *p;
 	NautilusIcon *icon;
+	RevealIconData *reveal_icon_data;
 
 	selection_changed = FALSE;
 	
@@ -1837,12 +1855,31 @@
 	if (selection_changed && icon_to_select != NULL) {
 		AtkObject *atk_object = eel_accessibility_for_object (icon_to_select->item);
 		atk_focus_tracker_notify (atk_object);
-		reveal_icon (container, icon_to_select);
+		if (retard_reveal_icon)  {		
+			reveal_icon_data = g_new0 (RevealIconData, 1);
+			reveal_icon_data->container = container;
+			reveal_icon_data->icon_to_select = icon_to_select;
+			g_timeout_add_seconds (	1,
+						reveal_icon_timeout_callback,
+						reveal_icon_data);
+		}
 	}
 	return selection_changed;
 }
 
 static gboolean
+reveal_icon_timeout_callback (gpointer data)
+{
+	RevealIconData *reveal_icon_data;
+
+	reveal_icon_data = (RevealIconData *) (data);
+	reveal_icon (reveal_icon_data->container, reveal_icon_data->icon_to_select);
+	g_free (reveal_icon_data);
+
+	return FALSE;
+}
+
+static gboolean
 unselect_all (NautilusIconContainer *container)
 {
 	return select_one_unselect_others (container, NULL);
@@ -5180,7 +5217,7 @@
 			g_signal_emit (container,
 				       signals[SELECTION_CHANGED], 0);
 		} else {
-			select_one_unselect_others (container, icon);
+			select_one_unselect_others2 (container, icon, TRUE);
 			g_signal_emit (container,
 				       signals[SELECTION_CHANGED], 0);
 		}


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