static void _content_notify (MexContent *content, GParamSpec *pspec, MexContentTile *tile) { MexContentTilePrivate *priv = tile->priv; const gchar *still_prop_name, *title_prop_name, *logo_prop_name; still_prop_name = mex_content_get_property_name (MEX_CONTENT (priv->content), MEX_CONTENT_METADATA_STILL); title_prop_name = mex_content_get_property_name (MEX_CONTENT (priv->content), MEX_CONTENT_METADATA_TITLE); logo_prop_name = mex_content_get_property_name (MEX_CONTENT (priv->content), MEX_CONTENT_METADATA_STATION_LOGO); if (!g_strcmp0 (pspec->name, still_prop_name)) { _reset_thumbnail (tile); } else if (!g_strcmp0 (pspec->name, title_prop_name)) { _update_title (tile); } else if (!g_strcmp0 (pspec->name, logo_prop_name)) { _update_logo (tile); } }
static void mex_content_tile_set_content (MexContentView *view, MexContent *content) { MexContentTile *tile = MEX_CONTENT_TILE (view); MexContentTilePrivate *priv = tile->priv; const gchar *label_prop_name, *secondary_label_prop_name; if (priv->content == content) return; if (priv->changed_id) { g_signal_handler_disconnect (priv->content, priv->changed_id); priv->changed_id = 0; } if (priv->content) { g_object_unref (priv->content); priv->content = NULL; } if (!content) return; priv->content = g_object_ref_sink (content); /* Update title/thumbnail display */ label_prop_name = mex_content_get_property_name (priv->content, MEX_CONTENT_METADATA_TITLE); secondary_label_prop_name = mex_content_get_property_name (priv->content, MEX_CONTENT_METADATA_ARTIST); g_object_bind_property (content, label_prop_name, tile, "label", G_BINDING_SYNC_CREATE); if (secondary_label_prop_name) { g_object_bind_property (content, secondary_label_prop_name, tile, "secondary-label", G_BINDING_SYNC_CREATE); } _update_logo (tile); _reset_thumbnail (tile); /* TODO: use g_object_bind_property */ priv->changed_id = g_signal_connect (priv->content, "notify", G_CALLBACK (_content_notify), view); }
static void mex_content_tile_set_content (MexContentView *view, MexContent *content) { MexContentTile *tile = MEX_CONTENT_TILE (view); MexContentTilePrivate *priv = tile->priv; if (priv->content == content) return; if (priv->changed_id) { g_signal_handler_disconnect (priv->content, priv->changed_id); priv->changed_id = 0; } if (priv->content) { g_object_unref (priv->content); priv->content = NULL; } if (!content) return; priv->content = g_object_ref_sink (content); /* Update title/thumbnail display */ _update_title (tile); _update_logo (tile); _reset_thumbnail (tile); /* TODO: use g_object_bind_property */ priv->changed_id = g_signal_connect (priv->content, "notify", G_CALLBACK (_content_notify), view); }