]> git.0d.be Git - empathy.git/commitdiff
Add a comment for the usage of row_activated class method and optimise a bit that...
authorXavier Claessens <xclaesse@src.gnome.org>
Tue, 15 Jul 2008 14:00:55 +0000 (14:00 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Tue, 15 Jul 2008 14:00:55 +0000 (14:00 +0000)
svn path=/trunk/; revision=1256

libempathy-gtk/empathy-contact-list-view.c

index ddb5d24e6f8cb59db6f5846ed49e5c0df468172e..359f708d55a9636f94f0ddc20ad666ac14760260 100644 (file)
@@ -515,23 +515,21 @@ contact_list_view_row_activated (GtkTreeView       *view,
        GtkTreeModel               *model;
        GtkTreeIter                 iter;
 
        GtkTreeModel               *model;
        GtkTreeIter                 iter;
 
+       if (!(priv->contact_features & EMPATHY_CONTACT_FEATURE_CHAT)) {
+               return;
+       }
+
        model = GTK_TREE_MODEL (priv->store);
        gtk_tree_model_get_iter (model, &iter, path);
        gtk_tree_model_get (model, &iter,
                            EMPATHY_CONTACT_LIST_STORE_COL_CONTACT, &contact,
                            -1);
 
        model = GTK_TREE_MODEL (priv->store);
        gtk_tree_model_get_iter (model, &iter, path);
        gtk_tree_model_get (model, &iter,
                            EMPATHY_CONTACT_LIST_STORE_COL_CONTACT, &contact,
                            -1);
 
-       if (!contact) {
-               return;
-       }
-
-       /* There is no event for the contact, default action is starting a chat */
-       if (priv->contact_features & EMPATHY_CONTACT_FEATURE_CHAT) {
+       if (contact) {
                DEBUG ("Starting a chat");
                empathy_dispatcher_chat_with_contact (contact);
                DEBUG ("Starting a chat");
                empathy_dispatcher_chat_with_contact (contact);
+               g_object_unref (contact);
        }
        }
-
-       g_object_unref (contact);
 }
 
 static void
 }
 
 static void
@@ -1042,6 +1040,9 @@ 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;
 
        widget_class->drag_end           = contact_list_view_drag_end;
        widget_class->drag_motion        = contact_list_view_drag_motion;
 
+       /* We use the class method to let user of this widget to connect to
+        * the signal and stop emission of the signal so the default handler
+        * won't be called. */
        tree_view_class->row_activated = contact_list_view_row_activated;
 
        signals[DRAG_CONTACT_RECEIVED] =
        tree_view_class->row_activated = contact_list_view_row_activated;
 
        signals[DRAG_CONTACT_RECEIVED] =