~psgenfan/do-plugins/TomboyInsertText

« back to all changes in this revision

Viewing changes to Tomboy/src/TomboyConfiguration.cs

  • Committer: Marcus
  • Date: 2010-03-27 17:53:23 UTC
  • Revision ID: marcus@marcus-desktop-20100327175323-zryvim7tt6384n3n
first

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
        {
39
39
                private const string DeriveTitlePrefKey = "deriveTitle";
40
40
                private const string TitleFirstPrefKey = "titleFirst";
41
 
                
 
41
                private const string InsertionDatePrefKey = "includeDate";
 
42
                private const string PrependPrefKey = "insertPrepand";
 
43
                private const string DateFormatKey = "dateFormat";
42
44
                private static IPreferences prefs;
43
45
                
44
46
                static TomboyConfiguration ()
56
58
                        get { return prefs.Get (TitleFirstPrefKey, false); }
57
59
                }
58
60
                
 
61
                public static bool DateInsertion
 
62
                {
 
63
                        get { return prefs.Get (InsertionDatePrefKey, false); }
 
64
                }
 
65
                public static bool PrependInsertion
 
66
                {
 
67
                        get {return prefs.Get (PrependPrefKey, false); }        
 
68
                }
 
69
                public static int DateFormat
 
70
                {
 
71
                        get {return prefs.Get (DateFormatKey, 0);}
 
72
                }       
59
73
                public TomboyConfiguration()
60
74
                {
61
75
                        this.Build();
64
78
                        deriveTitleCheckButton.Active = DeriveTitle;
65
79
                        contentFirstRadioButton.Active = !TitleFirst;
66
80
                        titleFirstRadioButton.Active = TitleFirst;
67
 
                        
 
81
                        insertionIncludeTime.Active = DateInsertion;
 
82
                        insertionPrepend.Active = PrependInsertion;
 
83
                        insertionAppend.Active = !PrependInsertion;
 
84
                        InsertionDateFormat.Active = DateFormat;
68
85
                        // Set up events.  I had trouble doing this from stetic.
69
86
                        deriveTitleCheckButton.Toggled += OnDeriveTitleCheckButtonToggled;
70
87
                        contentFirstRadioButton.Toggled += OnContentFirstRadioButtonToggled;
71
88
                        titleFirstRadioButton.Toggled += OnContentFirstRadioButtonToggled;
 
89
                        insertionIncludeTime.Toggled += OnInsertionIncludeTimeToggled;
 
90
                        insertionPrepend.Toggled += OnInsertionPrependToggled;
 
91
                        insertionAppend.Toggled += OnInsertionPrependToggled;
 
92
                        InsertionDateFormat.Changed += OnDateFormatSelection;
72
93
                }
73
94
 
 
95
                protected virtual void OnInsertionIncludeTimeToggled (object Sender, System.EventArgs e)
 
96
                {
 
97
                        prefs.Set(InsertionDatePrefKey, insertionIncludeTime.Active);   
 
98
                }
 
99
                protected virtual void OnInsertionPrependToggled (object Sender, System.EventArgs e)
 
100
                {
 
101
                        prefs.Set(PrependPrefKey, insertionPrepend.Active);
 
102
                }
74
103
                protected virtual void OnDeriveTitleCheckButtonToggled (object sender, System.EventArgs e)
75
104
                {
76
105
                        prefs.Set (DeriveTitlePrefKey, deriveTitleCheckButton.Active);
80
109
                {
81
110
                        prefs.Set (TitleFirstPrefKey, titleFirstRadioButton.Active);
82
111
                }
 
112
                protected virtual void OnDateFormatSelection(object sender, System.EventArgs e)
 
113
                {
 
114
                        prefs.Set (DateFormatKey, InsertionDateFormat.Active);  
 
115
                }
83
116
        }
84
117
}