[epiphany] ephy-history-view: properly handle button-press-event



commit c4aa241ef52c68990afff259a513f2902d5f34d7
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Wed Mar 7 10:20:42 2012 +0200

    ephy-history-view: properly handle button-press-event
    
    So that it doesn't trigger a double-click in the first press. Use
    a handler instead of connecting to the signal.

 lib/widgets/ephy-history-view.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/lib/widgets/ephy-history-view.c b/lib/widgets/ephy-history-view.c
index 145f3ca..2db3499 100644
--- a/lib/widgets/ephy-history-view.c
+++ b/lib/widgets/ephy-history-view.c
@@ -37,9 +37,8 @@ button_event_modifies_selection (GdkEventButton *event)
 }
 
 static gboolean
-ephy_history_view_button_press_cb (GtkWidget *treeview,
-                                   GdkEventButton *event,
-                                   EphyHistoryView *view)
+ephy_history_view_button_press (GtkWidget *treeview,
+                                GdkEventButton *event)
 {
   GtkTreeSelection *selection;
   GtkTreePath *path = NULL;
@@ -73,7 +72,7 @@ ephy_history_view_button_press_cb (GtkWidget *treeview,
     if (event->button == 3) {
       gboolean retval;
 
-      g_signal_emit_by_name (view, "popup_menu", &retval);
+      g_signal_emit_by_name (treeview, "popup_menu", &retval);
     }
     gtk_tree_path_free (path);
   } else
@@ -85,6 +84,9 @@ ephy_history_view_button_press_cb (GtkWidget *treeview,
 static void
 ephy_history_view_class_init (EphyHistoryViewClass *klass)
 {
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  widget_class->button_press_event = ephy_history_view_button_press;
 }
 
 static void
@@ -94,10 +96,6 @@ ephy_history_view_init (EphyHistoryView *self)
 
   selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (self));
   gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
-
-  g_signal_connect_object (self, "button_press_event",
-                           G_CALLBACK (ephy_history_view_button_press_cb),
-                           self, 0);
 }
 
 void



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