playback/player: gtk-play: if title is NULL then use uri basename in toolbar label

If stream title is not available in the stream then use file basename in
toolbar title label and full uri in window title bar.
This commit is contained in:
Brijesh Singh 2015-07-30 07:35:04 -05:00 committed by Sebastian Dröge
parent a18cefb73c
commit 7a874938a0

View file

@ -1638,18 +1638,24 @@ media_info_updated_cb (GstPlayer * player, GstPlayerMediaInfo * media_info,
{
const gchar *title;
GdkPixbuf *pixbuf;
gchar *basename = NULL;
gchar *filename = NULL;
title = gst_player_media_info_get_title (media_info);
if (!title)
title = g_path_get_basename (gst_player_media_info_get_uri (media_info));
if (!title) {
filename = g_filename_from_uri(
gst_player_media_info_get_uri (media_info), NULL, NULL);
basename = g_path_get_basename (filename);
}
gtk_label_set_label (play->title_label, title ? title : basename);
set_title (play, title ? title : filename);
g_free(basename);
g_free(filename);
pixbuf = gtk_play_get_cover_image (media_info);
if (title) {
gtk_label_set_label (play->title_label, title);
set_title (play, title);
}
if (pixbuf) {
gtk_window_set_icon (GTK_WINDOW (play), pixbuf);
g_object_unref (pixbuf);