From 6bf0bc9539e97916dbdfe334ea2ded8480087f06 Mon Sep 17 00:00:00 2001 From: Jim Norman Date: Wed, 3 May 2006 19:03:21 +0000 Subject: [PATCH] Bug 171135. Give user the option to launch YAST when micasad is not running. --- CASA.changes | 5 +++++ c_gui/CasaMain.cs | 37 +++++++++++++++++++++++++++++++------ c_gui/Common.cs | 24 ++++++++++++++++++++++-- 3 files changed, 58 insertions(+), 8 deletions(-) diff --git a/CASA.changes b/CASA.changes index 692fe416..dfd66d15 100644 --- a/CASA.changes +++ b/CASA.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue May 02 15:37:37 MST 2006 - jnorman@novell.com +- Bug 171135. Give user the option to launch YAST when micasad is + not running. + ------------------------------------------------------------------- Tue May 02 15:37:37 MST 2006 - jnorman@novell.com - Security Audit 4.1. Enhanced Persistence encryption salt generation diff --git a/c_gui/CasaMain.cs b/c_gui/CasaMain.cs index 6494dcdd..208c5bf8 100644 --- a/c_gui/CasaMain.cs +++ b/c_gui/CasaMain.cs @@ -169,16 +169,34 @@ namespace Novell.CASA.GUI } catch (Exception e) { - //Console.WriteLine("CasaMain: EXCEPTION \n"+e.ToString()); - - string message = "miCASA services are not available"; + //Console.WriteLine("CasaMain: EXCEPTION \n"+e.ToString()); + string message; + Gtk.ButtonsType buttonType = Gtk.ButtonsType.Close; + if (m_bShowDebug) + { message = e.ToString(); + } + else + { + if (Common.IS_LINUX) + { + message = "CASA services are not available.\r\n\r\nConfigure CASA using YAST?"; + buttonType = Gtk.ButtonsType.YesNo; + } + else + { + message = "CASA services are not available"; + } + } + MessageDialog md=new MessageDialog(null,Gtk.DialogFlags.Modal, - Gtk.MessageType.Error, - Gtk.ButtonsType.Close, - message); + Gtk.MessageType.Error, + buttonType, + message); + md.Response+=new ResponseHandler(md_ResponseCloseWindow); + md.SetPosition(Gtk.WindowPosition.CenterAlways); md.Show(); Application.Run(); @@ -1632,6 +1650,13 @@ namespace Novell.CASA.GUI private static void md_ResponseCloseWindow(object o, ResponseArgs args) { MessageDialog md = (MessageDialog)o; + + if (args.Args[0].Equals(Gtk.ResponseType.Yes)) + { + // launch yast to configure CASA + Common.StartProcess("/sbin/yast2", "CASA"); + } + if (md != null) { md.Destroy(); diff --git a/c_gui/Common.cs b/c_gui/Common.cs index ae417c0d..c4f08e9c 100644 --- a/c_gui/Common.cs +++ b/c_gui/Common.cs @@ -325,8 +325,7 @@ public class Common string sUrl = GetHelpPath() + GetLocale() + sHelpFilename; return ShowUrl(sUrl); } - - + public static bool ShowUrl(string url) { @@ -362,6 +361,27 @@ public class Common else return false; } + + public static void StartProcess(string sProcessPath, string sProcessArgs) + { + if (sProcessPath != null) + { + Process newProcess = new Process(); + newProcess.StartInfo.FileName = sProcessPath; + if (sProcessArgs != null) + newProcess.StartInfo.Arguments = sProcessArgs; + + try + { + newProcess.Start(); + } + catch (Exception e) + { + Logger.DbgLog(e.Message); + Logger.DbgLog(e.StackTrace); + } + } + } } }