aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README7
-rw-r--r--chat/empathy-chat-main.c4
-rw-r--r--contact-list/empathy-contact-list-main.c17
-rw-r--r--launcher/empathy-launcher.c90
-rw-r--r--libempathy-gtk/gossip-account-widget-jabber.c12
-rw-r--r--libempathy-gtk/gossip-accounts-dialog.c96
-rw-r--r--libempathy-gtk/gossip-chat-window.c2
-rw-r--r--libempathy/empathy-contact-list.c3
-rw-r--r--libempathy/empathy-contact-manager.c15
-rw-r--r--libempathy/empathy-session.c107
-rw-r--r--libempathy/empathy-session.h2
-rw-r--r--libempathy/empathy-tp-chat.c12
12 files changed, 172 insertions, 195 deletions
diff --git a/README b/README
index ef16e2c7c..db1535d06 100644
--- a/README
+++ b/README
@@ -7,9 +7,12 @@ $ make && make install
2) Setup and enable some accounts
$ empathy-accounts
-3) Get your contact list
-$ empathy-contact-list
+3) Start the MC
+$ empathy-launcher
This will start MC and connect all enabled accounts. If you start a private chat
or someone is saying something to you, empathy-chat will be started
automagicaly and display a chat UI for your conversation.
+4) To see the contact list
+$ empathy-contact-list
+
diff --git a/chat/empathy-chat-main.c b/chat/empathy-chat-main.c
index 36cf3850b..864e506b7 100644
--- a/chat/empathy-chat-main.c
+++ b/chat/empathy-chat-main.c
@@ -29,6 +29,7 @@
#include <libtelepathy/tp-conn.h>
#include <libtelepathy/tp-chan.h>
+#include <libtelepathy/tp-helpers.h>
#include <libmissioncontrol/mc-account.h>
#include <libempathy/gossip-contact.h>
@@ -57,7 +58,7 @@ new_channel_cb (EmpathyChandler *chandler,
GossipPrivateChat *chat;
/* We have a private chat channel */
- mc = empathy_session_get_mission_control ();
+ mc = mission_control_new (tp_get_bus ());
account = mission_control_get_account_for_connection (mc, tp_conn, NULL);
manager = empathy_session_get_contact_manager ();
list = empathy_contact_manager_get_list (manager, account);
@@ -66,6 +67,7 @@ new_channel_cb (EmpathyChandler *chandler,
chat = gossip_private_chat_new_with_channel (contact, tp_chan);
gossip_chat_present (GOSSIP_CHAT (chat));
+ g_object_unref (mc);
g_object_unref (account);
g_object_unref (contact);
g_object_unref (chat);
diff --git a/contact-list/empathy-contact-list-main.c b/contact-list/empathy-contact-list-main.c
index 8be108b3d..1aba20447 100644
--- a/contact-list/empathy-contact-list-main.c
+++ b/contact-list/empathy-contact-list-main.c
@@ -27,8 +27,11 @@
#include <glib.h>
#include <gtk/gtk.h>
-#include <libempathy/gossip-contact.h>
+#include <libtelepathy/tp-helpers.h>
+#include <libmissioncontrol/mission-control.h>
+
#include <libempathy/empathy-session.h>
+#include <libempathy/gossip-contact.h>
#include <libempathy-gtk/gossip-contact-list.h>
#include <libempathy-gtk/gossip-private-chat.h>
#include <libempathy-gtk/gossip-stock.h>
@@ -43,11 +46,11 @@ destroy_cb (GtkWidget *window,
}
static void
-contact_chat_cb (GtkWidget *list,
- GossipContact *contact,
- gpointer user_data)
+contact_chat_cb (GtkWidget *list,
+ GossipContact *contact,
+ MissionControl *mc)
{
- mission_control_request_channel (empathy_session_get_mission_control (),
+ mission_control_request_channel (mc,
gossip_contact_get_account (contact),
TP_IFACE_CHANNEL_TYPE_TEXT,
gossip_contact_get_handle (contact),
@@ -64,8 +67,6 @@ main (int argc, char *argv[])
gtk_init (&argc, &argv);
- empathy_session_connect ();
-
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gossip_stock_init (window);
@@ -84,7 +85,7 @@ main (int argc, char *argv[])
NULL);
g_signal_connect (list, "contact-chat",
G_CALLBACK (contact_chat_cb),
- NULL);
+ mission_control_new (tp_get_bus ()));
gtk_widget_show_all (window);
diff --git a/launcher/empathy-launcher.c b/launcher/empathy-launcher.c
index 3f58be97c..f6851f95c 100644
--- a/launcher/empathy-launcher.c
+++ b/launcher/empathy-launcher.c
@@ -21,28 +21,106 @@
*/
#include <config.h>
-
#include <stdlib.h>
-
#include <glib.h>
-#include <libempathy/empathy-session.h>
+#include <libtelepathy/tp-helpers.h>
+#include <libmissioncontrol/mc-account-monitor.h>
+#include <libmissioncontrol/mission-control.h>
+
#include <libempathy/gossip-debug.h>
#define DEBUG_DOMAIN "Launcher"
+static void error_cb (MissionControl *mc,
+ GError *error,
+ gpointer data);
+static void service_ended_cb (MissionControl *mc,
+ gpointer user_data);
+static void start_mission_control (MissionControl *mc);
+
+
+
+
+static void
+error_cb (MissionControl *mc,
+ GError *error,
+ gpointer data)
+{
+ if (error) {
+ gossip_debug (DEBUG_DOMAIN, "Error: %s", error->message);
+ }
+}
+
+static void
+service_ended_cb (MissionControl *mc,
+ gpointer user_data)
+{
+ gossip_debug (DEBUG_DOMAIN, "Mission Control stopped");
+}
+
+static void
+account_enabled_cb (McAccountMonitor *monitor,
+ gchar *unique_name,
+ MissionControl *mc)
+{
+ gossip_debug (DEBUG_DOMAIN, "Account enabled: %s", unique_name);
+ start_mission_control (mc);
+}
+
+static void
+start_mission_control (MissionControl *mc)
+{
+ McPresence presence;
+
+ presence = mission_control_get_presence_actual (mc, NULL);
+
+ if (presence != MC_PRESENCE_UNSET &&
+ presence != MC_PRESENCE_OFFLINE) {
+ /* MC is already running and online, nothing to do */
+ return;
+ }
+
+ gossip_debug (DEBUG_DOMAIN, "Starting Mission Control...");
+
+ /* FIXME: Save/Restore status message */
+ mission_control_set_presence (mc, MC_PRESENCE_AVAILABLE,
+ NULL,
+ (McCallback) error_cb,
+ NULL);
+
+ mission_control_connect_all_with_default_presence (mc,
+ (McCallback) error_cb,
+ NULL);
+}
+
int
main (int argc, char *argv[])
{
- GMainLoop *main_loop;
+ GMainLoop *main_loop;
+ MissionControl *mc;
+ McAccountMonitor *monitor;
g_type_init ();
- empathy_session_connect ();
-
main_loop = g_main_loop_new (NULL, FALSE);
+ monitor = mc_account_monitor_new ();
+ mc = mission_control_new (tp_get_bus ());
+
+ g_signal_connect (monitor, "account-enabled",
+ G_CALLBACK (account_enabled_cb),
+ mc);
+ g_signal_connect (mc, "ServiceEnded",
+ G_CALLBACK (service_ended_cb),
+ NULL);
+
+ start_mission_control (mc);
+
g_main_loop_run (main_loop);
+ g_object_unref (monitor);
+ g_object_unref (mc);
+
return 0;
}
diff --git a/libempathy-gtk/gossip-account-widget-jabber.c b/libempathy-gtk/gossip-account-widget-jabber.c
index e9b393c3e..b5cf4ce29 100644
--- a/libempathy-gtk/gossip-account-widget-jabber.c
+++ b/libempathy-gtk/gossip-account-widget-jabber.c
@@ -173,12 +173,12 @@ account_widget_jabber_destroy_cb (GtkWidget *widget,
static void
account_widget_jabber_setup (GossipAccountWidgetJabber *settings)
{
- gint port;
- gchar *id;
- gchar *resource;
- gchar *server;
- gchar *password;
- gboolean old_ssl;
+ gint port = 0;
+ gchar *id = NULL;
+ gchar *resource = NULL;
+ gchar *server = NULL;
+ gchar *password = NULL;
+ gboolean old_ssl = FALSE;
mc_account_get_param_int (settings->account, "port", &port);
mc_account_get_param_string (settings->account, "account", &id);
diff --git a/libempathy-gtk/gossip-accounts-dialog.c b/libempathy-gtk/gossip-accounts-dialog.c
index 6f61dfb36..c4aa020b2 100644
--- a/libempathy-gtk/gossip-accounts-dialog.c
+++ b/libempathy-gtk/gossip-accounts-dialog.c
@@ -37,8 +37,8 @@
#include <libmissioncontrol/mission-control.h>
#include <libmissioncontrol/mc-account-monitor.h>
#include <libtelepathy/tp-constants.h>
+#include <libtelepathy/tp-helpers.h>
-#include <libempathy/empathy-session.h>
#include <libempathy/gossip-debug.h>
#include <libempathy/gossip-paths.h>
#include <libempathy/gossip-utils.h>
@@ -55,35 +55,38 @@
#define FLASH_TIMEOUT 500
typedef struct {
- GtkWidget *window;
+ GtkWidget *window;
- GtkWidget *alignment_settings;
+ GtkWidget *alignment_settings;
- GtkWidget *vbox_details;
- GtkWidget *frame_no_account;
- GtkWidget *label_no_account;
- GtkWidget *label_no_account_blurb;
+ GtkWidget *vbox_details;
+ GtkWidget *frame_no_account;
+ GtkWidget *label_no_account;
+ GtkWidget *label_no_account_blurb;
- GtkWidget *treeview;
+ GtkWidget *treeview;
- GtkWidget *button_remove;
- GtkWidget *button_connect;
+ GtkWidget *button_remove;
+ GtkWidget *button_connect;
- GtkWidget *frame_new_account;
- GtkWidget *combobox_profile;
- GtkWidget *entry_name;
- GtkWidget *table_new_account;
- GtkWidget *button_create;
- GtkWidget *button_cancel;
+ GtkWidget *frame_new_account;
+ GtkWidget *combobox_profile;
+ GtkWidget *entry_name;
+ GtkWidget *table_new_account;
+ GtkWidget *button_create;
+ GtkWidget *button_cancel;
- GtkWidget *image_type;
- GtkWidget *label_name;
- GtkWidget *label_type;
- GtkWidget *settings_widget;
+ GtkWidget *image_type;
+ GtkWidget *label_name;
+ GtkWidget *label_type;
+ GtkWidget *settings_widget;
- gboolean connecting_show;
- guint connecting_id;
- gboolean account_changed;
+ gboolean connecting_show;
+ guint connecting_id;
+ gboolean account_changed;
+
+ MissionControl *mc;
+ McAccountMonitor *monitor;
} GossipAccountsDialog;
enum {
@@ -162,13 +165,11 @@ accounts_dialog_setup (GossipAccountsDialog *dialog)
GtkTreeSelection *selection;
GtkTreeIter iter;
GList *accounts, *l;
- MissionControl *mc;
view = GTK_TREE_VIEW (dialog->treeview);
store = GTK_LIST_STORE (gtk_tree_view_get_model (view));
selection = gtk_tree_view_get_selection (view);
- mc = empathy_session_get_mission_control ();
accounts = mc_accounts_list ();
for (l = accounts; l; l = l->next) {
@@ -183,7 +184,7 @@ accounts_dialog_setup (GossipAccountsDialog *dialog)
continue;
}
- status = mission_control_get_connection_status (mc, account, NULL);
+ status = mission_control_get_connection_status (dialog->mc, account, NULL);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
@@ -192,7 +193,7 @@ accounts_dialog_setup (GossipAccountsDialog *dialog)
COL_ACCOUNT_POINTER, account,
-1);
- accounts_dialog_status_changed_cb (mc,
+ accounts_dialog_status_changed_cb (dialog->mc,
status,
MC_PRESENCE_UNSET,
TP_CONN_STATUS_REASON_NONE_SPECIFIED,
@@ -554,7 +555,6 @@ static void
accounts_dialog_add_account (GossipAccountsDialog *dialog,
McAccount *account)
{
- MissionControl *mc;
TelepathyConnectionStatus status;
const gchar *name;
GtkTreeView *view;
@@ -585,8 +585,7 @@ accounts_dialog_add_account (GossipAccountsDialog *dialog,
}
}
- mc = empathy_session_get_mission_control ();
- status = mission_control_get_connection_status (mc, account, NULL);
+ status = mission_control_get_connection_status (dialog->mc, account, NULL);
name = mc_account_get_display_name (account);
g_return_if_fail (name != NULL);
@@ -618,10 +617,8 @@ accounts_dialog_account_removed_cb (McAccountMonitor *monitor,
gchar *unique_name,
GossipAccountsDialog *dialog)
{
- MissionControl *mc;
- McAccount *account;
+ McAccount *account;
- mc = empathy_session_get_mission_control ();
account = mc_account_lookup (unique_name);
accounts_dialog_model_set_selected (dialog, account);
@@ -902,23 +899,19 @@ static void
accounts_dialog_destroy_cb (GtkWidget *widget,
GossipAccountsDialog *dialog)
{
- MissionControl *mc;
- McAccountMonitor *monitor;
- GList *accounts, *l;
-
- mc = empathy_session_get_mission_control ();
- monitor = mc_account_monitor_new ();
+ GList *accounts, *l;
/* Disconnect signals */
- g_signal_handlers_disconnect_by_func (monitor,
+ g_signal_handlers_disconnect_by_func (dialog->monitor,
accounts_dialog_account_added_cb,
dialog);
- g_signal_handlers_disconnect_by_func (monitor,
+ g_signal_handlers_disconnect_by_func (dialog->monitor,
accounts_dialog_account_removed_cb,
dialog);
- dbus_g_proxy_disconnect_signal (DBUS_G_PROXY (mc), "AccountStatusChanged",
- G_CALLBACK (accounts_dialog_status_changed_cb),
- dialog);
+ dbus_g_proxy_disconnect_signal (DBUS_G_PROXY (dialog->mc),
+ "AccountStatusChanged",
+ G_CALLBACK (accounts_dialog_status_changed_cb),
+ dialog);
/* Delete incomplete accounts */
accounts = mc_accounts_list ();
@@ -940,6 +933,9 @@ accounts_dialog_destroy_cb (GtkWidget *widget,
g_source_remove (dialog->connecting_id);
}
+ g_object_unref (dialog->mc);
+ g_object_unref (dialog->monitor);
+
g_free (dialog);
}
@@ -947,8 +943,6 @@ GtkWidget *
gossip_accounts_dialog_show (void)
{
static GossipAccountsDialog *dialog = NULL;
- MissionControl *mc;
- McAccountMonitor *monitor;
GladeXML *glade;
GtkWidget *bbox;
GtkWidget *button_close;
@@ -1010,17 +1004,17 @@ gossip_accounts_dialog_show (void)
gtk_widget_show (dialog->combobox_profile);
/* Set up signalling */
- mc = empathy_session_get_mission_control ();
- monitor = mc_account_monitor_new ();
+ dialog->mc = mission_control_new (tp_get_bus ());
+ dialog->monitor = mc_account_monitor_new ();
/* FIXME: connect account-enabled/disabled too */
- g_signal_connect (monitor, "account-created",
+ g_signal_connect (dialog->monitor, "account-created",
G_CALLBACK (accounts_dialog_account_added_cb),
dialog);
- g_signal_connect (monitor, "account-deleted",
+ g_signal_connect (dialog->monitor, "account-deleted",
G_CALLBACK (accounts_dialog_account_removed_cb),
dialog);
- dbus_g_proxy_connect_signal (DBUS_G_PROXY (mc), "AccountStatusChanged",
+ dbus_g_proxy_connect_signal (DBUS_G_PROXY (dialog->mc), "AccountStatusChanged",
G_CALLBACK (accounts_dialog_status_changed_cb),
dialog, NULL);
diff --git a/libempathy-gtk/gossip-chat-window.c b/libempathy-gtk/gossip-chat-window.c
index 76b1c596f..9f6f1a363 100644
--- a/libempathy-gtk/gossip-chat-window.c
+++ b/libempathy-gtk/gossip-chat-window.c
@@ -275,7 +275,7 @@ gossip_chat_window_init (GossipChatWindow *window)
priv->tooltips = g_object_ref (gtk_tooltips_new ());
gtk_object_sink (GTK_OBJECT (priv->tooltips));
- glade = gossip_glade_get_file ("empathy-chat.glade",
+ glade = gossip_glade_get_file ("gossip-chat.glade",
"chat_window",
NULL,
"chat_window", &priv->dialog,
diff --git a/libempathy/empathy-contact-list.c b/libempathy/empathy-contact-list.c
index 02d0c174d..1a8640026 100644
--- a/libempathy/empathy-contact-list.c
+++ b/libempathy/empathy-contact-list.c
@@ -312,7 +312,7 @@ empathy_contact_list_new (McAccount *account)
g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL);
- mc = empathy_session_get_mission_control ();
+ mc = mission_control_new (tp_get_bus ());
if (mission_control_get_connection_status (mc, account, NULL) != 0) {
/* The account is not connected, nothing to do. */
@@ -320,6 +320,7 @@ empathy_contact_list_new (McAccount *account)
}
tp_conn = mission_control_get_connection (mc, account, NULL);
+ g_object_unref (mc);
g_return_val_if_fail (tp_conn != NULL, NULL);
list = g_object_new (EMPATHY_TYPE_CONTACT_LIST, NULL);
diff --git a/libempathy/empathy-contact-manager.c b/libempathy/empathy-contact-manager.c
index 4246a03c7..cf5a81fe2 100644
--- a/libempathy/empathy-contact-manager.c
+++ b/libempathy/empathy-contact-manager.c
@@ -24,6 +24,7 @@
#include <string.h>
+#include <libtelepathy/tp-helpers.h>
#include <libtelepathy/tp-constants.h>
#include "empathy-contact-manager.h"
@@ -37,8 +38,9 @@
#define DEBUG_DOMAIN "ContactManager"
struct _EmpathyContactManagerPriv {
- GHashTable *lists;
- gboolean setup;
+ GHashTable *lists;
+ MissionControl *mc;
+ gboolean setup;
};
typedef struct {
@@ -130,7 +132,6 @@ static void
empathy_contact_manager_init (EmpathyContactManager *manager)
{
EmpathyContactManagerPriv *priv;
- MissionControl *mc;
GSList *accounts, *l;
priv = GET_PRIV (manager);
@@ -140,14 +141,15 @@ empathy_contact_manager_init (EmpathyContactManager *manager)
(GDestroyNotify) g_object_unref,
(GDestroyNotify) g_object_unref);
- mc = empathy_session_get_mission_control ();
+ priv->mc = mission_control_new (tp_get_bus ());
- dbus_g_proxy_connect_signal (DBUS_G_PROXY (mc), "AccountStatusChanged",
+ dbus_g_proxy_connect_signal (DBUS_G_PROXY (priv->mc),
+ "AccountStatusChanged",
G_CALLBACK (contact_manager_status_changed_cb),
manager, NULL);
/* Get ContactList for existing connections */
- accounts = mission_control_get_online_connections (mc, NULL);
+ accounts = mission_control_get_online_connections (priv->mc, NULL);
for (l = accounts; l; l = l->next) {
McAccount *account;
@@ -167,6 +169,7 @@ contact_manager_finalize (GObject *object)
priv = GET_PRIV (object);
g_hash_table_destroy (priv->lists);
+ g_object_unref (priv->mc);
}
EmpathyContactManager *
diff --git a/libempathy/empathy-session.c b/libempathy/empathy-session.c
index 1a46a9cd2..86ac1e180 100644
--- a/libempathy/empathy-session.c
+++ b/libempathy/empathy-session.c
@@ -33,70 +33,17 @@
#define DEBUG_DOMAIN "Session"
-static void session_start_mission_control (void);
-static void session_error_cb (MissionControl *mc,
- GError *error,
- gpointer data);
-static void session_account_enabled_cb (McAccountMonitor *monitor,
- gchar *unique_name,
- gpointer user_data);
-static void session_service_ended_cb (MissionControl *mc,
- gpointer user_data);
-
-static MissionControl *mission_control = NULL;
static EmpathyContactManager *contact_manager = NULL;
void
-empathy_session_connect (void)
-{
- MissionControl *mc;
- McAccountMonitor *monitor;
- static gboolean started = FALSE;
-
- if (started) {
- return;
- }
-
- mc = empathy_session_get_mission_control ();
- monitor = mc_account_monitor_new ();
-
- g_signal_connect (monitor, "account-enabled",
- G_CALLBACK (session_account_enabled_cb),
- NULL);
- g_signal_connect (mc, "ServiceEnded",
- G_CALLBACK (session_service_ended_cb),
- NULL);
-
- g_object_unref (monitor);
- session_start_mission_control ();
-
- started = TRUE;
-}
-
-void
empathy_session_finalize (void)
{
- if (mission_control) {
- g_object_unref (mission_control);
- mission_control = NULL;
- }
-
if (contact_manager) {
g_object_unref (contact_manager);
contact_manager = NULL;
}
}
-MissionControl *
-empathy_session_get_mission_control (void)
-{
- if (!mission_control) {
- mission_control = mission_control_new (tp_get_bus ());
- }
-
- return mission_control;
-}
-
EmpathyContactManager *
empathy_session_get_contact_manager (void)
{
@@ -107,57 +54,3 @@ empathy_session_get_contact_manager (void)
return contact_manager;
}
-static void
-session_start_mission_control (void)
-{
- MissionControl *mc;
- McPresence presence;
-
- mc = empathy_session_get_mission_control ();
- presence = mission_control_get_presence_actual (mc, NULL);
-
- if (presence != MC_PRESENCE_UNSET &&
- presence != MC_PRESENCE_OFFLINE) {
- /* MC is already running and online, nothing to do */
- return;
- }
-
- gossip_debug (DEBUG_DOMAIN, "Starting Mission Control...");
-
- /* FIXME: Save/Restore status message */
- mission_control_set_presence (mc, MC_PRESENCE_AVAILABLE,
- NULL,
- (McCallback) session_error_cb,
- NULL);
-
- mission_control_connect_all_with_default_presence (mc,
- (McCallback) session_error_cb,
- NULL);
-}
-
-static void
-session_error_cb (MissionControl *mc,
- GError *error,
- gpointer data)
-{
- if (error) {
- gossip_debug (DEBUG_DOMAIN, "Error: %s", error->message);
- }
-}
-
-static void
-session_account_enabled_cb (McAccountMonitor *monitor,
- gchar *unique_name,
- gpointer user_data)
-{
- gossip_debug (DEBUG_DOMAIN, "Account enabled: %s", unique_name);
- session_start_mission_control ();
-}
-
-static void
-session_service_ended_cb (MissionControl *mc,
- gpointer user_data)
-{
- gossip_debug (DEBUG_DOMAIN, "Mission Control stopped");
-}
-
diff --git a/libempathy/empathy-session.h b/libempathy/empathy-session.h
index 0a08cce6d..af843a5e0 100644
--- a/libempathy/empathy-session.h
+++ b/libempathy/empathy-session.h
@@ -30,9 +30,7 @@
G_BEGIN_DECLS
-void empathy_session_connect (void);
void empathy_session_finalize (void);
-MissionControl * empathy_session_get_mission_control (void);
EmpathyContactManager *empathy_session_get_contact_manager (void);
G_END_DECLS
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c
index 36ac8a7a8..f72655eca 100644
--- a/libempathy/empathy-tp-chat.c
+++ b/libempathy/empathy-tp-chat.c
@@ -44,6 +44,7 @@ struct _EmpathyTpChatPriv {
EmpathyContactList *list;
McAccount *account;
gchar *id;
+ MissionControl *mc;
TpChan *tp_chan;
DBusGProxy *text_iface;
@@ -167,6 +168,9 @@ tp_chat_finalize (GObject *object)
if (priv->account) {
g_object_unref (priv->account);
}
+ if (priv->mc) {
+ g_object_unref (priv->mc);
+ }
g_free (priv->id);
G_OBJECT_CLASS (empathy_tp_chat_parent_class)->finalize (object);
@@ -190,6 +194,7 @@ empathy_tp_chat_new (McAccount *account,
priv->list = empathy_contact_manager_get_list (manager, account);
priv->tp_chan = g_object_ref (tp_chan);
priv->account = g_object_ref (account);
+ priv->mc = mission_control_new (tp_get_bus ());
g_object_ref (priv->list);
priv->text_iface = tp_chan_get_interface (tp_chan,
@@ -230,7 +235,7 @@ empathy_tp_chat_new_with_contact (GossipContact *contact)
g_return_val_if_fail (GOSSIP_IS_CONTACT (contact), NULL);
- mc = empathy_session_get_mission_control ();
+ mc = mission_control_new (tp_get_bus ());
account = gossip_contact_get_account (contact);
if (mission_control_get_connection_status (mc, account, NULL) != 0) {
@@ -255,6 +260,7 @@ empathy_tp_chat_new_with_contact (GossipContact *contact)
g_object_unref (tp_conn);
g_object_unref (text_chan);
+ g_object_unref (mc);
return chat;
}
@@ -373,7 +379,6 @@ const gchar *
empathy_tp_chat_get_id (EmpathyTpChat *chat)
{
EmpathyTpChatPriv *priv;
- MissionControl *mc;
TpConn *tp_conn;
GArray *handles;
gchar **names;
@@ -387,8 +392,7 @@ empathy_tp_chat_get_id (EmpathyTpChat *chat)
return priv->id;
}
- mc = empathy_session_get_mission_control ();
- tp_conn = mission_control_get_connection (mc, priv->account, NULL);
+ tp_conn = mission_control_get_connection (priv->mc, priv->account, NULL);
handles = g_array_new (FALSE, FALSE, sizeof (guint));
g_array_append_val (handles, priv->tp_chan->handle);