diff --git a/campcaster/doc/gui/gladeConventions.html b/campcaster/doc/gui/gladeConventions.html index b7b1e90a8..b7a4df0d4 100644 --- a/campcaster/doc/gui/gladeConventions.html +++ b/campcaster/doc/gui/gladeConventions.html @@ -37,7 +37,8 @@ based on the design documentation <code>styleguide.pdf</code>. <p>Each toplevel has its own file, named the same as the C++ class which controls it, with the extension <code>.glade</code>. For example: <code>ScratchpadWindow.glade</code>, <code>LiveModeWindow.glade</code>. -Pop-up dialogs go into the Glade file of the toplevel which pops them up. +Pop-up dialogs which do not have their own class go into the Glade file +of the toplevel which pops them up. <p>Each toplevel should be a GtkWindow, except for pop-ups like the Login window, confirmation dialogs etc., which are GtkDialogs or subclasses of it.</p> diff --git a/campcaster/src/products/gLiveSupport/src/BackupView.cxx b/campcaster/src/products/gLiveSupport/src/BackupView.cxx index 16bca4e61..ae522bf5f 100644 --- a/campcaster/src/products/gLiveSupport/src/BackupView.cxx +++ b/campcaster/src/products/gLiveSupport/src/BackupView.cxx @@ -101,7 +101,7 @@ BackupView :: BackupView (GuiObject * parent) constructCriteriaView(); constructBackupListView(); - dateTimeChooserWindow.reset(new DateTimeChooserWindow(gLiveSupport)); + dateTimeChooserWindow.reset(new DateTimeChooserWindow()); } diff --git a/campcaster/src/products/gLiveSupport/src/DateTimeChooserWindow.cxx b/campcaster/src/products/gLiveSupport/src/DateTimeChooserWindow.cxx index 9874e5969..5088338eb 100644 --- a/campcaster/src/products/gLiveSupport/src/DateTimeChooserWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/DateTimeChooserWindow.cxx @@ -45,6 +45,11 @@ using namespace LiveSupport::GLiveSupport; namespace { +/*------------------------------------------------------------------------------ + * The name of the localization resource bundle. + *----------------------------------------------------------------------------*/ +const Glib::ustring bundleName = "dateTimeChooserWindow"; + /*------------------------------------------------------------------------------ * The name of the glade file. *----------------------------------------------------------------------------*/ @@ -60,21 +65,11 @@ const Glib::ustring gladeFileName = "DateTimeChooserWindow.glade"; /*------------------------------------------------------------------------------ * Constructor. *----------------------------------------------------------------------------*/ -DateTimeChooserWindow :: DateTimeChooserWindow( - Ptr<GLiveSupport>::Ref gLiveSupport) +DateTimeChooserWindow :: DateTimeChooserWindow (void) throw () + : GuiWindow(bundleName, + gladeFileName) { - Ptr<ResourceBundle>::Ref - bundle = gLiveSupport->getBundle("dateTimeChooserWindow"); - setBundle(bundle); - - Glib::ustring gladeDir = gLiveSupport->getGladeDir(); - Glib::RefPtr<Gnome::Glade::Xml> - glade = Gnome::Glade::Xml::create(gladeDir + gladeFileName); - - glade->get_widget("mainWindow1", mainWindow); - mainWindow->set_title(*getResourceUstring("windowTitle")); - Gtk::Label * hourLabel; Gtk::Label * minuteLabel; glade->get_widget("hourLabel1", hourLabel); diff --git a/campcaster/src/products/gLiveSupport/src/DateTimeChooserWindow.h b/campcaster/src/products/gLiveSupport/src/DateTimeChooserWindow.h index 967e98bc1..c01a25fe8 100644 --- a/campcaster/src/products/gLiveSupport/src/DateTimeChooserWindow.h +++ b/campcaster/src/products/gLiveSupport/src/DateTimeChooserWindow.h @@ -40,15 +40,14 @@ #include "configure.h" #endif -#include <gtkmm.h> -#include <libglademm.h> #include <boost/date_time/gregorian/gregorian.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include "LiveSupport/Core/Ptr.h" -#include "LiveSupport/Core/LocalizedObject.h" #include "GLiveSupport.h" +#include "GuiWindow.h" + namespace LiveSupport { namespace GLiveSupport { @@ -74,15 +73,10 @@ using namespace LiveSupport::Core; * @author $Author$ * @version $Revision$ */ -class DateTimeChooserWindow : public LocalizedObject +class DateTimeChooserWindow : public GuiWindow { private: - /** - * The main window for this class. - */ - Gtk::Dialog * mainWindow; - /** * The calendar where the date is chosen. */ @@ -122,11 +116,8 @@ class DateTimeChooserWindow : public LocalizedObject /** * Constructor. - * - * @param gLiveSupport the gLiveSupport object, containing - * all the vital info. */ - DateTimeChooserWindow(Ptr<GLiveSupport>::Ref gLiveSupport) + DateTimeChooserWindow(void) throw (); /** diff --git a/campcaster/src/products/gLiveSupport/src/ExportFormatRadioButtons.cxx b/campcaster/src/products/gLiveSupport/src/ExportFormatRadioButtons.cxx index 511d86a8f..a0b5cc6f7 100644 --- a/campcaster/src/products/gLiveSupport/src/ExportFormatRadioButtons.cxx +++ b/campcaster/src/products/gLiveSupport/src/ExportFormatRadioButtons.cxx @@ -54,11 +54,9 @@ using namespace LiveSupport::GLiveSupport; /*------------------------------------------------------------------------------ * Constructor. *----------------------------------------------------------------------------*/ -ExportFormatRadioButtons :: ExportFormatRadioButtons( - Ptr<ResourceBundle>::Ref bundle, - Glib::RefPtr<Gnome::Glade::Xml> glade) +ExportFormatRadioButtons :: ExportFormatRadioButtons(GuiObject * parent) throw () - : LocalizedObject(bundle) + : GuiComponent(parent) { glade->get_widget("internalFormatRadioButton1", internalFormatRadioButton); glade->get_widget("smilFormatRadioButton1", smilFormatRadioButton); diff --git a/campcaster/src/products/gLiveSupport/src/ExportFormatRadioButtons.h b/campcaster/src/products/gLiveSupport/src/ExportFormatRadioButtons.h index de2055b57..e499a08fa 100644 --- a/campcaster/src/products/gLiveSupport/src/ExportFormatRadioButtons.h +++ b/campcaster/src/products/gLiveSupport/src/ExportFormatRadioButtons.h @@ -36,12 +36,10 @@ /* ============================================================ include files */ -#include <gtkmm.h> -#include <libglademm.h> - -#include "LiveSupport/Core/LocalizedObject.h" #include "LiveSupport/StorageClient/StorageClientInterface.h" +#include "GuiComponent.h" + namespace LiveSupport { namespace GLiveSupport { @@ -64,7 +62,7 @@ using namespace LiveSupport::StorageClient; * @author $Author$ * @version $Revision$ */ -class ExportFormatRadioButtons : public LocalizedObject +class ExportFormatRadioButtons : public GuiComponent { private: @@ -84,11 +82,9 @@ class ExportFormatRadioButtons : public LocalizedObject /** * Constructor. * - * @param bundle the resource bundle holding the localized - * resources for this window. + * @param parent the GuiObject which contains this one. */ - ExportFormatRadioButtons(Ptr<ResourceBundle>::Ref bundle, - Glib::RefPtr<Gnome::Glade::Xml> glade) + ExportFormatRadioButtons(GuiObject * parent) throw (); /** diff --git a/campcaster/src/products/gLiveSupport/src/ExportPlaylistWindow.cxx b/campcaster/src/products/gLiveSupport/src/ExportPlaylistWindow.cxx index 2832b9882..1c83d315a 100644 --- a/campcaster/src/products/gLiveSupport/src/ExportPlaylistWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/ExportPlaylistWindow.cxx @@ -54,6 +54,11 @@ using namespace LiveSupport::GLiveSupport; namespace { +/*------------------------------------------------------------------------------ + * The name of the localization resource bundle. + *----------------------------------------------------------------------------*/ +const Glib::ustring bundleName = "exportPlaylistWindow"; + /*------------------------------------------------------------------------------ * The name of the glade file. *----------------------------------------------------------------------------*/ @@ -69,25 +74,12 @@ const Glib::ustring gladeFileName = "ExportPlaylistWindow.glade"; /*------------------------------------------------------------------------------ * Constructor. *----------------------------------------------------------------------------*/ -ExportPlaylistWindow :: ExportPlaylistWindow( - Ptr<GLiveSupport>::Ref gLiveSupport, - const Glib::ustring & gladeDir, - Ptr<Playlist>::Ref playlist) +ExportPlaylistWindow :: ExportPlaylistWindow(Ptr<Playlist>::Ref playlist) throw () - : gLiveSupport(gLiveSupport), + : GuiWindow(bundleName, + gladeFileName), playlist(playlist) { - Ptr<ResourceBundle>::Ref bundle = gLiveSupport->getBundle( - "exportPlaylistWindow"); - setBundle(bundle); - - glade = Gnome::Glade::Xml::create(gladeDir + gladeFileName); - - glade->get_widget("mainWindow1", mainWindow); - mainWindow->set_title(*getResourceUstring("windowTitle")); - mainWindow->signal_delete_event().connect(sigc::mem_fun(*this, - &ExportPlaylistWindow::onDeleteEvent)); - Gtk::Label * playlistTitleTextLabel; Gtk::Label * formatLabel; glade->get_widget("playlistTitleTextLabel1", playlistTitleTextLabel); @@ -105,7 +97,7 @@ ExportPlaylistWindow :: ExportPlaylistWindow( glade->connect_clicked("saveButton1", sigc::mem_fun(*this, &ExportPlaylistWindow::onSaveButtonClicked)); - formatButtons.reset(new ExportFormatRadioButtons(bundle, glade)); + formatButtons.reset(new ExportFormatRadioButtons(this)); } diff --git a/campcaster/src/products/gLiveSupport/src/ExportPlaylistWindow.h b/campcaster/src/products/gLiveSupport/src/ExportPlaylistWindow.h index 1cca57c78..6c307084c 100644 --- a/campcaster/src/products/gLiveSupport/src/ExportPlaylistWindow.h +++ b/campcaster/src/products/gLiveSupport/src/ExportPlaylistWindow.h @@ -40,14 +40,12 @@ #include "configure.h" #endif -#include <gtkmm.h> -#include <libglademm.h> - #include "LiveSupport/Core/Playlist.h" -#include "LiveSupport/Core/LocalizedObject.h" #include "ExportFormatRadioButtons.h" #include "GLiveSupport.h" +#include "GuiWindow.h" + namespace LiveSupport { namespace GLiveSupport { @@ -71,25 +69,10 @@ using namespace LiveSupport::Core; * @author $Author$ * @version $Revision$ */ -class ExportPlaylistWindow : public LocalizedObject +class ExportPlaylistWindow : public GuiWindow { private: - /** - * The GLiveSupport object, holding the state of the application. - */ - Ptr<GLiveSupport>::Ref gLiveSupport; - - /** - * The Glade object, containing the visual design. - */ - Glib::RefPtr<Gnome::Glade::Xml> glade; - - /** - * The main window for this class. - */ - Gtk::Window * mainWindow; - /** * The playlist to be exported. */ @@ -129,8 +112,12 @@ class ExportPlaylistWindow : public LocalizedObject /** * Event handler called when the the window gets hidden. - * * It closes the exporting operations, if there is one in progress. + * + * Overrides GuiWindow::onDeleteEvent(). + * + * @param event attributes of the event. + * @return true if handled the event, false to continue deleting. */ virtual bool onDeleteEvent(GdkEventAny * event) throw (); @@ -141,14 +128,9 @@ class ExportPlaylistWindow : public LocalizedObject /** * Constructor. * - * @param gLiveSupport the gLiveSupport object, containing - * all the vital info. - * @param gladeDir the directory where the Glade files are. * @param playlist the playlist to be exported. */ - ExportPlaylistWindow(Ptr<GLiveSupport>::Ref gLiveSupport, - const Glib::ustring & gladeDir, - Ptr<Playlist>::Ref playlist) + ExportPlaylistWindow(Ptr<Playlist>::Ref playlist) throw (); /** @@ -158,15 +140,6 @@ class ExportPlaylistWindow : public LocalizedObject ~ExportPlaylistWindow(void) throw () { } - - /** - * Get the underlying Gtk::Window. - */ - virtual Gtk::Window * - getWindow(void) throw () - { - return mainWindow; - } }; /* ================================================= external data structures */ diff --git a/campcaster/src/products/gLiveSupport/src/LiveModeWindow.cxx b/campcaster/src/products/gLiveSupport/src/LiveModeWindow.cxx index a5502e4d7..4ec96861e 100644 --- a/campcaster/src/products/gLiveSupport/src/LiveModeWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/LiveModeWindow.cxx @@ -400,17 +400,17 @@ LiveModeWindow :: onSchedulePlaylist(void) throw () { Gtk::TreeModel::iterator iter = getSelected(); - if (iter) { - Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn]; - Ptr<Playlist>::Ref playlist = playable->getPlaylist(); - if (playlist) { - schedulePlaylistWindow.reset(new SchedulePlaylistWindow( - gLiveSupport, - gLiveSupport->getGladeDir(), - playlist)); - schedulePlaylistWindow->getWindow()->set_transient_for(*mainWindow); - Gtk::Main::run(*schedulePlaylistWindow->getWindow()); - } + if (!iter) { + return; + } + + Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn]; + Ptr<Playlist>::Ref playlist = playable->getPlaylist(); + + if (playlist) { + schedulePlaylistWindow.reset(new SchedulePlaylistWindow(playlist)); + schedulePlaylistWindow->getWindow()->set_transient_for(*mainWindow); + Gtk::Main::run(*schedulePlaylistWindow->getWindow()); } } @@ -423,17 +423,17 @@ LiveModeWindow :: onExportPlaylist(void) throw () { Gtk::TreeModel::iterator iter = getSelected(); - if (iter) { - Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn]; - Ptr<Playlist>::Ref playlist = playable->getPlaylist(); - if (playlist) { - exportPlaylistWindow.reset(new ExportPlaylistWindow( - gLiveSupport, - gLiveSupport->getGladeDir(), - playlist)); - exportPlaylistWindow->getWindow()->set_transient_for(*mainWindow); - Gtk::Main::run(*exportPlaylistWindow->getWindow()); - } + if (!iter) { + return; + } + + Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn]; + Ptr<Playlist>::Ref playlist = playable->getPlaylist(); + + if (playlist) { + exportPlaylistWindow.reset(new ExportPlaylistWindow(playlist)); + exportPlaylistWindow->getWindow()->set_transient_for(*mainWindow); + Gtk::Main::run(*exportPlaylistWindow->getWindow()); } } diff --git a/campcaster/src/products/gLiveSupport/src/MasterPanelWindow.h b/campcaster/src/products/gLiveSupport/src/MasterPanelWindow.h index 635ba1def..b71ba194b 100644 --- a/campcaster/src/products/gLiveSupport/src/MasterPanelWindow.h +++ b/campcaster/src/products/gLiveSupport/src/MasterPanelWindow.h @@ -382,8 +382,10 @@ class MasterPanelWindow : public GuiWindow * Event handler for when the user closes the master panel. * It pops up a confirmation dialog. * - * @param event attributes for the event (?) - * @return true if handled the event, false to continue deleting + * Overrides GuiWindow::onDeleteEvent(). + * + * @param event attributes of the event. + * @return true if handled the event, false to continue deleting. */ virtual bool onDeleteEvent(GdkEventAny * event) throw (); diff --git a/campcaster/src/products/gLiveSupport/src/RestoreBackupWindow.cxx b/campcaster/src/products/gLiveSupport/src/RestoreBackupWindow.cxx index f3a050197..1dcd44f08 100644 --- a/campcaster/src/products/gLiveSupport/src/RestoreBackupWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/RestoreBackupWindow.cxx @@ -44,6 +44,15 @@ using namespace LiveSupport::GLiveSupport; /* ================================================ local constants & macros */ namespace { +/*------------------------------------------------------------------------------ + * The name of the localization resource bundle. + *----------------------------------------------------------------------------*/ +const Glib::ustring bundleName = "restoreBackupWindow"; + +/*------------------------------------------------------------------------------ + * The name of the glade file. + *----------------------------------------------------------------------------*/ +const Glib::ustring gladeFileName = "RestoreBackupWindow.glade"; /*------------------------------------------------------------------------------ * The interval between two calls to restoreBackupCheck(), in milliseconds. @@ -61,28 +70,18 @@ const unsigned int timerInterval = 10000; * Constructor. *----------------------------------------------------------------------------*/ RestoreBackupWindow :: RestoreBackupWindow ( - Ptr<GLiveSupport>::Ref gLiveSupport, - Glib::RefPtr<Gnome::Glade::Xml> glade, Ptr<const Glib::ustring>::Ref fileName) throw () - : gLiveSupport(gLiveSupport), + : GuiWindow(bundleName, + gladeFileName), fileName(fileName), currentState(AsyncState::pendingState) { - Ptr<ResourceBundle>::Ref bundle = gLiveSupport->getBundle( - "restoreBackupWindow"); - setBundle(bundle); - - glade->get_widget("restoreBackupWindow1", mainWindow); - mainWindow->set_title(*getResourceUstring("windowTitle")); - Gtk::Button * cancelButton; glade->get_widget("restoreBackupMessageLabel1", messageLabel); glade->get_widget("restoreBackupCancelButton1", cancelButton); glade->get_widget("restoreBackupOkButton1", okButton); - mainWindow->signal_delete_event().connect(sigc::mem_fun(*this, - &RestoreBackupWindow::onDeleteEvent)); cancelButton->signal_clicked().connect(sigc::mem_fun(*this, &RestoreBackupWindow::onCancelButtonClicked)); okButton->signal_clicked().connect(sigc::mem_fun(*this, @@ -265,16 +264,6 @@ RestoreBackupWindow :: resetTimer(void) throw () } -/*------------------------------------------------------------------------------ - * Show the window. - *----------------------------------------------------------------------------*/ -void -RestoreBackupWindow :: show(void) throw () -{ - mainWindow->show(); -} - - /*------------------------------------------------------------------------------ * Close the connection and hide the window. *----------------------------------------------------------------------------*/ @@ -282,7 +271,7 @@ void RestoreBackupWindow :: hide(void) throw () { restoreBackupClose(); - mainWindow->hide(); + GuiWindow::hide(); } diff --git a/campcaster/src/products/gLiveSupport/src/RestoreBackupWindow.h b/campcaster/src/products/gLiveSupport/src/RestoreBackupWindow.h index 53497a393..133b6ca2a 100644 --- a/campcaster/src/products/gLiveSupport/src/RestoreBackupWindow.h +++ b/campcaster/src/products/gLiveSupport/src/RestoreBackupWindow.h @@ -40,14 +40,12 @@ #include "configure.h" #endif -#include <unicode/resbund.h> -#include <gtkmm.h> -#include <libglademm.h> - #include "LiveSupport/Core/Ptr.h" #include "LiveSupport/StorageClient/StorageClientInterface.h" #include "GLiveSupport.h" +#include "GuiWindow.h" + namespace LiveSupport { namespace GLiveSupport { @@ -69,20 +67,10 @@ using namespace LiveSupport::StorageClient; * @author $Author$ * @version $Revision$ */ -class RestoreBackupWindow : public LocalizedObject +class RestoreBackupWindow : public GuiWindow { private: - /** - * The GLiveSupport object, holding the state of the application. - */ - Ptr<GLiveSupport>::Ref gLiveSupport; - - /** - * The main window for this class. - */ - Gtk::Window * mainWindow; - /** * The label holding the current message displayed by the window. */ @@ -130,6 +118,12 @@ class RestoreBackupWindow : public LocalizedObject /** * Event handler for closing the window from the window manager. + * Calls StorageClientInterface::restoreBackupClose(). + * + * Overrides GuiWindow::onDeleteEvent(). + * + * @param event attributes of the event. + * @return true if handled the event, false to continue deleting. */ virtual bool onDeleteEvent(GdkEventAny * event) throw (); @@ -220,15 +214,9 @@ class RestoreBackupWindow : public LocalizedObject /** * Constructor. * - * @param gLiveSupport the gLiveSupport object, containing - * all the vital info. - * @param glade the Glade object, which contains the - * visual design. * @param fileName the file name of the backup to be restored. */ - RestoreBackupWindow(Ptr<GLiveSupport>::Ref gLiveSupport, - Glib::RefPtr<Gnome::Glade::Xml> glade, - Ptr<const Glib::ustring>::Ref fileName) + RestoreBackupWindow(Ptr<const Glib::ustring>::Ref fileName) throw (); /** @@ -239,14 +227,11 @@ class RestoreBackupWindow : public LocalizedObject { } - /** - * Show the window. - */ - virtual void - show(void) throw (); - /** * Close the connection and hide the window. + * Calls StorageClientInterface::restoreBackupClose(). + * + * Overrides GuiWindow::hide(). */ virtual void hide(void) throw (); diff --git a/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.cxx b/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.cxx index 86cc4fe85..d3b9c88bc 100644 --- a/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.cxx @@ -51,6 +51,11 @@ using namespace LiveSupport::GLiveSupport; namespace { +/*------------------------------------------------------------------------------ + * The name of the localization resource bundle. + *----------------------------------------------------------------------------*/ +const Glib::ustring bundleName = "schedulePlaylistWindow"; + /*------------------------------------------------------------------------------ * The name of the glade file. *----------------------------------------------------------------------------*/ @@ -66,23 +71,12 @@ const Glib::ustring gladeFileName = "SchedulePlaylistWindow.glade"; /*------------------------------------------------------------------------------ * Constructor. *----------------------------------------------------------------------------*/ -SchedulePlaylistWindow :: SchedulePlaylistWindow ( - Ptr<GLiveSupport>::Ref gLiveSupport, - const Glib::ustring & gladeDir, - Ptr<Playlist>::Ref playlist) +SchedulePlaylistWindow :: SchedulePlaylistWindow (Ptr<Playlist>::Ref playlist) throw () - : gLiveSupport(gLiveSupport), + : GuiWindow(bundleName, + gladeFileName), playlist(playlist) { - Ptr<ResourceBundle>::Ref bundle = gLiveSupport->getBundle( - "schedulePlaylistWindow"); - setBundle(bundle); - - glade = Gnome::Glade::Xml::create(gladeDir + gladeFileName); - - glade->get_widget("mainWindow1", mainWindow); - mainWindow->set_title(*getResourceUstring("windowTitle")); - Gtk::Label * playlistLabel; glade->get_widget("playlistLabel1", playlistLabel); playlistLabel->set_label(*playlist->getTitle()); diff --git a/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.h b/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.h index 2e43e2e57..0ab469388 100644 --- a/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.h +++ b/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.h @@ -41,14 +41,12 @@ #endif #include <string> -#include <unicode/resbund.h> -#include <gtkmm.h> -#include <libglademm.h> #include "LiveSupport/Core/Ptr.h" -#include "LiveSupport/Core/LocalizedObject.h" #include "GLiveSupport.h" +#include "GuiWindow.h" + namespace LiveSupport { namespace GLiveSupport { @@ -84,25 +82,10 @@ using namespace LiveSupport::Core; * @author $Author$ * @version $Revision$ */ -class SchedulePlaylistWindow : public LocalizedObject +class SchedulePlaylistWindow : public GuiWindow { private: - /** - * The GLiveSupport object, holding the state of the application. - */ - Ptr<GLiveSupport>::Ref gLiveSupport; - - /** - * The Glade object, containing the visual design. - */ - Glib::RefPtr<Gnome::Glade::Xml> glade; - - /** - * The main window for this class. - */ - Gtk::Window * mainWindow; - /** * The playlist to schedule. */ @@ -143,14 +126,9 @@ class SchedulePlaylistWindow : public LocalizedObject /** * Constructor. * - * @param gLiveSupport the gLiveSupport object, containing - * all the vital info. - * @param gladeDir the directory where the Glade files are. * @param playlist the playlist to schedule. */ - SchedulePlaylistWindow(Ptr<GLiveSupport>::Ref gLiveSupport, - const Glib::ustring & gladeDir, - Ptr<Playlist>::Ref playlist) + SchedulePlaylistWindow(Ptr<Playlist>::Ref playlist) throw (); /** @@ -160,15 +138,6 @@ class SchedulePlaylistWindow : public LocalizedObject ~SchedulePlaylistWindow(void) throw () { } - - /** - * Get the underlying Gtk::Window. - */ - virtual Gtk::Window * - getWindow(void) throw () - { - return mainWindow; - } }; /* ================================================= external data structures */ diff --git a/campcaster/src/products/gLiveSupport/src/ScratchpadWindow.cxx b/campcaster/src/products/gLiveSupport/src/ScratchpadWindow.cxx index da8702022..43a6d1b8f 100644 --- a/campcaster/src/products/gLiveSupport/src/ScratchpadWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/ScratchpadWindow.cxx @@ -293,31 +293,13 @@ void ScratchpadWindow :: onSchedulePlaylist(void) throw () { Ptr<Playable>::Ref playable = currentRow[modelColumns.playableColumn]; - Ptr<UniqueId>::Ref uid = playable->getId(); + Ptr<Playlist>::Ref playlist = playable->getPlaylist(); - Ptr<Playlist>::Ref playlist; - - try { - if (!gLiveSupport->existsPlaylist(uid)) { - return; - } - - playlist = gLiveSupport->getPlaylist(uid); - - } catch (std::invalid_argument &e) { - std::cerr << e.what() << std::endl; - return; - } catch (XmlRpcException &e) { - std::cerr << "error in ScratchpadWindow::onSchedulePlaylist(): " - << e.what() << std::endl; - return; + if (playlist) { + schedulePlaylistWindow.reset(new SchedulePlaylistWindow(playlist)); + schedulePlaylistWindow->getWindow()->set_transient_for(*mainWindow); + Gtk::Main::run(*schedulePlaylistWindow->getWindow()); } - - schedulePlaylistWindow.reset(new SchedulePlaylistWindow(gLiveSupport, - gLiveSupport->getGladeDir(), - playlist)); - - Gtk::Main::run(*schedulePlaylistWindow->getWindow()); } @@ -330,17 +312,10 @@ ScratchpadWindow :: onExportPlaylist(void) throw () Ptr<Playable>::Ref playable = currentRow[modelColumns.playableColumn]; Ptr<Playlist>::Ref playlist = playable->getPlaylist(); - try { - if (playlist) { - exportPlaylistWindow.reset(new ExportPlaylistWindow( - gLiveSupport, - gLiveSupport->getGladeDir(), - playlist)); - exportPlaylistWindow->getWindow()->set_transient_for(*mainWindow); - Gtk::Main::run(*exportPlaylistWindow->getWindow()); - } - } catch (std::invalid_argument &e) { - std::cerr << e.what() << std::endl; + if (playlist) { + exportPlaylistWindow.reset(new ExportPlaylistWindow(playlist)); + exportPlaylistWindow->getWindow()->set_transient_for(*mainWindow); + Gtk::Main::run(*exportPlaylistWindow->getWindow()); } } diff --git a/campcaster/src/products/gLiveSupport/src/ScratchpadWindow.h b/campcaster/src/products/gLiveSupport/src/ScratchpadWindow.h index cd5bc08c0..a670dc55f 100644 --- a/campcaster/src/products/gLiveSupport/src/ScratchpadWindow.h +++ b/campcaster/src/products/gLiveSupport/src/ScratchpadWindow.h @@ -45,12 +45,14 @@ #include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Widgets/PlayableTreeModelColumnRecord.h" #include "LiveSupport/Widgets/ZebraTreeView.h" -#include "GuiWindow.h" #include "CuePlayer.h" #include "ContentsStorable.h" #include "ExportPlaylistWindow.h" #include "SchedulePlaylistWindow.h" +#include "GuiWindow.h" + + namespace LiveSupport { namespace GLiveSupport { diff --git a/campcaster/src/products/gLiveSupport/src/SearchWindow.cxx b/campcaster/src/products/gLiveSupport/src/SearchWindow.cxx index dbf15b8ee..4949d8881 100644 --- a/campcaster/src/products/gLiveSupport/src/SearchWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/SearchWindow.cxx @@ -754,17 +754,17 @@ SearchWindow :: onSchedulePlaylist(void) throw () Gtk::TreeModel::iterator iter = refSelection->get_selected(); - if (iter) { - Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn]; - Ptr<Playlist>::Ref playlist = playable->getPlaylist(); - if (playlist) { - schedulePlaylistWindow.reset(new SchedulePlaylistWindow( - gLiveSupport, - gLiveSupport->getGladeDir(), - playlist)); - schedulePlaylistWindow->getWindow()->set_transient_for(*mainWindow); - Gtk::Main::run(*schedulePlaylistWindow->getWindow()); - } + if (!iter) { + return; + } + + Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn]; + Ptr<Playlist>::Ref playlist = playable->getPlaylist(); + + if (playlist) { + schedulePlaylistWindow.reset(new SchedulePlaylistWindow(playlist)); + schedulePlaylistWindow->getWindow()->set_transient_for(*mainWindow); + Gtk::Main::run(*schedulePlaylistWindow->getWindow()); } } @@ -780,25 +780,17 @@ SearchWindow :: onExportPlaylist(void) throw () Gtk::TreeModel::iterator iter = refSelection->get_selected(); - if (iter) { - Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn]; - if (playable) { - Ptr<Playlist>::Ref playlist = playable->getPlaylist(); - if (playlist) { - try { - exportPlaylistWindow.reset(new ExportPlaylistWindow( - gLiveSupport, - gLiveSupport->getGladeDir(), - playlist)); - } catch (std::invalid_argument &e) { - std::cerr << e.what() << std::endl; - return; - } - exportPlaylistWindow->getWindow()->set_transient_for( - *mainWindow); - Gtk::Main::run(*exportPlaylistWindow->getWindow()); - } - } + if (!iter) { + return; + } + + Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn]; + Ptr<Playlist>::Ref playlist = playable->getPlaylist(); + + if (playlist) { + exportPlaylistWindow.reset(new ExportPlaylistWindow(playlist)); + exportPlaylistWindow->getWindow()->set_transient_for(*mainWindow); + Gtk::Main::run(*exportPlaylistWindow->getWindow()); } } diff --git a/campcaster/src/products/gLiveSupport/src/UploadFileWindow.cxx b/campcaster/src/products/gLiveSupport/src/UploadFileWindow.cxx index b82db0198..41b8b4d51 100644 --- a/campcaster/src/products/gLiveSupport/src/UploadFileWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/UploadFileWindow.cxx @@ -455,10 +455,7 @@ UploadFileWindow :: uploadStorageArchive(void) throw () fileNameEntry->get_text() )); Ptr<RestoreBackupWindow>::Ref restoreBackupWindow( - new RestoreBackupWindow( - gLiveSupport, - glade, - path)); + new RestoreBackupWindow(path)); restoreBackupWindow->show(); restoreBackupWindowList.push_back(restoreBackupWindow); diff --git a/campcaster/src/products/gLiveSupport/src/UploadFileWindow.h b/campcaster/src/products/gLiveSupport/src/UploadFileWindow.h index ad1200282..8a640c1e6 100644 --- a/campcaster/src/products/gLiveSupport/src/UploadFileWindow.h +++ b/campcaster/src/products/gLiveSupport/src/UploadFileWindow.h @@ -40,15 +40,15 @@ #include "configure.h" #endif -#include "GuiWindow.h" -#include "LiveSupport/Core/NumericTools.h" - #include "LiveSupport/Core/Ptr.h" -#include "LiveSupport/Core/LocalizedObject.h" #include "LiveSupport/Widgets/ComboBoxText.h" #include "RestoreBackupWindow.h" #include "GLiveSupport.h" +#include "GuiWindow.h" +#include "LiveSupport/Core/NumericTools.h" + + namespace LiveSupport { namespace GLiveSupport { diff --git a/campcaster/src/products/gLiveSupport/var/glade/RestoreBackupWindow.glade b/campcaster/src/products/gLiveSupport/var/glade/RestoreBackupWindow.glade new file mode 100644 index 000000000..d07df13d0 --- /dev/null +++ b/campcaster/src/products/gLiveSupport/var/glade/RestoreBackupWindow.glade @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd"> +<!--Generated with glade3 3.2.0 on Fri Aug 10 18:25:00 2007 by fgerlits@fgerlits-laptop--> +<glade-interface> + <widget class="GtkWindow" id="mainWindow1"> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="border_width">8</property> + <property name="window_position">GTK_WIN_POS_CENTER_ALWAYS</property> + <child> + <widget class="GtkVBox" id="vbox3"> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="spacing">8</property> + <child> + <widget class="GtkLabel" id="restoreBackupMessageLabel1"> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="label" translatable="yes">uploading backup file +please wait...</property> + <property name="justify">GTK_JUSTIFY_CENTER</property> + </widget> + </child> + <child> + <widget class="GtkHButtonBox" id="hbuttonbox1"> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="spacing">8</property> + <property name="layout_style">GTK_BUTTONBOX_END</property> + <child> + <widget class="GtkButton" id="restoreBackupCancelButton1"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="label" translatable="yes">gtk-cancel</property> + <property name="use_stock">True</property> + <property name="response_id">-6</property> + </widget> + </child> + <child> + <widget class="GtkButton" id="restoreBackupOkButton1"> + <property name="visible">True</property> + <property name="sensitive">False</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="label" translatable="yes">gtk-ok</property> + <property name="use_stock">True</property> + <property name="response_id">-5</property> + </widget> + <packing> + <property name="position">1</property> + </packing> + </child> + </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + </widget> + </child> + </widget> +</glade-interface> diff --git a/campcaster/src/products/gLiveSupport/var/glade/UploadFileWindow.glade b/campcaster/src/products/gLiveSupport/var/glade/UploadFileWindow.glade index 984634ea7..627e74300 100644 --- a/campcaster/src/products/gLiveSupport/var/glade/UploadFileWindow.glade +++ b/campcaster/src/products/gLiveSupport/var/glade/UploadFileWindow.glade @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd"> -<!--Generated with glade3 3.2.0 on Thu Jul 26 14:44:06 2007 by fgerlits@desktop--> +<!--Generated with glade3 3.2.0 on Fri Aug 10 19:26:43 2007 by fgerlits@fgerlits-laptop--> <glade-interface> <widget class="GtkDialog" id="mainWindow1"> <property name="width_request">380</property> @@ -1694,64 +1694,4 @@ </widget> </child> </widget> - <widget class="GtkWindow" id="restoreBackupWindow1"> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="border_width">8</property> - <property name="window_position">GTK_WIN_POS_CENTER_ALWAYS</property> - <child> - <widget class="GtkVBox" id="vbox3"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="spacing">8</property> - <child> - <widget class="GtkLabel" id="restoreBackupMessageLabel1"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">uploading backup file -please wait...</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - </widget> - </child> - <child> - <widget class="GtkHButtonBox" id="hbuttonbox1"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="spacing">8</property> - <property name="layout_style">GTK_BUTTONBOX_END</property> - <child> - <widget class="GtkButton" id="restoreBackupCancelButton1"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">gtk-cancel</property> - <property name="use_stock">True</property> - <property name="response_id">-6</property> - </widget> - </child> - <child> - <widget class="GtkButton" id="restoreBackupOkButton1"> - <property name="visible">True</property> - <property name="sensitive">False</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">gtk-ok</property> - <property name="use_stock">True</property> - <property name="response_id">-5</property> - </widget> - <packing> - <property name="position">1</property> - </packing> - </child> - </widget> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - </widget> - </child> - </widget> </glade-interface>