]> git.0d.be Git - empathy.git/blobdiff - libempathy/empathy-utils.c
stop using tp_account_manager_is_prepared()
[empathy.git] / libempathy / empathy-utils.c
index ee245d90f7048c17999a7bda3abbc3f9b2b044e6..4130627e76e1f5cc4e3a699cc8df75a69ae3528b 100644 (file)
@@ -32,6 +32,7 @@
 #include <glib/gi18n-lib.h>
 #include <dbus/dbus-protocol.h>
 #include <math.h>
+#include <telepathy-glib/telepathy-glib-dbus.h>
 
 #include "empathy-client-factory.h"
 #include "extensions.h"
@@ -107,41 +108,6 @@ empathy_init (void)
   g_object_unref (am);
 }
 
-gboolean
-empathy_xml_validate_from_resource (xmlDoc *doc,
-    const gchar *dtd_resourcename)
-{
-  GBytes *resourcecontents;
-  gconstpointer resourcedata;
-  gsize resourcesize;
-  xmlParserInputBufferPtr buffer;
-  xmlValidCtxt  cvp;
-  xmlDtd *dtd;
-  GError *error = NULL;
-  gboolean ret;
-
-  DEBUG ("Loading dtd resource %s", dtd_resourcename);
-
-  resourcecontents = g_resources_lookup_data (dtd_resourcename, G_RESOURCE_LOOKUP_FLAGS_NONE, &error);
-  if (error != NULL)
-    {
-      g_warning ("Unable to load dtd resource '%s': %s", dtd_resourcename, error->message);
-      g_error_free (error);
-      return FALSE;
-    }
-  resourcedata = g_bytes_get_data (resourcecontents, &resourcesize);
-  buffer = xmlParserInputBufferCreateStatic (resourcedata, resourcesize, XML_CHAR_ENCODING_UTF8);
-
-  memset (&cvp, 0, sizeof (cvp));
-  dtd = xmlIOParseDTD (NULL, buffer, XML_CHAR_ENCODING_UTF8);
-  ret = xmlValidateDtd (&cvp, doc, dtd);
-
-  xmlFreeDtd (dtd);
-  g_bytes_unref (resourcecontents);
-
-  return ret;
-}
-
 xmlNodePtr
 empathy_xml_node_get_child (xmlNodePtr   node,
     const gchar *child_name)
@@ -449,7 +415,7 @@ empathy_account_manager_get_accounts_connected (gboolean *connecting)
 
   manager = tp_account_manager_dup ();
 
-  if (G_UNLIKELY (!tp_account_manager_is_prepared (manager,
+  if (G_UNLIKELY (!tp_proxy_is_prepared (manager,
           TP_ACCOUNT_MANAGER_FEATURE_CORE)))
     g_critical (G_STRLOC ": %s called before AccountManager ready", G_STRFUNC);
 
@@ -594,7 +560,9 @@ empathy_dup_persona_store_for_connection (TpConnection *connection)
           account = tpf_persona_store_get_account (persona_store);
           conn_cur = tp_account_get_connection (account);
           if (conn_cur == connection)
-            result = persona_store;
+            result = g_object_ref (persona_store);
+
+          g_clear_object (&persona_store);
         }
       g_clear_object (&iter);
     }
@@ -789,25 +757,6 @@ empathy_format_currency (gint amount,
   return money;
 }
 
-gboolean
-empathy_account_has_uri_scheme_tel (TpAccount *account)
-{
-  const gchar * const * uri_schemes;
-  guint i;
-
-  uri_schemes = tp_account_get_uri_schemes (account);
-  if (uri_schemes == NULL)
-    return FALSE;
-
-  for (i = 0; uri_schemes[i] != NULL; i++)
-    {
-      if (!tp_strdiff (uri_schemes[i], "tel"))
-        return TRUE;
-    }
-
-  return FALSE;
-}
-
 /* Return the TpContact on @conn associated with @individual, if any */
 TpContact *
 empathy_get_tp_contact_for_individual (FolksIndividual *individual,