[goobox] fixed notification text in all possible player states



commit 462dbda8ee18b36091eff3f74801ae7bef94e969
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sun Jun 5 22:53:17 2011 +0200

    fixed notification text in all possible player states

 src/goo-window.c |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/src/goo-window.c b/src/goo-window.c
index 67a7bcd..4827f09 100644
--- a/src/goo-window.c
+++ b/src/goo-window.c
@@ -981,6 +981,7 @@ first_time_idle (gpointer callback_data)
 	GooWindow *window = callback_data;
 
 	g_source_remove (window->priv->first_time_event);
+	window->priv->first_time_event = 0;
 	goo_player_update (window->priv->player);
 
 	return FALSE;
@@ -1309,13 +1310,34 @@ notify_current_state_cb (gpointer user_data)
 
 #ifdef ENABLE_NOTIFICATION
 
-	GString *info = g_string_new ("");
+	GString        *info = g_string_new ("");
+	GooPlayerState  state;
+
+	state = goo_player_get_state (window->priv->player);
 
-	if ((window->priv->album == NULL) || (window->priv->current_track == NULL)) {
+	if ((state == GOO_PLAYER_STATE_ERROR) || (state == GOO_PLAYER_STATE_NO_DISC)) {
+		system_notify (window, _("No disc"), "");
+		return FALSE;
+	}
+
+	if (state == GOO_PLAYER_STATE_DATA_DISC) {
+		system_notify (window, _("Data disc"), "");
+		return FALSE;
+	}
+
+	if (window->priv->album == NULL) {
 		system_notify (window, "", "");
 		return FALSE;
 	}
 
+	if (window->priv->current_track == NULL) {
+		if ((window->priv->album != NULL) && (window->priv->album->title != NULL))
+			system_notify (window, window->priv->album->title , "");
+		else
+			system_notify (window, _("Audio CD"), "");
+		return FALSE;
+	}
+
 	if (window->priv->album->artist != NULL) {
 		char *e_artist = g_markup_escape_text (window->priv->album->artist, -1);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]