This commit is contained in:
fgerlits 2006-11-30 12:39:32 +00:00
parent fafbf6e87b
commit 3fd1e71d51
4 changed files with 45 additions and 7 deletions

View File

@ -117,7 +117,7 @@ class Notebook : public Gtk::Alignment
virtual void
onTabClicked(void) throw ()
{
notebook->activatePage(index);
notebook->setActivePage(index);
}
/**
@ -304,13 +304,34 @@ class Notebook : public Gtk::Alignment
appendPage(Gtk::Widget & widget,
const Glib::ustring & label) throw ();
/**
* Get the number of the active page.
*
* @return the index of the active page.
*/
virtual unsigned int
getActivePage(void) throw ()
{
return activePage;
}
/**
* Make a specific page active.
*
* @param pageNo the index of the page to make active.
*/
virtual void
activatePage(unsigned int pageNo) throw ();
setActivePage(unsigned int pageNo) throw ();
/**
* Enable or disable a page in the notebook.
*
* @param pageNo the index of the page to enable or disable.
* @param sensitive true (default) to enable, false to disable.
*/
virtual void
setPageSensitive(unsigned int pageNo,
bool sensitive) throw ();
};

View File

@ -246,7 +246,7 @@ Notebook :: pagesAdded(void) throw ()
}
// reset the active page to 0, and show it
activatePage(0);
setActivePage(0);
}
@ -254,7 +254,7 @@ Notebook :: pagesAdded(void) throw ()
* Make a page active
*----------------------------------------------------------------------------*/
void
Notebook :: activatePage(unsigned int pageNo) throw ()
Notebook :: setActivePage(unsigned int pageNo) throw ()
{
if (pageNo >= pageList.size()) {
return;
@ -270,3 +270,15 @@ Notebook :: activatePage(unsigned int pageNo) throw ()
}
/*------------------------------------------------------------------------------
* Enable or disable a page in the notebook.
*----------------------------------------------------------------------------*/
void
Notebook :: setPageSensitive(unsigned int pageNo,
bool sensitive) throw ()
{
if (pageNo < pageList.size()) {
pageList[pageNo]->button->setDisabled(!sensitive);
}
}

View File

@ -967,7 +967,7 @@ OptionsWindow :: resetEditedKeyBinding(void) throw ()
void
OptionsWindow :: run(void) throw ()
{
mainNotebook->activatePage(2); // "Servers"
mainNotebook->setActivePage(2); // "Servers"
property_window_position().set_value(Gtk::WIN_POS_CENTER_ALWAYS);
show_all();
Gtk::Main::run(*this);

View File

@ -991,7 +991,7 @@ bool
SearchWindow :: uploadToHub(Ptr<Playable>::Ref playable) throw ()
{
try {
searchInput->activatePage(3);
searchInput->setActivePage(3);
transportList->addUpload(playable);
} catch (XmlRpcException &e) {
@ -1020,7 +1020,7 @@ SearchWindow :: onDownloadFromHub(void) throw ()
if (playable) {
if (!gLiveSupport->existsPlayable(playable->getId())) {
try {
searchInput->activatePage(3);
searchInput->setActivePage(3);
transportList->addDownload(playable);
} catch (XmlRpcException &e) {
@ -1093,8 +1093,13 @@ void
SearchWindow :: onSearchWhereChanged(void) throw ()
{
if (searchIsLocal()) {
searchInput->setPageSensitive(2, true);
searchResultsTreeView->set_model(localSearchResults);
} else {
if (searchInput->getActivePage() == 2) {
searchInput->setActivePage(0);
}
searchInput->setPageSensitive(2, false);
searchResultsTreeView->set_model(remoteSearchResults);
}