[gtk+/places-sidebar: 33/53] Replacement for eel_gtk_tree_view_set_activate_on_single_click()



commit a4ac2d59581998435174103961be68f50d823f6d
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Oct 4 11:34:44 2011 -0500

    Replacement for eel_gtk_tree_view_set_activate_on_single_click()
    
    Signed-off-by: Federico Mena Quintero <federico gnome org>

 gtk/gtkplacessidebar.c |   34 ++++++++++++++++++++++++++++++++--
 1 files changed, 32 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index 5fca811..e2d3265 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -3066,6 +3066,37 @@ bookmarks_changed_cb (gpointer data)
 	update_places (sidebar);
 }
 
+static gboolean
+tree_view_button_press_callback (GtkWidget *tree_view,
+				 GdkEventButton *event,
+				 gpointer data)
+{
+	GtkTreePath *path;
+	GtkTreeViewColumn *column;
+
+	if (event->button == 1 && event->type == GDK_BUTTON_PRESS) {
+		if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (tree_view),
+						   event->x, event->y,
+						   &path,
+						   &column,
+						   NULL,
+						   NULL)) {
+			gtk_tree_view_row_activated (GTK_TREE_VIEW (tree_view), path, column);
+		}
+	}
+
+	return FALSE;
+}
+
+static void
+tree_view_set_activate_on_single_click (GtkTreeView *tree_view)
+{
+	g_signal_connect (tree_view, "button_press_event",
+			  G_CALLBACK (tree_view_button_press_callback),
+			  NULL);
+}
+
+
 static void
 gtk_places_sidebar_init (GtkPlacesSidebar *sidebar)
 {
@@ -3257,8 +3288,7 @@ gtk_places_sidebar_init (GtkPlacesSidebar *sidebar)
 	g_signal_connect (tree_view, "button-release-event",
 			  G_CALLBACK (bookmarks_button_release_event_cb), sidebar);
 
-	eel_gtk_tree_view_set_activate_on_single_click (sidebar->tree_view,
-							TRUE);
+	tree_view_set_activate_on_single_click (sidebar->tree_view);
 
 	g_signal_connect_object (nautilus_trash_monitor_get (),
 				 "trash_state_changed",



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