~ubuntu-branches/ubuntu/gutsy/tomboy/gutsy-updates

« back to all changes in this revision

Viewing changes to Tomboy/NoteManager.cs

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2007-01-08 21:12:13 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20070108211213-duqllmpnxes216dv
Tags: 0.5.3-0ubuntu1
* New upstream release
* debian/patches/01_utf8-fix.patch:
  + Dropped, merged upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
                        trie_controller = CreateTrieController ();
37
37
 
38
38
                        if (first_run) {
39
 
                                // First run. Create "Start Here" note.
40
 
                                CreateStartNote ();
 
39
                                // First run. Create "Start Here" notes.
 
40
                                CreateStartNotes ();
41
41
                        } else {
42
42
                                LoadNotes ();
43
43
                        }
49
49
                // methods.
50
50
                protected virtual PluginManager CreatePluginManager ()
51
51
                {
52
 
                        string tomboy_dir = 
53
 
                                Path.Combine (Environment.GetEnvironmentVariable ("HOME"), 
54
 
                                              ".tomboy");
55
 
                        string plugins_dir = Path.Combine (tomboy_dir, "Plugins");
 
52
                        // Allow developers to override the plugins path with an
 
53
                        // environment variable.
 
54
                        string plugins_dir =
 
55
                                Environment.GetEnvironmentVariable ("TOMBOY_PLUGINS_PATH");
 
56
 
 
57
                        if (plugins_dir == null) {
 
58
                                string tomboy_dir = 
 
59
                                        Path.Combine (Environment.GetEnvironmentVariable ("HOME"), 
 
60
                                                      ".tomboy");
 
61
                                plugins_dir = Path.Combine (tomboy_dir, "Plugins");
 
62
                        }
 
63
 
56
64
                        PluginManager.CreatePluginsDir (plugins_dir);
57
65
 
58
66
                        return new PluginManager (plugins_dir);
96
104
                                NoteRenamed (note, old_title);
97
105
                }
98
106
 
99
 
                protected virtual void CreateStartNote () 
 
107
                protected virtual void CreateStartNotes () 
100
108
                {
101
 
                        string content = 
102
 
                                string.Format ("<note-content>" +
103
 
                                               "{0}\n\n" +
104
 
                                               "<bold>{1}</bold>\n\n" +
105
 
                                               "{2}" +
106
 
                                               "</note-content>",
107
 
                                               Catalog.GetString ("Start Here"),
108
 
                                               Catalog.GetString ("Welcome to Tomboy!"),
109
 
                                               Catalog.GetString ("Use this page as a Start Page " +
110
 
                                                                  "for organizing your notes and " +
111
 
                                                                  "keeping unorganized ideas " +
112
 
                                                                  "around."));
 
109
                        // FIXME: Delay the creation of the start notes so the panel/tray
 
110
                        // icon has enough time to appear so that Tomboy.TrayIconShowing
 
111
                        // is valid.  Then, we'll be able to instruct the user where to
 
112
                        // find the Tomboy icon.
 
113
                        //string icon_str = Tomboy.TrayIconShowing ?
 
114
                        //                                      Catalog.GetString ("System Tray Icon area") :
 
115
                        //                                      Catalog.GetString ("GNOME Panel");
 
116
                        string start_note_content = 
 
117
                                Catalog.GetString ("<note-content>" +
 
118
                                                "Start Here\n\n" +
 
119
                                                "<bold>Welcome to Tomboy!</bold>\n\n" +
 
120
                                                "Use this \"Start Here\" note to begin organizing " +
 
121
                                                "your ideas and thoughts.\n\n" +
 
122
                                                "You can create new notes to hold your ideas by " +
 
123
                                                "selecting the \"Create New Note\" item from the " +
 
124
                                                "Tomboy Notes menu in your GNOME Panel.\n\n" +
 
125
                                                "Then organize the notes you create by linking " +
 
126
                                                "related notes and ideas together!\n\n" +
 
127
                                                "We've created a note called " +
 
128
                                                "<link:internal>Using Links in Tomboy</link:internal>.  " +
 
129
                                                "Notice how each time we type <link:internal>Using " +
 
130
                                                "Links in Tomboy</link:internal> it automatically " +
 
131
                                                "gets underlined?  Click on the link to open the note." +
 
132
                                                "</note-content>");
 
133
 
 
134
                        string links_note_content =
 
135
                                Catalog.GetString ("<note-content>" +
 
136
                                                "Using Links in Tomboy\n\n" +
 
137
                                                "Notes in Tomboy can be linked together by " +
 
138
                                                "highlighting text in the current note and clicking" +
 
139
                                                " the <bold>Link</bold> button above in the toolbar.  " +
 
140
                                                "Doing so will create a new note and also underline " +
 
141
                                                "the note's title in the current note.\n\n" +
 
142
                                                "Changing the title of a note will update links " +
 
143
                                                "present in other notes.  This prevents broken links " +
 
144
                                                "from occurring when a note is renamed.\n\n" +
 
145
                                                "Also, if you type the name of another note in your " +
 
146
                                                "current note, it will automatically be linked for you." +
 
147
                                                "</note-content>");
113
148
 
114
149
                        try {
115
 
                                Note start_note = Create (Catalog.GetString ("Start Here"), 
116
 
                                                          content);
 
150
                                Note start_note = Create (Catalog.GetString ("Start Here"),
 
151
                                                                start_note_content);
117
152
                                start_note.Save ();
 
153
 
 
154
                                Note links_note = Create (Catalog.GetString ("Using Links in Tomboy"),
 
155
                                                                links_note_content);
 
156
                                links_note.Save ();
 
157
                                
118
158
                                start_note.Window.Show ();
119
 
                        } catch (Exception e) {
 
159
                        } catch {
120
160
                                // Fail silently
121
161
                        }
122
162
                }