void
mnb_launcher_button_set_icon (MnbLauncherButton  *self,
                              const gchar        *icon_file,
                              gint                icon_size)
{
  MxTextureCache *texture_cache;
  GError         *error = NULL;

  if (self->priv->icon_file)
    {
      g_free (self->priv->icon_file);
      self->priv->icon_file = NULL;
    }

  if (self->priv->icon)
    {
      clutter_actor_destroy (self->priv->icon);
      self->priv->icon = NULL;
    }

  self->priv->icon_file = g_strdup (icon_file);
  self->priv->icon_size = icon_size;

  error = NULL;
  texture_cache = mx_texture_cache_get_default ();
  self->priv->icon = mx_texture_cache_get_actor (texture_cache,
                                                   self->priv->icon_file);

  if (error) {
    g_warning (G_STRLOC "%s", error->message);
    g_clear_error (&error);
  }

  if (self->priv->icon) {

    if (self->priv->icon_size > -1) {
      clutter_actor_set_size (self->priv->icon,
                              self->priv->icon_size,
                              self->priv->icon_size);
    }

    mx_table_insert_actor_with_properties (MX_TABLE (self),
                                           CLUTTER_ACTOR (self->priv->icon),
                                           0, 0,
                                           "x-align", MX_ALIGN_MIDDLE,
                                           "x-expand", FALSE,
                                           "x-fill", FALSE,
                                           "y-align", MX_ALIGN_MIDDLE,
                                           "y-expand", FALSE,
                                           "y-fill", FALSE,
                                           NULL);
  }
}
static void
mex_content_box_set_property (GObject      *object,
                              guint         property_id,
                              const GValue *value,
                              GParamSpec   *pspec)
{
  MexContentBox *self = MEX_CONTENT_BOX (object);
  MexContentBoxPrivate *priv = self->priv;

  switch (property_id)
    {
    case PROP_MEDIA_URL:
      g_free (priv->media_url);
      priv->media_url = g_value_dup_string (value);
      break;

    case PROP_LOGO_URL:
      /* FIXME: We want the logo URL to be file:// to share the same
       * underlying texture. This should be handled by a generic "download
       * queue + texture cache" thingy that caches the same URL to a local
       * file and hands over a ClutterTexure (or a MagicTexture) with the
       * same underlying Cogl texture */
    {
      MxTextureCache *cache;
      ClutterActor *logo, *logo_frame;
      GFile *file;
      gchar *path;
      gint bw, bh;
      gfloat ratio;

      g_free (priv->logo_url);
      priv->logo_url = g_value_dup_string (value);

      if (priv->logo_url == NULL)
        break;

      file = g_file_new_for_uri (priv->logo_url);
      path = g_file_get_path (file);
      g_object_unref (file);
      if (G_UNLIKELY (path == NULL))
        {
          g_warning ("The logo URL provided is not local, refusing to load it");
          break;
        }

      cache = mx_texture_cache_get_default ();
      logo = mx_texture_cache_get_actor (cache, path);
      if (G_UNLIKELY (logo == NULL))
        {
          g_warning ("Could not retrieve texture for %s", path);
          break;
        }

      logo_frame = mex_aspect_frame_new ();
      /* FIXME, had to set the size (for now?) provides some GObject properties
       * to tune that? expose it in the CSS */
      clutter_actor_set_size (logo_frame, 60, 40);
      clutter_texture_get_base_size (CLUTTER_TEXTURE (logo), &bw, &bh);
      ratio = bh / 40.;
      mex_aspect_frame_set_ratio (MEX_ASPECT_FRAME (logo_frame), ratio);
      clutter_container_add_actor (CLUTTER_CONTAINER (logo_frame), logo);

      mex_tile_set_primary_icon (MEX_TILE (priv->tile), logo_frame);
    }
    break;

    case PROP_THUMB_WIDTH:
      priv->thumb_width = g_value_get_int (value);
      g_object_set (G_OBJECT (priv->tile),
                    "thumb-width",
                    priv->thumb_width,
                    NULL);
      break;

    case PROP_THUMB_HEIGHT:
      priv->thumb_height = g_value_get_int (value);
      g_object_set (G_OBJECT (priv->tile),
                    "thumb-height",
                    priv->thumb_height,
                    NULL);
      break;

    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
    }
}