aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTravis Reitter <treitter@gmail.com>2010-07-27 18:54:06 +0800
committerTravis Reitter <treitter@gmail.com>2010-07-27 18:54:06 +0800
commit34e8fc1344c5433be1a9d8f8614cdb84933a84fb (patch)
tree81cacf070d6f80ad2a1418bf37f753d40f7ae599
parent4ca3b29b70ca4f624153783c26f0d746f58003a8 (diff)
parenta976f8193404e5c89d0a9a9051f629057e200f9b (diff)
downloadgsoc2013-empathy-34e8fc1344c5433be1a9d8f8614cdb84933a84fb.tar
gsoc2013-empathy-34e8fc1344c5433be1a9d8f8614cdb84933a84fb.tar.gz
gsoc2013-empathy-34e8fc1344c5433be1a9d8f8614cdb84933a84fb.tar.bz2
gsoc2013-empathy-34e8fc1344c5433be1a9d8f8614cdb84933a84fb.tar.lz
gsoc2013-empathy-34e8fc1344c5433be1a9d8f8614cdb84933a84fb.tar.xz
gsoc2013-empathy-34e8fc1344c5433be1a9d8f8614cdb84933a84fb.tar.zst
gsoc2013-empathy-34e8fc1344c5433be1a9d8f8614cdb84933a84fb.zip
Merge branch 'folks-async-and-prepare'
-rw-r--r--configure.ac2
-rw-r--r--libempathy-gtk/empathy-individual-view.c22
-rw-r--r--libempathy/empathy-contact.c19
-rw-r--r--libempathy/empathy-individual-manager.c40
4 files changed, 77 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac
index 37de4493c..7d735187d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,7 +31,7 @@ AC_COPYRIGHT([
# Minimal version required
# Hardp deps
-FOLKS_REQUIRED=0.1.9
+FOLKS_REQUIRED=0.1.11
GCONF_REQUIRED=1.2.0
GLIB_REQUIRED=2.25.9
GTK_REQUIRED=2.21.2
diff --git a/libempathy-gtk/empathy-individual-view.c b/libempathy-gtk/empathy-individual-view.c
index ef4f938f3..7083b238b 100644
--- a/libempathy-gtk/empathy-individual-view.c
+++ b/libempathy-gtk/empathy-individual-view.c
@@ -320,6 +320,22 @@ OUT:
}
static void
+groups_change_group_cb (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ FolksGroups *groups = FOLKS_GROUPS (source);
+ GError *error = NULL;
+
+ folks_groups_change_group_finish (groups, result, &error);
+ if (error != NULL)
+ {
+ g_warning ("failed to change group: %s", error->message);
+ g_clear_error (&error);
+ }
+}
+
+static void
individual_view_handle_drag (EmpathyIndividualView *self,
FolksIndividual *individual,
const gchar *old_group,
@@ -349,10 +365,12 @@ individual_view_handle_drag (EmpathyIndividualView *self,
}
if (new_group != NULL)
- folks_groups_change_group (FOLKS_GROUPS (individual), new_group, TRUE);
+ 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);
+ folks_groups_change_group (FOLKS_GROUPS (individual), old_group, FALSE,
+ groups_change_group_cb, NULL);
}
static gboolean
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c
index 9a2bd8fb5..6842cde09 100644
--- a/libempathy/empathy-contact.c
+++ b/libempathy/empathy-contact.c
@@ -662,6 +662,22 @@ empathy_contact_set_alias (EmpathyContact *contact,
g_object_unref (contact);
}
+static void
+groups_change_group_cb (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ FolksGroups *groups = FOLKS_GROUPS (source);
+ GError *error = NULL;
+
+ folks_groups_change_group_finish (groups, result, &error);
+ if (error != NULL)
+ {
+ g_warning ("failed to change group: %s", error->message);
+ g_clear_error (&error);
+ }
+}
+
void
empathy_contact_change_group (EmpathyContact *contact, const gchar *group,
gboolean is_member)
@@ -679,7 +695,8 @@ empathy_contact_change_group (EmpathyContact *contact, const gchar *group,
if (persona != NULL)
{
if (FOLKS_IS_GROUPS (persona))
- folks_groups_change_group (FOLKS_GROUPS (persona), group, is_member);
+ folks_groups_change_group (FOLKS_GROUPS (persona), group, is_member,
+ groups_change_group_cb, contact);
return;
}
diff --git a/libempathy/empathy-individual-manager.c b/libempathy/empathy-individual-manager.c
index cb3a3975e..55541b299 100644
--- a/libempathy/empathy-individual-manager.c
+++ b/libempathy/empathy-individual-manager.c
@@ -228,6 +228,7 @@ empathy_individual_manager_init (EmpathyIndividualManager *self)
priv->aggregator = folks_individual_aggregator_new ();
g_signal_connect (priv->aggregator, "individuals-changed",
G_CALLBACK (aggregator_individuals_changed_cb), self);
+ folks_individual_aggregator_prepare (priv->aggregator, NULL, NULL);
}
EmpathyIndividualManager *
@@ -325,6 +326,23 @@ empathy_individual_manager_add_from_contact (EmpathyIndividualManager *self,
g_hash_table_destroy (details);
}
+static void
+aggregator_remove_individual_cb (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ FolksIndividualAggregator *aggregator = FOLKS_INDIVIDUAL_AGGREGATOR (source);
+ GError *error = NULL;
+
+ folks_individual_aggregator_remove_individual_finish (
+ aggregator, result, &error);
+ if (error != NULL)
+ {
+ g_warning ("failed to remove individual: %s", error->message);
+ g_clear_error (&error);
+ }
+}
+
/**
* Removes the inner contact from the server (and thus the Individual). Not
* meant for de-shelling inner personas from an Individual.
@@ -345,7 +363,24 @@ empathy_individual_manager_remove (EmpathyIndividualManager *self,
folks_individual_get_id (individual),
folks_individual_get_alias (individual));
- folks_individual_aggregator_remove_individual (priv->aggregator, individual);
+ folks_individual_aggregator_remove_individual (priv->aggregator, individual,
+ aggregator_remove_individual_cb, self);
+}
+
+static void
+groups_change_group_cb (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ FolksGroups *groups = FOLKS_GROUPS (source);
+ GError *error = NULL;
+
+ folks_groups_change_group_finish (groups, result, &error);
+ if (error != NULL)
+ {
+ g_warning ("failed to change group: %s", error->message);
+ g_clear_error (&error);
+ }
}
static void
@@ -353,7 +388,8 @@ remove_group_cb (const gchar *id,
FolksIndividual *individual,
const gchar *group)
{
- folks_groups_change_group (FOLKS_GROUPS (individual), group, FALSE);
+ folks_groups_change_group (FOLKS_GROUPS (individual), group, FALSE,
+ groups_change_group_cb, NULL);
}
void