aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2010-08-24 19:31:10 +0800
committerPhilip Withnall <philip.withnall@collabora.co.uk>2010-08-27 17:23:48 +0800
commit56e80c63b33bff7d82cd43bc8e1dc02f1a10a1d4 (patch)
tree789a8d0d834de90a9676f00d5b54f1522bc7aa9f /libempathy-gtk
parent4b17d88ae214bc8b9b74d7fd6c0c01e14f206478 (diff)
downloadgsoc2013-empathy-56e80c63b33bff7d82cd43bc8e1dc02f1a10a1d4.tar
gsoc2013-empathy-56e80c63b33bff7d82cd43bc8e1dc02f1a10a1d4.tar.gz
gsoc2013-empathy-56e80c63b33bff7d82cd43bc8e1dc02f1a10a1d4.tar.bz2
gsoc2013-empathy-56e80c63b33bff7d82cd43bc8e1dc02f1a10a1d4.tar.lz
gsoc2013-empathy-56e80c63b33bff7d82cd43bc8e1dc02f1a10a1d4.tar.xz
gsoc2013-empathy-56e80c63b33bff7d82cd43bc8e1dc02f1a10a1d4.tar.zst
gsoc2013-empathy-56e80c63b33bff7d82cd43bc8e1dc02f1a10a1d4.zip
Move individual_view_handle_drag() to individual_view_contact_drag_received()
This will make refactoring easier. Helps: bgo#627715
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-individual-view.c73
1 files changed, 33 insertions, 40 deletions
diff --git a/libempathy-gtk/empathy-individual-view.c b/libempathy-gtk/empathy-individual-view.c
index 66ddad73a..f86004521 100644
--- a/libempathy-gtk/empathy-individual-view.c
+++ b/libempathy-gtk/empathy-individual-view.c
@@ -247,44 +247,6 @@ groups_change_group_cb (GObject *source,
}
}
-static void
-individual_view_handle_drag (EmpathyIndividualView *self,
- FolksIndividual *individual,
- const gchar *old_group,
- const gchar *new_group,
- GdkDragAction action)
-{
- g_return_if_fail (EMPATHY_IS_INDIVIDUAL_VIEW (self));
- g_return_if_fail (FOLKS_IS_INDIVIDUAL (individual));
-
- DEBUG ("individual %s dragged from '%s' to '%s'",
- folks_individual_get_id (individual), old_group, new_group);
-
- if (!tp_strdiff (new_group, EMPATHY_INDIVIDUAL_STORE_FAVORITE))
- {
- /* Mark contact as favourite */
- folks_favourite_set_is_favourite (FOLKS_FAVOURITE (individual), TRUE);
- return;
- }
-
- if (!tp_strdiff (old_group, EMPATHY_INDIVIDUAL_STORE_FAVORITE))
- {
- /* Remove contact as favourite */
- folks_favourite_set_is_favourite (FOLKS_FAVOURITE (individual), FALSE);
-
- /* Don't try to remove it */
- old_group = NULL;
- }
-
- if (new_group != NULL)
- folks_groups_change_group (FOLKS_GROUPS (individual), new_group, TRUE,
- groups_change_group_cb, NULL);
-
- if (old_group != NULL && action == GDK_ACTION_MOVE)
- folks_groups_change_group (FOLKS_GROUPS (individual), old_group, FALSE,
- groups_change_group_cb, NULL);
-}
-
static gboolean
group_can_be_modified (const gchar *name,
gboolean is_fake_group,
@@ -373,8 +335,39 @@ individual_view_contact_drag_received (GtkWidget *self,
/* FIXME: We should probably wait for the cb before calling
* gtk_drag_finish */
- individual_view_handle_drag (EMPATHY_INDIVIDUAL_VIEW (self), individual,
- old_group, new_group, gdk_drag_context_get_selected_action (context));
+ DEBUG ("individual %s dragged from '%s' to '%s'",
+ folks_individual_get_id (individual), old_group, new_group);
+
+ if (!tp_strdiff (new_group, EMPATHY_INDIVIDUAL_STORE_FAVORITE))
+ {
+ /* Mark contact as favourite */
+ folks_favourite_set_is_favourite (FOLKS_FAVOURITE (individual), TRUE);
+ }
+ else
+ {
+ if (!tp_strdiff (old_group, EMPATHY_INDIVIDUAL_STORE_FAVORITE))
+ {
+ /* Remove contact as favourite */
+ folks_favourite_set_is_favourite (FOLKS_FAVOURITE (individual),
+ FALSE);
+
+ /* Don't try to remove it */
+ old_group = NULL;
+ }
+
+ if (new_group != NULL)
+ {
+ folks_groups_change_group (FOLKS_GROUPS (individual), new_group, TRUE,
+ groups_change_group_cb, NULL);
+ }
+
+ if (old_group != NULL &&
+ gdk_drag_context_get_selected_action (context) == GDK_ACTION_MOVE)
+ {
+ folks_groups_change_group (FOLKS_GROUPS (individual), old_group,
+ FALSE, groups_change_group_cb, NULL);
+ }
+ }
g_object_unref (G_OBJECT (manager));
g_free (old_group);