Prevent to start a chat when activating a row with an event
authorXavier Claessens <xclaesse@src.gnome.org>
Tue, 15 Jul 2008 14:00:54 +0000 (14:00 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Tue, 15 Jul 2008 14:00:54 +0000 (14:00 +0000)
svn path=/trunk/; revision=1255

libempathy-gtk/empathy-contact-list-view.c
src/empathy-main-window.c

index 582ce69..ddb5d24 100644 (file)
@@ -506,10 +506,9 @@ contact_list_view_key_press_event_cb (EmpathyContactListView *view,
 }
 
 static void
-contact_list_view_row_activated_cb (EmpathyContactListView *view,
-                                   GtkTreePath            *path,
-                                   GtkTreeViewColumn      *col,
-                                   gpointer                user_data)
+contact_list_view_row_activated (GtkTreeView       *view,
+                                GtkTreePath       *path,
+                                GtkTreeViewColumn *column)
 {
        EmpathyContactListViewPriv *priv = GET_PRIV (view);
        EmpathyContact             *contact;
@@ -528,6 +527,7 @@ contact_list_view_row_activated_cb (EmpathyContactListView *view,
 
        /* There is no event for the contact, default action is starting a chat */
        if (priv->contact_features & EMPATHY_CONTACT_FEATURE_CHAT) {
+               DEBUG ("Starting a chat");
                empathy_dispatcher_chat_with_contact (contact);
        }
 
@@ -1027,8 +1027,9 @@ contact_list_view_set_property (GObject      *object,
 static void
 empathy_contact_list_view_class_init (EmpathyContactListViewClass *klass)
 {
-       GObjectClass   *object_class = G_OBJECT_CLASS (klass);
-       GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+       GObjectClass     *object_class = G_OBJECT_CLASS (klass);
+       GtkWidgetClass   *widget_class = GTK_WIDGET_CLASS (klass);
+       GtkTreeViewClass *tree_view_class = GTK_TREE_VIEW_CLASS (klass);
 
        object_class->finalize = contact_list_view_finalize;
        object_class->get_property = contact_list_view_get_property;
@@ -1041,6 +1042,8 @@ empathy_contact_list_view_class_init (EmpathyContactListViewClass *klass)
        widget_class->drag_end           = contact_list_view_drag_end;
        widget_class->drag_motion        = contact_list_view_drag_motion;
 
+       tree_view_class->row_activated = contact_list_view_row_activated;
+
        signals[DRAG_CONTACT_RECEIVED] =
                g_signal_new ("drag-contact-received",
                              G_OBJECT_CLASS_TYPE (klass),
@@ -1099,9 +1102,6 @@ empathy_contact_list_view_init (EmpathyContactListView *view)
        g_signal_connect (view, "key-press-event",
                          G_CALLBACK (contact_list_view_key_press_event_cb),
                          NULL);
-       g_signal_connect (view, "row-activated",
-                         G_CALLBACK (contact_list_view_row_activated_cb),
-                         NULL);
        g_signal_connect (view, "row-expanded",
                          G_CALLBACK (contact_list_view_row_expand_or_collapse_cb),
                          GINT_TO_POINTER (TRUE));
index 577f45b..371d9d1 100644 (file)
@@ -352,7 +352,11 @@ main_window_row_activated_cb (EmpathyContactListView *view,
                EmpathyEvent *event = l->data;
 
                if (event->contact == contact) {
+                       DEBUG ("Activate event");
                        empathy_event_activate (event);
+
+                       /* We don't want the default handler of this signal */
+                       g_signal_stop_emission_by_name (view, "row-activated");
                        break;
                }
        }