diff --git a/livesupport/products/gLiveSupport/src/GLiveSupport.cxx b/livesupport/products/gLiveSupport/src/GLiveSupport.cxx index aa39a4b10..4f75d6b78 100644 --- a/livesupport/products/gLiveSupport/src/GLiveSupport.cxx +++ b/livesupport/products/gLiveSupport/src/GLiveSupport.cxx @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.13 $ + Version : $Revision: 1.14 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.cxx,v $ ------------------------------------------------------------------------------*/ @@ -431,6 +431,18 @@ GLiveSupport :: schedulePlaylist(Ptr::Ref playlist, } +/*------------------------------------------------------------------------------ + * Remove a scheduled entry. + *----------------------------------------------------------------------------*/ +void +LiveSupport :: GLiveSupport :: +GLiveSupport :: removeFromSchedule(Ptr::Ref scheduleEntryId) + throw (XmlRpcException) +{ + scheduler->removeFromSchedule(sessionId, scheduleEntryId); +} + + /*------------------------------------------------------------------------------ * Delete a playable object from the storage. *----------------------------------------------------------------------------*/ diff --git a/livesupport/products/gLiveSupport/src/GLiveSupport.h b/livesupport/products/gLiveSupport/src/GLiveSupport.h index 40aa0e7e8..fb90da799 100644 --- a/livesupport/products/gLiveSupport/src/GLiveSupport.h +++ b/livesupport/products/gLiveSupport/src/GLiveSupport.h @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.15 $ + Version : $Revision: 1.16 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.h,v $ ------------------------------------------------------------------------------*/ @@ -95,7 +95,7 @@ class MasterPanelWindow; * respective documentation. * * @author $Author: maroy $ - * @version $Revision: 1.15 $ + * @version $Revision: 1.16 $ * @see LocalizedObject#getBundle(const xmlpp::Element &) * @see AuthenticationClientFactory * @see StorageClientFactory @@ -455,6 +455,17 @@ class GLiveSupport : public LocalizedConfigurable, throw (XmlRpcException); + /** + * Remove a scheduled item. + * + * @param sessionId a valid, authenticated session id. + * @param scheduledEntryId the id of the scheduled entry to remove. + * @exception XmlRpcException in case of XML-RPC errors. + */ + virtual void + removeFromSchedule(Ptr::Ref scheduleEntryId) + throw (XmlRpcException); + /** * Delete a playable object from storage. * diff --git a/livesupport/products/gLiveSupport/src/SchedulerWindow.cxx b/livesupport/products/gLiveSupport/src/SchedulerWindow.cxx index 984518ebe..cfefaf6a8 100644 --- a/livesupport/products/gLiveSupport/src/SchedulerWindow.cxx +++ b/livesupport/products/gLiveSupport/src/SchedulerWindow.cxx @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.4 $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SchedulerWindow.cxx,v $ ------------------------------------------------------------------------------*/ @@ -96,6 +96,19 @@ SchedulerWindow :: SchedulerWindow (Ptr::Ref gLiveSupport, std::cerr << e.what() << std::endl; } + // register the signal handler for entries view entries being clicked + entriesView->signal_button_press_event().connect_notify(sigc::mem_fun(*this, + &SchedulerWindow::onEntryClicked)); + + // create the right-click entry context menu for audio clips + entryMenu.reset(new Gtk::Menu()); + Gtk::Menu::MenuList& menuList = entryMenu->items(); + // register the signal handlers for the popup menu + menuList.push_back(Gtk::Menu_Helpers::MenuElem( + *getResourceUstring("deleteMenuItem"), + sigc::mem_fun(*this, + &SchedulerWindow::onDeleteItem))); + entryMenu->accelerate(*this); layout.reset(new Gtk::Table()); @@ -226,6 +239,52 @@ SchedulerWindow :: showContents(void) throw () } +/*------------------------------------------------------------------------------ + * Event handler for an entry being clicked in the list + *----------------------------------------------------------------------------*/ +void +SchedulerWindow :: onEntryClicked (GdkEventButton * event) throw () +{ + if (event->type == GDK_BUTTON_PRESS && event->button == 3) { + // only show the context menu, if something is already selected + Glib::RefPtr refSelection = + entriesView->get_selection(); + if (refSelection) { + Gtk::TreeModel::iterator iter = refSelection->get_selected(); + if (iter) { + entryMenu->popup(event->button, event->time); + } + } + } +} + + +/*------------------------------------------------------------------------------ + * Event handler for the Delete menu item selected from the entry conext menu + *----------------------------------------------------------------------------*/ +void +SchedulerWindow :: onDeleteItem(void) throw () +{ + Glib::RefPtr refSelection = + entriesView->get_selection(); + + if (refSelection) { + Gtk::TreeModel::iterator iter = refSelection->get_selected(); + if (iter) { + Ptr::Ref uid = (*iter)[entryColumns->idColumn]; + Ptr::Ref entryId(new UniqueId(uid->getId())); + + try { + gLiveSupport->removeFromSchedule(entryId); + } catch (XmlRpcException &e) { + // TODO: signal error here + } + showContents(); + } + } +} + + /*------------------------------------------------------------------------------ * Event handler for the close button getting clicked. *----------------------------------------------------------------------------*/ diff --git a/livesupport/products/gLiveSupport/src/SchedulerWindow.h b/livesupport/products/gLiveSupport/src/SchedulerWindow.h index 21dff0139..3c65dab7c 100644 --- a/livesupport/products/gLiveSupport/src/SchedulerWindow.h +++ b/livesupport/products/gLiveSupport/src/SchedulerWindow.h @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.1 $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SchedulerWindow.h,v $ ------------------------------------------------------------------------------*/ @@ -88,7 +88,7 @@ using namespace LiveSupport::Core; * * * @author $Author: maroy $ - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ */ class SchedulerWindow : public Gtk::Window, public LocalizedObject { @@ -100,7 +100,7 @@ class SchedulerWindow : public Gtk::Window, public LocalizedObject * Lists one scheduled item per row. * * @author $Author: maroy $ - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ */ class ModelColumns : public Gtk::TreeModel::ColumnRecord { @@ -179,6 +179,11 @@ class SchedulerWindow : public Gtk::Window, public LocalizedObject */ Glib::RefPtr entriesModel; + /** + * The right-click context menu for schedule entries. + */ + Ptr::Ref entryMenu; + /** * The close button. */ @@ -190,6 +195,21 @@ class SchedulerWindow : public Gtk::Window, public LocalizedObject virtual void onDateSelected(void) throw (); + /** + * Signal handler for the mouse clicked on one of the entries. + * + * @param event the button event recieved + */ + virtual void + onEntryClicked(GdkEventButton * event) throw (); + + /** + * Signal handler for the "delete" menu item selected from + * the entry context menu. + */ + virtual void + onDeleteItem(void) throw (); + /** * Signal handler for the close button clicked. */ diff --git a/livesupport/products/gLiveSupport/var/hu.txt b/livesupport/products/gLiveSupport/var/hu.txt index 8f2889bf8..f54410569 100644 --- a/livesupport/products/gLiveSupport/var/hu.txt +++ b/livesupport/products/gLiveSupport/var/hu.txt @@ -94,6 +94,7 @@ hu:table startColumnLabel:string { "kezdet" } titleColumnLabel:string { "cím" } endColumnLabel:string { "vég" } + deleteMenuItem:string { "_Töröl" } closeButtonLabel:string { "bezár" } } diff --git a/livesupport/products/gLiveSupport/var/root.txt b/livesupport/products/gLiveSupport/var/root.txt index af6252d47..28e88694e 100644 --- a/livesupport/products/gLiveSupport/var/root.txt +++ b/livesupport/products/gLiveSupport/var/root.txt @@ -94,6 +94,7 @@ root:table startColumnLabel:string { "start" } titleColumnLabel:string { "title" } endColumnLabel:string { "end" } + deleteMenuItem:string { "_Delete" } closeButtonLabel:string { "close" }