[gthumb: 6/9] fixed file list double-click



commit 47f9d958b4b0bf10694abadb42bd2a1c2a5ec588
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Mon Apr 26 20:01:10 2010 +0200

    fixed file list double-click

 gthumb/gth-browser.c   |   17 +++++++++++++----
 gthumb/gth-icon-view.c |   24 +++++++++++++++++++++---
 2 files changed, 34 insertions(+), 7 deletions(-)
---
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index 5cb0a2c..03d38db 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -4912,8 +4912,10 @@ load_file_delayed_cb (gpointer user_data)
 
 	load_file_data_ref (data);
 
-	g_source_remove (browser->priv->load_file_timeout);
-	browser->priv->load_file_timeout = 0;
+	if (browser->priv->load_file_timeout != 0) {
+		g_source_remove (browser->priv->load_file_timeout);
+		browser->priv->load_file_timeout = 0;
+	}
 
 	if (gth_browser_get_file_modified (browser)) {
 		load_file_data_ref (data);
@@ -4939,8 +4941,15 @@ gth_browser_load_file (GthBrowser  *browser,
 
 	data = load_file_data_new (browser, file_data, view);
 
-	if (browser->priv->load_file_timeout != 0)
-		g_source_remove (browser->priv->load_file_timeout);
+	if (browser->priv->load_file_timeout != 0) {
+		if (view) {
+			g_source_remove (browser->priv->load_file_timeout);
+			browser->priv->load_file_timeout = 0;
+			load_file_delayed_cb (data);
+		}
+		return;
+	}
+
 	browser->priv->load_file_timeout =
 			g_timeout_add_full (G_PRIORITY_DEFAULT,
 					    LOAD_FILE_DELAY,
diff --git a/gthumb/gth-icon-view.c b/gthumb/gth-icon-view.c
index 050ff5f..5cbf1ab 100644
--- a/gthumb/gth-icon-view.c
+++ b/gthumb/gth-icon-view.c
@@ -540,7 +540,24 @@ icon_view_button_press_event_cb (GtkWidget      *widget,
 	GthIconView *icon_view = user_data;
 	gboolean     retval = FALSE;
 
-	if (event->button == 1) {
+	if ((event->button == 1) && (event->type == GDK_2BUTTON_PRESS)) {
+		GtkTreePath *path;
+
+		path = gtk_icon_view_get_path_at_pos (GTK_ICON_VIEW (icon_view), event->x, event->y);
+		if (path != NULL) {
+			if (! (event->state & GDK_CONTROL_MASK) && ! (event->state & GDK_SHIFT_MASK)) {
+				stop_dragging (icon_view);
+				icon_view->priv->selection_pending = FALSE;
+
+				gtk_icon_view_item_activated (GTK_ICON_VIEW (icon_view), path);
+			}
+			gtk_tree_path_free (path);
+		}
+
+		return TRUE;
+	}
+
+	if ((event->button == 1) && (event->type == GDK_BUTTON_PRESS)) {
 		GtkTreePath *path;
 		int          pos;
 		int          new_selection_end;
@@ -577,6 +594,9 @@ icon_view_button_press_event_cb (GtkWidget      *widget,
 			retval = TRUE;
 		}
 
+		gtk_tree_path_free (path);
+		path = NULL;
+
 		new_selection_end = pos;
 		if (event->state & GDK_SHIFT_MASK) {
 			int    selection_start;
@@ -585,8 +605,6 @@ icon_view_button_press_event_cb (GtkWidget      *widget,
 			GList *scan;
 			int    i;
 
-			gtk_tree_path_free (path);
-
 			selection_start = MIN (icon_view->priv->selection_range_start, new_selection_end);
 			selection_end = MAX (new_selection_end, icon_view->priv->selection_range_start);
 



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