]> git.0d.be Git - empathy.git/blobdiff - megaphone/src/megaphone-applet.c
Renamed empathy_contact_list_view_get_selected to empathy_contact_list_view_dup_selec...
[empathy.git] / megaphone / src / megaphone-applet.c
index 48b5a1859e48b7f0ef73dede8f5b626438925c21..0879e75a5dbad218c1822887d7a5a63382988284 100644 (file)
@@ -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);
@@ -192,14 +198,13 @@ megaphone_applet_new_connection_cb (EmpathyAccountManager *manager,
                                    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,7 +221,7 @@ 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;
                        const gchar *account_id;
@@ -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);