]> git.0d.be Git - empathy.git/blobdiff - libempathy-gtk/empathy-groups-widget.c
remove released flag
[empathy.git] / libempathy-gtk / empathy-groups-widget.c
index fa092b6d643dbaea91462b7970b088b49e9a376b..b7f4b256ab5237075e890f2677c23429caf96981 100644 (file)
  *          Philip Withnall <philip.withnall@collabora.co.uk>
  */
 
-#include <config.h>
-
-#include <string.h>
-#include <stdlib.h>
+#include "config.h"
+#include "empathy-groups-widget.h"
 
-#include <gtk/gtk.h>
 #include <glib/gi18n-lib.h>
+#include <tp-account-widgets/tpaw-utils.h>
 
-#include <telepathy-glib/util.h>
-
-#include <folks/folks.h>
-
-#include <libempathy/empathy-utils.h>
-#include <libempathy/empathy-contact-manager.h>
-
-#include "empathy-groups-widget.h"
-#include "empathy-ui-utils.h"
+#include "empathy-utils.h"
+#include "empathy-connection-aggregator.h"
 
 /**
  * SECTION:empathy-groups-widget
@@ -127,7 +118,7 @@ model_find_name (EmpathyGroupsWidget *self,
   EmpathyGroupsWidgetPriv *priv = GET_PRIV (self);
   FindNameData data;
 
-  if (EMP_STR_EMPTY (name))
+  if (TPAW_STR_EMPTY (name))
     return FALSE;
 
   data.widget = self;
@@ -150,20 +141,19 @@ static void
 populate_data (EmpathyGroupsWidget *self)
 {
   EmpathyGroupsWidgetPriv *priv = GET_PRIV (self);
-  EmpathyContactManager *manager;
-  GtkTreeIter iter;
+  EmpathyConnectionAggregator *aggregator;
   GeeSet *member_groups;
   GList *all_groups, *l;
 
   /* Remove the old groups */
   gtk_list_store_clear (priv->group_store);
 
-  /* FIXME: We have to get the whole group list from EmpathyContactManager, as
-   * libfolks hasn't grown API to get the whole group list yet. (bgo#627398) */
-  manager = empathy_contact_manager_dup_singleton ();
-  all_groups = empathy_contact_list_get_all_groups (
-      EMPATHY_CONTACT_LIST (manager));
-  g_object_unref (manager);
+  /* FIXME: We have to get the whole group list from
+   * EmpathyConnectionAggregator, as libfolks hasn't grown API to get the whole
+   * group list yet. (bgo#627398) */
+  aggregator = empathy_connection_aggregator_dup_singleton ();
+  all_groups = empathy_connection_aggregator_get_all_groups (aggregator);
+  g_object_unref (aggregator);
 
   /* Get the list of groups that this #FolksGroupDetails is currently in */
   member_groups = folks_group_details_get_groups (priv->group_details);
@@ -176,14 +166,11 @@ populate_data (EmpathyGroupsWidget *self)
       enabled = gee_collection_contains (GEE_COLLECTION (member_groups),
           group_str);
 
-      gtk_list_store_append (priv->group_store, &iter);
-      gtk_list_store_set (priv->group_store, &iter,
+      gtk_list_store_insert_with_values (priv->group_store, NULL, -1,
           COL_NAME, group_str,
           COL_EDITABLE, TRUE,
           COL_ENABLED, enabled,
           -1);
-
-      g_free (l->data);
     }
 
   g_list_free (all_groups);
@@ -206,7 +193,7 @@ add_group_entry_changed_cb (GtkEditable *editable,
   else
     {
       gtk_widget_set_sensitive (GTK_WIDGET (priv->add_group_button),
-          !EMP_STR_EMPTY (group));
+          !TPAW_STR_EMPTY (group));
     }
 }
 
@@ -238,13 +225,11 @@ add_group_button_clicked_cb (GtkButton *button,
    EmpathyGroupsWidget *self)
 {
   EmpathyGroupsWidgetPriv *priv = GET_PRIV (self);
-  GtkTreeIter iter;
   const gchar *group;
 
   group = gtk_entry_get_text (GTK_ENTRY (priv->add_group_entry));
 
-  gtk_list_store_append (priv->group_store, &iter);
-  gtk_list_store_set (priv->group_store, &iter,
+  gtk_list_store_insert_with_values (priv->group_store, NULL, -1,
       COL_NAME, group,
       COL_ENABLED, TRUE,
       -1);