Author: aschnell Date: Fri Nov 20 18:13:34 2009 New Revision: 59679 URL: http://svn.opensuse.org/viewcvs/yast?rev=59679&view=rev Log: - added mount graph (requires libstorage 2.19.1) Modified: trunk/storage/package/yast2-storage.changes trunk/storage/storage/src/include/ep-graph.ycp trunk/storage/storage/src/include/ep-main.ycp trunk/storage/storage/src/modules/Storage.ycp trunk/storage/yast2-storage.spec.in Modified: trunk/storage/package/yast2-storage.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/package/yast2-storage.cha... ============================================================================== --- trunk/storage/package/yast2-storage.changes (original) +++ trunk/storage/package/yast2-storage.changes Fri Nov 20 18:13:34 2009 @@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Fri Nov 20 18:01:15 CET 2009 - aschnell@suse.de + +- added mount graph (requires libstorage 2.19.1) + +------------------------------------------------------------------- Thu Nov 19 10:32:36 CET 2009 - aschnell@suse.de - keep name entry in target-map as provided by libstorage Modified: trunk/storage/storage/src/include/ep-graph.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/ep-gr... ============================================================================== --- trunk/storage/storage/src/include/ep-graph.ycp (original) +++ trunk/storage/storage/src/include/ep-graph.ycp Fri Nov 20 18:13:34 2009 @@ -10,7 +10,7 @@ textdomain "storage"; - void EpContextMenuGraph() + void EpContextMenuDeviceGraph() { symbol widget = ContextMenu::Simple([ `item(`id(`add_raid), `icon(StorageIcons::raid_icon), _("Add RAID")), `item(`id(`add_lvmvg), `icon(StorageIcons::lvm_icon), _("Add Volume Group")) ]); @@ -28,21 +28,21 @@ } - void CreateGraphPanel(any user_data) + void CreateDeviceGraphPanel(any user_data) { - string filename = Directory::tmpdir + "/storage.gv"; - Storage::SaveGraph(filename); + string filename = Directory::tmpdir + "/device.gv"; + Storage::SaveDeviceGraph(filename); UI::ReplaceWidget(`tree_panel, Greasemonkey::Transform( `VBox( // dialog heading, graph is the mathematic term for // a set of notes connected with edges - `IconAndHeading(_("Graph"), StorageIcons::graph_icon), + `IconAndHeading(_("Device Graph"), StorageIcons::graph_icon), `Graph(`id(`graph), `opt(`notify, `notifyContextMenu), filename, "dot"), `HBox( // button text - `PushButton(`id(`export), _("Export Graph...")), + `PushButton(`id(`export), _("Export Device Graph...")), `HStretch() ) )) @@ -51,22 +51,22 @@ SCR::Execute(.target.remove, filename); // helptext - string helptext = _("<p>This view shows a graph.</p>"); + string helptext = _("<p>This view shows a graph of devices.</p>"); Wizard::RestoreHelp(helptext); } - void RefreshGraphPanel(any user_data) + void RefreshDeviceGraphPanel(any user_data) { - string filename = Directory::tmpdir + "/storage.gv"; - Storage::SaveGraph(filename); + string filename = Directory::tmpdir + "/device.gv"; + Storage::SaveDeviceGraph(filename); UI::ChangeWidget(`id(`graph), `Filename, filename); } - void HandleGraphPanel(any user_data, map event) + void HandleDeviceGraphPanel(any user_data, map event) { void GotoDevice(string device) { @@ -81,7 +81,7 @@ string node = (string) UI::QueryWidget(`id(`graph), `Item); if (isempty(node)) - EpContextMenuGraph(); + EpContextMenuDeviceGraph(); else if (String::StartsWith(node, "device:")) EpContextMenuDevice(substring(node, 7)); @@ -108,7 +108,7 @@ string filename = UI::AskForSaveFileName("/tmp", "*.gv", "Save as..."); if (filename != nil) { - if (!Storage::SaveGraph(filename)) + if (!Storage::SaveDeviceGraph(filename)) { // error popup Popup::Error(_("Saving graph file failed.")); @@ -118,4 +118,79 @@ break; } } + + + void CreateMountGraphPanel(any user_data) + { + string filename = Directory::tmpdir + "/mount.gv"; + Storage::SaveMountGraph(filename); + + UI::ReplaceWidget(`tree_panel, + Greasemonkey::Transform( + `VBox( + // dialog heading, graph is the mathematic term for + // a set of notes connected with edges + `IconAndHeading(_("Mount Graph"), StorageIcons::graph_icon), + `Graph(`id(`graph), `opt(`notify, `notifyContextMenu), filename, "dot"), + `HBox( + // button text + `PushButton(`id(`export), _("Export Mount Graph...")), + `HStretch() + ) + )) + ); + + SCR::Execute(.target.remove, filename); + + // helptext + string helptext = _("<p>This view shows a graph of mount points.</p>"); + + Wizard::RestoreHelp(helptext); + } + + + void RefreshMountGraphPanel(any user_data) + { + string filename = Directory::tmpdir + "/mount.gv"; + Storage::SaveMountGraph(filename); + + UI::ChangeWidget(`id(`graph), `Filename, filename); + } + + + void HandleMountGraphPanel(any user_data, map event) + { + void GotoDevice(string device) + { + TreePanel::SwitchToNew(device); + UI::SetFocus(UI::WidgetExists(`id(`table)) ? `id(`table) : `id(`text)); + } + + switch (Event::IsWidgetActivated(event)) + { + case `graph: + { + string node = (string) UI::QueryWidget(`id(`graph), `Item); + + if (String::StartsWith(node, "mountpoint:")) + GotoDevice(substring(node, 11)); + } + break; + + case `export: + { + string filename = UI::AskForSaveFileName("/tmp", "*.gv", "Save as..."); + if (filename != nil) + { + if (!Storage::SaveMountGraph(filename)) + { + // error popup + Popup::Error(_("Saving graph file failed.")); + } + } + } + break; + } + } + } Modified: trunk/storage/storage/src/include/ep-main.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/ep-ma... ============================================================================== --- trunk/storage/storage/src/include/ep-main.ycp (original) +++ trunk/storage/storage/src/include/ep-main.ycp Fri Nov 20 18:13:34 2009 @@ -101,7 +101,8 @@ `dm : $[ `create : CreateDmMainPanel, `handle : HandleDmMainPanel ], `nfs : $[ `create : CreateNfsMainPanel, `handle : HandleNfsMainPanel ], `unused : $[ `create : CreateUnusedPanel, `handle : HandleUnusedPanel ], - `graph : $[ `create : CreateGraphPanel, `refresh : RefreshGraphPanel, `handle : HandleGraphPanel ], + `devicegraph : $[ `create : CreateDeviceGraphPanel, `refresh : RefreshDeviceGraphPanel, `handle : HandleDeviceGraphPanel ], + `mountgraph : $[ `create : CreateMountGraphPanel, `refresh : RefreshDeviceGraphPanel, `handle : HandleMountGraphPanel ], `summary : $[ `create : CreateSummaryPanel ], `settings : $[ `create : CreateSettingsPanel, `handle : HandleSettingsPanel, `destroy : DestroySettingsPanel ], `log : $[ `create : CreateLogPanel, `handle : HandleLogPanel, `destroy : DestroyLogPanel ] ]; @@ -203,8 +204,13 @@ ]; if (UI::HasSpecialWidget(`Graph)) + { + // tree node label + tree = add(tree, `item(`id(`devicegraph), `icon(StorageIcons::graph_icon), _("Device Graph"), open(`devicegraph))); // tree node label - tree = add(tree, `item(`id(`graph), `icon(StorageIcons::graph_icon), _("Graph"), open(`graph))); + tree = add(tree, `item(`id(`mountgraph), `icon(StorageIcons::graph_icon), _("Mount Graph"), open(`mountgraph))); + } + // tree node label tree = add(tree, `item(`id(`summary), `icon(StorageIcons::summary_icon), _("Installation Summary"), open(`summary))); Modified: trunk/storage/storage/src/modules/Storage.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/modules/Stora... ============================================================================== --- trunk/storage/storage/src/modules/Storage.ycp (original) +++ trunk/storage/storage/src/modules/Storage.ycp Fri Nov 20 18:13:34 2009 @@ -5265,10 +5265,18 @@ } -global boolean SaveGraph(string filename) +global boolean SaveDeviceGraph(string filename) { - boolean ret = LibStorage::saveGraph(sint, filename); - y2milestone("SaveGraph filename:%1 ret:%2", filename, ret); + boolean ret = LibStorage::saveDeviceGraph(sint, filename); + y2milestone("SaveDeviceGraph filename:%1 ret:%2", filename, ret); + return ret; +} + + +global boolean SaveMountGraph(string filename) +{ + boolean ret = LibStorage::saveMountGraph(sint, filename); + y2milestone("SaveMountGraph filename:%1 ret:%2", filename, ret); return ret; } Modified: trunk/storage/yast2-storage.spec.in URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/yast2-storage.spec.in?rev... ============================================================================== --- trunk/storage/yast2-storage.spec.in (original) +++ trunk/storage/yast2-storage.spec.in Fri Nov 20 18:13:34 2009 @@ -5,7 +5,7 @@ License: GPL v2 or later BuildRequires: blocxx-devel boost-devel gcc-c++ libxcrypt-devel openssl-devel sablot swig BuildRequires: docbook-xsl-stylesheets doxygen libxslt perl-XML-Writer sgml-skel update-desktop-files -BuildRequires: libstorage-devel >= 2.18.21 yast2 >= 2.18.19 yast2-core-devel >= 2.18.1 yast2-devtools +BuildRequires: libstorage-devel >= 2.19.1 yast2 >= 2.18.19 yast2-core-devel >= 2.18.1 yast2-devtools BuildRequires: yast2-testsuite yast2-perl-bindings Requires: libstorage = %(echo `rpm -q --queryformat '%{VERSION}' libstorage`) Requires: yast2-perl-bindings yast2-core >= 2.18.3 yast2 >= 2.18.19 yast2-libyui >= 2.18.7 -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org