using System; using System.Collections.Generic; using Gtk; using Gdk; namespace lliurex { namespace controlcenter { public class ConfigApplication { public const String path_icons = "/usr/share/zero-center/icons/"; public const String path_zmds = "/usr/share/zero-center/zmds/"; public String name; public String locale_name; public String category; public Gdk.Pixbuf icon; public List prereq; public String [] pres; public uint status; public String script_path; public String comment; public bool service; public ConfigApplication(PropertyReader pr) { status = Core.S_CONF_NEEDED; service = true; if(pr.values.ContainsKey("Name"))name=pr.values["Name"]; else name="noname"; if(pr.values.ContainsKey("Name["+Core.getCore().locale+"]"))locale_name=pr.values["Name["+Core.getCore().locale+"]"]; else if(pr.values.ContainsKey("Name["+Core.getCore().short_locale+"]"))locale_name=pr.values["Name["+Core.getCore().short_locale+"]"]; else locale_name=""; if(pr.values.ContainsKey("Comment["+Core.getCore().locale+"]"))comment=pr.values["Comment["+Core.getCore().locale+"]"]; else if(pr.values.ContainsKey("Comment"))comment=pr.values["Comment"]; if(pr.values.ContainsKey("Icon")) { if(Gtk.IconTheme.Default.HasIcon(pr.values["Icon"])) { //cond 1: Icon exists on /usr/share/zero-center/icons if(System.IO.File.Exists(path_icons+pr.values["Icon"]))icon=new Gdk.Pixbuf("",48,48); else { //cond 2: Icon exists as gnome theme icon=Gtk.IconTheme.Default.LoadIcon(pr.values["Icon"],48,IconLookupFlags.ForceSvg); } } else icon=Core.getCore().pixdefault; } else icon=Core.getCore().pixdefault; if(pr.values.ContainsKey("Prereq")) { pres = pr.values["Prereq"].Split(';'); } if(pr.values.ContainsKey("ScriptPath")) { script_path = path_zmds + pr.values["ScriptPath"]; } if(pr.values.ContainsKey("Category"))category=pr.values["Category"]; else category="Other"; if(pr.values.ContainsKey("Service")) { String tmp = pr.values["Service"]; if(tmp=="True")service=true; if(tmp=="False")service=false; } } } } }