Hello,

Here is a quick patch to store and restore the editing settings. This is only a temporary solution for two reasons: it doesn't effect monodoc until the next time it is run, and it is specific to having one setting. Let me know if I can commit. Thanks.
Index: Makefile.am
===================================================================
RCS file: /cvs/public/monodoc/browser/Makefile.am,v
retrieving revision 1.36
diff -u -r1.36 Makefile.am
--- Makefile.am 8 Sep 2003 03:40:37 -0000       1.36
+++ Makefile.am 22 Sep 2003 19:33:30 -0000
@@ -6,7 +6,7 @@
 CSC=mcs
 
 
-monodoc_sources = $(srcdir)/man-provider.cs $(srcdir)/monohb-provider.cs 
$(srcdir)/xhtml-provider.cs $(srcdir)/ecma-provider.cs $(srcdir)/simple-provider.cs 
$(srcdir)/html-helper.cs $(srcdir)/provider.cs $(srcdir)/index.cs 
$(srcdir)/error-provider.cs $(srcdir)/ecmaspec-provider.cs $(srcdir)/editing.cs
+monodoc_sources = $(srcdir)/man-provider.cs $(srcdir)/monohb-provider.cs 
$(srcdir)/xhtml-provider.cs $(srcdir)/ecma-provider.cs $(srcdir)/simple-provider.cs 
$(srcdir)/html-helper.cs $(srcdir)/provider.cs $(srcdir)/index.cs 
$(srcdir)/error-provider.cs $(srcdir)/ecmaspec-provider.cs $(srcdir)/editing.cs 
$(srcdir)/settings.cs
 
 assembler_sources = $(srcdir)/assembler.cs 
 dump_sources      = $(srcdir)/dump.cs 
Index: browser.cs
===================================================================
RCS file: /cvs/public/monodoc/browser/browser.cs,v
retrieving revision 1.65
diff -u -r1.65 browser.cs
--- browser.cs  14 Sep 2003 19:18:04 -0000      1.65
+++ browser.cs  22 Sep 2003 19:33:30 -0000
@@ -95,6 +95,7 @@
        [Glade.Widget] Statusbar statusbar;
        [Glade.Widget] Button back_button, forward_button;
        [Glade.Widget] Entry index_entry;
+       [Glade.Widget] CheckMenuItem editing1;
 
        //
        // Editor
@@ -170,6 +171,10 @@
 
                help_tree = RootTree.LoadTree ();
                tree_browser = new TreeBrowser (help_tree, reference_tree, this);
+               
+               // restore the editing setting
+               editing1.Active = Settings.Restore ();
+               editable = Settings.Restore ();
 
                //
                // Setup the HTML rendering area
@@ -210,11 +215,6 @@
        public enum Mode {
                Viewer, Editor
        }
-       
-       public bool IsEditable
-       {
-               get { return editable; }
-       }
 
        public Mode BrowserMode {
                get {
@@ -397,6 +397,7 @@
        void OnEditingActivate (object o, EventArgs args)
        {
                editable = !editable;
+               Settings.Save (editable);
        }
        
        void OnCollapseActivate (object o, EventArgs args)
Index: ecma-provider.cs
===================================================================
RCS file: /cvs/public/monodoc/browser/ecma-provider.cs,v
retrieving revision 1.69
diff -u -r1.69 ecma-provider.cs
--- ecma-provider.cs    7 Sep 2003 16:36:44 -0000       1.69
+++ ecma-provider.cs    22 Sep 2003 19:33:30 -0000
@@ -1066,7 +1066,7 @@
                
                static ExtensionObject ()
                {
-                       if (Environment.GetEnvironmentVariable ("MONODOC_EDITING") != 
null)
+                       if (Settings.Restore ())
                                editing = true;
                }
                
Index: settings.cs
===================================================================
RCS file: settings.cs
diff -N settings.cs
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ settings.cs 22 Sep 2003 19:33:30 -0000
@@ -0,0 +1,35 @@
+using System;
+using System.IO;
+using System.Text;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace Monodoc
+{
+       public class Settings
+       {
+               static string xmlfile;
+               
+               static Settings ()
+               {
+                       string home = System.Environment.GetEnvironmentVariable 
("HOME");
+                       xmlfile = Path.Combine (home, ".monodoc/settings.xml");
+               }
+
+               public static void Save (bool val)
+               {
+                       XmlSerializer settings = new XmlSerializer (typeof (bool));
+                       settings.Serialize (new XmlTextWriter (xmlfile, 
Encoding.UTF8), val);
+               }
+
+               public static bool Restore ()
+               {
+                       if (File.Exists (xmlfile))
+                       {
+                               XmlSerializer settings = new XmlSerializer (typeof 
(bool));
+                               return (bool) settings.Deserialize (new XmlTextReader 
(xmlfile));
+                       }
+                       else { return false; }
+               }       
+       }
+}

Reply via email to