aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-02-13 21:19:28 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-04-20 17:33:08 +0800
commit69f4cb22dcefd39cadcbe274b1896b06a3eadc15 (patch)
tree635e1efa4902855edb202c2adc9d62ccf811a94d /libempathy
parenteb6f86cc365f373851b52a11e06578374d0af9d2 (diff)
downloadgsoc2013-empathy-69f4cb22dcefd39cadcbe274b1896b06a3eadc15.tar
gsoc2013-empathy-69f4cb22dcefd39cadcbe274b1896b06a3eadc15.tar.gz
gsoc2013-empathy-69f4cb22dcefd39cadcbe274b1896b06a3eadc15.tar.bz2
gsoc2013-empathy-69f4cb22dcefd39cadcbe274b1896b06a3eadc15.tar.lz
gsoc2013-empathy-69f4cb22dcefd39cadcbe274b1896b06a3eadc15.tar.xz
gsoc2013-empathy-69f4cb22dcefd39cadcbe274b1896b06a3eadc15.tar.zst
gsoc2013-empathy-69f4cb22dcefd39cadcbe274b1896b06a3eadc15.zip
add empathy_connection_aggregator_rename_group()
https://bugzilla.gnome.org/show_bug.cgi?id=501065
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-connection-aggregator.c41
-rw-r--r--libempathy/empathy-connection-aggregator.h5
2 files changed, 46 insertions, 0 deletions
diff --git a/libempathy/empathy-connection-aggregator.c b/libempathy/empathy-connection-aggregator.c
index fde365c27..2b517bf51 100644
--- a/libempathy/empathy-connection-aggregator.c
+++ b/libempathy/empathy-connection-aggregator.c
@@ -288,3 +288,44 @@ empathy_connection_aggregator_dup_all_contacts (
return result;
}
+
+static void
+rename_group_cb (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ GError *error = NULL;
+
+ if (!tp_connection_rename_group_finish (TP_CONNECTION (source), result,
+ &error))
+ {
+ DEBUG ("Failed to rename group on %s: %s",
+ tp_proxy_get_object_path (source), error->message);
+ g_error_free (error);
+ }
+}
+
+void
+empathy_connection_aggregator_rename_group (EmpathyConnectionAggregator *self,
+ const gchar *old_name,
+ const gchar *new_name)
+{
+ GList *l;
+
+ for (l = self->priv->conns; l != NULL; l = g_list_next (l))
+ {
+ TpConnection *conn = l->data;
+ const gchar * const *groups;
+
+ groups = tp_connection_get_contact_groups (conn);
+
+ if (!tp_strv_contains (groups, old_name))
+ continue;
+
+ DEBUG ("Rename group '%s' to '%s' on %s", old_name, new_name,
+ tp_proxy_get_object_path (conn));
+
+ tp_connection_rename_group_async (conn, old_name, new_name,
+ rename_group_cb, NULL);
+ }
+}
diff --git a/libempathy/empathy-connection-aggregator.h b/libempathy/empathy-connection-aggregator.h
index c21c04dec..5f85193c9 100644
--- a/libempathy/empathy-connection-aggregator.h
+++ b/libempathy/empathy-connection-aggregator.h
@@ -67,6 +67,11 @@ GList * empathy_connection_aggregator_get_all_groups (
GPtrArray * empathy_connection_aggregator_dup_all_contacts (
EmpathyConnectionAggregator *self);
+void empathy_connection_aggregator_rename_group (
+ EmpathyConnectionAggregator *self,
+ const gchar *old_name,
+ const gchar *new_name);
+
G_END_DECLS
#endif /* #ifndef __EMPATHY_CONNECTION_AGGREGATOR_H__*/