Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/rhythmbox/ChangeLog,v
retrieving revision 1.2404
diff -u -r1.2404 ChangeLog
--- ChangeLog	15 Nov 2006 13:34:25 -0000	1.2404
+++ ChangeLog	17 Nov 2006 00:31:33 -0000
@@ -1,3 +1,13 @@
+2006-11-17  Richard Boulton <richard@lemurconsulting.com>
+
+	* shell/rb-shell-player.c:
+
+	Change play button to be an GtkAction which displays a play icon
+	and "Play" text when not playing, and changes to display a pause
+	icon and "Pause" text when playing, instead of being a
+	GtkToggleAction which is selected while playing.  Provides better
+	feedback to users, and should fix #326066.
+
 2006-11-15  Jonathan Matthew  <jonathan@kaolin.wh9.net>
 
 	* shell/rb-playlist-manager.c: (*):
Index: shell/rb-shell-player.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/shell/rb-shell-player.c,v
retrieving revision 1.265
diff -u -r1.265 rb-shell-player.c
--- shell/rb-shell-player.c	30 Oct 2006 13:51:10 -0000	1.265
+++ shell/rb-shell-player.c	17 Nov 2006 00:31:36 -0000
@@ -240,6 +240,9 @@
 
 static GtkActionEntry rb_shell_player_actions [] =
 {
+	{ "ControlPlay", GTK_STOCK_MEDIA_PLAY, N_("_Play"), "<control>space",
+	  N_("Start playback"),
+	  G_CALLBACK (rb_shell_player_cmd_play) },
 	{ "ControlPrevious", GTK_STOCK_MEDIA_PREVIOUS, N_("P_revious"), "<alt>Left",
 	  N_("Start playing the previous song"),
 	  G_CALLBACK (rb_shell_player_cmd_previous) },
@@ -257,9 +260,6 @@
 
 static GtkToggleActionEntry rb_shell_player_toggle_entries [] =
 {
-	{ "ControlPlay", GTK_STOCK_MEDIA_PLAY, N_("_Play"), "<control>space",
-	  N_("Start playback"),
-	  G_CALLBACK (rb_shell_player_cmd_play) },
 	{ "ControlShuffle", GNOME_MEDIA_SHUFFLE, N_("Sh_uffle"), "<control>U",
 	  N_("Play songs in a random order"),
 	  G_CALLBACK (rb_shell_player_shuffle_changed_cb) },
@@ -2957,22 +2957,54 @@
 }
 #endif /* HAVE_MMKEYS */
 
+static void
+update_playpause_icon (RBShellPlayer *player)
+{
+	GtkAction *action;
+	gboolean playing;
+	char *tooltip;
+	char *label;
+	char *stockid;
+	gchar * oldstockid;
+
+	g_object_get (player, "playing", &playing, NULL);
+	action = gtk_action_group_get_action (player->priv->actiongroup,
+					      "ControlPlay");
+	g_object_get (action, "stock-id", &oldstockid, NULL);
+	if (playing) {
+		tooltip = g_strdup (_("Stop playback"));
+		label = g_strdup (N_("_Pause"));
+		stockid = g_strdup ("gtk-media-pause");
+	} else {
+		tooltip = g_strdup (_("Start playback"));
+		label = g_strdup (N_("_Play"));
+		stockid = g_strdup ("gtk-media-play");
+	}
+	if (strcmp (stockid, oldstockid) != 0) {
+		/* Don't set the properties if the values haven't changed, because
+		* this causes the icon to flicker. */
+		g_object_set (action, "tooltip", tooltip, NULL);
+		g_object_set (action, "label", label, NULL);
+		g_object_set (action, "stock-id", stockid, NULL);
+	}
+	g_free (tooltip);
+	g_free (label);
+	g_free (stockid);
+	g_free (oldstockid);
+}
+
 static gboolean
 _idle_unblock_signal_cb (gpointer data)
 {
 	RBShellPlayer *player = (RBShellPlayer *)data;
 	GtkAction *action;
-	gboolean playing;
 
 	GDK_THREADS_ENTER ();
 
+	update_playpause_icon (player);
+
 	action = gtk_action_group_get_action (player->priv->actiongroup,
 					      "ControlPlay");
-
-	/* sync the active state of the action again */
-	g_object_get (player, "playing", &playing, NULL);
-	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), playing);
-
 	g_signal_handlers_unblock_by_func (action, rb_shell_player_cmd_play, player);
 
 	GDK_THREADS_LEAVE ();
@@ -2985,25 +3017,14 @@
 				    gpointer user_data)
 {
 	GtkAction *action;
-	gboolean playing;
-	char *tooltip;
-
-	g_object_get (player, "playing", &playing, NULL);
-	action = gtk_action_group_get_action (player->priv->actiongroup,
-					      "ControlPlay");
-	if (playing) {
-		tooltip = g_strdup (_("Stop playback"));
-	} else {
-		tooltip = g_strdup (_("Start playback"));
-	}
-	g_object_set (action, "tooltip", tooltip, NULL);
-	g_free (tooltip);
+	update_playpause_icon (player);
 
 	/* block the signal, so that it doesn't get stuck by triggering recursively,
 	 * and don't unblock it until whatever else is happening has finished.
 	 */
+	action = gtk_action_group_get_action (player->priv->actiongroup,
+					      "ControlPlay");
 	g_signal_handlers_block_by_func (action, rb_shell_player_cmd_play, player);
-	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), playing);
 	g_idle_add (_idle_unblock_signal_cb, player);
 }
 
