]> git.0d.be Git - empathy.git/blobdiff - megaphone/src/megaphone-applet.c
Updated Oriya Translation
[empathy.git] / megaphone / src / megaphone-applet.c
index 48b5a1859e48b7f0ef73dede8f5b626438925c21..132e8b74fb0a7a6e50fb3b57ad9caecd16d397ca 100644 (file)
 #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>
@@ -55,7 +55,7 @@
 typedef struct {
        EmpathyTpContactFactory *factory;
        EmpathyAccountManager   *account_manager;
-       McAccount               *account;
+       EmpathyAccount          *account;
        gchar                   *id;
        GtkWidget               *image;
        gint                     image_size;
@@ -172,13 +172,19 @@ megaphone_applet_update_contact (MegaphoneApplet *applet)
 
 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);
@@ -188,18 +194,17 @@ megaphone_applet_got_contact_cb (EmpathyTpContactFactory *factory,
 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));
 }
@@ -216,15 +221,15 @@ megaphone_applet_preferences_response_cb (GtkWidget       *dialog,
                /* 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);
@@ -235,6 +240,7 @@ megaphone_applet_preferences_response_cb (GtkWidget       *dialog,
                                                       "contact_id", str,
                                                       NULL);
                        g_free (str);
+                       g_object_unref (contact);
                }
        }
        gtk_widget_destroy (dialog);
@@ -276,7 +282,7 @@ megaphone_applet_show_preferences (MegaphoneApplet *applet)
        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);
@@ -294,7 +300,6 @@ megaphone_applet_button_press_event_cb (GtkWidget       *widget,
                                        MegaphoneApplet *applet)
 {
        MegaphoneAppletPriv *priv = GET_PRIV (applet);
-       MissionControl      *mc;
 
        /* Only react on left-clicks */
        if (event->button != 1 || event->type != GDK_BUTTON_PRESS) {
@@ -311,15 +316,8 @@ megaphone_applet_button_press_event_cb (GtkWidget       *widget,
                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;
 }
 
@@ -447,15 +445,15 @@ megaphone_applet_set_contact (MegaphoneApplet *applet,
        /* 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);