#include <gconf/gconf-client.h>
#include <libmissioncontrol/mission-control.h>
-#include <libmissioncontrol/mc-account.h>
#include <libempathy/empathy-tp-contact-factory.h>
#include <libempathy/empathy-account-manager.h>
+#include <libempathy/empathy-dispatcher.h>
#include <libempathy/empathy-contact.h>
#include <libempathy/empathy-contact-list.h>
#include <libempathy/empathy-contact-manager.h>
typedef struct {
EmpathyTpContactFactory *factory;
EmpathyAccountManager *account_manager;
- McAccount *account;
+ EmpathyAccount *account;
gchar *id;
GtkWidget *image;
gint image_size;
static void
megaphone_applet_got_contact_cb (EmpathyTpContactFactory *factory,
- GList *contacts,
+ EmpathyContact *contact,
+ const GError *error,
gpointer user_data,
GObject *applet)
{
MegaphoneAppletPriv *priv = GET_PRIV (applet);
- priv->contact = g_object_ref (contacts->data);
+ if (error != NULL) {
+ DEBUG ("Error: %s", error->message);
+ return;
+ }
+
+ priv->contact = g_object_ref (contact);
g_signal_connect_swapped (priv->contact, "notify",
G_CALLBACK (megaphone_applet_update_contact),
applet);
static void
megaphone_applet_new_connection_cb (EmpathyAccountManager *manager,
TpConnection *connection,
- McAccount *account,
+ EmpathyAccount *account,
MegaphoneApplet *applet)
{
MegaphoneAppletPriv *priv = GET_PRIV (applet);
- const gchar *id = priv->id;
if (priv->contact || !empathy_account_equal (account, priv->account)) {
return;
}
priv->factory = empathy_tp_contact_factory_dup_singleton (connection);
- empathy_tp_contact_factory_get_from_ids (priv->factory, 1, &id,
+ empathy_tp_contact_factory_get_from_id (priv->factory, priv->id,
megaphone_applet_got_contact_cb,
NULL, NULL, G_OBJECT (applet));
}
/* Retrieve the selected contact, if any and set it up in gconf.
* GConf will notify us from the change and we will adjust ourselves */
contact_list = g_object_get_data (G_OBJECT (dialog), "contact-list");
- contact = empathy_contact_list_view_get_selected (contact_list);
+ contact = empathy_contact_list_view_dup_selected (contact_list);
if (contact) {
- McAccount *account;
+ EmpathyAccount *account;
const gchar *account_id;
const gchar *contact_id;
gchar *str;
account = empathy_contact_get_account (contact);
- account_id = mc_account_get_unique_name (account);
+ account_id = empathy_account_get_unique_name (account);
contact_id = empathy_contact_get_id (contact);
str = g_strconcat (account_id, "/", contact_id, NULL);
"contact_id", str,
NULL);
g_free (str);
+ g_object_unref (contact);
}
}
gtk_widget_destroy (dialog);
gtk_window_set_default_size (GTK_WINDOW (dialog), 300, 500);
scroll = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (scroll), GTK_WIDGET (contact_list));
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), scroll);
+ gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), scroll);
gtk_widget_show (scroll);
g_object_set_data (G_OBJECT (dialog), "contact-list", contact_list);
MegaphoneApplet *applet)
{
MegaphoneAppletPriv *priv = GET_PRIV (applet);
- MissionControl *mc;
/* Only react on left-clicks */
if (event->button != 1 || event->type != GDK_BUTTON_PRESS) {
empathy_contact_get_id (priv->contact),
empathy_contact_get_handle (priv->contact));
- mc = empathy_mission_control_dup_singleton ();
- mission_control_request_channel (mc,
- empathy_contact_get_account (priv->contact),
- TP_IFACE_CHANNEL_TYPE_TEXT,
- empathy_contact_get_handle (priv->contact),
- TP_HANDLE_TYPE_CONTACT,
- NULL, NULL);
- g_object_unref (mc);
-
+ empathy_dispatcher_chat_with_contact (priv->contact, NULL, NULL);
+
return TRUE;
}
/* Lookup the new contact */
if (str) {
strv = g_strsplit (str, "/", 2);
- priv->account = mc_account_lookup (strv[0]);
+ priv->account = empathy_account_manager_lookup (priv->account_manager,
+ strv[0]);
priv->id = strv[1];
g_free (strv[0]);
g_free (strv);
}
if (priv->account) {
- connection = empathy_account_manager_get_connection (
- priv->account_manager, priv->account);
+ connection = empathy_account_get_connection (priv->account);
if (connection) {
megaphone_applet_new_connection_cb (priv->account_manager,
connection, priv->account, applet);