[goobox] update the statusbar correctly, removed the fake signal emition



commit 4f618552944778c1e808d17ec054a5fd3376f34a
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sun Nov 15 23:28:36 2009 +0100

    update the statusbar correctly, removed the fake signal emition

 src/goo-player-info.c |    2 +-
 src/goo-player.c      |   20 ++++++++++++--------
 src/goo-player.h      |    3 ++-
 src/goo-window.c      |   20 ++++++++++----------
 4 files changed, 25 insertions(+), 20 deletions(-)
---
diff --git a/src/goo-player-info.c b/src/goo-player-info.c
index 292e66b..38b32c5 100644
--- a/src/goo-player-info.c
+++ b/src/goo-player-info.c
@@ -785,7 +785,7 @@ player_done_cb (GooPlayer       *player,
 		break;
 	case GOO_PLAYER_ACTION_PLAY:
 	case GOO_PLAYER_ACTION_STOP:
-	case GOO_PLAYER_ACTION_EJECT:
+	case GOO_PLAYER_ACTION_MEDIUM_REMOVED:
 		goo_player_info_set_time (info, 0);
 		break;
 	default:
diff --git a/src/goo-player.c b/src/goo-player.c
index a71800c..a4a99ec 100644
--- a/src/goo-player.c
+++ b/src/goo-player.c
@@ -335,7 +335,7 @@ static void
 goo_player_init (GooPlayer *self)
 {
 	self->priv = GOO_PLAYER_GET_PRIVATE_DATA (self);
-	self->priv->state = GOO_PLAYER_STATE_LISTING;
+	self->priv->state = GOO_PLAYER_STATE_NO_DISC;
 	self->priv->action = GOO_PLAYER_ACTION_NONE;
 	self->priv->is_busy = FALSE;
 	self->priv->hibernate = FALSE;
@@ -389,7 +389,10 @@ drive_medium_added_cb (BraseroDrive  *drive,
 		       BraseroMedium *medium,
 		       gpointer       user_data)
 {
-	goo_player_update ((GooPlayer *) user_data);
+	GooPlayer *self = user_data;
+
+	action_done (self, GOO_PLAYER_ACTION_MEDIUM_ADDED);
+	goo_player_update (self);
 }
 
 
@@ -398,7 +401,10 @@ drive_medium_removed_cb (BraseroDrive  *drive,
 		         BraseroMedium *medium,
 		         gpointer       user_data)
 {
-	goo_player_update ((GooPlayer *) user_data);
+	GooPlayer *self = user_data;
+
+	action_done (self, GOO_PLAYER_ACTION_MEDIUM_REMOVED);
+	goo_player_update (self);
 }
 
 
@@ -785,8 +791,6 @@ goo_player_update (GooPlayer *self)
 		action_done (self, GOO_PLAYER_ACTION_LIST);
 	}
 	else if ((BRASERO_MEDIUM_IS (brasero_medium_get_status (medium), BRASERO_MEDIUM_CD | BRASERO_MEDIUM_HAS_AUDIO))) {
-		if (self->priv->state == GOO_PLAYER_STATE_NO_DISC)
-			action_done (self, GOO_PLAYER_ACTION_EJECT); /* fake EJECT signal to update the window state correctly */
 		self->priv->audio_cd = TRUE;
 		goo_player_set_state (self, GOO_PLAYER_STATE_STOPPED, TRUE);
 		goo_player_list (self);
@@ -1041,9 +1045,9 @@ eject_ready_cb (GObject      *source_object,
 	GError    *error = NULL;
 
 	if (! g_drive_eject_with_operation_finish (G_DRIVE (source_object), result, &error))
-		g_signal_emit_by_name (G_OBJECT (self), "done", GOO_PLAYER_ACTION_EJECT, error);
+		g_signal_emit_by_name (G_OBJECT (self), "done", GOO_PLAYER_ACTION_MEDIUM_REMOVED, error);
 	else
-		g_signal_emit_by_name (G_OBJECT (self), "done", GOO_PLAYER_ACTION_EJECT, NULL);
+		g_signal_emit_by_name (G_OBJECT (self), "done", GOO_PLAYER_ACTION_MEDIUM_REMOVED, NULL);
 
 	goo_player_set_state (self, GOO_PLAYER_STATE_STOPPED, TRUE);
 }
@@ -1057,7 +1061,7 @@ goo_player_eject (GooPlayer *self)
 	if (self->priv->hibernate)
 		return;
 
-	g_signal_emit_by_name (G_OBJECT (self), "start", GOO_PLAYER_ACTION_EJECT);
+	g_signal_emit_by_name (G_OBJECT (self), "start", GOO_PLAYER_ACTION_MEDIUM_REMOVED);
 
 	gdrive = brasero_drive_get_gdrive (self->priv->drive);
 	g_drive_eject_with_operation (gdrive,
diff --git a/src/goo-player.h b/src/goo-player.h
index 8ab84c8..e3710de 100644
--- a/src/goo-player.h
+++ b/src/goo-player.h
@@ -48,7 +48,8 @@ typedef enum {
 	GOO_PLAYER_ACTION_PLAY,
 	GOO_PLAYER_ACTION_PAUSE,
 	GOO_PLAYER_ACTION_STOP,
-	GOO_PLAYER_ACTION_EJECT,
+	GOO_PLAYER_ACTION_MEDIUM_REMOVED,
+	GOO_PLAYER_ACTION_MEDIUM_ADDED,
 	GOO_PLAYER_ACTION_UPDATE,
 	GOO_PLAYER_ACTION_METADATA
 } GooPlayerAction;
diff --git a/src/goo-window.c b/src/goo-window.c
index 5a6fec3..90022bf 100644
--- a/src/goo-window.c
+++ b/src/goo-window.c
@@ -116,7 +116,6 @@ struct _GooWindowPrivate {
 	int                pos_x, pos_y;
 	gboolean           hibernate;
 	gboolean           notify_action;
-	gboolean           ejected;
 
 #ifdef ENABLE_MEDIA_KEYS
 	DBusGProxy        *media_keys_proxy;
@@ -395,6 +394,7 @@ goo_window_update_list (GooWindow *window)
 	}
 
 	window_update_sensitivity (window);
+	window_update_statusbar_list_info (window);
 
 	g_object_unref (icon);
 }
@@ -976,7 +976,7 @@ first_time_idle (gpointer callback_data)
 	GooWindow *window = callback_data;
 
 	g_source_remove (window->priv->first_time_event);
-	goo_player_update (window->priv->player);
+	/*goo_player_update (window->priv->player); FIXME */
 
 	return FALSE;
 }
@@ -1231,8 +1231,11 @@ get_action_name (GooPlayerAction action)
 	case GOO_PLAYER_ACTION_STOP:
 		name = "STOP";
 		break;
-	case GOO_PLAYER_ACTION_EJECT:
-		name = "EJECT";
+	case GOO_PLAYER_ACTION_MEDIUM_ADDED:
+		name = "MEDIUM ADDED";
+		break;
+	case GOO_PLAYER_ACTION_MEDIUM_REMOVED:
+		name = "MEDIUM REMOVED";
 		break;
 	case GOO_PLAYER_ACTION_UPDATE:
 		name = "UPDATE";
@@ -1636,12 +1639,10 @@ player_done_cb (GooPlayer       *player,
 		goo_window_update_cover (window);
 		window_update_title (window);
 		set_current_track_icon (window, NULL);
-		if (AutoPlay || (window->priv->ejected && eel_gconf_get_boolean (PREF_GENERAL_AUTOPLAY, TRUE))) {
+		if (AutoPlay || eel_gconf_get_boolean (PREF_GENERAL_AUTOPLAY, TRUE)) {
 			AutoPlay = FALSE;
 			g_timeout_add (AUTOPLAY_DELAY, autoplay_cb, window);
 		}
-		if (goo_player_get_state (player) >= GOO_PLAYER_STATE_NO_DISC)
-			window->priv->ejected = FALSE;
 		break;
 
 	case GOO_PLAYER_ACTION_METADATA:
@@ -1660,7 +1661,7 @@ player_done_cb (GooPlayer       *player,
 		
 	case GOO_PLAYER_ACTION_PLAY:
 	case GOO_PLAYER_ACTION_STOP:
-	case GOO_PLAYER_ACTION_EJECT:
+	case GOO_PLAYER_ACTION_MEDIUM_REMOVED:
 		set_action_label_and_icon (window,
 					   "TogglePlay", 
 					   _("_Play"), 
@@ -1674,8 +1675,7 @@ player_done_cb (GooPlayer       *player,
 		} 
 		else if (action == GOO_PLAYER_ACTION_STOP) 
 			set_current_track_icon (window, GTK_STOCK_MEDIA_STOP);
-		else if (action == GOO_PLAYER_ACTION_EJECT)
-			window->priv->ejected = TRUE;
+
 		break;
 		
 	case GOO_PLAYER_ACTION_PAUSE:



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