Author: aschnell Date: Tue Feb 3 20:48:39 2009 New Revision: 55221 URL: http://svn.opensuse.org/viewcvs/yast?rev=55221&view=rev Log: - added some error handling for graph saving Modified: trunk/storage/libstorage/src/Graph.cc trunk/storage/libstorage/src/Graph.h trunk/storage/storage/src/include/ep-graph.ycp trunk/storage/storage/src/modules/Storage.ycp Modified: trunk/storage/libstorage/src/Graph.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Graph.cc?rev=55221&r1=55220&r2=55221&view=diff ============================================================================== --- trunk/storage/libstorage/src/Graph.cc (original) +++ trunk/storage/libstorage/src/Graph.cc Tue Feb 3 20:48:39 2009 @@ -69,7 +69,7 @@ } - int + bool saveGraph(StorageInterface* s, const string& filename) { list<Node> nodes; @@ -211,8 +211,7 @@ out.close(); - - return 0; + return !out.bad(); } } Modified: trunk/storage/libstorage/src/Graph.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Graph.h?rev=55221&r1=55220&r2=55221&view=diff ============================================================================== --- trunk/storage/libstorage/src/Graph.h (original) +++ trunk/storage/libstorage/src/Graph.h Tue Feb 3 20:48:39 2009 @@ -4,7 +4,6 @@ #include <string> - #include "StorageInterface.h" @@ -14,10 +13,11 @@ /** * Saves a graph of the storage devices as a DOT file for graphviz. * + * @param s StorageInterface * @param filename filename of graph - * @return zero if all is ok, negative number to indicate an error + * @return true on successful writing of graph */ - int saveGraph(StorageInterface* s, const std::string& filename); + bool saveGraph(StorageInterface* s, const std::string& filename); } Modified: trunk/storage/storage/src/include/ep-graph.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/ep-graph.ycp?rev=55221&r1=55220&r2=55221&view=diff ============================================================================== --- trunk/storage/storage/src/include/ep-graph.ycp (original) +++ trunk/storage/storage/src/include/ep-graph.ycp Tue Feb 3 20:48:39 2009 @@ -11,7 +11,6 @@ void CreateGraphPanel(any user_data) { string filename = Directory::tmpdir + "/storage.dot"; - y2milestone("saving graph to %1", filename); Storage::SaveGraph(filename); UI::ReplaceWidget(`tree_panel, @@ -62,8 +61,11 @@ string filename = UI::AskForSaveFileName("/tmp", "*.dot", "Save as..."); if (filename != nil) { - y2milestone("saving graph to %1", filename); - Storage::SaveGraph(filename); + if (!Storage::SaveGraph(filename)) + { + // error popup + Popup::Error(_("Saving graph file failed.")); + } } } break; Modified: trunk/storage/storage/src/modules/Storage.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/modules/Storage.ycp?rev=55221&r1=55220&r2=55221&view=diff ============================================================================== --- trunk/storage/storage/src/modules/Storage.ycp (original) +++ trunk/storage/storage/src/modules/Storage.ycp Tue Feb 3 20:48:39 2009 @@ -6461,9 +6461,10 @@ } -global integer SaveGraph(string filename) +global boolean SaveGraph(string filename) { - integer ret = LibStorage::saveGraph(sint, filename); + boolean ret = LibStorage::saveGraph(sint, filename); + y2milestone("SaveGraph filename:%1 ret:%2", filename, ret); return ret; } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org