]> git.0d.be Git - empathy.git/blobdiff - src/empathy-accounts-dialog.c
Be more compatible with Facebook emoticon codes
[empathy.git] / src / empathy-accounts-dialog.c
index 0e004f5a50b53da0bac5220124763c0a1baf70ed..21b3fd609e7d0f16185cea06b172151e61658f12 100644 (file)
  *          Danielle Madeley <danielle.madeley@collabora.co.uk>
  */
 
-#include <config.h>
-
-#include <string.h>
-#include <stdlib.h>
+#include "config.h"
+#include "empathy-accounts-dialog.h"
 
-#include <gtk/gtk.h>
 #include <glib/gi18n-lib.h>
-#include <dbus/dbus-glib.h>
-#include <gio/gdesktopappinfo.h>
-
-#include <telepathy-glib/account-manager.h>
-#include <telepathy-glib/defs.h>
-#include <telepathy-glib/util.h>
-
-#include <libempathy/empathy-utils.h>
-#include <libempathy/empathy-connection-managers.h>
-#include <libempathy/empathy-connectivity.h>
-#include <libempathy/empathy-pkg-kit.h>
-#include <libempathy/empathy-tp-contact-factory.h>
-
-#include <libempathy-gtk/empathy-ui-utils.h>
-#include <libempathy-gtk/empathy-protocol-chooser.h>
-#include <libempathy-gtk/empathy-account-widget.h>
-#include <libempathy-gtk/empathy-account-widget-irc.h>
-#include <libempathy-gtk/empathy-account-widget-sip.h>
-#include <libempathy-gtk/empathy-cell-renderer-activatable.h>
-#include <libempathy-gtk/empathy-contact-widget.h>
-#include <libempathy-gtk/empathy-images.h>
-#include <libempathy-gtk/empathy-local-xmpp-assistant-widget.h>
-#include <libempathy-gtk/empathy-new-account-dialog.h>
+#include <tp-account-widgets/tpaw-account-widget.h>
+#include <tp-account-widgets/tpaw-builder.h>
+#include <tp-account-widgets/tpaw-user-info.h>
+#include <tp-account-widgets/tpaw-pixbuf-utils.h>
+#include <tp-account-widgets/tpaw-utils.h>
 
 #include "empathy-accounts-common.h"
-#include "empathy-accounts-dialog.h"
 #include "empathy-import-dialog.h"
 #include "empathy-import-utils.h"
+#include "empathy-local-xmpp-assistant-widget.h"
+#include "empathy-new-account-dialog.h"
+#include "empathy-pkg-kit.h"
+#include "empathy-ui-utils.h"
+#include "empathy-utils.h"
 
 #define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT
-#include <libempathy/empathy-debug.h>
+#include "empathy-debug.h"
 
 /* Flashing delay for icons (milliseconds). */
 #define FLASH_TIMEOUT 500
@@ -69,7 +52,7 @@
 /* The primary text of the dialog shown to the user when he is about to lose
  * unsaved changes */
 #define PENDING_CHANGES_QUESTION_PRIMARY_TEXT \
-  _("There are unsaved modifications to your %s account.")
+  _("There are unsaved modifications to your %.50s account.")
 /* The primary text of the dialog shown to the user when he is about to lose
  * an unsaved new account */
 #define UNSAVED_NEW_ACCOUNT_QUESTION_PRIMARY_TEXT \
@@ -97,6 +80,7 @@ typedef struct {
   GtkWidget *enabled_switch;
 
   GtkWidget *treeview;
+  GtkCellRenderer *name_renderer;
 
   GtkWidget *button_add;
   GtkWidget *button_remove;
@@ -106,34 +90,35 @@ typedef struct {
   GtkWidget *label_name;
   GtkWidget *label_type;
   GtkWidget *dialog_content;
+  GtkWidget *user_info;
 
   GtkWidget *notebook_account;
   GtkWidget *spinner;
   gboolean loading;
 
-  /* We have to keep a weak reference on the actual EmpathyAccountWidget, not
+  /* We have to keep a weak reference on the actual TpawAccountWidget, not
    * just its GtkWidget. It is the only reliable source we can query to know if
    * there are any unsaved changes to the currently selected account. We can't
    * look at the account settings because it does not contain everything that
-   * can be changed using the EmpathyAccountWidget. For instance, it does not
+   * can be changed using the TpawAccountWidget. For instance, it does not
    * contain the state of the "Enabled" checkbox.
    *
    * Even if we create it ourself, we just get a weak ref and not a strong one
-   * as EmpathyAccountWidget unrefs itself when the GtkWidget is destroyed.
+   * as TpawAccountWidget unrefs itself when the GtkWidget is destroyed.
    * That's kinda ugly; cf bgo #640417.
    *
    * */
-  EmpathyAccountWidget *setting_widget_object;
+  TpawAccountWidget *setting_widget;
 
   gboolean  connecting_show;
   guint connecting_id;
 
   gulong  settings_ready_id;
-  EmpathyAccountSettings *settings_ready;
+  TpawAccountSettings *settings_ready;
 
   TpAccountManager *account_manager;
-  EmpathyConnectionManagers *cms;
-  EmpathyConnectivity *connectivity;
+  TpawConnectionManagers *cms;
+  GNetworkMonitor *connectivity;
 
   GtkWindow *parent_window;
   TpAccount *initial_selection;
@@ -145,6 +130,8 @@ typedef struct {
    * EmpathyAccountsDialog object. */
   gboolean force_change_row;
   GtkTreeRowReference *destination_row;
+
+  GHashTable *icons_cache;
 } EmpathyAccountsDialogPriv;
 
 enum {
@@ -159,13 +146,13 @@ enum {
   PROP_PARENT = 1
 };
 
-static EmpathyAccountSettings * accounts_dialog_model_get_selected_settings (
+static TpawAccountSettings * accounts_dialog_model_get_selected_settings (
     EmpathyAccountsDialog *dialog);
 
 static void accounts_dialog_model_select_first (EmpathyAccountsDialog *dialog);
 
 static void accounts_dialog_update_settings (EmpathyAccountsDialog *dialog,
-    EmpathyAccountSettings *settings);
+    TpawAccountSettings *settings);
 
 static void accounts_dialog_model_set_selected (EmpathyAccountsDialog *dialog,
     TpAccount *account);
@@ -191,19 +178,6 @@ static void accounts_dialog_model_selection_changed (
 static gboolean accounts_dialog_has_pending_change (
     EmpathyAccountsDialog *dialog, TpAccount **account);
 
-static void
-accounts_dialog_update_name_label (EmpathyAccountsDialog *dialog,
-    const gchar *display_name)
-{
-  gchar *text;
-  EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
-
-  text = g_markup_printf_escaped ("<b>%s</b>", display_name);
-  gtk_label_set_markup (GTK_LABEL (priv->label_name), text);
-
-  g_free (text);
-}
-
 static void
 accounts_dialog_status_infobar_set_message (EmpathyAccountsDialog *dialog,
     const gchar *message)
@@ -241,7 +215,7 @@ accounts_dialog_enable_account_cb (GObject *object,
     {
       am = tp_account_manager_dup ();
 
-      empathy_connect_new_account (account, am);
+      tpaw_connect_new_account (account, am);
       g_object_unref (am);
     }
 }
@@ -259,7 +233,7 @@ accounts_dialog_enable_switch_active_cb (GtkSwitch *sw,
     GParamSpec *spec,
     EmpathyAccountsDialog *dialog)
 {
-  EmpathyAccountSettings *settings;
+  TpawAccountSettings *settings;
   TpAccount *account;
   gboolean enable;
 
@@ -267,7 +241,7 @@ accounts_dialog_enable_switch_active_cb (GtkSwitch *sw,
   if (settings == NULL)
     return;
 
-  account = empathy_account_settings_get_account (settings);
+  account = tpaw_account_settings_get_account (settings);
   if (account == NULL)
     return;
 
@@ -305,6 +279,8 @@ account_is_selected (EmpathyAccountsDialog *dialog,
     return FALSE;
 
   selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->treeview));
+  if (selection == NULL)
+    return FALSE;
 
   if (!gtk_tree_selection_get_selected (selection, &model, &iter))
     return FALSE;
@@ -327,7 +303,7 @@ account_can_be_enabled (TpAccount *account)
     return FALSE;
 
   /* Butterfly accounts shouldn't be used any more */
-  if (!tp_strdiff (tp_account_get_connection_manager (account),
+  if (!tp_strdiff (tp_account_get_cm_name (account),
         "butterfly"))
     return FALSE;
 
@@ -353,6 +329,8 @@ accounts_dialog_update_status_infobar (EmpathyAccountsDialog *dialog,
 
   if (account != NULL)
     {
+      gchar *text;
+
       status = tp_account_get_connection_status (account, &reason);
       presence = tp_account_get_current_presence (account, NULL, &status_message);
       account_enabled = tp_account_is_enabled (account);
@@ -372,6 +350,11 @@ accounts_dialog_update_status_infobar (EmpathyAccountsDialog *dialog,
         presence = TP_CONNECTION_PRESENCE_TYPE_OFFLINE;
 
       display_switch = account_can_be_enabled (account);
+
+      text = g_markup_printf_escaped ("<b>%.50s</b>",
+          tp_account_get_display_name (account));
+      gtk_label_set_markup (GTK_LABEL (priv->label_name), text);
+      g_free (text);
     }
   else
     {
@@ -463,7 +446,7 @@ accounts_dialog_update_status_infobar (EmpathyAccountsDialog *dialog,
                 g_free (message);
               }
 
-            if (!empathy_connectivity_is_online (priv->connectivity))
+            if (!g_network_monitor_get_network_available (priv->connectivity))
                accounts_dialog_status_infobar_set_message (dialog,
                     _("Offline — No Network Connection"));
 
@@ -483,7 +466,7 @@ accounts_dialog_update_status_infobar (EmpathyAccountsDialog *dialog,
     }
   else
     {
-      if (!tp_strdiff (tp_account_get_connection_manager (account),
+      if (!tp_strdiff (tp_account_get_cm_name (account),
             "butterfly"))
         {
           const gchar *packages[] = { "telepathy-haze", NULL };
@@ -526,7 +509,7 @@ empathy_account_dialog_cancel (EmpathyAccountsDialog *dialog)
   GtkTreeModel *model;
   GtkTreeSelection *selection;
   GtkTreeIter iter;
-  EmpathyAccountSettings *settings;
+  TpawAccountSettings *settings;
   TpAccount *account;
   EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
 
@@ -540,7 +523,7 @@ empathy_account_dialog_cancel (EmpathyAccountsDialog *dialog)
       COL_ACCOUNT_SETTINGS, &settings,
       COL_ACCOUNT, &account, -1);
 
-  empathy_account_widget_discard_pending_changes (priv->setting_widget_object);
+  tpaw_account_widget_discard_pending_changes (priv->setting_widget);
 
   if (account == NULL)
     {
@@ -566,7 +549,7 @@ empathy_account_dialog_cancel (EmpathyAccountsDialog *dialog)
 
 static void
 empathy_account_dialog_widget_cancelled_cb (
-    EmpathyAccountWidget *widget_object,
+    TpawAccountWidget *widget_object,
     EmpathyAccountsDialog *dialog)
 {
   empathy_account_dialog_cancel (dialog);
@@ -580,7 +563,7 @@ accounts_dialog_has_valid_accounts (EmpathyAccountsDialog *dialog)
   GtkTreeIter iter;
   gboolean creating;
 
-  g_object_get (priv->setting_widget_object,
+  g_object_get (priv->setting_widget,
       "creating-account", &creating, NULL);
 
   if (!creating)
@@ -598,8 +581,8 @@ static void
 account_dialog_create_edit_params_dialog (EmpathyAccountsDialog *dialog)
 {
   EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
-  EmpathyAccountSettings *settings;
-  GtkWidget *subdialog, *content, *content_area, *align;
+  TpawAccountSettings *settings;
+  GtkWidget *subdialog, *content_area, *align;
 
   settings = accounts_dialog_model_get_selected_settings (dialog);
   if (settings == NULL)
@@ -610,22 +593,22 @@ account_dialog_create_edit_params_dialog (EmpathyAccountsDialog *dialog)
       GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
       NULL, NULL);
 
-  priv->setting_widget_object =
-    empathy_account_widget_new_for_protocol (settings, FALSE);
+  gtk_window_set_resizable (GTK_WINDOW (subdialog), FALSE);
 
-  g_object_add_weak_pointer (G_OBJECT (priv->setting_widget_object),
-      (gpointer *) &priv->setting_widget_object);
+  priv->setting_widget = (TpawAccountWidget *)
+    tpaw_account_widget_new_for_protocol (settings, NULL, FALSE);
 
-  if (accounts_dialog_has_valid_accounts (dialog))
-    empathy_account_widget_set_other_accounts_exist (
-        priv->setting_widget_object, TRUE);
+  g_object_add_weak_pointer (G_OBJECT (priv->setting_widget),
+      (gpointer *) &priv->setting_widget);
 
-  content = empathy_account_widget_get_widget (priv->setting_widget_object);
+  if (accounts_dialog_has_valid_accounts (dialog))
+    tpaw_account_widget_set_other_accounts_exist (
+        priv->setting_widget, TRUE);
 
-  g_signal_connect (priv->setting_widget_object, "cancelled",
+  g_signal_connect (priv->setting_widget, "cancelled",
           G_CALLBACK (empathy_account_dialog_widget_cancelled_cb), dialog);
 
-  g_signal_connect_swapped (priv->setting_widget_object, "close",
+  g_signal_connect_swapped (priv->setting_widget, "close",
       G_CALLBACK (gtk_widget_destroy), subdialog);
 
   content_area = gtk_dialog_get_content_area (GTK_DIALOG (subdialog));
@@ -633,34 +616,14 @@ account_dialog_create_edit_params_dialog (EmpathyAccountsDialog *dialog)
   align = gtk_alignment_new (0.5, 0.5, 1, 1);
   gtk_alignment_set_padding (GTK_ALIGNMENT (align), 6, 0, 6, 6);
 
-  gtk_container_add (GTK_CONTAINER (align), content);
+  gtk_container_add (GTK_CONTAINER (align), GTK_WIDGET (priv->setting_widget));
   gtk_box_pack_start (GTK_BOX (content_area), align, TRUE, TRUE, 0);
 
-  gtk_widget_show (content);
+  gtk_widget_show (GTK_WIDGET (priv->setting_widget));
   gtk_widget_show (align);
   gtk_widget_show (subdialog);
 }
 
-static void
-start_external_app (GAppInfo *app_info)
-{
-  GError *error = NULL;
-  GdkAppLaunchContext *context = NULL;
-  GdkDisplay *display;
-
-  display = gdk_display_get_default ();
-  context = gdk_display_get_app_launch_context (display);
-
-  if (!g_app_info_launch (app_info, NULL, (GAppLaunchContext *) context,
-        &error))
-    {
-      g_critical ("Failed to bisho: %s", error->message);
-      g_clear_error (&error);
-    }
-
-  tp_clear_object (&context);
-}
-
 static void
 use_external_storage_provider (EmpathyAccountsDialog *self,
     TpAccount *account)
@@ -670,55 +633,20 @@ use_external_storage_provider (EmpathyAccountsDialog *self,
   provider = tp_account_get_storage_provider (account);
   if (!tp_strdiff (provider, "com.meego.libsocialweb"))
     {
-      GDesktopAppInfo *desktop_info;
-      gchar *cmd;
-      GAppInfo *app_info;
-      GError *error = NULL;
-
-      desktop_info = g_desktop_app_info_new ("gnome-control-center.desktop");
-      if (desktop_info == NULL)
-        {
-          g_critical ("Could not locate 'gnome-control-center.desktop'");
-          return;
-        }
-
-      /* glib doesn't have API to start a desktop file with args... (#637875) */
-      cmd = g_strdup_printf ("%s bisho.desktop", g_app_info_get_commandline (
-            (GAppInfo *) desktop_info));
-
-      app_info = g_app_info_create_from_commandline (cmd, NULL, 0, &error);
-
-      if (app_info == NULL)
-        {
-          DEBUG ("Failed to create app info: %s", error->message);
-          g_error_free (error);
-        }
-      else
-        {
-          start_external_app (app_info);
-          g_object_unref (app_info);
-        }
-
-      g_object_unref (desktop_info);
-      g_free (cmd);
+      empathy_launch_external_app ("gnome-control-center.desktop",
+          "bisho.desktop", NULL);
       return;
     }
-  else if (!tp_strdiff (provider, "org.gnome.OnlineAccounts"))
+  else if (!tp_strdiff (provider, EMPATHY_GOA_PROVIDER))
     {
-      GDesktopAppInfo *desktop_info;
-
-      desktop_info = g_desktop_app_info_new (
-          "gnome-online-accounts-panel.desktop");
-      if (desktop_info == NULL)
-        {
-          g_critical ("Could not locate 'gnome-online-accounts-panel.desktop'");
-        }
-      else
-        {
-          start_external_app (G_APP_INFO (desktop_info));
-          g_object_unref (desktop_info);
-        }
-
+      empathy_launch_external_app ("gnome-online-accounts-panel.desktop",
+          NULL, NULL);
+      return;
+    }
+  else if (!tp_strdiff (provider, EMPATHY_UOA_PROVIDER))
+    {
+      empathy_launch_external_app ("unity-credentials-panel.desktop",
+          NULL, NULL);
       return;
     }
   else
@@ -732,7 +660,7 @@ static void
 account_dialow_show_edit_params_dialog (EmpathyAccountsDialog *dialog,
     GtkButton *button)
 {
-  EmpathyAccountSettings *settings;
+  TpawAccountSettings *settings;
   TpAccount *account;
   TpStorageRestrictionFlags storage_restrictions;
 
@@ -740,7 +668,7 @@ account_dialow_show_edit_params_dialog (EmpathyAccountsDialog *dialog,
   if (settings == NULL)
     return;
 
-  account = empathy_account_settings_get_account (settings);
+  account = tpaw_account_settings_get_account (settings);
   g_return_if_fail (account != NULL);
 
   storage_restrictions = tp_account_get_storage_restrictions (account);
@@ -758,118 +686,42 @@ account_dialow_show_edit_params_dialog (EmpathyAccountsDialog *dialog,
     }
 }
 
-static void
-account_dialog_show_contact_details_failed (EmpathyAccountsDialog *dialog,
-    gboolean error)
-{
-  EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
-  GtkWidget *infobar, *label;
-
-  infobar = gtk_info_bar_new ();
-
-  if (error)
-    {
-      gtk_info_bar_set_message_type (GTK_INFO_BAR (infobar), GTK_MESSAGE_ERROR);
-      label = gtk_label_new (_("Failed to retrieve your personal information "
-                               "from the server."));
-    }
-  else
-    {
-      gtk_info_bar_set_message_type (GTK_INFO_BAR (infobar), GTK_MESSAGE_INFO);
-      label = gtk_label_new (_("Go online to edit your personal information."));
-    }
-
-  gtk_container_add (
-      GTK_CONTAINER (gtk_info_bar_get_content_area (GTK_INFO_BAR (infobar))),
-      label);
-  gtk_box_pack_start (GTK_BOX (priv->dialog_content), infobar, FALSE, FALSE, 0);
-  gtk_widget_show_all (infobar);
-}
-
-static void
-account_dialog_got_self_contact (TpConnection *conn,
-    EmpathyContact *contact,
-    const GError *in_error,
-    gpointer user_data,
-    GObject *dialog)
-{
-  EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
-  GtkWidget *editor, *alig;
-
-  if (in_error != NULL)
-    {
-      DEBUG ("Failed to get self-contact: %s", in_error->message);
-      account_dialog_show_contact_details_failed (
-          EMPATHY_ACCOUNTS_DIALOG (dialog), TRUE);
-      return;
-    }
-
-  alig = gtk_alignment_new (0.5, 0, 1, 1);
-
-  /* create the contact info editor for this account */
-  editor = empathy_contact_widget_new (contact,
-      EMPATHY_CONTACT_WIDGET_EDIT_ALIAS |
-      EMPATHY_CONTACT_WIDGET_EDIT_AVATAR |
-      EMPATHY_CONTACT_WIDGET_NO_STATUS |
-      EMPATHY_CONTACT_WIDGET_EDIT_DETAILS |
-      EMPATHY_CONTACT_WIDGET_NO_ACCOUNT);
-
-  gtk_box_pack_start (GTK_BOX (priv->dialog_content), alig, TRUE, TRUE, 0);
-  gtk_container_add (GTK_CONTAINER (alig), editor);
-  gtk_widget_show (alig);
-  gtk_widget_show (editor);
-}
-
 static void
 account_dialog_create_dialog_content (EmpathyAccountsDialog *dialog,
-    EmpathyAccountSettings *settings)
+    TpawAccountSettings *settings)
 {
   EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
   const gchar *icon_name;
   TpAccount *account;
-  TpConnection *conn = NULL;
   GtkWidget *bbox, *button;
+  GtkWidget *alig;
 
-  account = empathy_account_settings_get_account (settings);
-
-  // if (priv->setting_widget_object != NULL)
-  //   g_object_remove_weak_pointer (G_OBJECT (priv->setting_widget_object),
-  //       (gpointer *) &priv->setting_widget_object);
+  account = tpaw_account_settings_get_account (settings);
 
   priv->dialog_content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
   gtk_container_add (GTK_CONTAINER (priv->alignment_settings),
       priv->dialog_content);
   gtk_widget_show (priv->dialog_content);
 
-  /* request the self contact */
-  if (account != NULL)
-    conn = tp_account_get_connection (account);
-
-  if (conn != NULL &&
-      tp_proxy_get_invalidated (conn) == NULL)
-    {
-      empathy_tp_contact_factory_get_from_handle (conn,
-          tp_connection_get_self_handle (conn),
-          account_dialog_got_self_contact,
-          NULL, NULL, G_OBJECT (dialog));
-    }
-  else
-    {
-      account_dialog_show_contact_details_failed (dialog, FALSE);
-    }
+  alig = gtk_alignment_new (0.5, 0, 1, 1);
+  priv->user_info = tpaw_user_info_new (account);
+  gtk_container_add (GTK_CONTAINER (alig), priv->user_info);
+  gtk_box_pack_start (GTK_BOX (priv->dialog_content), alig, TRUE, TRUE, 0);
+  gtk_widget_show (alig);
+  gtk_widget_show (priv->user_info);
 
   bbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
   gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END);
   gtk_box_pack_end (GTK_BOX (priv->dialog_content), bbox, FALSE, TRUE, 0);
   gtk_widget_show (bbox);
 
-  button = gtk_button_new_with_mnemonic (_("_Edit Connection Parameters..."));
+  button = gtk_button_new_with_mnemonic (_("_Edit Connection Parameters"));
   gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, TRUE, 0);
   gtk_widget_show (button);
   g_signal_connect_swapped (button, "clicked",
       G_CALLBACK (account_dialow_show_edit_params_dialog), dialog);
 
-  icon_name = empathy_account_settings_get_icon_name (settings);
+  icon_name = tpaw_account_settings_get_icon_name (settings);
 
   if (!gtk_icon_theme_has_icon (gtk_icon_theme_get_default (),
           icon_name))
@@ -881,22 +733,19 @@ account_dialog_create_dialog_content (EmpathyAccountsDialog *dialog,
   gtk_image_set_from_icon_name (GTK_IMAGE (priv->image_type),
       icon_name, GTK_ICON_SIZE_DIALOG);
   gtk_widget_set_tooltip_text (priv->image_type,
-      empathy_protocol_name_to_display_name
-      (empathy_account_settings_get_protocol (settings)));
+      tpaw_protocol_name_to_display_name
+      (tpaw_account_settings_get_protocol (settings)));
   gtk_widget_show (priv->image_type);
 
-  accounts_dialog_update_name_label (dialog,
-      empathy_account_settings_get_display_name (settings));
-
   accounts_dialog_update_status_infobar (dialog, account);
 }
 
 static void
-account_dialog_settings_ready_cb (EmpathyAccountSettings *settings,
+account_dialog_settings_ready_cb (TpawAccountSettings *settings,
     GParamSpec *spec,
     EmpathyAccountsDialog *dialog)
 {
-  if (empathy_account_settings_is_ready (settings))
+  if (tpaw_account_settings_is_ready (settings))
     account_dialog_create_dialog_content (dialog, settings);
 }
 
@@ -938,9 +787,9 @@ accounts_dialog_has_pending_change (EmpathyAccountsDialog *dialog,
   if (gtk_tree_selection_get_selected (selection, &model, &iter))
     gtk_tree_model_get (model, &iter, COL_ACCOUNT, account, -1);
 
-  return priv->setting_widget_object != NULL
-      && empathy_account_widget_contains_pending_changes (
-          priv->setting_widget_object);
+  return priv->setting_widget != NULL
+      && tpaw_account_widget_contains_pending_changes (
+          priv->setting_widget);
 }
 
 static void
@@ -1011,9 +860,9 @@ accounts_dialog_button_add_clicked_cb (GtkWidget *button,
 
   response = gtk_dialog_run (GTK_DIALOG (dialog));
 
-  if (response == GTK_RESPONSE_OK)
+  if (response == GTK_RESPONSE_APPLY)
     {
-      EmpathyAccountSettings *settings;
+      TpawAccountSettings *settings;
       TpAccount *account;
 
       settings = empathy_new_account_dialog_get_settings (
@@ -1022,7 +871,7 @@ accounts_dialog_button_add_clicked_cb (GtkWidget *button,
       /* The newly created account has already been added by
        * accounts_dialog_account_validity_changed_cb so we just
        * have to select it. */
-      account = empathy_account_settings_get_account (settings);
+      account = tpaw_account_settings_get_account (settings);
       accounts_dialog_model_set_selected (self, account);
     }
 
@@ -1031,7 +880,7 @@ accounts_dialog_button_add_clicked_cb (GtkWidget *button,
 
 static void
 accounts_dialog_update_settings (EmpathyAccountsDialog *dialog,
-    EmpathyAccountSettings *settings)
+    TpawAccountSettings *settings)
 {
   EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
 
@@ -1063,9 +912,10 @@ accounts_dialog_update_settings (EmpathyAccountsDialog *dialog,
           return;
         }
 
-      /* No account and no profile, warn the user */
+      /* No account selected */
       gtk_widget_hide (priv->vbox_details);
-      gtk_widget_set_sensitive (priv->button_add, FALSE);
+      gtk_widget_set_sensitive (priv->button_add, TRUE);
+      gtk_widget_set_sensitive (priv->button_remove, FALSE);
 
       gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook_account),
           NOTEBOOK_PAGE_NO_PROTOCOL);
@@ -1076,13 +926,19 @@ accounts_dialog_update_settings (EmpathyAccountsDialog *dialog,
    * one for the account selected */
   gtk_widget_show (priv->vbox_details);
 
+  if (priv->user_info != NULL)
+    {
+      tpaw_user_info_apply_async ((TpawUserInfo *) priv->user_info,
+          NULL, NULL);
+      priv->user_info = NULL;
+    }
   if (priv->dialog_content)
     {
       gtk_widget_destroy (priv->dialog_content);
       priv->dialog_content = NULL;
     }
 
-  if (empathy_account_settings_is_ready (settings))
+  if (tpaw_account_settings_is_ready (settings))
     {
       account_dialog_create_dialog_content (dialog, settings);
     }
@@ -1160,6 +1016,28 @@ get_status_icon_for_account (EmpathyAccountsDialog *self,
   return empathy_icon_name_for_presence (presence);
 }
 
+static GdkPixbuf *
+ensure_icon (EmpathyAccountsDialog *self,
+    const gchar *icon_name)
+{
+  EmpathyAccountsDialogPriv *priv = GET_PRIV (self);
+  GdkPixbuf *pixbuf;
+
+  pixbuf = g_hash_table_lookup (priv->icons_cache, icon_name);
+  if (pixbuf == NULL)
+    {
+      pixbuf = tpaw_pixbuf_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON);
+
+      if (pixbuf == NULL)
+        return NULL;
+
+      g_hash_table_insert (priv->icons_cache, g_strdup (icon_name),
+          pixbuf);
+    }
+
+  return g_object_ref (pixbuf);
+}
+
 static void
 accounts_dialog_model_status_pixbuf_data_func (GtkTreeViewColumn *tree_column,
     GtkCellRenderer *cell,
@@ -1168,15 +1046,23 @@ accounts_dialog_model_status_pixbuf_data_func (GtkTreeViewColumn *tree_column,
     EmpathyAccountsDialog *dialog)
 {
   TpAccount *account;
+  const gchar *icon_name;
+  GdkPixbuf *pixbuf;
 
   gtk_tree_model_get (model, iter, COL_ACCOUNT, &account, -1);
 
+  icon_name = get_status_icon_for_account (dialog, account);
+  pixbuf = ensure_icon (dialog, icon_name);
+
   g_object_set (cell,
-      "icon-name", get_status_icon_for_account (dialog, account),
+      "pixbuf", pixbuf,
       NULL);
 
   if (account != NULL)
     g_object_unref (account);
+
+  if (pixbuf != NULL)
+    g_object_unref (pixbuf);
 }
 
 static void
@@ -1186,7 +1072,7 @@ accounts_dialog_model_protocol_pixbuf_data_func (GtkTreeViewColumn *tree_column,
     GtkTreeIter *iter,
     EmpathyAccountsDialog *dialog)
 {
-  EmpathyAccountSettings  *settings;
+  TpawAccountSettings  *settings;
   gchar              *icon_name;
   GdkPixbuf          *pixbuf;
   TpConnectionStatus  status;
@@ -1196,8 +1082,8 @@ accounts_dialog_model_protocol_pixbuf_data_func (GtkTreeViewColumn *tree_column,
       COL_ACCOUNT_SETTINGS, &settings,
       -1);
 
-  icon_name = empathy_account_settings_get_icon_name (settings);
-  pixbuf = empathy_pixbuf_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON);
+  icon_name = tpaw_account_settings_get_icon_name (settings);
+  pixbuf = ensure_icon (dialog, icon_name);
 
   g_object_set (cell,
       "visible", TRUE,
@@ -1258,7 +1144,7 @@ accounts_dialog_name_edited_cb (GtkCellRendererText *renderer,
     gchar *new_text,
     EmpathyAccountsDialog *dialog)
 {
-  EmpathyAccountSettings    *settings;
+  TpawAccountSettings    *settings;
   GtkTreeModel *model;
   GtkTreePath  *treepath;
   GtkTreeIter   iter;
@@ -1285,7 +1171,7 @@ accounts_dialog_name_edited_cb (GtkCellRendererText *renderer,
       -1);
   gtk_tree_path_free (treepath);
 
-  empathy_account_settings_set_display_name_async (settings, new_text,
+  tpaw_account_settings_set_display_name_async (settings, new_text,
       NULL, NULL);
   g_object_set (settings, "display-name-overridden", TRUE, NULL);
   g_object_unref (settings);
@@ -1359,7 +1245,7 @@ accounts_dialog_remove_account_iter (EmpathyAccountsDialog *dialog,
     }
 
   question_dialog_primary_text = g_strdup_printf (
-      _("Do you want to remove %s from your computer?"),
+      _("Do you want to remove %.50s from your computer?"),
       tp_account_get_display_name (account));
 
   accounts_dialog_show_question_dialog (dialog, question_dialog_primary_text,
@@ -1390,24 +1276,6 @@ accounts_dialog_button_remove_clicked_cb (GtkWidget *button,
   accounts_dialog_remove_account_iter (dialog, &iter);
 }
 
-#ifdef HAVE_MEEGO
-static void
-accounts_dialog_view_delete_activated_cb (EmpathyCellRendererActivatable *cell,
-    const gchar *path_string,
-    EmpathyAccountsDialog *dialog)
-{
-  EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
-  GtkTreeModel *model;
-  GtkTreeIter iter;
-
-  model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->treeview));
-  if (!gtk_tree_model_get_iter_from_string (model, &iter, path_string))
-    return;
-
-  accounts_dialog_remove_account_iter (dialog, &iter);
-}
-#endif /* HAVE_MEEGO */
-
 static void
 accounts_dialog_model_add_columns (EmpathyAccountsDialog *dialog)
 {
@@ -1443,45 +1311,32 @@ accounts_dialog_model_add_columns (EmpathyAccountsDialog *dialog)
       NULL);
 
   /* Name renderer */
-  cell = gtk_cell_renderer_text_new ();
-  g_object_set (cell,
+  priv->name_renderer = gtk_cell_renderer_text_new ();
+  g_object_set (priv->name_renderer,
       "ellipsize", PANGO_ELLIPSIZE_END,
       "width-chars", 25,
       "editable", TRUE,
       NULL);
-  gtk_tree_view_column_pack_start (column, cell, TRUE);
-  gtk_tree_view_column_add_attribute (column, cell, "text", COL_NAME);
-  g_signal_connect (cell, "edited",
+  gtk_tree_view_column_pack_start (column, priv->name_renderer, TRUE);
+  gtk_tree_view_column_add_attribute (column, priv->name_renderer,
+      "text", COL_NAME);
+  g_signal_connect (priv->name_renderer, "edited",
       G_CALLBACK (accounts_dialog_name_edited_cb),
       dialog);
-  g_signal_connect (cell, "editing-started",
+  g_signal_connect (priv->name_renderer, "editing-started",
       G_CALLBACK (accounts_dialog_name_editing_started_cb),
       dialog);
-  g_object_set (cell, "ypad", 4, NULL);
-
-#ifdef HAVE_MEEGO
-  /* Delete column */
-  cell = empathy_cell_renderer_activatable_new ();
-  gtk_tree_view_column_pack_start (column, cell, FALSE);
-  g_object_set (cell,
-        "icon-name", GTK_STOCK_DELETE,
-        "show-on-select", TRUE,
-        NULL);
-
-  g_signal_connect (cell, "path-activated",
-      G_CALLBACK (accounts_dialog_view_delete_activated_cb),
-      dialog);
-#endif /* HAVE_MEEGO */
+  g_object_set (priv->name_renderer, "ypad", 4, NULL);
 }
 
-static EmpathyAccountSettings *
+static TpawAccountSettings *
 accounts_dialog_model_get_selected_settings (EmpathyAccountsDialog *dialog)
 {
   GtkTreeView      *view;
   GtkTreeModel     *model;
   GtkTreeSelection *selection;
   GtkTreeIter       iter;
-  EmpathyAccountSettings   *settings;
+  TpawAccountSettings   *settings;
   EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
 
   view = GTK_TREE_VIEW (priv->treeview);
@@ -1501,7 +1356,7 @@ accounts_dialog_model_selection_changed (GtkTreeSelection *selection,
     EmpathyAccountsDialog *dialog)
 {
   EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
-  EmpathyAccountSettings *settings;
+  TpawAccountSettings *settings;
   GtkTreeModel *model;
   GtkTreeIter   iter;
   gboolean      is_selection;
@@ -1515,9 +1370,9 @@ accounts_dialog_model_selection_changed (GtkTreeSelection *selection,
   if (settings != NULL)
     g_object_unref (settings);
 
-  if (priv->setting_widget_object != NULL)
+  if (priv->setting_widget != NULL)
     {
-      g_object_get (priv->setting_widget_object,
+      g_object_get (priv->setting_widget,
           "creating-account", &creating, NULL);
     }
 
@@ -1545,8 +1400,8 @@ accounts_dialog_selection_change_response_cb (GtkDialog *message_dialog,
         GtkTreeSelection *selection;
 
         priv->force_change_row = TRUE;
-        empathy_account_widget_discard_pending_changes (
-            priv->setting_widget_object);
+        tpaw_account_widget_discard_pending_changes (
+            priv->setting_widget);
 
         path = gtk_tree_row_reference_get_path (priv->destination_row);
         selection = gtk_tree_view_get_selection (
@@ -1631,7 +1486,7 @@ accounts_dialog_model_setup (EmpathyAccountsDialog *dialog)
       G_TYPE_STRING,         /* name */
       G_TYPE_UINT,           /* status */
       TP_TYPE_ACCOUNT,   /* account */
-      EMPATHY_TYPE_ACCOUNT_SETTINGS); /* settings */
+      TPAW_TYPE_ACCOUNT_SETTINGS); /* settings */
 
   gtk_tree_view_set_model (GTK_TREE_VIEW (priv->treeview),
       GTK_TREE_MODEL (store));
@@ -1731,6 +1586,30 @@ accounts_dialog_treeview_enabled_cb (GtkMenuItem *item,
   enable_and_connect_account (account, !enabled);
 }
 
+static void
+accounts_dialog_treeview_rename_cb (GtkMenuItem *item,
+    EmpathyAccountsDialog *self)
+{
+  EmpathyAccountsDialogPriv *priv = GET_PRIV (self);
+  GtkTreePath *path;
+  GtkTreeIter iter;
+  GtkTreeSelection *selection;
+  GtkTreeModel *model;
+
+  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->treeview));
+  if (!gtk_tree_selection_get_selected (selection, &model, &iter))
+    return;
+  path = gtk_tree_model_get_path (model, &iter);
+
+  g_object_set (G_OBJECT (priv->name_renderer), "editable", TRUE, NULL);
+
+  gtk_widget_grab_focus (GTK_WIDGET (priv->treeview));
+  gtk_tree_view_set_cursor (GTK_TREE_VIEW (priv->treeview), path,
+      gtk_tree_view_get_column (GTK_TREE_VIEW (priv->treeview), 0), TRUE);
+
+  gtk_tree_path_free (path);
+}
+
 static gboolean
 accounts_dialog_treeview_button_press_event_cb (GtkTreeView *view,
     GdkEventButton *event,
@@ -1742,8 +1621,7 @@ accounts_dialog_treeview_button_press_event_cb (GtkTreeView *view,
   GtkTreePath *path = NULL;
   GtkTreeIter iter;
   GtkWidget *menu;
-  GtkWidget *item_enable, *item_disable;
-  GtkWidget *image_enable, *image_disable;
+  GtkWidget *item;
 
   /* ignore multiple clicks */
   if (event->type != GDK_BUTTON_PRESS)
@@ -1766,49 +1644,37 @@ accounts_dialog_treeview_button_press_event_cb (GtkTreeView *view,
   /* Create the menu */
   menu = empathy_context_menu_new (GTK_WIDGET (view));
 
-  /* Get images for menu items */
-  image_enable = gtk_image_new_from_icon_name (empathy_icon_name_for_presence (
-        tp_account_manager_get_most_available_presence (
-          priv->account_manager, NULL, NULL)),
-      GTK_ICON_SIZE_MENU);
-  image_disable = gtk_image_new_from_icon_name (
-      empathy_icon_name_for_presence (TP_CONNECTION_PRESENCE_TYPE_OFFLINE),
-      GTK_ICON_SIZE_MENU);
-
-  /* Menu items: to enabled/disable the account */
-  item_enable = gtk_image_menu_item_new_with_mnemonic (_("_Enable"));
-  item_disable = gtk_image_menu_item_new_with_mnemonic (_("_Disable"));
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item_enable),
-      image_enable);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item_disable),
-      image_disable);
-
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu), item_enable);
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu), item_disable);
+  /* Menu item: to enabled/disable the account */
+  item = gtk_check_menu_item_new_with_mnemonic (_("_Enabled"));
+
+  gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
 
   if (account_can_be_enabled (account))
     {
-      if (tp_account_is_enabled (account))
-        {
-          tp_g_signal_connect_object (item_disable, "activate",
-              G_CALLBACK (accounts_dialog_treeview_enabled_cb), account, 0);
-          gtk_widget_set_sensitive (item_enable, FALSE);
-        }
-      else
-        {
-          tp_g_signal_connect_object (item_enable, "activate",
-              G_CALLBACK (accounts_dialog_treeview_enabled_cb), account, 0);
-          gtk_widget_set_sensitive (item_disable, FALSE);
-        }
+      gboolean active;
+
+      active = tp_account_is_enabled (account);
+      gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item),
+          active);
+
+      tp_g_signal_connect_object (item, "activate",
+          G_CALLBACK (accounts_dialog_treeview_enabled_cb), account, 0);
     }
   else
     {
-      gtk_widget_set_sensitive (item_enable, FALSE);
-      gtk_widget_set_sensitive (item_disable, FALSE);
+      gtk_widget_set_sensitive (item, FALSE);
     }
 
-  gtk_widget_show (item_enable);
-  gtk_widget_show (item_disable);
+  gtk_widget_show (item);
+
+  /* Menu item: Rename */
+  item = gtk_menu_item_new_with_mnemonic (_("Rename"));
+  gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+
+  tp_g_signal_connect_object (item, "activate",
+      G_CALLBACK (accounts_dialog_treeview_rename_cb), dialog, 0);
+
+  gtk_widget_show (item);
 
   /* FIXME: Add here presence items, to be able to set per-account presence */
 
@@ -1826,7 +1692,7 @@ finally:
 static void
 reload_account_widget (EmpathyAccountsDialog *self)
 {
-  EmpathyAccountSettings *settings;
+  TpawAccountSettings *settings;
 
   settings = accounts_dialog_model_get_selected_settings (self);
   accounts_dialog_update_settings (self, settings);
@@ -1914,35 +1780,21 @@ accounts_dialog_presence_changed_cb (TpAccount *account,
 static void
 accounts_dialog_account_display_name_changed_cb (TpAccount *account,
   GParamSpec *pspec,
-  gpointer user_data)
+  EmpathyAccountsDialog *dialog)
 {
-  const gchar *display_name;
-  GtkTreeIter iter;
-  GtkTreeModel *model;
-  EmpathyAccountSettings *settings;
-  TpAccount *selected_account;
-  EmpathyAccountsDialog *dialog = EMPATHY_ACCOUNTS_DIALOG (user_data);
   EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
+  GtkTreeModel *model;
+  GtkTreeIter iter;
 
-  display_name = tp_account_get_display_name (account);
   model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->treeview));
-  settings = accounts_dialog_model_get_selected_settings (dialog);
-  if (settings == NULL)
-    return;
-
-  selected_account = empathy_account_settings_get_account (settings);
-
   if (accounts_dialog_get_account_iter (dialog, account, &iter))
     {
       gtk_list_store_set (GTK_LIST_STORE (model), &iter,
-          COL_NAME, display_name,
+          COL_NAME, tp_account_get_display_name (account),
           -1);
     }
 
-  if (selected_account == account)
-    accounts_dialog_update_name_label (dialog, display_name);
-
-  g_object_unref (settings);
+  accounts_dialog_update_status_infobar (dialog, account);
 }
 
 static void
@@ -1983,7 +1835,7 @@ static void
 accounts_dialog_add_account (EmpathyAccountsDialog *dialog,
     TpAccount *account)
 {
-  EmpathyAccountSettings *settings;
+  TpawAccountSettings *settings;
   GtkTreeModel       *model;
   GtkTreeIter         iter;
   TpConnectionStatus  status;
@@ -1996,7 +1848,7 @@ accounts_dialog_add_account (EmpathyAccountsDialog *dialog,
   status = tp_account_get_connection_status (account, NULL);
   name = tp_account_get_display_name (account);
 
-  settings = empathy_account_settings_new_for_account (account);
+  settings = tpaw_account_settings_new_for_account (account);
 
   selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->treeview));
 
@@ -2072,11 +1924,11 @@ accounts_dialog_accounts_model_row_inserted_cb (GtkTreeModel *model,
 {
   EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
 
-  if (priv->setting_widget_object != NULL &&
+  if (priv->setting_widget != NULL &&
       accounts_dialog_has_valid_accounts (dialog))
     {
-      empathy_account_widget_set_other_accounts_exist (
-          priv->setting_widget_object, TRUE);
+      tpaw_account_widget_set_other_accounts_exist (
+          priv->setting_widget, TRUE);
     }
 }
 
@@ -2087,11 +1939,11 @@ accounts_dialog_accounts_model_row_deleted_cb (GtkTreeModel *model,
 {
   EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
 
-  if (priv->setting_widget_object != NULL &&
+  if (priv->setting_widget != NULL &&
       !accounts_dialog_has_valid_accounts (dialog))
     {
-      empathy_account_widget_set_other_accounts_exist (
-          priv->setting_widget_object, FALSE);
+      tpaw_account_widget_set_other_accounts_exist (
+          priv->setting_widget, FALSE);
     }
 }
 
@@ -2303,11 +2155,11 @@ accounts_dialog_cms_prepare_cb (GObject *source,
     GAsyncResult *result,
     gpointer user_data)
 {
-  EmpathyConnectionManagers *cms = EMPATHY_CONNECTION_MANAGERS (source);
+  TpawConnectionManagers *cms = TPAW_CONNECTION_MANAGERS (source);
   EmpathyAccountsDialog *dialog = user_data;
   EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
 
-  if (!empathy_connection_managers_prepare_finish (cms, result, NULL))
+  if (!tpaw_connection_managers_prepare_finish (cms, result, NULL))
     goto out;
 
   /* No need to update the settings if we are already preparing one */
@@ -2345,16 +2197,16 @@ accounts_dialog_accounts_setup (EmpathyAccountsDialog *dialog)
       dialog);
 
   /* Add existing accounts */
-  accounts = tp_account_manager_get_valid_accounts (priv->account_manager);
+  accounts = tp_account_manager_dup_valid_accounts (priv->account_manager);
   for (l = accounts; l; l = l->next)
     {
       accounts_dialog_add_account (dialog, l->data);
     }
-  g_list_free (accounts);
+  g_list_free_full (accounts, g_object_unref);
 
-  priv->cms = empathy_connection_managers_dup_singleton ();
+  priv->cms = tpaw_connection_managers_dup_singleton ();
 
-  empathy_connection_managers_prepare_async (priv->cms,
+  tpaw_connection_managers_prepare_async (priv->cms,
       accounts_dialog_cms_prepare_cb, dialog);
 
   accounts_dialog_model_select_first (dialog);
@@ -2435,7 +2287,7 @@ accounts_dialog_build_ui (EmpathyAccountsDialog *dialog)
 
   filename = empathy_file_lookup ("empathy-accounts-dialog.ui", "src");
 
-  gui = empathy_builder_get_file (filename,
+  gui = tpaw_builder_get_file (filename,
       "accounts_dialog_hbox", &top_hbox,
       "vbox_details", &priv->vbox_details,
       "alignment_settings", &priv->alignment_settings,
@@ -2451,7 +2303,7 @@ accounts_dialog_build_ui (EmpathyAccountsDialog *dialog)
       NULL);
   g_free (filename);
 
-  empathy_builder_connect (gui, dialog,
+  tpaw_builder_connect (gui, dialog,
       "button_add", "clicked", accounts_dialog_button_add_clicked_cb,
       "button_remove", "clicked", accounts_dialog_button_remove_clicked_cb,
       "button_import", "clicked", accounts_dialog_button_import_clicked_cb,
@@ -2467,11 +2319,6 @@ accounts_dialog_build_ui (EmpathyAccountsDialog *dialog)
 
   action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
 
-#ifdef HAVE_MEEGO
-  gtk_widget_hide (action_area);
-  gtk_widget_hide (priv->button_remove);
-#endif /* HAVE_MEEGO */
-
   /* Display loading page */
   priv->loading = TRUE;
 
@@ -2517,6 +2364,7 @@ accounts_dialog_build_ui (EmpathyAccountsDialog *dialog)
 
   /* first row */
   priv->label_name = gtk_label_new (NULL);
+  gtk_label_set_ellipsize (GTK_LABEL (priv->label_name), PANGO_ELLIPSIZE_END);
   gtk_grid_attach (GTK_GRID (grid), priv->label_name, 1, 0, 1, 1);
 
   /* second row */
@@ -2584,12 +2432,25 @@ do_dispose (GObject *obj)
   EmpathyAccountsDialog *dialog = EMPATHY_ACCOUNTS_DIALOG (obj);
   EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
 
+  if (priv->user_info != NULL)
+    {
+      tpaw_user_info_apply_async ((TpawUserInfo *) priv->user_info,
+          NULL, NULL);
+      priv->user_info = NULL;
+    }
+
   if (priv->connecting_id != 0)
     {
       g_source_remove (priv->connecting_id);
       priv->connecting_id = 0;
     }
 
+  if (priv->connectivity)
+    {
+      g_object_unref (priv->connectivity);
+      priv->connectivity = NULL;
+    }
+
   if (priv->account_manager != NULL)
     {
       g_object_unref (priv->account_manager);
@@ -2602,18 +2463,14 @@ do_dispose (GObject *obj)
       priv->cms = NULL;
     }
 
-  if (priv->connectivity)
-    {
-      g_object_unref (priv->connectivity);
-      priv->connectivity = NULL;
-    }
-
   if (priv->initial_selection != NULL)
     {
       g_object_unref (priv->initial_selection);
       priv->initial_selection = NULL;
     }
 
+  tp_clear_pointer (&priv->icons_cache, g_hash_table_unref);
+
   G_OBJECT_CLASS (empathy_accounts_dialog_parent_class)->dispose (obj);
 }
 
@@ -2675,7 +2532,8 @@ do_constructed (GObject *object)
   tp_proxy_prepare_async (priv->account_manager, NULL,
       accounts_dialog_manager_ready_cb, dialog);
 
-  priv->connectivity = empathy_connectivity_dup_singleton ();
+  priv->connectivity = g_network_monitor_get_default ();
+  g_object_ref (priv->connectivity);
 }
 
 static void
@@ -2707,6 +2565,9 @@ empathy_accounts_dialog_init (EmpathyAccountsDialog *dialog)
       EMPATHY_TYPE_ACCOUNTS_DIALOG,
       EmpathyAccountsDialogPriv);
   dialog->priv = priv;
+
+  priv->icons_cache = g_hash_table_new_full (g_str_hash, g_str_equal,
+      g_free, g_object_unref);
 }
 
 /* public methods */
@@ -2725,7 +2586,7 @@ empathy_accounts_dialog_show (GtkWindow *parent,
 
   if (selected_account)
     {
-      if (priv->cms != NULL && empathy_connection_managers_is_ready (priv->cms))
+      if (priv->cms != NULL && tpaw_connection_managers_is_ready (priv->cms))
         accounts_dialog_set_selected_account (dialog, selected_account);
       else
         /* save the selection to set it later when the cms
@@ -2739,9 +2600,94 @@ empathy_accounts_dialog_show (GtkWindow *parent,
   return GTK_WIDGET (dialog);
 }
 
-void
-empathy_accounts_dialog_show_application (GdkScreen *screen,
-    TpAccount *selected_account,
+#ifdef HAVE_UOA
+typedef struct
+{
+  TpAccount *account;
+  gboolean if_needed;
+} LaunchUOACtx;
+
+static LaunchUOACtx *
+launch_uoa_ctx_new (TpAccount *account,
+    gboolean if_needed)
+{
+  LaunchUOACtx *ctx;
+
+  ctx = g_slice_new0 (LaunchUOACtx);
+  if (account != NULL)
+    ctx->account = g_object_ref (account);
+  ctx->if_needed = if_needed;
+
+  return ctx;
+}
+
+static void
+launch_uoa_ctx_free (LaunchUOACtx *ctx)
+{
+  g_clear_object (&ctx->account);
+  g_slice_free (LaunchUOACtx, ctx);
+}
+
+static void
+am_prepare_cb (GObject *source,
+    GAsyncResult *result,
+    gpointer user_data)
+{
+  TpAccountManager *manager = TP_ACCOUNT_MANAGER (source);
+  GError *error = NULL;
+  LaunchUOACtx *ctx = user_data;
+  gchar *args = NULL;
+
+  if (!tp_proxy_prepare_finish (manager, result, &error))
+    {
+      DEBUG ("Failed to prepare account manager: %s", error->message);
+      g_error_free (error);
+      goto out;
+    }
+
+  if (ctx->if_needed && empathy_accounts_has_non_salut_accounts (manager))
+    goto out;
+
+  if (ctx->account != NULL)
+    {
+      const GValue *value;
+
+      value = tp_account_get_storage_identifier (ctx->account);
+
+      if (G_VALUE_HOLDS_UINT (value))
+        args = g_strdup_printf ("account-details=%u", g_value_get_uint (value));
+    }
+
+  empathy_launch_external_app ("unity-credentials-panel.desktop", args, NULL);
+
+  g_free (args);
+out:
+  launch_uoa_ctx_free (ctx);
+}
+
+static void
+launch_uoa_panel (TpAccount *selected_account,
+    gboolean if_needed,
+    gboolean hidden)
+{
+  TpAccountManager *manager;
+
+  if (hidden)
+    /* Nothing to do */
+    return;
+
+  manager = tp_account_manager_dup ();
+
+  tp_proxy_prepare_async (manager, NULL, am_prepare_cb,
+      launch_uoa_ctx_new (selected_account, if_needed));
+
+  g_object_unref (manager);
+}
+
+#else /* HAVE_UOA */
+
+static void
+launch_empathy_accounts (TpAccount *selected_account,
     gboolean if_needed,
     gboolean hidden)
 {
@@ -2770,6 +2716,20 @@ empathy_accounts_dialog_show_application (GdkScreen *screen,
 
   g_string_free (args, TRUE);
 }
+#endif /* HAVE_UOA */
+
+void
+empathy_accounts_dialog_show_application (GdkScreen *screen,
+    TpAccount *selected_account,
+    gboolean if_needed,
+    gboolean hidden)
+{
+#ifdef HAVE_UOA
+  launch_uoa_panel (selected_account, if_needed, hidden);
+#else
+  launch_empathy_accounts (selected_account, if_needed, hidden);
+#endif
+}
 
 gboolean
 empathy_accounts_dialog_is_creating (EmpathyAccountsDialog *dialog)
@@ -2777,10 +2737,10 @@ empathy_accounts_dialog_is_creating (EmpathyAccountsDialog *dialog)
   EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
   gboolean result = FALSE;
 
-  if (priv->setting_widget_object == NULL)
+  if (priv->setting_widget == NULL)
     goto out;
 
-  g_object_get (priv->setting_widget_object,
+  g_object_get (priv->setting_widget,
       "creating-account", &result, NULL);
 
 out: