[empathy] Support removing groups
- From: Travis Reitter <treitter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] Support removing groups
- Date: Tue, 20 Jul 2010 23:22:42 +0000 (UTC)
commit 2fcee569ba4bf86f78b6b5d6c12bfeeecbb1c47e
Author: Philip Withnall <philip withnall collabora co uk>
Date: Thu Jul 1 17:03:59 2010 +0100
Support removing groups
libempathy-gtk/empathy-individual-view.c | 6 ++++--
libempathy/empathy-individual-manager.c | 26 ++++++++++++++++++++++++++
libempathy/empathy-individual-manager.h | 3 +++
3 files changed, 33 insertions(+), 2 deletions(-)
---
diff --git a/libempathy-gtk/empathy-individual-view.c b/libempathy-gtk/empathy-individual-view.c
index e75f362..43d4a78 100644
--- a/libempathy-gtk/empathy-individual-view.c
+++ b/libempathy-gtk/empathy-individual-view.c
@@ -1997,8 +1997,10 @@ individual_view_group_remove_activate_cb (GtkMenuItem *menuitem,
if (individual_view_remove_dialog_show (parent, _("Removing group"),
text))
{
- /* TODO: implement */
- DEBUG ("removing group unimplemented");
+ EmpathyIndividualManager *manager =
+ empathy_individual_manager_dup_singleton ();
+ empathy_individual_manager_remove_group (manager, group);
+ g_object_unref (G_OBJECT (manager));
}
g_free (text);
diff --git a/libempathy/empathy-individual-manager.c b/libempathy/empathy-individual-manager.c
index ef2688b..c2c2eef 100644
--- a/libempathy/empathy-individual-manager.c
+++ b/libempathy/empathy-individual-manager.c
@@ -329,6 +329,32 @@ empathy_individual_manager_remove (EmpathyIndividualManager *self,
folks_individual_aggregator_remove_individual (priv->aggregator, individual);
}
+static void
+remove_group_cb (const gchar *id, FolksIndividual *individual,
+ const gchar *group)
+{
+ folks_groups_change_group (FOLKS_GROUPS (individual), group, FALSE);
+}
+
+void
+empathy_individual_manager_remove_group (EmpathyIndividualManager *manager,
+ const gchar *group)
+{
+ EmpathyIndividualManagerPriv *priv;
+ GHashTable *individuals;
+
+ g_return_if_fail (EMPATHY_IS_INDIVIDUAL_MANAGER (manager));
+ g_return_if_fail (group != NULL);
+
+ priv = GET_PRIV (manager);
+
+ DEBUG (G_STRLOC ": removing group %s", group);
+
+ /* Remove every individual from the group */
+ individuals = folks_individual_aggregator_get_individuals (priv->aggregator);
+ g_hash_table_foreach (individuals, (GHFunc) remove_group_cb, group);
+}
+
EmpathyIndividualManagerFlags
empathy_individual_manager_get_flags_for_connection (
EmpathyIndividualManager *self,
diff --git a/libempathy/empathy-individual-manager.h b/libempathy/empathy-individual-manager.h
index 2fab1ff..66014bc 100644
--- a/libempathy/empathy-individual-manager.h
+++ b/libempathy/empathy-individual-manager.h
@@ -79,6 +79,9 @@ void empathy_individual_manager_remove (EmpathyIndividualManager *manager,
FolksIndividual *individual,
const gchar *message);
+void empathy_individual_manager_remove_group (EmpathyIndividualManager *manager,
+ const gchar *group);
+
EmpathyIndividualManagerFlags
empathy_individual_manager_get_flags_for_connection (
EmpathyIndividualManager *manager,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]