* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <config.h>
-
+#include "config.h"
#include "empathy-connection-aggregator.h"
-#include <telepathy-glib/telepathy-glib.h>
-
#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
#include "empathy-debug.h"
-#include "empathy-utils.h"
-
-
-#include "extensions/extensions.h"
G_DEFINE_TYPE (EmpathyConnectionAggregator, empathy_connection_aggregator,
G_TYPE_OBJECT);
contact_list_changed_cb (conn, contacts, empty, self);
g_ptr_array_unref (empty);
}
+ g_ptr_array_unref (contacts);
tp_g_signal_connect_object (conn, "invalidated",
G_CALLBACK (conn_invalidated_cb), self, 0);
goto out;
}
- accounts = tp_account_manager_get_valid_accounts (self->priv->mgr);
+ accounts = tp_account_manager_dup_valid_accounts (self->priv->mgr);
for (l = accounts; l != NULL; l = g_list_next (l))
{
TpAccount *account = l->data;
tp_g_signal_connect_object (self->priv->mgr, "account-validity-changed",
G_CALLBACK (account_validity_changed_cb), self, 0);
- g_list_free (accounts);
+ g_list_free_full (accounts, g_object_unref);
out:
g_object_unref (self);
return aggregator;
}
+/* (transfer container) */
GList *
empathy_connection_aggregator_get_all_groups (EmpathyConnectionAggregator *self)
{
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);
+ }
+}