]> git.0d.be Git - empathy.git/commitdiff
Port the main of empathy to EmpathyAccount
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>
Fri, 26 Jun 2009 13:49:13 +0000 (14:49 +0100)
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>
Wed, 1 Jul 2009 13:19:40 +0000 (14:19 +0100)
13 files changed:
src/empathy-accounts-dialog.c
src/empathy-accounts-dialog.h
src/empathy-chat-window.c
src/empathy-chat-window.h
src/empathy-chatrooms-window.c
src/empathy-event-manager.c
src/empathy-import-dialog.c
src/empathy-import-dialog.h
src/empathy-import-pidgin.c
src/empathy-main-window.c
src/empathy-new-chatroom-dialog.c
src/empathy-status-icon.c
src/empathy.c

index 4cf39110875c0d0fa906ff660b4beadc6ae35075..98e848566c0443e094f9dc0090382d830ae8fb28 100644 (file)
@@ -31,7 +31,6 @@
 #include <glib/gi18n.h>
 #include <dbus/dbus-glib.h>
 
-#include <libmissioncontrol/mc-account.h>
 #include <libmissioncontrol/mc-profile.h>
 #include <telepathy-glib/util.h>
 
@@ -96,7 +95,7 @@ enum {
 };
 
 static void       accounts_dialog_update_account            (EmpathyAccountsDialog    *dialog,
-                                                            McAccount                *account);
+                                                            EmpathyAccount           *account);
 static void       accounts_dialog_model_setup               (EmpathyAccountsDialog    *dialog);
 static void       accounts_dialog_model_add_columns         (EmpathyAccountsDialog    *dialog);
 static void       accounts_dialog_name_editing_started_cb   (GtkCellRenderer          *renderer,
@@ -109,19 +108,19 @@ static void       accounts_dialog_model_pixbuf_data_func    (GtkTreeViewColumn
                                                             GtkTreeModel             *model,
                                                             GtkTreeIter              *iter,
                                                             EmpathyAccountsDialog    *dialog);
-static McAccount *accounts_dialog_model_get_selected        (EmpathyAccountsDialog    *dialog);
+static EmpathyAccount *accounts_dialog_model_get_selected        (EmpathyAccountsDialog    *dialog);
 static void       accounts_dialog_model_set_selected        (EmpathyAccountsDialog    *dialog,
-                                                            McAccount                *account);
+                                                            EmpathyAccount           *account);
 static gboolean   accounts_dialog_model_remove_selected     (EmpathyAccountsDialog    *dialog);
 static void       accounts_dialog_model_selection_changed   (GtkTreeSelection         *selection,
                                                             EmpathyAccountsDialog    *dialog);
 static void       accounts_dialog_add_or_update_account     (EmpathyAccountsDialog    *dialog,
-                                                            McAccount                *account);
+                                                            EmpathyAccount           *account);
 static void       accounts_dialog_account_added_cb          (EmpathyAccountManager    *manager,
-                                                            McAccount                *account,
+                                                            EmpathyAccount           *account,
                                                             EmpathyAccountsDialog    *dialog);
 static void       accounts_dialog_account_removed_cb        (EmpathyAccountManager    *manager,
-                                                            McAccount                *account,
+                                                            EmpathyAccount           *account,
                                                             EmpathyAccountsDialog    *dialog);
 static gboolean   accounts_dialog_row_changed_foreach       (GtkTreeModel             *model,
                                                             GtkTreePath              *path,
@@ -129,7 +128,7 @@ static gboolean   accounts_dialog_row_changed_foreach       (GtkTreeModel
                                                             gpointer                  user_data);
 static gboolean   accounts_dialog_flash_connecting_cb       (EmpathyAccountsDialog    *dialog);
 static void       accounts_dialog_connection_changed_cb     (EmpathyAccountManager    *manager,
-                                                            McAccount                *account,
+                                                            EmpathyAccount           *account,
                                                             TpConnectionStatusReason  reason,
                                                             TpConnectionStatus        current,
                                                             TpConnectionStatus        previous,
@@ -154,12 +153,12 @@ static void       accounts_dialog_destroy_cb                (GtkWidget
 
 static void
 accounts_dialog_update_name_label (EmpathyAccountsDialog *dialog,
-                                  McAccount             *account)
+                                  EmpathyAccount        *account)
 {
        gchar *text;
 
        text = g_markup_printf_escaped ("<big><b>%s</b></big>",
-                       mc_account_get_display_name (account));
+                       empathy_account_get_display_name (account));
        gtk_label_set_markup (GTK_LABEL (dialog->label_name), text);
 
        g_free (text);
@@ -167,7 +166,7 @@ accounts_dialog_update_name_label (EmpathyAccountsDialog *dialog,
 
 static void
 accounts_dialog_update_account (EmpathyAccountsDialog *dialog,
-                               McAccount            *account)
+                               EmpathyAccount       *account)
 {
        McProfile   *profile;
        const gchar *config_ui;
@@ -216,7 +215,7 @@ accounts_dialog_update_account (EmpathyAccountsDialog *dialog,
                dialog->settings_widget = NULL;
        }
 
-       profile = mc_account_get_profile (account);
+       profile = empathy_account_get_profile (account);
        config_ui = mc_profile_get_configuration_ui (profile);
        if (!tp_strdiff (config_ui, "jabber")) {
                dialog->settings_widget =
@@ -282,10 +281,10 @@ accounts_dialog_model_setup (EmpathyAccountsDialog *dialog)
        GtkTreeSelection *selection;
 
        store = gtk_list_store_new (COL_COUNT,
-                                   G_TYPE_BOOLEAN,    /* enabled */
-                                   G_TYPE_STRING,     /* name */
-                                   G_TYPE_UINT,       /* status */
-                                   MC_TYPE_ACCOUNT);  /* account */
+                                   G_TYPE_BOOLEAN,        /* enabled */
+                                   G_TYPE_STRING,         /* name */
+                                   G_TYPE_UINT,           /* status */
+                                   EMPATHY_TYPE_ACCOUNT); /* account */
 
        gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->treeview),
                                 GTK_TREE_MODEL (store));
@@ -311,7 +310,7 @@ accounts_dialog_name_edited_cb (GtkCellRendererText   *renderer,
                                gchar                 *new_text,
                                EmpathyAccountsDialog *dialog)
 {
-       McAccount    *account;
+       EmpathyAccount    *account;
        GtkTreeModel *model;
        GtkTreePath  *treepath;
        GtkTreeIter   iter;
@@ -333,7 +332,7 @@ accounts_dialog_name_edited_cb (GtkCellRendererText   *renderer,
                            -1);
        gtk_tree_path_free (treepath);
 
-       mc_account_set_display_name (account, new_text);
+       empathy_account_set_display_name (account, new_text);
        g_object_unref (account);
 }
 
@@ -342,7 +341,7 @@ accounts_dialog_enable_toggled_cb (GtkCellRendererToggle *cell_renderer,
                                   gchar                 *path,
                                   EmpathyAccountsDialog *dialog)
 {
-       McAccount    *account;
+       EmpathyAccount    *account;
        GtkTreeModel *model;
        GtkTreePath  *treepath;
        GtkTreeIter   iter;
@@ -356,11 +355,11 @@ accounts_dialog_enable_toggled_cb (GtkCellRendererToggle *cell_renderer,
                            -1);
        gtk_tree_path_free (treepath);
 
-       enabled = mc_account_is_enabled (account);
-       mc_account_set_enabled (account, !enabled);
+       enabled = empathy_account_is_enabled (account);
+       empathy_account_set_enabled (account, !enabled);
 
        DEBUG ("%s account %s", enabled ? "Disabled" : "Enable",
-               mc_account_get_display_name (account));
+               empathy_account_get_display_name (account));
 
        g_object_unref (account);
 }
@@ -457,7 +456,7 @@ accounts_dialog_model_pixbuf_data_func (GtkTreeViewColumn    *tree_column,
                                        GtkTreeIter          *iter,
                                        EmpathyAccountsDialog *dialog)
 {
-       McAccount          *account;
+       EmpathyAccount     *account;
        const gchar        *icon_name;
        GdkPixbuf          *pixbuf;
        TpConnectionStatus  status;
@@ -504,7 +503,7 @@ accounts_dialog_model_pixbuf_data_func (GtkTreeViewColumn    *tree_column,
 
 static gboolean
 accounts_dialog_get_account_iter (EmpathyAccountsDialog *dialog,
-                                McAccount             *account,
+                                EmpathyAccount        *account,
                                 GtkTreeIter           *iter)
 {
        GtkTreeView      *view;
@@ -520,7 +519,7 @@ accounts_dialog_get_account_iter (EmpathyAccountsDialog *dialog,
        for (ok = gtk_tree_model_get_iter_first (model, iter);
             ok;
             ok = gtk_tree_model_iter_next (model, iter)) {
-               McAccount *this_account;
+               EmpathyAccount *this_account;
                gboolean   equal;
 
                gtk_tree_model_get (model, iter,
@@ -538,14 +537,14 @@ accounts_dialog_get_account_iter (EmpathyAccountsDialog *dialog,
        return FALSE;
 }
 
-static McAccount *
+static EmpathyAccount *
 accounts_dialog_model_get_selected (EmpathyAccountsDialog *dialog)
 {
        GtkTreeView      *view;
        GtkTreeModel     *model;
        GtkTreeSelection *selection;
        GtkTreeIter       iter;
-       McAccount        *account;
+       EmpathyAccount   *account;
 
        view = GTK_TREE_VIEW (dialog->treeview);
        selection = gtk_tree_view_get_selection (view);
@@ -561,7 +560,7 @@ accounts_dialog_model_get_selected (EmpathyAccountsDialog *dialog)
 
 static void
 accounts_dialog_model_set_selected (EmpathyAccountsDialog *dialog,
-                                   McAccount             *account)
+                                   EmpathyAccount        *account)
 {
        GtkTreeSelection *selection;
        GtkTreeIter       iter;
@@ -594,7 +593,7 @@ static void
 accounts_dialog_model_selection_changed (GtkTreeSelection     *selection,
                                         EmpathyAccountsDialog *dialog)
 {
-       McAccount    *account;
+       EmpathyAccount    *account;
        GtkTreeModel *model;
        GtkTreeIter   iter;
        gboolean      is_selection;
@@ -611,7 +610,7 @@ accounts_dialog_model_selection_changed (GtkTreeSelection     *selection,
 
 static void
 accounts_dialog_add_or_update_account (EmpathyAccountsDialog *dialog,
-                                      McAccount             *account)
+                                      EmpathyAccount        *account)
 {
        GtkTreeModel       *model;
        GtkTreeIter         iter;
@@ -620,9 +619,9 @@ accounts_dialog_add_or_update_account (EmpathyAccountsDialog *dialog,
        gboolean            enabled;
 
        model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->treeview));
-       status = mission_control_get_connection_status (dialog->mc, account, NULL);
-       name = mc_account_get_display_name (account);
-       enabled = mc_account_is_enabled (account);
+       g_object_get (account, "status", &status, NULL);
+       name = empathy_account_get_display_name (account);
+       enabled = empathy_account_is_enabled (account);
 
        if (!accounts_dialog_get_account_iter (dialog, account, &iter)) {
                DEBUG ("Adding new account");
@@ -646,7 +645,7 @@ accounts_dialog_add_or_update_account (EmpathyAccountsDialog *dialog,
 
 static void
 accounts_dialog_account_added_cb (EmpathyAccountManager *manager,
-                                 McAccount *account,
+                                 EmpathyAccount *account,
                                  EmpathyAccountsDialog *dialog)
 {
        const gchar *current_name;
@@ -656,25 +655,25 @@ accounts_dialog_account_added_cb (EmpathyAccountManager *manager,
 
        /* Change the display name to "%s (%s)" % (protocol, account).
         *  - The protocol is the display name of the profile.
-        *  - The account should be the normalized name of the McAccount but
+        *  - The account should be the normalized name of the EmpathyAccount but
         *    it's not set until first connection, so we get the "account"
         *    parameter for CM that have it. */
-       current_name = mc_account_get_display_name (account);
-       mc_account_get_param_string (account, "account", &account_param);
+       current_name = empathy_account_get_display_name (account);
+       account_param = empathy_account_get_param_string (account, "account");
        if (!EMP_STR_EMPTY (account_param)) {
                McProfile   *profile;
                const gchar *profile_name;
                gchar       *new_name;
 
-               profile = mc_account_get_profile (account);
+               profile = empathy_account_get_profile (account);
                profile_name = mc_profile_get_display_name (profile);
                new_name = g_strdup_printf ("%s (%s)", profile_name,
                                            account_param);
 
                DEBUG ("Setting new display name for account %s: '%s'",
-                      mc_account_get_unique_name (account), new_name);
+                      empathy_account_get_unique_name (account), new_name);
 
-               mc_account_set_display_name (account, new_name);
+               empathy_account_set_display_name (account, new_name);
                g_free (new_name);
                g_object_unref (profile);
        } else {
@@ -685,7 +684,7 @@ accounts_dialog_account_added_cb (EmpathyAccountManager *manager,
 
 static void
 accounts_dialog_account_removed_cb (EmpathyAccountManager *manager,
-                                   McAccount            *account,
+                                   EmpathyAccount       *account,
                                    EmpathyAccountsDialog *dialog)
 {
 
@@ -722,7 +721,7 @@ accounts_dialog_flash_connecting_cb (EmpathyAccountsDialog *dialog)
 
 static void
 accounts_dialog_connection_changed_cb     (EmpathyAccountManager    *manager,
-                                          McAccount                *account,
+                                          EmpathyAccount           *account,
                                           TpConnectionStatusReason  reason,
                                           TpConnectionStatus        current,
                                           TpConnectionStatus        previous,
@@ -763,7 +762,7 @@ accounts_dialog_connection_changed_cb     (EmpathyAccountManager    *manager,
 
 static void
 enable_or_disable_account (EmpathyAccountsDialog *dialog,
-                          McAccount *account,
+                          EmpathyAccount *account,
                           gboolean enabled)
 {
        GtkTreeModel *model;
@@ -773,7 +772,7 @@ enable_or_disable_account (EmpathyAccountsDialog *dialog,
        model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->treeview));
 
        DEBUG ("Account %s is now %s",
-               mc_account_get_display_name (account),
+               empathy_account_get_display_name (account),
                enabled ? "enabled" : "disabled");
 
        if (accounts_dialog_get_account_iter (dialog, account, &iter)) {
@@ -785,7 +784,7 @@ enable_or_disable_account (EmpathyAccountsDialog *dialog,
 
 static void
 accounts_dialog_account_disabled_cb (EmpathyAccountManager *manager,
-                                    McAccount             *account,
+                                    EmpathyAccount        *account,
                                     EmpathyAccountsDialog *dialog)
 {
        enable_or_disable_account (dialog, account, FALSE);
@@ -793,7 +792,7 @@ accounts_dialog_account_disabled_cb (EmpathyAccountManager *manager,
 
 static void
 accounts_dialog_account_enabled_cb (EmpathyAccountManager *manager,
-                                   McAccount             *account,
+                                   EmpathyAccount        *account,
                                    EmpathyAccountsDialog *dialog)
 {
        enable_or_disable_account (dialog, account, TRUE);
@@ -801,10 +800,10 @@ accounts_dialog_account_enabled_cb (EmpathyAccountManager *manager,
 
 static void
 accounts_dialog_account_changed_cb (EmpathyAccountManager *manager,
-                                   McAccount             *account,
+                                   EmpathyAccount        *account,
                                    EmpathyAccountsDialog  *dialog)
 {
-       McAccount *selected_account;
+       EmpathyAccount *selected_account;
 
        accounts_dialog_add_or_update_account (dialog, account);
        selected_account = accounts_dialog_model_get_selected (dialog);
@@ -818,7 +817,7 @@ accounts_dialog_button_create_clicked_cb (GtkWidget             *button,
                                          EmpathyAccountsDialog  *dialog)
 {
        McProfile *profile;
-       McAccount *account;
+       EmpathyAccount *account;
        gchar     *str;
        McProfileCapabilityFlags cap;
 
@@ -826,7 +825,7 @@ accounts_dialog_button_create_clicked_cb (GtkWidget             *button,
            EMPATHY_PROFILE_CHOOSER (dialog->combobox_profile));
 
        /* Create account */
-       account = mc_account_create (profile);
+       account = empathy_account_manager_create (dialog->account_manager, profile);
        if (account == NULL) {
                /* We can't display an error to the user as MC doesn't give us
                 * any clue about the reason of the failure... */
@@ -837,7 +836,7 @@ accounts_dialog_button_create_clicked_cb (GtkWidget             *button,
        /* To translator: %s is the protocol name */
        str = g_strdup_printf (_("New %s account"),
                               mc_profile_get_display_name (profile));
-       mc_account_set_display_name (account, str);
+       empathy_account_set_display_name (account, str);
        g_free (str);
 
        cap = mc_profile_get_capabilities (profile);
@@ -846,7 +845,7 @@ accounts_dialog_button_create_clicked_cb (GtkWidget             *button,
 
                active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->radiobutton_register));
                if (active) {
-                       mc_account_set_param_boolean (account, "register", TRUE);
+                       empathy_account_set_param_boolean (account, "register", TRUE);
                }
        }
 
@@ -861,7 +860,7 @@ static void
 accounts_dialog_button_back_clicked_cb (GtkWidget             *button,
                                        EmpathyAccountsDialog  *dialog)
 {
-       McAccount *account;
+       EmpathyAccount *account;
 
        account = accounts_dialog_model_get_selected (dialog);
        accounts_dialog_update_account (dialog, account);
@@ -932,13 +931,13 @@ static void
 accounts_dialog_button_remove_clicked_cb (GtkWidget            *button,
                                          EmpathyAccountsDialog *dialog)
 {
-       McAccount *account;
+       EmpathyAccount *account;
        GtkWidget *message_dialog;
        gint       res;
 
        account = accounts_dialog_model_get_selected (dialog);
 
-       if (!mc_account_is_complete (account)) {
+       if (!empathy_account_is_valid (account)) {
                accounts_dialog_model_remove_selected (dialog);
                accounts_dialog_model_select_first (dialog);
                return;
@@ -950,7 +949,7 @@ accounts_dialog_button_remove_clicked_cb (GtkWidget            *button,
                 GTK_BUTTONS_NONE,
                 _("You are about to remove your %s account!\n"
                   "Are you sure you want to proceed?"),
-                mc_account_get_display_name (account));
+                empathy_account_get_display_name (account));
 
        gtk_message_dialog_format_secondary_text
                (GTK_MESSAGE_DIALOG (message_dialog),
@@ -971,7 +970,7 @@ accounts_dialog_button_remove_clicked_cb (GtkWidget            *button,
        res = gtk_dialog_run (GTK_DIALOG (message_dialog));
 
        if (res == GTK_RESPONSE_YES) {
-               mc_account_delete (account);
+               empathy_account_manager_remove (dialog->account_manager, account);
                accounts_dialog_model_select_first (dialog);
        }
        gtk_widget_destroy (message_dialog);
@@ -1021,15 +1020,15 @@ accounts_dialog_destroy_cb (GtkWidget            *widget,
                                              dialog);
 
        /* Delete incomplete accounts */
-       accounts = mc_accounts_list ();
+       accounts = empathy_account_manager_dup_accounts (dialog->account_manager);
        for (l = accounts; l; l = l->next) {
-               McAccount *account;
+               EmpathyAccount *account;
 
                account = l->data;
-               if (!mc_account_is_complete (account)) {
+               if (!empathy_account_is_valid (account)) {
                        /* FIXME: Warn the user the account is not complete
                         *        and is going to be removed. */
-                       mc_account_delete (account);
+                       empathy_account_manager_remove (dialog->account_manager, account);
                }
 
                g_object_unref (account);
@@ -1048,7 +1047,7 @@ accounts_dialog_destroy_cb (GtkWidget            *widget,
 
 GtkWidget *
 empathy_accounts_dialog_show (GtkWindow *parent,
-                             McAccount *selected_account)
+                             EmpathyAccount *selected_account)
 {
        static EmpathyAccountsDialog *dialog = NULL;
        GtkBuilder                   *gui;
@@ -1136,7 +1135,7 @@ empathy_accounts_dialog_show (GtkWindow *parent,
        accounts_dialog_model_setup (dialog);
 
        /* Add existing accounts */
-       accounts = mc_accounts_list ();
+       accounts = empathy_account_manager_dup_accounts (dialog->account_manager);
        for (l = accounts; l; l = l->next) {
                accounts_dialog_add_or_update_account (dialog, l->data);
                g_object_unref (l->data);
index b8c3d3691036146bcc12e648f0b9f4c717232623..11e237c8f640eb9a7df9ca3d268a0c30cdfc2916 100644 (file)
 
 #include <gtk/gtk.h>
 
-#include <libmissioncontrol/mc-account.h>
+#include <libempathy/empathy-account.h>
 
 G_BEGIN_DECLS
 
 GtkWidget *empathy_accounts_dialog_show (GtkWindow *parent,
-                                        McAccount *selected_account);
+                                        EmpathyAccount *selected_account);
 
 G_END_DECLS
 
index 8e317f603029eaff735fedb0cd1ceb1a6547f4f9..f4315f5fa57582ee887f0079dd9cdb7cf17b45fa 100644 (file)
@@ -408,7 +408,7 @@ chat_window_update_chat_tab (EmpathyChat *chat)
        EmpathyContact        *remote_contact;
        const gchar           *name;
        const gchar           *id;
-       McAccount             *account;
+       EmpathyAccount        *account;
        const gchar           *subject;
        const gchar           *status = NULL;
        GtkWidget             *widget;
@@ -429,7 +429,7 @@ chat_window_update_chat_tab (EmpathyChat *chat)
        remote_contact = empathy_chat_get_remote_contact (chat);
 
        DEBUG ("Updating chat tab, name=%s, account=%s, subject=%s, remote_contact=%p",
-               name, mc_account_get_unique_name (account), subject, remote_contact);
+               name, empathy_account_get_unique_name (account), subject, remote_contact);
 
        /* Update tab image */
        if (g_list_find (priv->chats_new_msg, chat)) {
@@ -461,7 +461,7 @@ chat_window_update_chat_tab (EmpathyChat *chat)
        append_markup_printf (tooltip,
                              "<b>%s</b><small> (%s)</small>",
                              id,
-                             mc_account_get_display_name (account));
+                             empathy_account_get_display_name (account));
 
        if (!EMP_STR_EMPTY (status)) {
                append_markup_printf (tooltip, "\n<i>%s</i>", status);
@@ -556,7 +556,7 @@ chat_window_conv_activate_cb (GtkAction         *action,
        is_room = empathy_chat_is_room (priv->current_chat);
        if (is_room) {
                const gchar *room;
-               McAccount   *account;
+               EmpathyAccount   *account;
                gboolean     found;
 
                room = empathy_chat_get_id (priv->current_chat);
@@ -602,7 +602,7 @@ chat_window_favorite_toggled_cb (GtkToggleAction   *toggle_action,
 {
        EmpathyChatWindowPriv *priv = GET_PRIV (window);
        gboolean               active;
-       McAccount             *account;
+       EmpathyAccount        *account;
        const gchar           *room;
        EmpathyChatroom       *chatroom;
 
@@ -1235,41 +1235,40 @@ chat_window_drag_data_received (GtkWidget        *widget,
        if (info == DND_DRAG_TYPE_CONTACT_ID) {
                EmpathyChat           *chat;
                EmpathyChatWindow     *old_window;
-               McAccount             *account;
+               EmpathyAccount        *account;
+               EmpathyAccountManager *account_manager;
                const gchar           *id;
                gchar                **strv;
                const gchar           *account_id;
                const gchar           *contact_id;
 
                id = (const gchar*) selection->data;
+               account_manager = empathy_account_manager_dup_singleton ();
 
                DEBUG ("DND contact from roster with id:'%s'", id);
 
                strv = g_strsplit (id, "/", 2);
                account_id = strv[0];
                contact_id = strv[1];
-               account = mc_account_lookup (account_id);
+               account = empathy_account_manager_lookup (account_manager, account_id);
                chat = empathy_chat_window_find_chat (account, contact_id);
 
                if (!chat) {
-                       EmpathyAccountManager *account_manager;
                        TpConnection *connection;
 
-                       account_manager = empathy_account_manager_dup_singleton ();
-                       connection = empathy_account_manager_get_connection (
-                               account_manager, account);
+                       connection = empathy_account_get_connection (account);
 
                        if (connection) {
                                empathy_dispatcher_chat_with_contact_id (
                                        connection, contact_id, NULL, NULL);
                        }
 
-                       g_object_unref (account_manager);
                        g_object_unref (account);
                        g_strfreev (strv);
                        return;
                }
                g_object_unref (account);
+               g_object_unref (account_manager);
                g_strfreev (strv);
 
                old_window = chat_window_find_chat (chat);
@@ -1740,12 +1739,11 @@ empathy_chat_window_has_focus (EmpathyChatWindow *window)
 }
 
 EmpathyChat *
-empathy_chat_window_find_chat (McAccount   *account,
+empathy_chat_window_find_chat (EmpathyAccount   *account,
                               const gchar *id)
 {
        GList *l;
 
-       g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL);
        g_return_val_if_fail (!EMP_STR_EMPTY (id), NULL);
 
        for (l = chat_windows; l; l = l->next) {
index c46ef8fc43b42f1249b58885e13a8da099f899d9..6f3d21fca10343df553235982407a3a6ef3182b9 100644 (file)
@@ -31,7 +31,7 @@
 #include <glib-object.h>
 #include <gtk/gtk.h>
 
-#include <libmissioncontrol/mc-account.h>
+#include <libempathy/empathy-account.h>
 #include <libempathy-gtk/empathy-chat.h>
 
 G_BEGIN_DECLS
@@ -69,7 +69,7 @@ void               empathy_chat_window_move_chat      (EmpathyChatWindow *old_wi
 void               empathy_chat_window_switch_to_chat (EmpathyChatWindow *window,
                                                       EmpathyChat       *chat);
 gboolean           empathy_chat_window_has_focus      (EmpathyChatWindow *window);
-EmpathyChat *      empathy_chat_window_find_chat      (McAccount        *account,
+EmpathyChat *      empathy_chat_window_find_chat      (EmpathyAccount   *account,
                                                       const gchar      *id);
 void               empathy_chat_window_present_chat   (EmpathyChat      *chat);
 
index a0fb8e6ec84188b172b95816f0d3a4f578244f0b..3b5dd1f77cf20bcbe973e864b1c307f4ba376966 100644 (file)
@@ -308,7 +308,7 @@ chatrooms_window_model_refresh_data (EmpathyChatroomsWindow *window,
        GtkTreeIter            iter;
        GtkTreeViewColumn     *column;
        EmpathyAccountChooser  *account_chooser;
-       McAccount             *account;
+       EmpathyAccount        *account;
        GList                 *chatrooms, *l;
 
        view = GTK_TREE_VIEW (window->treeview);
@@ -506,7 +506,7 @@ chatrooms_window_chatroom_added_cb (EmpathyChatroomManager *manager,
                                    EmpathyChatroomsWindow *window)
 {
        EmpathyAccountChooser *account_chooser;
-       McAccount            *account;
+       EmpathyAccount       *account;
 
        account_chooser = EMPATHY_ACCOUNT_CHOOSER (window->account_chooser);
        account = empathy_account_chooser_dup_account (account_chooser);
index a80aad2362006883e4bccef8e522b0291a63aa3a..1a7ec09cbf6215df2b6475e0a0a148febbf26789 100644 (file)
@@ -914,19 +914,12 @@ event_manager_presence_changed_cb (EmpathyContactMonitor *monitor,
     TpConnectionPresenceType previous,
     EmpathyEventManager *manager)
 {
-  McAccount *account;
-  gboolean just_connected;
-  EmpathyAccountManager *account_manager;
+  EmpathyAccount *account;
   gchar *header = NULL;
   gboolean preference = FALSE;
 
   account = empathy_contact_get_account (contact);
-  account_manager = empathy_account_manager_dup_singleton ();
-  just_connected = empathy_account_manager_is_account_just_connected (
-                  account_manager, account);
-
-  g_object_unref (account_manager);
-  if (just_connected)
+  if (empathy_account_is_just_connected (account))
     return;
 
   if (tp_connection_presence_type_cmp_availability (previous,
index 8e9a04595d666703f1152bd7fd2127496920d629..1e135892df5e8887bc489071d0b574b2888c7c37 100644 (file)
@@ -27,7 +27,6 @@
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
 
-#include <libmissioncontrol/mc-account.h>
 #include <telepathy-glib/util.h>
 
 #include "empathy-import-dialog.h"
@@ -36,6 +35,7 @@
 #define DEBUG_FLAG EMPATHY_DEBUG_OTHER
 #include <libempathy/empathy-debug.h>
 #include <libempathy/empathy-utils.h>
+#include <libempathy/empathy-account-manager.h>
 
 #include <libempathy-gtk/empathy-ui-utils.h>
 
@@ -91,13 +91,16 @@ empathy_import_account_data_free (EmpathyImportAccountData *data)
 static void
 import_dialog_add_account (EmpathyImportAccountData *data)
 {
-  McAccount *account;
+  EmpathyAccountManager *account_manager;
+  EmpathyAccount *account;
   GHashTableIter iter;
   gpointer key, value;
   gchar *display_name;
   GValue *username;
 
-  account = mc_account_create (data->profile);
+  account_manager = empathy_account_manager_dup_singleton ();
+  account = empathy_account_manager_create (account_manager, data->profile);
+  g_object_unref (account_manager);
   if (account == NULL)
     {
       DEBUG ("Failed to create account");
@@ -115,21 +118,21 @@ import_dialog_add_account (EmpathyImportAccountData *data)
           case G_TYPE_STRING:
             DEBUG ("Set param '%s' to '%s' (string)",
                 param, g_value_get_string (gvalue));
-            mc_account_set_param_string (account,
+            empathy_account_set_param_string (account,
                 param, g_value_get_string (gvalue));
             break;
 
           case G_TYPE_BOOLEAN:
             DEBUG ("Set param '%s' to %s (boolean)",
                 param, g_value_get_boolean (gvalue) ? "TRUE" : "FALSE");
-            mc_account_set_param_boolean (account,
+            empathy_account_set_param_boolean (account,
                 param, g_value_get_boolean (gvalue));
             break;
 
           case G_TYPE_INT:
             DEBUG ("Set param '%s' to '%i' (integer)",
                 param, g_value_get_int (gvalue));
-            mc_account_set_param_int (account,
+            empathy_account_set_param_int (account,
                 param, g_value_get_int (gvalue));
             break;
         }
@@ -140,7 +143,7 @@ import_dialog_add_account (EmpathyImportAccountData *data)
   display_name = g_strdup_printf ("%s (%s)",
       mc_profile_get_display_name (data->profile),
       g_value_get_string (username));
-  mc_account_set_display_name (account, display_name);
+  empathy_account_set_display_name (account, display_name);
 
   g_free (display_name);
   g_object_unref (account);
@@ -155,11 +158,12 @@ import_dialog_account_id_in_list (GList *accounts,
   for (l = accounts; l; l = l->next)
     {
       McAccount *account = l->data;
-      gchar *value;
+      gchar *value = NULL;
       gboolean result;
 
-      if (mc_account_get_param_string (account, "account", &value)
-          == MC_ACCOUNT_SETTING_ABSENT)
+      mc_account_get_param_string (account, "account", &value);
+
+      if (value == NULL)
         continue;
 
       result = tp_strdiff (value, account_id);
index a3ef3e13c782168079c6f3ba2280d81d06e7bc5c..0e3fd148f70b60469642b6a92c804145e1e5cc3b 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include <gtk/gtk.h>
+#include <libmissioncontrol/mc-profile.h>
 
 #ifndef __EMPATHY_IMPORT_DIALOG_H__
 #define __EMPATHY_IMPORT_DIALOG_H__
index 804936eaec94f38c089f2245691a00b0fe11a3cd..935c022eabb01c68d7419a1b3d0989e5fc1a1d29 100644 (file)
@@ -28,7 +28,6 @@
 #include <libxml/parser.h>
 #include <libxml/tree.h>
 
-#include <libmissioncontrol/mc-account.h>
 #include <telepathy-glib/util.h>
 #include <telepathy-glib/dbus.h>
 
index 0da037beb556d1e981453c17db5427f3cb329496..c7816d7fd67a44c72bba6694d3276ecd259ee050 100644 (file)
@@ -302,7 +302,7 @@ static void
 main_window_error_edit_clicked_cb (GtkButton         *button,
                                   EmpathyMainWindow *window)
 {
-       McAccount *account;
+       EmpathyAccount *account;
        GtkWidget *error_widget;
 
        account = g_object_get_data (G_OBJECT (button), "account");
@@ -317,7 +317,7 @@ static void
 main_window_error_clear_clicked_cb (GtkButton         *button,
                                    EmpathyMainWindow *window)
 {
-       McAccount *account;
+       EmpathyAccount *account;
        GtkWidget *error_widget;
 
        account = g_object_get_data (G_OBJECT (button), "account");
@@ -328,7 +328,7 @@ main_window_error_clear_clicked_cb (GtkButton         *button,
 
 static void
 main_window_error_display (EmpathyMainWindow *window,
-                          McAccount         *account,
+                          EmpathyAccount    *account,
                           const gchar       *message)
 {
        GtkWidget *child;
@@ -349,7 +349,7 @@ main_window_error_display (EmpathyMainWindow *window,
 
                /* Just set the latest error and return */
                str = g_markup_printf_escaped ("<b>%s</b>\n%s",
-                                              mc_account_get_display_name (account),
+                                              empathy_account_get_display_name (account),
                                               message);
                gtk_label_set_markup (GTK_LABEL (label), str);
                g_free (str);
@@ -430,7 +430,7 @@ main_window_error_display (EmpathyMainWindow *window,
        gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
 
        str = g_markup_printf_escaped ("<b>%s</b>\n%s",
-                                      mc_account_get_display_name (account),
+                                      empathy_account_get_display_name (account),
                                       message);
        gtk_label_set_markup (GTK_LABEL (label), str);
        g_free (str);
@@ -482,7 +482,7 @@ main_window_update_status (EmpathyMainWindow *window, EmpathyAccountManager *man
 
 static void
 main_window_connection_changed_cb (EmpathyAccountManager *manager,
-                                  McAccount *account,
+                                  EmpathyAccount *account,
                                   TpConnectionStatusReason reason,
                                   TpConnectionStatus current,
                                   TpConnectionStatus previous,
@@ -569,11 +569,11 @@ main_window_contact_presence_changed_cb (EmpathyContactMonitor *monitor,
                                         TpConnectionPresenceType previous,
                                         EmpathyMainWindow *window)
 {
-       McAccount *account;
+       EmpathyAccount *account;
        gboolean should_play;
 
        account = empathy_contact_get_account (contact);
-       should_play = !empathy_account_manager_is_account_just_connected (window->account_manager, account);
+       should_play = !empathy_account_is_just_connected (account);
 
        if (!should_play) {
                return;
@@ -729,16 +729,13 @@ main_window_view_show_map_cb (GtkCheckMenuItem  *item,
 static void
 main_window_favorite_chatroom_join (EmpathyChatroom *chatroom)
 {
-       EmpathyAccountManager *manager;
-       McAccount      *account;
+       EmpathyAccount *account;
        TpConnection   *connection;
        const gchar    *room;
 
-       manager = empathy_account_manager_dup_singleton ();
        account = empathy_chatroom_get_account (chatroom);
-       connection = empathy_account_manager_get_connection (manager, account);
+       connection = empathy_account_get_connection (account);
        room = empathy_chatroom_get_room (chatroom);
-       g_object_unref (manager);
 
        if (connection != NULL) {
                DEBUG ("Requesting channel for '%s'", room);
@@ -1009,7 +1006,7 @@ main_window_configure_event_cb (GtkWidget         *widget,
 
 static void
 main_window_account_created_or_deleted_cb (EmpathyAccountManager  *manager,
-                                          McAccount              *account,
+                                          EmpathyAccount         *account,
                                           EmpathyMainWindow      *window)
 {
        gtk_action_set_sensitive (window->view_history,
index da90cbb493999752ac62301905c3f4e577a2b0f8..e16da91a7b2076d2fc7f9aeca5a7a5ac6520f989 100644 (file)
@@ -33,7 +33,6 @@
 #include <glib/gprintf.h>
 
 #include <libmissioncontrol/mission-control.h>
-#include <libmissioncontrol/mc-account.h>
 #include <libmissioncontrol/mc-profile.h>
 
 #include <libempathy/empathy-tp-roomlist.h>
@@ -358,14 +357,14 @@ static void
 new_chatroom_dialog_update_widgets (EmpathyNewChatroomDialog *dialog)
 {
        EmpathyAccountChooser *account_chooser;
-       McAccount             *account;
+       EmpathyAccount        *account;
        McProfile             *profile;
        const gchar           *protocol;
        const gchar           *room;
 
        account_chooser = EMPATHY_ACCOUNT_CHOOSER (dialog->account_chooser);
        account = empathy_account_chooser_dup_account (account_chooser);
-       profile = mc_account_get_profile (account);
+       profile = empathy_account_get_profile (account);
        protocol = mc_profile_get_protocol_name (profile);
 
        gtk_entry_set_text (GTK_ENTRY (dialog->entry_server), "");
@@ -399,12 +398,13 @@ new_chatroom_dialog_account_changed_cb (GtkComboBox             *combobox,
                                        EmpathyNewChatroomDialog *dialog)
 {
        EmpathyAccountChooser *account_chooser;
-       McAccount             *account;
+       EmpathyAccount        *account;
        gboolean               listing = FALSE;
        gboolean               expanded = FALSE;
 
        if (dialog->room_list) {
                g_object_unref (dialog->room_list);
+               dialog->room_list = NULL;
        }
 
        ephy_spinner_stop (EPHY_SPINNER (dialog->throbber));
@@ -412,6 +412,9 @@ new_chatroom_dialog_account_changed_cb (GtkComboBox             *combobox,
 
        account_chooser = EMPATHY_ACCOUNT_CHOOSER (dialog->account_chooser);
        account = empathy_account_chooser_dup_account (account_chooser);
+       if (account == NULL)
+               goto out;
+
        dialog->room_list = empathy_tp_roomlist_new (account);
 
        if (dialog->room_list) {
@@ -444,9 +447,10 @@ new_chatroom_dialog_account_changed_cb (GtkComboBox             *combobox,
                }
        }
 
-       new_chatroom_dialog_update_widgets (dialog);
-
        g_object_unref (account);
+
+out:
+       new_chatroom_dialog_update_widgets (dialog);
 }
 
 static void
index a4b01b7c0e137a27ab94c9f3b4f2fa2099bb9377..f6c63c5372c85c95fbc86610a256a5bc578df1e1 100644 (file)
@@ -306,14 +306,20 @@ status_icon_set_visibility (EmpathyStatusIcon *icon,
                empathy_window_iconify (priv->window, priv->icon);
        } else {
                GList *accounts;
+               GList *l;
+               gboolean one_enabled = FALSE;
 
                empathy_window_present (GTK_WINDOW (priv->window), TRUE);
 
                /* Show the accounts dialog if there is no enabled accounts */
-               accounts = mc_accounts_list_by_enabled (TRUE);
-               if (accounts) {
-                       mc_accounts_list_free (accounts);
-               } else {
+               accounts = empathy_account_manager_dup_accounts (priv->account_manager);
+               for (l = accounts ; l != NULL ; l = g_list_next (l)) {
+                       one_enabled = empathy_account_is_enabled (EMPATHY_ACCOUNT (l->data))
+                               || one_enabled;
+                       g_object_unref (l->data);
+               }
+               g_list_free (accounts);
+               if (!one_enabled) {
                        DEBUG ("No enabled account, Showing account dialog");
                        empathy_accounts_dialog_show (GTK_WINDOW (priv->window), NULL);
                }
@@ -484,7 +490,7 @@ status_icon_create_menu (EmpathyStatusIcon *icon)
 
 static void
 status_icon_connection_changed_cb (EmpathyAccountManager *manager,
-                                  McAccount *account,
+                                  EmpathyAccount *account,
                                   TpConnectionStatusReason reason,
                                   TpConnectionStatus current,
                                   TpConnectionStatus previous,
index 85124d1e9156056ed813130780a670dd6bd61552..40626b5327a5c090a04b36411d0e317c5f4fed2c 100644 (file)
@@ -40,7 +40,6 @@
 
 #include <telepathy-glib/dbus.h>
 #include <telepathy-glib/util.h>
-#include <libmissioncontrol/mc-account.h>
 #include <libmissioncontrol/mission-control.h>
 
 #include <libempathy/empathy-idle.h>
@@ -107,7 +106,7 @@ dispatch_cb (EmpathyDispatcher *dispatcher,
                if (id) {
                        EmpathyAccountManager *manager;
                        TpConnection *connection;
-                       McAccount *account;
+                       EmpathyAccount *account;
 
                        manager = empathy_account_manager_dup_singleton ();
                        connection = empathy_tp_chat_get_connection (tp_chat);
@@ -227,7 +226,8 @@ create_salut_account (void)
        McProfile  *profile;
        McProtocol *protocol;
        gboolean    salut_created = FALSE;
-       McAccount  *account;
+       EmpathyAccount  *account;
+       EmpathyAccountManager *account_manager;
        GList      *accounts;
        EBook      *book;
        EContact   *contact;
@@ -284,8 +284,10 @@ create_salut_account (void)
                return;
        }
 
-       account = mc_account_create (profile);
-       mc_account_set_display_name (account, _("People nearby"));
+       account_manager = empathy_account_manager_dup_singleton ();
+       account = empathy_account_manager_create (account_manager, profile);
+       empathy_account_set_display_name (account, _("People nearby"));
+       g_object_unref (account_manager);
 
        nickname = e_contact_get (contact, E_CONTACT_NICKNAME);
        first_name = e_contact_get (contact, E_CONTACT_GIVEN_NAME);
@@ -302,11 +304,11 @@ create_salut_account (void)
                "last-name=%s\nemail=%s\njid=%s\n",
                nickname, first_name, last_name, email, jid);
 
-       mc_account_set_param_string (account, "nickname", nickname ? nickname : "");
-       mc_account_set_param_string (account, "first-name", first_name ? first_name : "");
-       mc_account_set_param_string (account, "last-name", last_name ? last_name : "");
-       mc_account_set_param_string (account, "email", email ? email : "");
-       mc_account_set_param_string (account, "jid", jid ? jid : "");
+       empathy_account_set_param_string (account, "nickname", nickname ? nickname : "");
+       empathy_account_set_param_string (account, "first-name", first_name ? first_name : "");
+       empathy_account_set_param_string (account, "last-name", last_name ? last_name : "");
+       empathy_account_set_param_string (account, "email", email ? email : "");
+       empathy_account_set_param_string (account, "jid", jid ? jid : "");
 
        g_free (nickname);
        g_free (first_name);