[libsocialweb] lastfm-contact-view: Remove unused functions from ItemView copy



commit da537c24c992398e60152c20e4126824e762b3df
Author: Rob Bradford <rob linux intel com>
Date:   Fri Apr 29 16:54:40 2011 +0100

    lastfm-contact-view: Remove unused functions from ItemView copy

 services/lastfm/lastfm-contact-view.c |  172 ---------------------------------
 1 files changed, 0 insertions(+), 172 deletions(-)
---
diff --git a/services/lastfm/lastfm-contact-view.c b/services/lastfm/lastfm-contact-view.c
index 7d43de6..7e6eb30 100644
--- a/services/lastfm/lastfm-contact-view.c
+++ b/services/lastfm/lastfm-contact-view.c
@@ -237,178 +237,6 @@ _update_if_done (SwLastfmContactView *contact_view)
   }
 }
 
-static const char *
-get_image_url (RestXmlNode *node,
-               const char  *size)
-{
-  g_assert (node);
-  g_assert (size);
-
-  for (node = rest_xml_node_find (node, "image"); node; node = node->next) {
-    /* Skip over images which are not medium sized */
-    if (!g_str_equal (rest_xml_node_get_attr (node, "size"), size))
-      continue;
-
-    if (node->content) {
-      return node->content;
-    } else {
-      /* TODO: should fetch another size instead */
-      return NULL;
-    }
-  }
-
-  return NULL;
-}
-
-static void
-get_artist_info_cb (RestProxyCall *call,
-                    const GError  *error,
-                    GObject       *weak_object,
-                    gpointer       user_data)
-{
-  SwLastfmContactView *contact_view = SW_LASTFM_CONTACT_VIEW (weak_object);
-  SwLastfmContactViewPrivate *priv = GET_PRIVATE (contact_view);
-  SwContact *contact = user_data;
-  RestXmlNode *root, *artist_node;
-  const char *url;
-
-  sw_call_list_remove (priv->calls, call);
-
-  if (error) {
-    g_message (G_STRLOC ": error from Last.fm: %s", error->message);
-    g_object_unref (call);
-    g_object_unref (contact);
-    return;
-  }
-
-  root = node_from_call (call);
-  g_object_unref (call);
-  if (!root)
-    return;
-
-  artist_node = rest_xml_node_find (root, "artist");
-  url = get_image_url (artist_node, "large");
-  if (url)
-    sw_contact_request_image_fetch (contact, TRUE, "thumbnail", url);
-
-  sw_contact_pop_pending (contact);
-  g_object_unref (contact);
-
-  _update_if_done (contact_view);
-
-  rest_xml_node_unref (root);
-}
-
-static void
-get_thumbnail (SwLastfmContactView *contact_view,
-               SwContact           *contact,
-               RestXmlNode      *track_node)
-{
-  SwLastfmContactViewPrivate *priv = GET_PRIVATE (contact_view);
-  const char *url;
-  RestProxyCall *call;
-  RestXmlNode *artist;
-  const char *mbid;
-
-  url = get_image_url (track_node, "large");
-  if (url) {
-    sw_contact_request_image_fetch (contact, TRUE, "thumbnail", url);
-    return;
-  }
-
-  /* If we didn't find an album image, then try the artist image */
-
-  sw_contact_push_pending (contact);
-
-  call = rest_proxy_new_call (priv->proxy);
-  sw_call_list_add (priv->calls, call);
-
-  rest_proxy_call_add_params (call,
-                              "method", "artist.getInfo",
-                              "api_key", sw_keystore_get_key ("lastfm"),
-                              NULL);
-
-  artist = rest_xml_node_find (track_node, "artist");
-  mbid = rest_xml_node_get_attr (artist, "mbid");
-  if (mbid && mbid[0] != '\0') {
-    rest_proxy_call_add_param (call, "mbid", mbid);
-  } else {
-    rest_proxy_call_add_param (call, "artist", artist->content);
-  }
-
-  rest_proxy_call_async (call,
-                         get_artist_info_cb,
-                         (GObject *)contact_view,
-                         g_object_ref (contact),
-                         NULL);
-}
-
-static char *
-make_title (RestXmlNode *node)
-{
-  const char *track, *artist;
-
-  track = rest_xml_node_find (node, "name")->content;
-  artist = rest_xml_node_find (node, "artist")->content;
-
-  if (track && artist) {
-    /* Translators "[track title] by [artist]" */
-    return g_strdup_printf (_("%s by %s"), track, artist);
-  } else if (track) {
-    return g_strdup (track);
-  } else {
-    return g_strdup (_("Unknown"));
-  }
-}
-
-static SwContact *
-make_contact (SwLastfmContactView *contact_view,
-           SwService        *service,
-           RestXmlNode      *user,
-           RestXmlNode      *track)
-{
-  RestXmlNode *date;
-  SwContact *contact;
-  const char *s;
-  char *id;
-
-  contact = sw_contact_new ();
-  sw_contact_set_service (contact, service);
-
-  id = g_strdup_printf ("%s %s",
-                        rest_xml_node_find (track, "url")->content,
-                        rest_xml_node_find (user, "name")->content);
-  sw_contact_take (contact, "id", id);
-  sw_contact_put (contact, "url", rest_xml_node_find (track, "url")->content);
-  sw_contact_take (contact, "title", make_title (track));
-  sw_contact_put (contact, "album", rest_xml_node_find (track, "album")->content);
-
-  get_thumbnail (contact_view, contact, track);
-
-  date = rest_xml_node_find (track, "date");
-  if (date) {
-    sw_contact_take (contact, "date", sw_time_t_to_string (atoi (rest_xml_node_get_attr (date, "uts"))));
-  } else {
-    /* No date means it's a now-playing contact, so use now at the timestamp */
-    sw_contact_take (contact, "date", sw_time_t_to_string (time (NULL)));
-  }
-
-  s = rest_xml_node_find (user, "realname")->content;
-  if (s) {
-    sw_contact_put (contact, "author", s);
-  } else {
-    sw_contact_put (contact, "author", rest_xml_node_find (user, "name")->content);
-  }
-
-  sw_contact_put (contact, "authorid", rest_xml_node_find (user, "name")->content);
-
-  s = get_image_url (user, "medium");
-  if (s)
-    sw_contact_request_image_fetch (contact, FALSE, "authoricon", s);
-
-  return contact;
-}
-
 static void
 _get_friends_cb (RestProxyCall *call,
                  const GError  *error,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]