[gitg] Use event-after for tree view popup for better selection handling



commit 4210e2422776f250e10cce29e53c4ca88c875c40
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Sun Jun 6 16:01:29 2010 +0200

    Use event-after for tree view popup for better selection handling

 gitg/gitg-window.c  |   28 +++++++++++++++++-----------
 gitg/gitg-window.ui |    2 +-
 2 files changed, 18 insertions(+), 12 deletions(-)
---
diff --git a/gitg/gitg-window.c b/gitg/gitg-window.c
index ade2333..dc035bb 100644
--- a/gitg/gitg-window.c
+++ b/gitg/gitg-window.c
@@ -132,9 +132,9 @@ void on_help_about (GtkAction *action, GitgWindow *window);
 void on_edit_preferences (GtkAction *action, GitgWindow *window);
 void on_repository_properties (GtkAction *action, GitgWindow *window);
 
-gboolean on_tree_view_rv_button_press_event (GtkWidget *widget,
-                                             GdkEventButton *event,
-                                             GitgWindow *window);
+void on_tree_view_rv_button_press_event (GtkWidget  *widget,
+                                         GdkEvent   *event,
+                                         GitgWindow *window);
 
 void on_checkout_branch_action_activate (GtkAction *action, GitgWindow *window);
 void on_remove_branch_action_activate (GtkAction *action, GitgWindow *window);
@@ -3044,17 +3044,23 @@ popup_revision (GitgWindow     *window,
 	return TRUE;
 }
 
-gboolean
-on_tree_view_rv_button_press_event (GtkWidget      *widget,
-                                    GdkEventButton *event,
-                                    GitgWindow     *window)
+void
+on_tree_view_rv_button_press_event (GtkWidget  *widget,
+                                    GdkEvent   *event,
+                                    GitgWindow  *window)
 {
-	if (event->button == 3)
+	if (event->type == GDK_BUTTON_PRESS)
 	{
-		return popup_ref (window, event) || popup_revision (window, event);
-	}
+		GdkEventButton *button = (GdkEventButton *)event;
 
-	return FALSE;
+		if (button->button == 3)
+		{
+			if (!popup_ref (window, button))
+			{
+				popup_revision (window, button);
+			}
+		}
+	}
 }
 
 void
diff --git a/gitg/gitg-window.ui b/gitg/gitg-window.ui
index 76117df..b84e092 100644
--- a/gitg/gitg-window.ui
+++ b/gitg/gitg-window.ui
@@ -89,7 +89,7 @@
                                 <property name="rules_hint">True</property>
                                 <property name="search_column">1</property>
                                 <property name="fixed_height_mode">True</property>
-                                <signal name="button_press_event" handler="on_tree_view_rv_button_press_event"/>
+                                <signal name="event_after" handler="on_tree_view_rv_button_press_event"/>
                                 <child>
                                   <object class="GtkTreeViewColumn" id="rv_column_subject">
                                     <property name="resizable">True</property>



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