diff options
author | Brijesh Singh <brijesh.ksingh@gmail.com> | 2015-07-30 07:35:04 -0500 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2015-07-30 15:54:16 +0300 |
commit | 7a874938a0a62d41dc91063489df8a521dddebbe (patch) | |
tree | 3c97b8f1a672b085dce6e14a181158a8c90a51af /playback | |
parent | a18cefb73c2bd2e63d0ba004f8703d1bf811907b (diff) |
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.
Diffstat (limited to 'playback')
-rw-r--r-- | playback/player/gtk/gtk-play.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/playback/player/gtk/gtk-play.c b/playback/player/gtk/gtk-play.c index e327606..ed778a3 100644 --- a/playback/player/gtk/gtk-play.c +++ b/playback/player/gtk/gtk-play.c @@ -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)); - pixbuf = gtk_play_get_cover_image (media_info); - - if (title) { - gtk_label_set_label (play->title_label, title); - set_title (play, title); + 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 (pixbuf) { gtk_window_set_icon (GTK_WINDOW (play), pixbuf); g_object_unref (pixbuf); |