]> git.0d.be Git - empathy.git/blobdiff - libempathy-gtk/empathy-contact-chooser.c
switch new message dialog to use an header bar
[empathy.git] / libempathy-gtk / empathy-contact-chooser.c
index f873bdc79d9ed25cd80f63b3b98f4d1cfc1849a8..4a4e4b4fad8eaabdcb14471b227caa4f80735015 100644 (file)
  */
 
 #include "config.h"
-
-#include <glib/gi18n.h>
-#include <folks/folks-telepathy.h>
-
 #include "empathy-contact-chooser.h"
 
-#include <libempathy/empathy-utils.h>
-#include <libempathy/empathy-client-factory.h>
+#include <glib/gi18n-lib.h>
 
-#include <libempathy-gtk/empathy-individual-store-manager.h>
-#include <libempathy-gtk/empathy-individual-view.h>
-#include <libempathy-gtk/empathy-ui-utils.h>
+#include "empathy-client-factory.h"
+#include "empathy-individual-store-manager.h"
+#include "empathy-individual-view.h"
+#include "empathy-ui-utils.h"
+#include "empathy-utils.h"
 
 G_DEFINE_TYPE (EmpathyContactChooser,
     empathy_contact_chooser, GTK_TYPE_BOX);
@@ -218,7 +215,7 @@ get_contacts_cb (GObject *source,
   GError *error = NULL;
   FolksIndividual *individual;
   TpContact *contact;
-  EmpathyContact *emp_contact;
+  EmpathyContact *emp_contact = NULL;
 
   self = tp_weak_ref_dup_object (wr);
   if (self == NULL)
@@ -237,7 +234,7 @@ get_contacts_cb (GObject *source,
     /* another request has been started */
     goto out;
 
-  individual =  empathy_create_individual_from_tp_contact (contact);
+  individual =  empathy_ensure_individual_from_tp_contact (contact);
   if (individual == NULL)
     goto out;
 
@@ -283,7 +280,7 @@ add_temporary_individuals (EmpathyContactChooser *self,
   self->priv->add_temp_ctx = add_temporary_individual_ctx_new (self);
 
   /* Try to add an individual for each connected account */
-  accounts = tp_account_manager_get_valid_accounts (self->priv->account_mgr);
+  accounts = tp_account_manager_dup_valid_accounts (self->priv->account_mgr);
   for (l = accounts; l != NULL; l = g_list_next (l))
     {
       TpAccount *account = l->data;
@@ -303,7 +300,7 @@ add_temporary_individuals (EmpathyContactChooser *self,
       g_object_unref (factory);
     }
 
-  g_list_free (accounts);
+  g_list_free_full (accounts, g_object_unref);
 }
 
 static void
@@ -317,7 +314,7 @@ search_text_changed (GtkEntry *entry,
 
   id = gtk_entry_get_text (entry);
 
-  self->priv->search_words = empathy_live_search_strip_utf8_string (id);
+  self->priv->search_words = tpaw_live_search_strip_utf8_string (id);
   self->priv->search_str = g_strdup (id);
 
   add_temporary_individuals (self, id);
@@ -414,8 +411,10 @@ empathy_contact_chooser_init (EmpathyContactChooser *self)
   tp_proxy_prepare_async (self->priv->account_mgr, features, NULL, NULL);
 
   /* Search entry */
-  self->priv->search_entry = gtk_entry_new ();
-  gtk_box_pack_start (GTK_BOX (self), self->priv->search_entry, FALSE, TRUE, 6);
+  self->priv->search_entry = gtk_search_entry_new ();
+  gtk_entry_set_placeholder_text ( GTK_ENTRY(self->priv->search_entry),
+                  _("Type to search a contact…"));
+  gtk_box_pack_start (GTK_BOX (self), self->priv->search_entry, FALSE, TRUE, 0);
   gtk_widget_show (self->priv->search_entry);
 
   g_signal_connect (self->priv->search_entry, "changed",
@@ -451,7 +450,7 @@ empathy_contact_chooser_init (EmpathyContactChooser *self)
   gtk_container_add (GTK_CONTAINER (self->priv->scroll_view),
       GTK_WIDGET (self->priv->view));
 
-  gtk_box_pack_start (GTK_BOX (self), self->priv->scroll_view, TRUE, TRUE, 6);
+  gtk_box_pack_start (GTK_BOX (self), self->priv->scroll_view, TRUE, TRUE, 0);
   gtk_widget_show (GTK_WIDGET (self->priv->view));
   gtk_widget_show (self->priv->scroll_view);
 }