nautilus r14296 - in branches/gnome-2-22: . libnautilus-private



Author: cneumair
Date: Sun Jun 29 10:53:37 2008
New Revision: 14296
URL: http://svn.gnome.org/viewvc/nautilus?rev=14296&view=rev

Log:
2008-06-29  Christian Neumair  <cneumair gnome org>

	* libnautilus-private/nautilus-icon-container.c
	(clicked_within_double_click_interval), (handle_icon_button_press):
	* libnautilus-private/nautilus-icon-private.h:
	Use customized double click detection, for supporting double clicks
	on half shown items, where the first click triggers a scroll event.
	Thanks to Nelson BenÃtez LeÃn. Fixes #347423.


Modified:
   branches/gnome-2-22/ChangeLog
   branches/gnome-2-22/libnautilus-private/nautilus-icon-container.c
   branches/gnome-2-22/libnautilus-private/nautilus-icon-private.h

Modified: branches/gnome-2-22/libnautilus-private/nautilus-icon-container.c
==============================================================================
--- branches/gnome-2-22/libnautilus-private/nautilus-icon-container.c	(original)
+++ branches/gnome-2-22/libnautilus-private/nautilus-icon-container.c	Sun Jun 29 10:53:37 2008
@@ -3439,6 +3439,31 @@
 	}
 }
 
+static gboolean
+clicked_within_double_click_interval (NautilusIconContainer *container)
+{
+	static gint64 last_click_time = 0;
+	static gint click_count = 0;
+	gint double_click_time;
+	gint64 current_time;
+
+	/* Determine click count */
+	g_object_get (G_OBJECT (gtk_widget_get_settings (GTK_WIDGET (container))), 
+		      "gtk-double-click-time", &double_click_time,
+		      NULL);
+	current_time = eel_get_system_time ();
+	if (current_time - last_click_time < double_click_time * 1000) {
+		click_count++;
+	} else {
+		click_count = 0;
+	}
+
+	/* Stash time for next compare */
+	last_click_time = current_time;
+
+	return (click_count > 0);
+}
+
 static void
 clear_drag_state (NautilusIconContainer *container)
 {
@@ -5193,8 +5218,9 @@
 		details->double_click_icon[1] = details->double_click_icon[0];
 		details->double_click_icon[0] = icon;
 	}
-	if (event->type == GDK_2BUTTON_PRESS &&
-	    (event->button == DRAG_BUTTON || event->button == MIDDLE_BUTTON)) {
+
+	if ((event->button == DRAG_BUTTON || event->button == MIDDLE_BUTTON)
+	    && (!details->single_click_mode && clicked_within_double_click_interval(container) && details->icon_revealed)) {
 		/* Double clicking does not trigger a D&D action. */
 		details->drag_button = 0;
 		details->drag_icon = NULL;
@@ -5211,6 +5237,7 @@
 				activate_selected_items_alternate (container, icon);
 			}
 		}
+		details->icon_revealed = FALSE;
 		return TRUE;
 	}
 	if (event->button == DRAG_BUTTON
@@ -5259,6 +5286,7 @@
 				       signals[SELECTION_CHANGED], 0);
 		} else {
 			select_one_unselect_others (container, icon);
+			details->icon_revealed = TRUE;
 			g_signal_emit (container,
 				       signals[SELECTION_CHANGED], 0);
 		}

Modified: branches/gnome-2-22/libnautilus-private/nautilus-icon-private.h
==============================================================================
--- branches/gnome-2-22/libnautilus-private/nautilus-icon-private.h	(original)
+++ branches/gnome-2-22/libnautilus-private/nautilus-icon-private.h	Sun Jun 29 10:53:37 2008
@@ -274,6 +274,9 @@
 	GtkWidget *search_entry;
 	guint search_entry_changed_id;
 	guint typeselect_flush_timeout;
+
+	/* Needed for dblclicking activation of partially shown icons, see bug #347423 */
+	gboolean icon_revealed;
 };
 
 /* Private functions shared by mutiple files. */



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