From 974702af3e6d9b3ad06f874c271319018bcff0df Mon Sep 17 00:00:00 2001 From: elvez Date: Fri, 4 Aug 2006 00:29:37 +0000 Subject: [PATCH] - Added other two dialogs for the gui - Added exception specifications to the methods of the serializer interface and xml plugin git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@821 3ecf2c5c-341e-0410-92b4-d18e462d057c --- glade/configure-cpu-policy-dialog.glade | 102 ++++ glade/configure-dialog.glade | 526 ++++++++++++++++++ plugins/xmlsave/src/xml_serializer.cc | 6 +- plugins/xmlsave/src/xml_serializer.hh | 6 +- plugins/xmlsave/src/xml_serializer_factory.cc | 2 +- plugins/xmlsave/src/xml_serializer_factory.hh | 2 +- plugins/xmlsave/src/xml_visitor.cc | 30 +- plugins/xmlsave/src/xml_visitor.hh | 30 +- src/backend/serialize_visitor.hh | 18 +- src/backend/serializer.hh | 4 +- 10 files changed, 678 insertions(+), 48 deletions(-) create mode 100644 glade/configure-cpu-policy-dialog.glade create mode 100644 glade/configure-dialog.glade diff --git a/glade/configure-cpu-policy-dialog.glade b/glade/configure-cpu-policy-dialog.glade new file mode 100644 index 0000000..3500e13 --- /dev/null +++ b/glade/configure-cpu-policy-dialog.glade @@ -0,0 +1,102 @@ + + + + + + + 0 + True + Configure the CPU Policy + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_MOUSE + True + True + False + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True + False + True + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_SPREAD + + + + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + True + -6 + + + + + + True + True + True + gtk-ok + True + GTK_RELIEF_NORMAL + True + -5 + + + + + 0 + False + True + GTK_PACK_END + + + + + + True + True + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + False + True + False + False + False + + + + + 0 + True + True + + + + + + + diff --git a/glade/configure-dialog.glade b/glade/configure-dialog.glade new file mode 100644 index 0000000..ee67f62 --- /dev/null +++ b/glade/configure-dialog.glade @@ -0,0 +1,526 @@ + + + + + + + 0 + True + Configure SGPEMv2 + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_MOUSE + True + True + False + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True + False + True + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_SPREAD + + + + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + True + -6 + + + + + + True + True + True + gtk-ok + True + GTK_RELIEF_NORMAL + True + -5 + + + + + 0 + False + True + GTK_PACK_END + + + + + + True + True + True + True + GTK_POS_TOP + False + False + + + + True + False + 0 + + + + True + True + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + False + True + False + False + False + + + + + 0 + True + True + + + + + False + True + + + + + + True + Plugins + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + tab + + + + + + True + False + 0 + + + + 6 + True + 0 + 0.5 + GTK_SHADOW_IN + + + + 6 + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 12 + 0 + + + + True + False + 10 + + + + True + True + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + False + True + False + False + False + + + + + 0 + True + True + + + + + + True + False + 10 + + + + 100 + True + True + GTK_RELIEF_NORMAL + True + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-open + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + Add + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + + + + 0 + False + False + + + + + + 100 + True + True + GTK_RELIEF_NORMAL + True + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-remove + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + Remove + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + + + + 0 + False + False + + + + + 0 + False + True + + + + + + + + + + True + <b>Additional Plugin Directories</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.479999989271 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + label_item + + + + + 0 + True + True + + + + + + True + <b>PLEASE! +PLEASE! +TELL ME +THERE IS SOME OTHER OPTION TO PUT HERE...</b> + False + True + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + False + True + + + + + + True + Startup + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + tab + + + + + + True + <b>FILL ME IN...</b> + False + True + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + False + True + + + + + + True + Other(?) + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + tab + + + + + 0 + True + True + + + + + + + diff --git a/plugins/xmlsave/src/xml_serializer.cc b/plugins/xmlsave/src/xml_serializer.cc index 55089cb..936fe4f 100644 --- a/plugins/xmlsave/src/xml_serializer.cc +++ b/plugins/xmlsave/src/xml_serializer.cc @@ -40,7 +40,7 @@ XMLSerializer::XMLSerializer() -void XMLSerializer::save_snapshot(const Glib::ustring& filename, const History& hist) +void XMLSerializer::save_snapshot(const Glib::ustring& filename, const History& hist) throw(SerializeError) { /* COMPAT: Do not genrate nodes for formatting spaces */ LIBXML_TEST_VERSION @@ -65,7 +65,7 @@ void XMLSerializer::save_snapshot(const Glib::ustring& filename, const History& xmlCleanupParser(); } -void XMLSerializer::restore_snapshot(const Glib::ustring& filename, History& hist) +void XMLSerializer::restore_snapshot(const Glib::ustring& filename, History& hist) throw(SerializeError) { // TODO - all to do!! // DEBUG - remove me when finished @@ -222,7 +222,7 @@ void XMLSerializer::clear_history(History& hist) } -void XMLSerializer::read_doc(xmlDocPtr doc, XMLSerializerFactory& fact) +void XMLSerializer::read_doc(xmlDocPtr doc, XMLSerializerFactory& fact) throw(SerializeError) { /* * Check the document is of the right kind diff --git a/plugins/xmlsave/src/xml_serializer.hh b/plugins/xmlsave/src/xml_serializer.hh index a13b954..715ff41 100644 --- a/plugins/xmlsave/src/xml_serializer.hh +++ b/plugins/xmlsave/src/xml_serializer.hh @@ -61,7 +61,7 @@ namespace sgpem \throws backend::SerializerError on error */ - virtual void save_snapshot(const Glib::ustring& filename, const History& hist); + virtual void save_snapshot(const Glib::ustring& filename, const History& hist) throw(SerializeError); /** \brief Re-initialize system status from a saved XML snapshot @@ -72,7 +72,7 @@ namespace sgpem \throws backend::SerializerError */ - virtual void restore_snapshot(const Glib::ustring& filename, History& hist); + virtual void restore_snapshot(const Glib::ustring& filename, History& hist) throw(SerializeError); /** \return Constant string "xsgp" @@ -124,7 +124,7 @@ namespace sgpem Traverse the passed (previously readed) xml document and rebuild the correct image using the XMLSerializerFactory object. */ - void read_doc(xmlDocPtr doc, XMLSerializerFactory& fact); + void read_doc(xmlDocPtr doc, XMLSerializerFactory& fact) throw(SerializeError); /** \brief Restore all the resources from the passed xml node diff --git a/plugins/xmlsave/src/xml_serializer_factory.cc b/plugins/xmlsave/src/xml_serializer_factory.cc index 40dc241..06aec14 100644 --- a/plugins/xmlsave/src/xml_serializer_factory.cc +++ b/plugins/xmlsave/src/xml_serializer_factory.cc @@ -50,7 +50,7 @@ History* XMLSerializerFactory::get_history() } void -XMLSerializerFactory::factory_method(const Glib::ustring& class_name, Parameters& parameters) +XMLSerializerFactory::factory_method(const Glib::ustring& class_name, Parameters& parameters) throw(SerializeError) { if(class_name == "Resource") { diff --git a/plugins/xmlsave/src/xml_serializer_factory.hh b/plugins/xmlsave/src/xml_serializer_factory.hh index 9dc16b6..5935eb0 100644 --- a/plugins/xmlsave/src/xml_serializer_factory.hh +++ b/plugins/xmlsave/src/xml_serializer_factory.hh @@ -76,7 +76,7 @@ namespace sgpem \throw SerializerError If not all necessary parameters for an object creation are provided */ - void factory_method(const Glib::ustring& class_name, Parameters& parameters); + void factory_method(const Glib::ustring& class_name, Parameters& parameters) throw(SerializeError); protected: private: typedef Environment::resource_key_t resource_key_t; diff --git a/plugins/xmlsave/src/xml_visitor.cc b/plugins/xmlsave/src/xml_visitor.cc index d24e484..9eecf82 100644 --- a/plugins/xmlsave/src/xml_visitor.cc +++ b/plugins/xmlsave/src/xml_visitor.cc @@ -44,7 +44,7 @@ XMLVisitor::~XMLVisitor() { } -void XMLVisitor::from_resource(const Resource& obj) +void XMLVisitor::from_resource(const Resource& obj) throw(SerializerError) { throw SerializerError( _("XMLVisitor: unsupported method from_resource(const Resource& obj)") @@ -52,42 +52,42 @@ void XMLVisitor::from_resource(const Resource& obj) } -void XMLVisitor::from_history(const History& obj) +void XMLVisitor::from_history(const History& obj) throw(SerializerError) { from_history(_current, obj); } -void XMLVisitor::from_environment(const Environment& obj) +void XMLVisitor::from_environment(const Environment& obj) throw(SerializerError) { from_environment(_current, obj); } -void XMLVisitor::from_process(const Process& obj) +void XMLVisitor::from_process(const Process& obj) throw(SerializerError) { from_process(_current, obj); } -void XMLVisitor::from_thread(const Thread& obj) +void XMLVisitor::from_thread(const Thread& obj) throw(SerializerError) { from_thread(_current, obj); } -void XMLVisitor::from_request(const Request& obj) +void XMLVisitor::from_request(const Request& obj) throw(SerializerError) { from_request(_current, obj); } -void XMLVisitor::from_subrequest(const SubRequest& obj) +void XMLVisitor::from_subrequest(const SubRequest& obj) throw(SerializerError) { from_subrequest(_current, obj); } -void XMLVisitor::from_resource(const Resource& obj, const Glib::ustring& key) +void XMLVisitor::from_resource(const Resource& obj, const Glib::ustring& key) throw(SerializerError) { from_resource(_current, obj, key); } @@ -98,7 +98,7 @@ void XMLVisitor::from_resource(const Resource& obj, const Glib::ustring& key) -void XMLVisitor::from_history(xmlNodePtr parent, const History& hist) +void XMLVisitor::from_history(xmlNodePtr parent, const History& hist) throw(SerializerError) { if(parent!=NULL) { @@ -111,7 +111,7 @@ void XMLVisitor::from_history(xmlNodePtr parent, const History& hist) } -void XMLVisitor::from_environment(xmlNodePtr parent, const Environment& env) +void XMLVisitor::from_environment(xmlNodePtr parent, const Environment& env) throw(SerializerError) { if(parent==NULL) { @@ -158,7 +158,7 @@ void XMLVisitor::from_environment(xmlNodePtr parent, const Environment& env) } -void XMLVisitor::from_resource(xmlNodePtr parent, const Resource& obj, const Glib::ustring& key) +void XMLVisitor::from_resource(xmlNodePtr parent, const Resource& obj, const Glib::ustring& key) throw(SerializerError) { if(parent!=NULL) { @@ -182,7 +182,7 @@ void XMLVisitor::from_resource(xmlNodePtr parent, const Resource& obj, const Gli } -void XMLVisitor::from_process(xmlNodePtr parent, const Process& obj) +void XMLVisitor::from_process(xmlNodePtr parent, const Process& obj) throw(SerializerError) { if(parent!=NULL) { @@ -220,7 +220,7 @@ void XMLVisitor::from_process(xmlNodePtr parent, const Process& obj) } -void XMLVisitor::from_thread(xmlNodePtr parent, const Thread& obj) +void XMLVisitor::from_thread(xmlNodePtr parent, const Thread& obj) throw(SerializerError) { if(parent!=NULL) { @@ -261,7 +261,7 @@ void XMLVisitor::from_thread(xmlNodePtr parent, const Thread& obj) } -void XMLVisitor::from_request(xmlNodePtr parent, const Request& obj) +void XMLVisitor::from_request(xmlNodePtr parent, const Request& obj) throw(SerializerError) { if(parent!=NULL) { @@ -294,7 +294,7 @@ void XMLVisitor::from_request(xmlNodePtr parent, const Request& obj) } -void XMLVisitor::from_subrequest(xmlNodePtr parent, const SubRequest& obj) +void XMLVisitor::from_subrequest(xmlNodePtr parent, const SubRequest& obj) throw(SerializerError) { if(parent!=NULL) { diff --git a/plugins/xmlsave/src/xml_visitor.hh b/plugins/xmlsave/src/xml_visitor.hh index 42430e5..8b3f8fb 100644 --- a/plugins/xmlsave/src/xml_visitor.hh +++ b/plugins/xmlsave/src/xml_visitor.hh @@ -69,61 +69,61 @@ namespace sgpem \brief Add output to the serializer taking data from history Wrapper method: call from_history(xmlNodePtr parent, const History& obj); */ - virtual void from_history(const History& obj); + virtual void from_history(const History& obj) throw(SerializerError); /** \brief Add output to the serializer taking data from environment Wrapper method: call from_environment(xmlNodePtr parent, const Environment& obj); */ - virtual void from_environment(const Environment& obj); + virtual void from_environment(const Environment& obj) throw(SerializerError); /** \brief Add output to the serializer taking data from resource BUG: a resource must be saved with her own associated key. Throw an exception. */ - virtual void from_resource(const Resource& obj); + virtual void from_resource(const Resource& obj) throw(SerializerError); /** \brief Add output to the serializer taking data from resource and key BUG FIXED: This save a resource with her own associated key. Wrapper method: call from_resource(xmlNodePtr parent, const Resource& obj, const Glib::ustring& key); */ - virtual void from_resource(const Resource& obj, const Glib::ustring& key); + virtual void from_resource(const Resource& obj, const Glib::ustring& key) throw(SerializerError); /** \brief Add output to the serializer taking data from process Wrapper method: call from_process(xmlNodePtr parent, const Process& obj); */ - virtual void from_process(const Process& obj); + virtual void from_process(const Process& obj) throw(SerializerError); /** \brief Add output to the serializer taking data from thread Wrapper method: call from_thread(xmlNodePtr parent, const Thread& obj); */ - virtual void from_thread(const Thread& obj); + virtual void from_thread(const Thread& obj) throw(SerializerError); /** \brief Add output to the serializer taking data from request Wrapper method: call from_request(xmlNodePtr parent, const Request& obj); */ - virtual void from_request(const Request& obj); + virtual void from_request(const Request& obj) throw(SerializerError); /** \brief Add output to the serializer taking data from subrequest Wrapper method: call from_subrequest(xmlNodePtr parent, const SubRequest& obj); */ - virtual void from_subrequest(const SubRequest& obj); + virtual void from_subrequest(const SubRequest& obj) throw(SerializerError); private: - void from_history(xmlNodePtr parent, const History& obj); - void from_environment(xmlNodePtr parent, const Environment& obj); - void from_resource(xmlNodePtr parent, const Resource& obj, const Glib::ustring& key); - void from_process(xmlNodePtr parent, const Process& obj); - void from_thread(xmlNodePtr parent, const Thread& obj); - void from_request(xmlNodePtr parent, const Request& obj); - void from_subrequest(xmlNodePtr parent, const SubRequest& obj); + void from_history(xmlNodePtr parent, const History& obj) throw(SerializerError); + void from_environment(xmlNodePtr parent, const Environment& obj) throw(SerializerError); + void from_resource(xmlNodePtr parent, const Resource& obj, const Glib::ustring& key) throw(SerializerError); + void from_process(xmlNodePtr parent, const Process& obj) throw(SerializerError); + void from_thread(xmlNodePtr parent, const Thread& obj) throw(SerializerError); + void from_request(xmlNodePtr parent, const Request& obj) throw(SerializerError); + void from_subrequest(xmlNodePtr parent, const SubRequest& obj) throw(SerializerError); xmlNodePtr _current; }; diff --git a/src/backend/serialize_visitor.hh b/src/backend/serialize_visitor.hh index 988223b..02f4a54 100644 --- a/src/backend/serialize_visitor.hh +++ b/src/backend/serialize_visitor.hh @@ -34,6 +34,8 @@ namespace sgpem #include "config.h" +#include "serializer_error.hh" + #include namespace sgpem @@ -54,45 +56,45 @@ namespace sgpem /** \brief Add output to the serializer taking data from history */ - virtual void from_history(const History& obj) = 0; + virtual void from_history(const History& obj) throw(SerializerError) = 0; /** \brief Add output to the serializer taking data from environment */ - virtual void from_environment(const Environment& obj) = 0; + virtual void from_environment(const Environment& obj) throw(SerializerError) = 0; /** \brief Add output to the serializer taking data from resource BUG: a resource must be saved with her own associated key. */ - virtual void from_resource(const Resource& obj) = 0; + virtual void from_resource(const Resource& obj) throw(SerializerError) = 0; /** \brief Add output to the serializer taking data from resource and key BUG FIXED: This save a resource with her own associated key. */ - virtual void from_resource(const Resource& obj, const Glib::ustring& key) = 0; + virtual void from_resource(const Resource& obj, const Glib::ustring& key) throw(SerializerError) = 0; /** \brief Add output to the serializer taking data from process */ - virtual void from_process(const Process& obj) = 0; + virtual void from_process(const Process& obj) throw(SerializerError) = 0; /** \brief Add output to the serializer taking data from thread */ - virtual void from_thread(const Thread& obj) = 0; + virtual void from_thread(const Thread& obj) throw(SerializerError) = 0; /** \brief Add output to the serializer taking data from request */ - virtual void from_request(const Request& obj) = 0; + virtual void from_request(const Request& obj) throw(SerializerError) = 0; /** \brief Add output to the serializer taking data from subrequest */ - virtual void from_subrequest(const SubRequest& obj) = 0; + virtual void from_subrequest(const SubRequest& obj) throw(SerializerError) = 0; }; } diff --git a/src/backend/serializer.hh b/src/backend/serializer.hh index 8fb5eab..b08faba 100644 --- a/src/backend/serializer.hh +++ b/src/backend/serializer.hh @@ -35,8 +35,8 @@ namespace sgpem public: virtual ~Serializer() = 0; - virtual void save_snapshot(const Glib::ustring& filename, const History& hist) = 0; - virtual void restore_snapshot(const Glib::ustring& filename, History& hist) = 0; + virtual void save_snapshot(const Glib::ustring& filename, const History& hist) throw(SerializeError) = 0; + virtual void restore_snapshot(const Glib::ustring& filename, History& hist) throw(SerializeError) = 0; virtual const Glib::ustring get_filename_extension() = 0; virtual const Glib::ustring get_filename_description() = 0; protected: