+ if (path == NULL) {
+ /* Coordinates don't point to an actual row, so make sure the pointer
+ and highlighting don't indicate that a drag is possible.
+ */
+ gdk_drag_status (context, GDK_ACTION_DEFAULT, time_);
+ gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (widget), NULL, 0);
+ return FALSE;
+ }
+ target = gtk_drag_dest_find_target (widget, context, priv->file_targets);
+ gtk_tree_model_get_iter (model, &iter, path);
+
+ if (target == GDK_NONE) {
+ /* If target == GDK_NONE, then we don't have a target that can be
+ dropped on a contact. This means a contact drag. If we're
+ pointing to a group, highlight it. Otherwise, if the contact
+ we're pointing to is in a group, highlight that. Otherwise,
+ set the drag position to before the first row for a drag into
+ the "non-group" at the top.
+ */
+ GtkTreeIter group_iter;
+ gboolean is_group;
+ GtkTreePath *group_path;
+ gtk_tree_model_get (model, &iter,
+ EMPATHY_CONTACT_LIST_STORE_COL_IS_GROUP, &is_group,
+ -1);
+ if (is_group) {
+ group_iter = iter;
+ }
+ else {
+ if (gtk_tree_model_iter_parent (model, &group_iter, &iter))
+ gtk_tree_model_get (model, &group_iter,
+ EMPATHY_CONTACT_LIST_STORE_COL_IS_GROUP, &is_group,
+ -1);
+ }
+ if (is_group) {
+ gdk_drag_status (context, GDK_ACTION_MOVE, time_);
+ group_path = gtk_tree_model_get_path (model, &group_iter);
+ gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (widget),
+ group_path,
+ GTK_TREE_VIEW_DROP_INTO_OR_BEFORE);
+ gtk_tree_path_free (group_path);
+ }
+ else {
+ group_path = gtk_tree_path_new_first ();
+ gdk_drag_status (context, GDK_ACTION_MOVE, time_);
+ gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (widget),
+ group_path,
+ GTK_TREE_VIEW_DROP_BEFORE);
+ }
+ }
+ else {
+ /* This is a file drag, and it can only be dropped on contacts,
+ not groups.
+ */
+ EmpathyContact *contact;
+ gtk_tree_model_get (model, &iter,
+ EMPATHY_CONTACT_LIST_STORE_COL_CONTACT, &contact,
+ -1);
+ if (contact != NULL &&
+ empathy_contact_is_online (contact) &&
+ (empathy_contact_get_capabilities (contact) & EMPATHY_CAPABILITIES_FT)) {
+ gdk_drag_status (context, GDK_ACTION_COPY, time_);
+ gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (widget),
+ path,
+ GTK_TREE_VIEW_DROP_INTO_OR_BEFORE);
+ g_object_unref (contact);
+ }
+ else {
+ gdk_drag_status (context, 0, time_);
+ gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (widget), NULL, 0);
+ retval = FALSE;
+ }
+ }
+