fixed "crash on stop clicked while paused" bug

This commit is contained in:
fgerlits 2005-05-11 12:07:57 +00:00
parent a40d2e523c
commit 6d66851484
2 changed files with 20 additions and 5 deletions

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/NowPlaying.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/NowPlaying.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -81,6 +81,7 @@ NowPlaying :: NowPlaying(Ptr<GLiveSupport>::Ref gLiveSupport,
&NowPlaying::onStopButtonClicked )); &NowPlaying::onStopButtonClicked ));
isActive = false; isActive = false;
isPaused = false;
label = Gtk::manage(new Gtk::Label); label = Gtk::manage(new Gtk::Label);
label->set_ellipsize(Pango::ELLIPSIZE_END); label->set_ellipsize(Pango::ELLIPSIZE_END);
@ -101,6 +102,7 @@ NowPlaying :: setPlayable(Ptr<Playable>::Ref playable) throw ()
stopButton->show(); stopButton->show();
pauseButton->show(); pauseButton->show();
isActive = true; isActive = true;
isPaused = false;
} }
Ptr<Glib::ustring>::Ref infoString(new Glib::ustring); Ptr<Glib::ustring>::Ref infoString(new Glib::ustring);
@ -124,7 +126,11 @@ NowPlaying :: setPlayable(Ptr<Playable>::Ref playable) throw ()
label->set_text(""); label->set_text("");
if (isActive) { if (isActive) {
remove(*stopButton); remove(*stopButton);
if (isPaused) {
remove(*playButton);
} else {
remove(*pauseButton); remove(*pauseButton);
}
isActive = false; isActive = false;
} }
this->playable.reset(); this->playable.reset();
@ -143,6 +149,8 @@ NowPlaying :: onPlayButtonClicked(void) throw ()
remove(*playButton); remove(*playButton);
pack_end(*pauseButton, Gtk::PACK_SHRINK, 2); pack_end(*pauseButton, Gtk::PACK_SHRINK, 2);
pauseButton->show(); pauseButton->show();
isPaused = false;
} }
@ -157,6 +165,8 @@ NowPlaying :: onPauseButtonClicked(void) throw ()
remove(*pauseButton); remove(*pauseButton);
pack_end(*playButton, Gtk::PACK_SHRINK, 2); pack_end(*playButton, Gtk::PACK_SHRINK, 2);
playButton->show(); playButton->show();
isPaused = true;
} }

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/NowPlaying.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/NowPlaying.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -66,7 +66,7 @@ using namespace LiveSupport::Widgets;
* The box displaying "now playing" in the master panel. * The box displaying "now playing" in the master panel.
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.1 $ * @version $Revision: 1.2 $
*/ */
class NowPlaying : public Gtk::HBox, class NowPlaying : public Gtk::HBox,
public LocalizedObject public LocalizedObject
@ -78,6 +78,11 @@ class NowPlaying : public Gtk::HBox,
*/ */
bool isActive; bool isActive;
/**
* Whether the pause button has been clicked.
*/
bool isPaused;
/** /**
* The playable which is shown in the widget. * The playable which is shown in the widget.
*/ */