/// <summary> /// Retrieves the named configuration item from the storage media. /// </summary> /// <param name="name">Item name</param> /// <remarks> /// This method retrieves the item from the desklet instance config /// storage area. GConf path /apps/mono/desklets/DESKLET_NAME/DESKLET_INSTANCE_NUMBER is /// used as the storage base. /// </remarks> /// <returns> /// The requested item's value or null if not found /// </returns> public override object Retrieve(string name) { CheckValid(); object ret = null; string key = String.Format("{0}/{1}", KeyPathInstance, name); try { ret = client.Get(key); } catch (GConf.NoSuchKeyException) { ret = null; } return(ret); }
public ConfigBase(String baseName, String Name) { noGconfLoad = false; client = new GConf.Client(); keyBase = baseName.TrimEnd('/'); keyName = Name.TrimEnd('/').TrimStart('/'); keyFullName = keyBase + "/" + keyName; keyFullName_ = keyFullName + "/"; string[] sa; try{ sa = (string[])client.Get(AppBase + "/objects"); }catch { sa = new string[0]; client.Set(AppBase + "/objects", sa); } if (Array.FindIndex(sa, Name.Equals) == -1) { Array.Resize(ref sa, sa.Length + 1); sa[sa.Length - 1] = Name; client.Set(AppBase + "/objects", sa); } client.AddNotify(keyFullName, new NotifyEventHandler(OnGConf_Changed)); // client.AddNotify(keyFullName, // new NotifyEventHandler(beep)); System.Console.WriteLine("Listening on " + keyFullName); }
public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modItems) { GConf.Client client = new GConf.Client(); string exec; try { exec = client.Get("/desktop/gnome/applications/terminal/exec") as string; } catch { exec = "gnome-terminal"; } string hostname; if (items.First() is ITextItem) { ITextItem textitem = items.First() as ITextItem; hostname = textitem.Text; } else { SSHHostItem hostitem = items.First() as SSHHostItem; hostname = hostitem.Host; } Process term = new Process(); term.StartInfo.FileName = exec; term.StartInfo.Arguments = "-e 'ssh " + hostname + "'"; term.Start(); yield break; }
private string GetStringPref(string key, string def) { try { return((string)gconf.Get(key)); } catch { return(def); } }
override protected void PreInstallation(CStatusWindow sw) { InstallThemeFile = config.SplashInstallPath + Path.GetFileName(DownloadUrl); //Neuer GConfClient client = new GConf.Client(); //Sicherung sw.Mainlabel = CConfiguration.txtSavingForRestore; splashWasActive = (bool)client.Get(GConfShowSplashKey); prevSplash = (string)client.Get(GConfSplashImageKey); sw.SetProgress("1/" + installationSteps); sw.Mainlabel = CConfiguration.txtDownloadTheme; //Herunterladen if (!File.Exists(InstallThemeFile)) { GetThemeFile(sw); File.Copy(LocalThemeFile, InstallThemeFile); } sw.SetProgress("2/" + installationSteps); }
public ProfileItem(string profilePath) { Client client = new Client (); name = description = null; try { name = (string) client.Get (profilePath + "/visible_name"); description = (string) client.Get (profilePath + "/custom_command"); if (!string.IsNullOrEmpty (description)) description = string.Format ("{0} - {1}", description, DefaultDescription); } catch { name = description = null; } finally { if (string.IsNullOrEmpty (name)) name = DefaultName; if (string.IsNullOrEmpty (description)) description = DefaultDescription; } }
private void SetupUI() { hPaned1 = new HPaned(); hPaned2 = new HPaned(); hPaned1.Add1(SetupTypeTree()); hPaned1.Add2(hPaned2); hPaned1.Position = (int)gconf.Get(gconfPath + "hpaned1position"); hPaned2.Position = (int)gconf.Get(gconfPath + "hpaned2position"); vbox = new VBox(true, 2); vbox.Spacing = 2; Frame frame = new Frame(); frame.Shadow = ShadowType.In; frame.Add(MemberSelector()); vbox.Add(frame); frame = new Frame(); frame.Shadow = ShadowType.In; frame.Add(ICSelector()); vbox.Add(frame); hPaned2.Add1(vbox); memberView = new MemberView(); memberView.MemberSelectedEvent += new MemberView.MemberSelected(MemberSelected); memberView.RecordFactory = recordFactory [0]; ScrolledWindow sw = new ScrolledWindow(); sw.Add(memberView); hPaned2.Add2(sw); Content = new Notebook(); findBar = new FindBar(this); Content.AppendPage(findBar, new Label("Find")); Add1(hPaned1); Add2(Content); Position = (int)gconf.Get(gconfPath + "vpaned1position"); }
public object Retrieve(string key) { object retrievedKey; try { retrievedKey = client.Get(GCONF_APP_PATH + key); } catch (GConf.NoSuchKeyException e) { logger.Info("Key not found: " + e.Message); throw new SettingNotFoundException("Setting '" + key + "' cannot be found"); } return(retrievedKey); }
public object RetrieveAbsolute(string key) { try { lock (GCONF_APP_PATH) return(client.Get(key)); } catch (GConf.NoSuchKeyException e) { logger.Info("Key not found: " + e.Message); throw new SettingNotFoundException("Setting '" + key + "' cannot be found"); } }
static void CheckLockdown() { GConf.Client client = new GConf.Client(); try { disable_command_line = (bool)client.Get("/desktop/gnome/lockdown/disable_command_line"); } catch { // The key isn't set for some reason disable_command_line = false; } checked_gconf = true; }
static void CheckLockdown () { GConf.Client client = new GConf.Client (); try { disable_command_line = (bool) client.Get ("/desktop/gnome/lockdown/disable_command_line"); } catch { // The key isn't set for some reason disable_command_line = false; } checked_gconf = true; }
public String readconfig(String name, String def) { String s; try{ s = (String)client.Get(keyFullName_ + name); }catch { writeconfig(name, def); s = def; } return(s); }
// Plugin initializer public override void Initialize(IPlayer player) { // Initialize gettext Catalog.Init("muine", Defines.GNOME_LOCALE_DIR); GConf.Client gconf_client = new GConf.Client(); gconf_client.AddNotify(GConfKeyShowNotifications, new GConf.NotifyEventHandler(OnShowNotificationsChanged)); showNotifications = (bool)gconf_client.Get(GConfKeyShowNotifications); // Load stock icons InitStockIcons(); // Connect to player this.player = player; player.SongChangedEvent += OnSongChangedEvent; player.StateChangedEvent += OnStateChangedEvent; // Install "Hide Window" menu item player.UIManager.AddUi(player.UIManager.NewMergeId(), "/MenuBar/FileMenu/ExtraFileActions", "ToggleVisibleMenuItem", "ToggleVisible", UIManagerItemType.Menuitem, false); // Build menu player.UIManager.AddUiFromResource("TrayIcon.xml"); // Setup GConf gconf_client = new GConf.Client(); gconf_client.AddNotify(old_behaviour_key, BehaviourNotify); try { old_mouse_behaviour = (bool)gconf_client.Get(old_behaviour_key); } catch { old_mouse_behaviour = false; gconf_client.Set(old_behaviour_key, false); } // Maybe prevent 'delete' event from closing window by intercepting it player.Window.WidgetEvent += new WidgetEventHandler(OnWindowEvent); menu = (Menu)player.UIManager.GetWidget("/Menu"); menu.Deactivated += OnMenuDeactivated; // Init tooltips -- we init into "not playing" state tooltips = new Tooltips(); tooltips.Disable(); // init icon Init(); }
FoxTerm(string[] args) { program = new Program ("FoxTerm", "0.1", Modules.UI, args); app = new App ("FoxTerm", "Terminal"); app.SetDefaultSize (600, 450); app.DeleteEvent += new DeleteEventHandler (OnAppDelete); GConf.Client gc_client = new GConf.Client(); app.IconName = "terminal"; Terminal term = new Terminal (); term.EncodingChanged += new EventHandler (OnEncodingChanged); term.CursorBlinks = true; term.MouseAutohide = true; term.ScrollOnKeystroke = true; term.ScrollbackLines = int.MaxValue; term.DeleteBinding = TerminalEraseBinding.Auto; term.BackspaceBinding = TerminalEraseBinding.Auto; term.Encoding = "UTF-8"; term.FontFromString = (string)gc_client.Get("/desktop/gnome/interface/monospace_font_name"); term.ChildExited += new EventHandler (OnChildExited); term.WindowTitleChanged += OnTitleChanged; ScrolledWindow scroll = new ScrolledWindow(null,term.Adjustment); scroll.Add(term); scroll.HscrollbarPolicy = PolicyType.Automatic; scroll.HScrollbar.Hide(); string[] argv = Environment.GetCommandLineArgs (); // wants an array of "variable=value" string[] envv = new string[Environment.GetEnvironmentVariables ().Count]; int i = 0; foreach (DictionaryEntry e in Environment.GetEnvironmentVariables ()) { if ((string)(e.Key) == "" || (string)(e.Value) == "") continue; string tmp = String.Format ("{0}={1}", e.Key, e.Value); envv[i] = tmp; i++; } int pid = term.ForkCommand (Environment.GetEnvironmentVariable ("SHELL"), argv, envv, Environment.CurrentDirectory, false, true, true); app.Contents = scroll; app.ShowAll (); program.Run (); }
public static void autoread(ref uint var, string key, uint def) { try{ var = (uint)((int)conf.Get(KEY_BASE + key)); } catch { var = def; conf.Set(KEY_BASE + key, (int)def); System.Console.WriteLine("initial setting of {0} to {1}", key, def); } }
protected Item[] TextItemPerform(ITextItem item, TasqueCategoryItem category) { string defaultCategory; GConf.Client conf = new GConf.Client(); TasqueDBus tasque = new TasqueDBus(); try { defaultCategory = conf.Get("/apps/gnome-do/plugins/tasque/default_category") as string; } catch (GConf.NoSuchKeyException) { conf.Set("/apps/gnome-do/plugins/tasque/default_category", ""); return(null); } if (category.Name != "") { tasque.CreateTask(category.Name, item.Text); } else if (defaultCategory == String.Empty) { string[] split = item.Text.Split(':'); if (split [0] == item.Text) { IEnumerable <string> categories = tasque.GetCategoryNames(); tasque.CreateTask(categories.First(), item.Text); } else { tasque.CreateTask(split [0], split [1]); } } else { string[] split = item.Text.Split(':'); if (split [0] == item.Text) { tasque.CreateTask(defaultCategory, item.Text); } else { tasque.CreateTask(split [0], split [1]); } } return(null); }
void IExtensionService.Initialize() { artwork_manager_service = ServiceManager.Get <ArtworkManager> (); ThreadAssist.AssertInMainThread(); ServiceManager.PlayerEngine.ConnectEvent(OnPlayerEvent, PlayerEvent.StartOfStream | PlayerEvent.TrackInfoUpdated); // capture the current wallpaper to reestablish when exiting or in albums with no art gClient = new GConf.Client(); try { userWallpaper = (string)gClient.Get(GCONF_BACKGROUND_PATH); } catch (GConf.NoSuchKeyException ex) { Log.Error(ex.Message); //TODO: handle this exception (shouldn't happen though) } }
public void Read() { string keywords, spanto, sdelim, edelim, signore; ArrayList stylesList = new ArrayList(); ArrayList patternsList = new ArrayList(); Style style; string names = (string)gconf.Get(GCONF_PATH + "styles"); foreach (string name in names.Split(' ')) { if (name.Length == 0) { continue; } keywords = (string)gconf.Get(GCONF_PATH + name + "/keywords"); style = new Style(GCONF_PATH + name); stylesList.Add(style); sdelim = (string)gconf.Get(GCONF_PATH + name + "/sdelim"); edelim = (string)gconf.Get(GCONF_PATH + name + "/edelim"); try { signore = (string)gconf.Get(GCONF_PATH + name + "/signore"); } catch (NoSuchKeyException e) { signore = null; } try { spanto = (string)gconf.Get(GCONF_PATH + name + "/spanto"); } catch (NoSuchKeyException e) { spanto = null; } foreach (string key in keywords.Split(' ')) { patternsList.Add(new Pattern(style, GCONF_PATH + name, key, spanto, sdelim, edelim, signore)); } } patterns = (Pattern[])patternsList.ToArray(typeof(Pattern)); styles = (Style[])stylesList.ToArray(typeof(Style)); }
private bool GConfReady() { lock (lock_obj) { if (gconf_client == null) { gconf_client = new GConf.Client(); } try { this.data = gconf_client.Get(this.path); } catch (Exception ex) { this.ex = ex; } this.finished = true; Monitor.Pulse(lock_obj); } return(false); }
public MainWindow() : base(Gtk.WindowType.Toplevel) { Build(); ports = new SerPort[0]; taggers = new Tagger[0]; prng = new Random(); configTreeStore = new TreeStore(typeof(string)); configTreeView.Model = configTreeStore; configTreeColumn = new TreeViewColumn("Object", new CellRendererText(), "text", 0); configTreeView.AppendColumn(configTreeColumn); treeIters = new TreeIter[objNames.Length]; gcclient = new GConf.Client(); for (int i = 0; i < objNames.Length; ++i) { treeIters[i] = configTreeStore.AppendValues(objNames[i]); } try{ string[] sa; sa = (string[])(gcclient.Get(AppBase + "/objects")); foreach (string s in sa) { System.Console.WriteLine("found object: " + s); if (s.StartsWith("serialport-")) { try{ AddSerialPort(s, false); }catch { } } if (s.StartsWith("tagger-")) { try{ AddTagger(s, false); }catch { } } } }catch { System.Console.WriteLine("Ooops, no objects found"); } }
public GnomeHttpProxy( string domainUrl ) { client = new GConf.Client(); this.domainUrl = domainUrl.ToLower(); try { string[] bypassHosts = (string[]) client.Get( GCONF_IGNORE_HOSTS ); foreach( string host in bypassHosts ) { string normalizedHost = host.Replace( '/', ':' ).ToLower(); if ( normalizedHost == this.domainUrl ) { this.bypass = true; break; } } } catch( Exception) { } }
public T Get <T> (string @namespace, string key, T fallback) { if (DisableGConf || key == null) { return(fallback); } if (client == null) { client = new GConf.Client(); } try { return((T)client.Get(CreateKey(@namespace, key))); } catch (GConf.NoSuchKeyException) { return(fallback); } catch (Exception e) { Log.Exception(String.Format("Could no read GConf key {0}.{1}", @namespace, key), e); return(fallback); } }
/// <summary> /// Constructor - constains the target url /// which is checked against the bypass list /// If the target url exists in the bypass list /// proxy settings are ignored. /// </summary> public GnomeHttpProxy(string domainUrl) { client = new GConf.Client(); this.domainUrl = domainUrl.ToLower(); try { string[] bypassHosts = (string[])client.Get(GCONF_IGNORE_HOSTS); foreach (string host in bypassHosts) { string normalizedHost = host.Replace('/', ':').ToLower(); if (normalizedHost == this.domainUrl) { this.bypass = true; break; } } } catch (Exception) { //Debug.PrintLine( e.Message ); } }
public static WebResponse GetURI(string uri) { GConf.Client client = new GConf.Client (); bool use_proxy = false; bool use_auth = false; string user = null; string password = null; string host = null; int port = 80; // TODO: handle proxy exceptions properly, it doesn't look like the format // used by GConf is the same as the format expected by the .NET exclusions // list. e.g. 127.0.0.1/8 needs to be translated to 127.* try { use_proxy = (bool) client.Get (KEY_PROXY_USE); if (use_proxy) { host = (string) client.Get (KEY_PROXY_HOST); port = (int) client.Get (KEY_PROXY_PORT); use_auth = (bool) client.Get (KEY_PROXY_AUTH); if (use_auth) { user = (string) client.Get (KEY_PROXY_AUTH_USER); password = (string) client.Get (KEY_PROXY_AUTH_PASSWORD); } } } catch (Exception e) { System.Console.WriteLine ("Error reading proxy preferences: {0}", e.Message); } HttpWebRequest req = (HttpWebRequest) WebRequest.Create (uri); if (use_proxy) { string proxyuri = String.Format ("http://{0}:{1}", host, port); if (! use_auth) { req.Proxy = new WebProxy (proxyuri, true); } else { req.Proxy = new WebProxy (proxyuri, true, new string[] {}, (ICredentials) new NetworkCredential (user, password)); } } req.UserAgent = "Monopod"; return req.GetResponse (); }
public bool TryGet <T> (string @namespace, string key, out T result) { if (DisableGConf || key == null) { result = default(T); return(false); } if (client == null) { client = new GConf.Client(); } try { result = (T)client.Get(CreateKey(@namespace, key)); return(true); } catch (GConf.NoSuchKeyException) { } catch (Exception e) { Log.Exception(String.Format("Could no read GConf key {0}.{1}", @namespace, key), e); } result = default(T); return(false); }
void IExtensionService.Initialize() { artwork_manager_service = ServiceManager.Get<ArtworkManager> (); Banshee.Base.ThreadAssist.AssertInMainThread (); ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent, PlayerEvent.StartOfStream | PlayerEvent.TrackInfoUpdated); // capture the current wallpaper to reestablish when exiting or in albums with no art gClient = new GConf.Client(); try { userWallpaper = (string) gClient.Get(GCONF_BACKGROUND_PATH); } catch (GConf.NoSuchKeyException ex) { Hyena.Log.Error(ex.Message); //TODO: handle this exception (shouldn't happen though) } }
private void Load() { window.Resize((int)gconf.Get(gconfPath + "width"), (int)gconf.Get(gconfPath + "height")); }
override protected void PreInstallation(CStatusWindow sw) { InstallThemeFile = config.SplashInstallPath + Path.GetFileName(Image.URL); //Set the localPreviewFile to the downloaded file to fasten the preview localPreviewFile = LocalThemeFile; Console.WriteLine(LocalPreviewFile); sw.Mainlabel = CConfiguration.txtSavingForRestore; //Sichern client = new GConf.Client(); prevBackground = (string)client.Get(GConfBgKey); prevStyle = (string)client.Get(GConfISKey); sw.SetProgress("1/" + installationSteps); //Index und Type wurden vorher schon gwählt sw.Mainlabel = CConfiguration.txtDownloadTheme; if (!File.Exists(LocalThemeFile)) { if (!File.Exists(LocalPreviewFile)) { GetThemeFile(sw); } else { File.Copy(LocalPreviewFile, LocalThemeFile); Console.Out.WriteLine(LocalPreviewFile + " --- " + LocalThemeFile); } } try{ File.Copy(LocalThemeFile, InstallThemeFile); } catch {} ///home/.../.gnome2/backgrounds.xml einlesen und Background anhängen... //Just a hack...TODO:paste in XMLDoc if (!File.Exists(config.HomePath + ".gnome2/backgrounds.xml")) { StreamWriter locFile = new StreamWriter(config.HomePath + ".gnome2/backgrounds.xml"); locFile.WriteLine("<?xml version=\"1.0\"?>"); locFile.WriteLine("<!DOCTYPE wallpapers SYSTEM \"gnome-wp-list.dtd\"[]>"); locFile.WriteLine(" <wallpapers>"); locFile.WriteLine(" </wallpapers>"); locFile.Close(); } XmlDocument doc = new XmlDocument(); doc.Load(config.HomePath + ".gnome2/backgrounds.xml"); //Nach schon vorhandenem Eintrag in Backgrounds suchen XmlNode foundNode = doc.SelectSingleNode("wallpapers/wallpaper[filename='" + InstallThemeFile + "']"); if (foundNode != null) { XmlNodeList list = foundNode.ChildNodes; //Console.WriteLine("Count:"+list.Count); foreach (XmlNode node in list) { if (node.Name == "options") { Console.WriteLine(node.InnerText); node.InnerText = currentStyleString; break; } } } else { XmlNode newElem; XmlNode wallpaper = doc.CreateNode(XmlNodeType.Element, "wallpaper", ""); ((XmlElement)wallpaper).SetAttribute("deleted", "false"); newElem = doc.CreateNode(XmlNodeType.Element, "name", ""); newElem.InnerText = Path.GetFileName(InstallThemeFile); wallpaper.AppendChild(newElem); newElem = doc.CreateNode(XmlNodeType.Element, "filename", ""); newElem.InnerText = InstallThemeFile; wallpaper.AppendChild(newElem); newElem = doc.CreateNode(XmlNodeType.Element, "options", ""); newElem.InnerText = currentStyleString; wallpaper.AppendChild(newElem); newElem = doc.CreateNode(XmlNodeType.Element, "shade_type", ""); newElem.InnerText = "solid"; wallpaper.AppendChild(newElem); newElem = doc.CreateNode(XmlNodeType.Element, "pcolor", ""); newElem.InnerText = "#dadab0b08282"; wallpaper.AppendChild(newElem); newElem = doc.CreateNode(XmlNodeType.Element, "scolor", ""); newElem.InnerText = "#dadab0b08282"; wallpaper.AppendChild(newElem); doc.DocumentElement.AppendChild(wallpaper); } doc.Save(config.HomePath + ".gnome2/backgrounds.xml"); sw.SetProgress("2/" + installationSteps); }
protected Item[] TextItemPerform(ITextItem item, TasqueCategoryItem category) { string defaultCategory; GConf.Client conf = new GConf.Client (); TasqueDBus tasque = new TasqueDBus (); try { defaultCategory = conf.Get ("/apps/gnome-do/plugins/tasque/default_category") as string; } catch (GConf.NoSuchKeyException) { conf.Set ("/apps/gnome-do/plugins/tasque/default_category", ""); return null; } if (category.Name != "" ) { tasque.CreateTask(category.Name, item.Text); } else if (defaultCategory == String.Empty) { string[] split = item.Text.Split (':'); if (split [0] == item.Text) { IEnumerable<string> categories = tasque.GetCategoryNames (); tasque.CreateTask (categories.First (), item.Text); } else { tasque.CreateTask (split [0], split [1]); } } else { string[] split = item.Text.Split (':'); if (split [0] == item.Text) tasque.CreateTask (defaultCategory, item.Text); else tasque.CreateTask (split [0], split [1]); } return null; }
protected override void PreInstallation(CStatusWindow sw) { InstallThemeFile=config.SplashInstallPath+Path.GetFileName(DownloadUrl); //Neuer GConfClient client = new GConf.Client(); //Sicherung sw.Mainlabel=CConfiguration.txtSavingForRestore; splashWasActive = (bool)client.Get(GConfShowSplashKey); prevSplash = (string)client.Get(GConfSplashImageKey); sw.SetProgress("1/"+installationSteps); sw.Mainlabel=CConfiguration.txtDownloadTheme; //Herunterladen if (!File.Exists(InstallThemeFile)){ GetThemeFile(sw); File.Copy(LocalThemeFile,InstallThemeFile); } sw.SetProgress("2/"+installationSteps); }
protected override void PreInstallation(CStatusWindow sw) { InstallThemeFile = config.SplashInstallPath+Path.GetFileName(Image.URL); //Set the localPreviewFile to the downloaded file to fasten the preview localPreviewFile = LocalThemeFile; Console.WriteLine(LocalPreviewFile); sw.Mainlabel=CConfiguration.txtSavingForRestore; //Sichern client = new GConf.Client(); prevBackground=(string)client.Get(GConfBgKey); prevStyle = (string)client.Get(GConfISKey); sw.SetProgress("1/"+installationSteps); //Index und Type wurden vorher schon gwählt sw.Mainlabel=CConfiguration.txtDownloadTheme; if (!File.Exists(LocalThemeFile)) { if (!File.Exists(LocalPreviewFile)) { GetThemeFile(sw); } else { File.Copy(LocalPreviewFile,LocalThemeFile); Console.Out.WriteLine(LocalPreviewFile + " --- " + LocalThemeFile); } } try{File.Copy(LocalThemeFile,InstallThemeFile);} catch{} ///home/.../.gnome2/backgrounds.xml einlesen und Background anhängen... //Just a hack...TODO:paste in XMLDoc if (!File.Exists(config.HomePath+".gnome2/backgrounds.xml")){ StreamWriter locFile = new StreamWriter(config.HomePath+".gnome2/backgrounds.xml"); locFile.WriteLine("<?xml version=\"1.0\"?>"); locFile.WriteLine("<!DOCTYPE wallpapers SYSTEM \"gnome-wp-list.dtd\"[]>"); locFile.WriteLine(" <wallpapers>"); locFile.WriteLine(" </wallpapers>"); locFile.Close(); } XmlDocument doc = new XmlDocument(); doc.Load(config.HomePath+".gnome2/backgrounds.xml"); //Nach schon vorhandenem Eintrag in Backgrounds suchen XmlNode foundNode = doc.SelectSingleNode("wallpapers/wallpaper[filename='"+InstallThemeFile+"']"); if (foundNode != null){ XmlNodeList list = foundNode.ChildNodes; //Console.WriteLine("Count:"+list.Count); foreach (XmlNode node in list){ if (node.Name=="options"){ Console.WriteLine(node.InnerText); node.InnerText=currentStyleString; break; } } } else { XmlNode newElem; XmlNode wallpaper = doc.CreateNode(XmlNodeType.Element,"wallpaper",""); ((XmlElement)wallpaper).SetAttribute("deleted","false"); newElem = doc.CreateNode(XmlNodeType.Element, "name", ""); newElem.InnerText = Path.GetFileName(InstallThemeFile); wallpaper.AppendChild(newElem); newElem = doc.CreateNode(XmlNodeType.Element, "filename", ""); newElem.InnerText = InstallThemeFile; wallpaper.AppendChild(newElem); newElem = doc.CreateNode(XmlNodeType.Element, "options", ""); newElem.InnerText = currentStyleString; wallpaper.AppendChild(newElem); newElem = doc.CreateNode(XmlNodeType.Element, "shade_type", ""); newElem.InnerText = "solid"; wallpaper.AppendChild(newElem); newElem = doc.CreateNode(XmlNodeType.Element, "pcolor", ""); newElem.InnerText = "#dadab0b08282"; wallpaper.AppendChild(newElem); newElem = doc.CreateNode(XmlNodeType.Element, "scolor", ""); newElem.InnerText = "#dadab0b08282"; wallpaper.AppendChild(newElem); doc.DocumentElement.AppendChild(wallpaper); } doc.Save(config.HomePath+".gnome2/backgrounds.xml"); sw.SetProgress("2/"+installationSteps); }