[Xfce4-commits] <parole:master> Don't use uri as a status bar text for live streams.

Ali Abdallah noreply at xfce.org
Thu Dec 10 22:32:02 CET 2009


Updating branch refs/heads/master
         to d219dbb88a7abda6ab51f9b9215d9606862351af (commit)
       from eecb19706a3eedb207822f1693a5a285c96c7e2d (commit)

commit d219dbb88a7abda6ab51f9b9215d9606862351af
Author: Ali Abdallah <aliov at xfce.org>
Date:   Thu Dec 10 22:30:04 2009 +0100

    Don't use uri as a status bar text for live streams.

 src/parole-statusbar.c |   58 +++++++++++++++++++----------------------------
 1 files changed, 24 insertions(+), 34 deletions(-)

diff --git a/src/parole-statusbar.c b/src/parole-statusbar.c
index 9a2defa..71780c2 100644
--- a/src/parole-statusbar.c
+++ b/src/parole-statusbar.c
@@ -127,59 +127,49 @@ parole_statusbar_set_duration (ParoleStatusbar *bar, ParoleMediaState state, gin
 
 static void parole_statusbar_set_text (ParoleStatusbar *bar, const ParoleStream *stream, ParoleMediaState state)
 {
-    gchar *text = NULL;
-    gchar *title = NULL;
-    gchar *uri = NULL;
-    gboolean live;
+    gchar *uri;
     
-    if ( state >= PAROLE_MEDIA_STATE_PAUSED )
+    gtk_label_set_text (GTK_LABEL (bar->priv->label_text), NULL);
+    
+    g_object_get (G_OBJECT (stream),
+		  "uri", &uri,
+		  NULL);
+    
+    if ( state >= PAROLE_MEDIA_STATE_PAUSED && uri)
     {
+	gchar *filename;
+	gchar *text = NULL;
+	gchar *title = NULL;
+	gboolean live;
+	
 	g_object_get (G_OBJECT (stream),
 		      "title", &title,
 		      "live", &live,
-		      "uri", &uri,
 		      NULL);
-		      
+
 	if ( live )
 	{
-	    text = g_strdup_printf ("%s '%s'", _("Live stream:"), uri);
+	    filename = g_filename_from_uri (uri, NULL, NULL);
+	    text = g_strdup_printf ("%s '%s'", _("Live stream:"), filename);
 	    gtk_label_set_text (GTK_LABEL (bar->priv->label_text), text);
-	    g_free (text);
-	    g_free (uri);
-	    if ( title )
-		g_free (title);
-	    return;
+	    g_free (filename);
 	}
-	
-	if ( !title )
+	else
 	{
-	    gchar *filename;
-	    if ( G_UNLIKELY (uri == NULL) )
-		goto out;
-	    
-	    filename = g_filename_from_uri (uri, NULL, NULL);
-	    
-	    if ( filename )
+	    if ( title == NULL )
 	    {
-		title  = g_path_get_basename (filename);
+		filename = g_filename_from_uri (uri, NULL, NULL);
+		title = g_filename_display_basename (filename);
 		g_free (filename);
 	    }
-	    else
-	    {
-		TRACE ("Unable to set statusbar title");
-		goto out;
-	    }
+	    text = g_strdup (title != NULL ? title : filename);
+	    gtk_label_set_text (GTK_LABEL (bar->priv->label_text), text);
 	}
 	
-	text = g_strdup_printf ("%s", title);
-	gtk_label_set_text (GTK_LABEL (bar->priv->label_text), text);
 	g_free (text);
+	g_free (title);
 	g_free (uri);
-	return;
     }
-	
-out:
-    gtk_label_set_text (GTK_LABEL (bar->priv->label_text), NULL);
 }
 
 static void



More information about the Xfce4-commits mailing list