Merge lp:~dobey/ubuntu/oneiric/tomboy/no-more-u1 into lp:ubuntu/oneiric/tomboy
- Oneiric (11.10)
- no-more-u1
- Merge into oneiric
Proposed by
dobey
Status: | Merged | ||||
---|---|---|---|---|---|
Merge reported by: | Martin Pitt | ||||
Merged at revision: | not available | ||||
Proposed branch: | lp:~dobey/ubuntu/oneiric/tomboy/no-more-u1 | ||||
Merge into: | lp:ubuntu/oneiric/tomboy | ||||
Diff against target: |
2430 lines (+1705/-613) 12 files modified
.pc/02_sync_save_button_sensitive.patch/Tomboy/PreferencesDialog.cs (+1388/-0) .pc/32_logout_delay.patch/Tomboy/GnomeApplication.cs (+230/-0) .pc/applied-patches (+2/-0) Tomboy/GnomeApplication.cs (+6/-0) Tomboy/PreferencesDialog.cs (+1/-1) debian/changelog (+34/-0) debian/control (+1/-2) debian/patches/03_u1_as_default_sync.patch (+0/-13) debian/patches/05_add_start_u1_note.patch (+0/-39) debian/patches/06_use_ubuntu_sso.patch (+0/-555) debian/patches/32_logout_delay.patch (+42/-0) debian/patches/series (+1/-3) |
||||
To merge this branch: | bzr merge lp:~dobey/ubuntu/oneiric/tomboy/no-more-u1 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Didier Roche-Tolomelli | Approve | ||
Ubuntu branches | Pending | ||
Review via email: mp+146676@code.launchpad.net |
Commit message
Description of the change
* debian/
* debian/
* debian/
* debian/
- Remove patches to default to Ubuntu One for notes sync. (LP: #1115460)
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added directory '.pc/02_sync_save_button_sensitive.patch' | |||
2 | === added directory '.pc/02_sync_save_button_sensitive.patch/Tomboy' | |||
3 | === added file '.pc/02_sync_save_button_sensitive.patch/Tomboy/PreferencesDialog.cs' | |||
4 | --- .pc/02_sync_save_button_sensitive.patch/Tomboy/PreferencesDialog.cs 1970-01-01 00:00:00 +0000 | |||
5 | +++ .pc/02_sync_save_button_sensitive.patch/Tomboy/PreferencesDialog.cs 2013-02-05 16:50:59 +0000 | |||
6 | @@ -0,0 +1,1388 @@ | |||
7 | 1 | |||
8 | 2 | using System; | ||
9 | 3 | using System.Collections.Generic; | ||
10 | 4 | using System.Text; | ||
11 | 5 | using Mono.Unix; | ||
12 | 6 | |||
13 | 7 | using Tomboy.Sync; | ||
14 | 8 | |||
15 | 9 | namespace Tomboy | ||
16 | 10 | { | ||
17 | 11 | public class PreferencesDialog : Gtk.Dialog | ||
18 | 12 | { | ||
19 | 13 | Gtk.ListStore syncAddinStore; | ||
20 | 14 | Dictionary<string, Gtk.TreeIter> syncAddinIters; | ||
21 | 15 | Gtk.ComboBox syncAddinCombo; | ||
22 | 16 | SyncServiceAddin selectedSyncAddin; | ||
23 | 17 | Gtk.VBox syncAddinPrefsContainer; | ||
24 | 18 | Gtk.Widget syncAddinPrefsWidget; | ||
25 | 19 | Gtk.Button resetSyncAddinButton; | ||
26 | 20 | Gtk.Button saveSyncAddinButton; | ||
27 | 21 | Gtk.CheckButton autosyncCheck; | ||
28 | 22 | Gtk.SpinButton autosyncSpinner; | ||
29 | 23 | Gtk.ComboBox rename_behavior_combo; | ||
30 | 24 | readonly AddinManager addin_manager; | ||
31 | 25 | |||
32 | 26 | Gtk.Button font_button; | ||
33 | 27 | Gtk.Label font_face; | ||
34 | 28 | Gtk.Label font_size; | ||
35 | 29 | |||
36 | 30 | Mono.Addins.Gui.AddinTreeWidget addin_tree; | ||
37 | 31 | |||
38 | 32 | Gtk.Button enable_addin_button; | ||
39 | 33 | Gtk.Button disable_addin_button; | ||
40 | 34 | Gtk.Button addin_prefs_button; | ||
41 | 35 | Gtk.Button addin_info_button; | ||
42 | 36 | |||
43 | 37 | private Gtk.RadioButton promptOnConflictRadio; | ||
44 | 38 | private Gtk.RadioButton renameOnConflictRadio; | ||
45 | 39 | private Gtk.RadioButton overwriteOnConflictRadio; | ||
46 | 40 | |||
47 | 41 | /// <summary> | ||
48 | 42 | /// Keep track of the opened addin prefs dialogs so other windows | ||
49 | 43 | /// can be interacted with (as opposed to opening these as modal | ||
50 | 44 | /// dialogs). | ||
51 | 45 | /// | ||
52 | 46 | /// Key = Mono.Addins.Addin.Id | ||
53 | 47 | /// </summary> | ||
54 | 48 | Dictionary<string, Gtk.Dialog> addin_prefs_dialogs; | ||
55 | 49 | |||
56 | 50 | /// <summary> | ||
57 | 51 | /// Used to keep track of open AddinInfoDialogs. | ||
58 | 52 | /// Key = Mono.Addins.Addin.Id | ||
59 | 53 | /// </summary> | ||
60 | 54 | Dictionary<string, Gtk.Dialog> addin_info_dialogs; | ||
61 | 55 | |||
62 | 56 | public PreferencesDialog (AddinManager addin_manager) | ||
63 | 57 | : base () | ||
64 | 58 | { | ||
65 | 59 | this.addin_manager = addin_manager; | ||
66 | 60 | |||
67 | 61 | IconName = "tomboy"; | ||
68 | 62 | HasSeparator = false; | ||
69 | 63 | BorderWidth = 5; | ||
70 | 64 | Resizable = true; | ||
71 | 65 | Title = Catalog.GetString ("Tomboy Preferences"); | ||
72 | 66 | |||
73 | 67 | ActionArea.Layout = Gtk.ButtonBoxStyle.End; | ||
74 | 68 | |||
75 | 69 | addin_prefs_dialogs = | ||
76 | 70 | new Dictionary<string, Gtk.Dialog> (); | ||
77 | 71 | addin_info_dialogs = | ||
78 | 72 | new Dictionary<string, Gtk.Dialog> (); | ||
79 | 73 | |||
80 | 74 | // Notebook Tabs (Editing, Hotkeys)... | ||
81 | 75 | |||
82 | 76 | Gtk.Notebook notebook = new Gtk.Notebook (); | ||
83 | 77 | notebook.TabPos = Gtk.PositionType.Top; | ||
84 | 78 | notebook.Show (); | ||
85 | 79 | |||
86 | 80 | notebook.AppendPage (MakeEditingPane (), | ||
87 | 81 | new Gtk.Label (Catalog.GetString ("Editing"))); | ||
88 | 82 | if (! (Services.Keybinder is NullKeybinder)) | ||
89 | 83 | notebook.AppendPage (MakeHotkeysPane (), | ||
90 | 84 | new Gtk.Label (Catalog.GetString ("Hotkeys"))); | ||
91 | 85 | notebook.AppendPage (MakeSyncPane (), | ||
92 | 86 | new Gtk.Label (Catalog.GetString ("Synchronization"))); | ||
93 | 87 | notebook.AppendPage (MakeAddinsPane (), | ||
94 | 88 | new Gtk.Label (Catalog.GetString ("Add-ins"))); | ||
95 | 89 | |||
96 | 90 | // TODO: Figure out a way to have these be placed in a specific order | ||
97 | 91 | foreach (PreferenceTabAddin tabAddin in addin_manager.GetPreferenceTabAddins ()) { | ||
98 | 92 | Logger.Debug ("Adding preference tab addin: {0}", tabAddin.GetType ().Name); | ||
99 | 93 | try { | ||
100 | 94 | string tabName; | ||
101 | 95 | Gtk.Widget tabWidget; | ||
102 | 96 | if (tabAddin.GetPreferenceTabWidget (this, out tabName, out tabWidget) == true) { | ||
103 | 97 | notebook.AppendPage (tabWidget, new Gtk.Label (tabName)); | ||
104 | 98 | } | ||
105 | 99 | } catch (Exception e) { | ||
106 | 100 | Logger.Warn ("Problems adding preferences tab addin: {0}", tabAddin.GetType ().Name); | ||
107 | 101 | Logger.Debug ("{0}:\n{1}", e.Message, e.StackTrace); | ||
108 | 102 | } | ||
109 | 103 | } | ||
110 | 104 | |||
111 | 105 | VBox.PackStart (notebook, true, true, 0); | ||
112 | 106 | |||
113 | 107 | addin_manager.ApplicationAddinListChanged += OnAppAddinListChanged; | ||
114 | 108 | |||
115 | 109 | |||
116 | 110 | // Ok button... | ||
117 | 111 | |||
118 | 112 | Gtk.Button button = new Gtk.Button (Gtk.Stock.Close); | ||
119 | 113 | button.CanDefault = true; | ||
120 | 114 | button.Show (); | ||
121 | 115 | |||
122 | 116 | Gtk.AccelGroup accel_group = new Gtk.AccelGroup (); | ||
123 | 117 | AddAccelGroup (accel_group); | ||
124 | 118 | |||
125 | 119 | button.AddAccelerator ("activate", | ||
126 | 120 | accel_group, | ||
127 | 121 | (uint) Gdk.Key.Escape, | ||
128 | 122 | 0, | ||
129 | 123 | 0); | ||
130 | 124 | |||
131 | 125 | AddActionWidget (button, Gtk.ResponseType.Close); | ||
132 | 126 | DefaultResponse = Gtk.ResponseType.Close; | ||
133 | 127 | |||
134 | 128 | Preferences.SettingChanged += HandlePreferencesSettingChanged; | ||
135 | 129 | } | ||
136 | 130 | |||
137 | 131 | void HandlePreferencesSettingChanged (object sender, NotifyEventArgs args) | ||
138 | 132 | { | ||
139 | 133 | if (args.Key == Preferences.NOTE_RENAME_BEHAVIOR) { | ||
140 | 134 | int rename_behavior = (int) args.Value; | ||
141 | 135 | if (rename_behavior < 0 || rename_behavior > 2) { | ||
142 | 136 | rename_behavior = 0; | ||
143 | 137 | Preferences.Set (Preferences.NOTE_RENAME_BEHAVIOR, rename_behavior); | ||
144 | 138 | } | ||
145 | 139 | if (rename_behavior_combo.Active != rename_behavior) | ||
146 | 140 | rename_behavior_combo.Active = rename_behavior; | ||
147 | 141 | } else if (args.Key == Preferences.SYNC_AUTOSYNC_TIMEOUT) { | ||
148 | 142 | int timeout = (int) args.Value; | ||
149 | 143 | if (timeout <= 0 && autosyncCheck.Active) | ||
150 | 144 | autosyncCheck.Active = false; | ||
151 | 145 | else if (timeout > 0) { | ||
152 | 146 | timeout = (timeout >= 5 && timeout < 1000) ? timeout : 5; | ||
153 | 147 | if (!autosyncCheck.Active) | ||
154 | 148 | autosyncCheck.Active = true; | ||
155 | 149 | if ((int) autosyncSpinner.Value != timeout) | ||
156 | 150 | autosyncSpinner.Value = timeout; | ||
157 | 151 | } | ||
158 | 152 | } | ||
159 | 153 | } | ||
160 | 154 | |||
161 | 155 | // Page 1 | ||
162 | 156 | // List of editing options | ||
163 | 157 | public Gtk.Widget MakeEditingPane () | ||
164 | 158 | { | ||
165 | 159 | Gtk.Label label; | ||
166 | 160 | Gtk.CheckButton check; | ||
167 | 161 | Gtk.Alignment align; | ||
168 | 162 | IPropertyEditorBool peditor, font_peditor, bullet_peditor; | ||
169 | 163 | |||
170 | 164 | Gtk.VBox options_list = new Gtk.VBox (false, 12); | ||
171 | 165 | options_list.BorderWidth = 12; | ||
172 | 166 | options_list.Show (); | ||
173 | 167 | |||
174 | 168 | |||
175 | 169 | // Spell checking... | ||
176 | 170 | |||
177 | 171 | #if FIXED_GTKSPELL | ||
178 | 172 | if (NoteSpellChecker.GtkSpellAvailable) { | ||
179 | 173 | check = MakeCheckButton ( | ||
180 | 174 | Catalog.GetString ("_Spell check while typing")); | ||
181 | 175 | options_list.PackStart (check, false, false, 0); | ||
182 | 176 | |||
183 | 177 | peditor = Services.Factory.CreatePropertyEditorToggleButton ( | ||
184 | 178 | Preferences.ENABLE_SPELLCHECKING, | ||
185 | 179 | check); | ||
186 | 180 | SetupPropertyEditor (peditor); | ||
187 | 181 | |||
188 | 182 | label = MakeTipLabel ( | ||
189 | 183 | Catalog.GetString ("Misspellings will be underlined " + | ||
190 | 184 | "in red, with correct spelling " + | ||
191 | 185 | "suggestions shown in the context " + | ||
192 | 186 | "menu.")); | ||
193 | 187 | options_list.PackStart (label, false, false, 0); | ||
194 | 188 | } | ||
195 | 189 | #endif | ||
196 | 190 | |||
197 | 191 | |||
198 | 192 | // WikiWords... | ||
199 | 193 | |||
200 | 194 | check = MakeCheckButton (Catalog.GetString ("Highlight _WikiWords")); | ||
201 | 195 | options_list.PackStart (check, false, false, 0); | ||
202 | 196 | |||
203 | 197 | peditor = Services.Factory.CreatePropertyEditorToggleButton (Preferences.ENABLE_WIKIWORDS, | ||
204 | 198 | check); | ||
205 | 199 | SetupPropertyEditor (peditor); | ||
206 | 200 | |||
207 | 201 | label = MakeTipLabel ( | ||
208 | 202 | Catalog.GetString ("Enable this option to highlight " + | ||
209 | 203 | "words <b>ThatLookLikeThis</b>. " + | ||
210 | 204 | "Clicking the word will create a " + | ||
211 | 205 | "note with that name.")); | ||
212 | 206 | options_list.PackStart (label, false, false, 0); | ||
213 | 207 | |||
214 | 208 | // Auto bulleted list | ||
215 | 209 | check = MakeCheckButton (Catalog.GetString ("Enable auto-_bulleted lists")); | ||
216 | 210 | options_list.PackStart (check, false, false, 0); | ||
217 | 211 | bullet_peditor = | ||
218 | 212 | Services.Factory.CreatePropertyEditorToggleButton (Preferences.ENABLE_AUTO_BULLETED_LISTS, | ||
219 | 213 | check); | ||
220 | 214 | SetupPropertyEditor (bullet_peditor); | ||
221 | 215 | |||
222 | 216 | // Custom font... | ||
223 | 217 | Gtk.HBox font_box = new Gtk.HBox (false, 0); | ||
224 | 218 | check = MakeCheckButton (Catalog.GetString ("Use custom _font")); | ||
225 | 219 | font_box.PackStart (check); | ||
226 | 220 | |||
227 | 221 | font_peditor = | ||
228 | 222 | Services.Factory.CreatePropertyEditorToggleButton (Preferences.ENABLE_CUSTOM_FONT, | ||
229 | 223 | check); | ||
230 | 224 | SetupPropertyEditor (font_peditor); | ||
231 | 225 | |||
232 | 226 | font_button = MakeFontButton (); | ||
233 | 227 | font_button.Sensitive = check.Active; | ||
234 | 228 | font_box.PackStart (font_button); | ||
235 | 229 | font_box.ShowAll (); | ||
236 | 230 | options_list.PackStart (font_box, false, false, 0); | ||
237 | 231 | |||
238 | 232 | font_peditor.AddGuard (font_button); | ||
239 | 233 | |||
240 | 234 | // Note renaming bahvior | ||
241 | 235 | Gtk.HBox rename_behavior_box = new Gtk.HBox (false, 0); | ||
242 | 236 | label = MakeLabel (Catalog.GetString ("When renaming a linked note: ")); | ||
243 | 237 | rename_behavior_box.PackStart (label); | ||
244 | 238 | rename_behavior_combo = new Gtk.ComboBox (new string [] { | ||
245 | 239 | Catalog.GetString ("Ask me what to do"), | ||
246 | 240 | Catalog.GetString ("Never rename links"), | ||
247 | 241 | Catalog.GetString ("Always rename links")}); | ||
248 | 242 | int rename_behavior = (int) Preferences.Get (Preferences.NOTE_RENAME_BEHAVIOR); | ||
249 | 243 | if (rename_behavior < 0 || rename_behavior > 2) { | ||
250 | 244 | rename_behavior = 0; | ||
251 | 245 | Preferences.Set (Preferences.NOTE_RENAME_BEHAVIOR, rename_behavior); | ||
252 | 246 | } | ||
253 | 247 | rename_behavior_combo.Active = rename_behavior; | ||
254 | 248 | rename_behavior_combo.Changed += (o, e) => | ||
255 | 249 | Preferences.Set (Preferences.NOTE_RENAME_BEHAVIOR, | ||
256 | 250 | rename_behavior_combo.Active); | ||
257 | 251 | rename_behavior_box.PackStart (rename_behavior_combo); | ||
258 | 252 | rename_behavior_box.ShowAll (); | ||
259 | 253 | options_list.PackStart (rename_behavior_box, false, false, 0); | ||
260 | 254 | |||
261 | 255 | // New Note Template | ||
262 | 256 | // Translators: This is 'New Note' Template, not New 'Note Template' | ||
263 | 257 | label = MakeLabel (Catalog.GetString ("New Note Template")); | ||
264 | 258 | options_list.PackStart (label, false, false, 0); | ||
265 | 259 | |||
266 | 260 | label = MakeTipLabel ( | ||
267 | 261 | Catalog.GetString ("Use the new note template to specify the text " + | ||
268 | 262 | "that should be used when creating a new note.")); | ||
269 | 263 | options_list.PackStart (label, false, false, 0); | ||
270 | 264 | |||
271 | 265 | align = new Gtk.Alignment (0.5f, 0.5f, 0.4f, 1.0f); | ||
272 | 266 | align.Show (); | ||
273 | 267 | options_list.PackStart (align, false, false, 0); | ||
274 | 268 | |||
275 | 269 | Gtk.Button open_template_button = new Gtk.Button (); | ||
276 | 270 | open_template_button.Label = Catalog.GetString ("Open New Note Template"); | ||
277 | 271 | |||
278 | 272 | open_template_button.Clicked += OpenTemplateButtonClicked; | ||
279 | 273 | open_template_button.Show (); | ||
280 | 274 | align.Add (open_template_button); | ||
281 | 275 | |||
282 | 276 | return options_list; | ||
283 | 277 | } | ||
284 | 278 | |||
285 | 279 | Gtk.Button MakeFontButton () | ||
286 | 280 | { | ||
287 | 281 | Gtk.HBox font_box = new Gtk.HBox (false, 0); | ||
288 | 282 | font_box.Show (); | ||
289 | 283 | |||
290 | 284 | font_face = new Gtk.Label (null); | ||
291 | 285 | font_face.UseMarkup = true; | ||
292 | 286 | font_face.Show (); | ||
293 | 287 | font_box.PackStart (font_face, true, true, 0); | ||
294 | 288 | |||
295 | 289 | Gtk.VSeparator sep = new Gtk.VSeparator (); | ||
296 | 290 | sep.Show (); | ||
297 | 291 | font_box.PackStart (sep, false, false, 0); | ||
298 | 292 | |||
299 | 293 | font_size = new Gtk.Label (null); | ||
300 | 294 | font_size.Xpad = 4; | ||
301 | 295 | font_size.Show (); | ||
302 | 296 | font_box.PackStart (font_size, false, false, 0); | ||
303 | 297 | |||
304 | 298 | Gtk.Button button = new Gtk.Button (); | ||
305 | 299 | button.Clicked += OnFontButtonClicked; | ||
306 | 300 | button.Add (font_box); | ||
307 | 301 | button.Show (); | ||
308 | 302 | |||
309 | 303 | string font_desc = (string) Preferences.Get (Preferences.CUSTOM_FONT_FACE); | ||
310 | 304 | UpdateFontButton (font_desc); | ||
311 | 305 | |||
312 | 306 | return button; | ||
313 | 307 | } | ||
314 | 308 | |||
315 | 309 | // Page 2 | ||
316 | 310 | // List of Hotkey options | ||
317 | 311 | public Gtk.Widget MakeHotkeysPane () | ||
318 | 312 | { | ||
319 | 313 | Gtk.Label label; | ||
320 | 314 | Gtk.CheckButton check; | ||
321 | 315 | Gtk.Alignment align; | ||
322 | 316 | Gtk.Entry entry; | ||
323 | 317 | IPropertyEditorBool keybind_peditor; | ||
324 | 318 | IPropertyEditor peditor; | ||
325 | 319 | |||
326 | 320 | Gtk.VBox hotkeys_list = new Gtk.VBox (false, 12); | ||
327 | 321 | hotkeys_list.BorderWidth = 12; | ||
328 | 322 | hotkeys_list.Show (); | ||
329 | 323 | |||
330 | 324 | |||
331 | 325 | // Hotkeys... | ||
332 | 326 | |||
333 | 327 | check = MakeCheckButton (Catalog.GetString ("Listen for _Hotkeys")); | ||
334 | 328 | hotkeys_list.PackStart (check, false, false, 0); | ||
335 | 329 | |||
336 | 330 | keybind_peditor = | ||
337 | 331 | Services.Factory.CreatePropertyEditorToggleButton (Preferences.ENABLE_KEYBINDINGS, | ||
338 | 332 | check); | ||
339 | 333 | SetupPropertyEditor (keybind_peditor); | ||
340 | 334 | |||
341 | 335 | label = MakeTipLabel ( | ||
342 | 336 | Catalog.GetString ("Hotkeys allow you to quickly access " + | ||
343 | 337 | "your notes from anywhere with a keypress. " + | ||
344 | 338 | "Example Hotkeys: " + | ||
345 | 339 | "<b><Control><Shift>F11</b>, " + | ||
346 | 340 | "<b><Alt>N</b>")); | ||
347 | 341 | hotkeys_list.PackStart (label, false, false, 0); | ||
348 | 342 | |||
349 | 343 | align = new Gtk.Alignment (0.5f, 0.5f, 0.0f, 1.0f); | ||
350 | 344 | align.Show (); | ||
351 | 345 | hotkeys_list.PackStart (align, false, false, 0); | ||
352 | 346 | |||
353 | 347 | Gtk.Table table = new Gtk.Table (4, 2, false); | ||
354 | 348 | table.ColumnSpacing = 6; | ||
355 | 349 | table.RowSpacing = 6; | ||
356 | 350 | table.Show (); | ||
357 | 351 | align.Add (table); | ||
358 | 352 | |||
359 | 353 | |||
360 | 354 | // Show notes menu keybinding... | ||
361 | 355 | |||
362 | 356 | label = MakeLabel (Catalog.GetString ("Show notes _menu")); | ||
363 | 357 | table.Attach (label, 0, 1, 0, 1); | ||
364 | 358 | |||
365 | 359 | entry = new Gtk.Entry (); | ||
366 | 360 | label.MnemonicWidget = entry; | ||
367 | 361 | entry.Show (); | ||
368 | 362 | table.Attach (entry, 1, 2, 0, 1); | ||
369 | 363 | |||
370 | 364 | peditor = Services.Factory.CreatePropertyEditorEntry (Preferences.KEYBINDING_SHOW_NOTE_MENU, | ||
371 | 365 | entry); | ||
372 | 366 | SetupPropertyEditor (peditor); | ||
373 | 367 | |||
374 | 368 | keybind_peditor.AddGuard (entry); | ||
375 | 369 | |||
376 | 370 | |||
377 | 371 | // Open Start Here keybinding... | ||
378 | 372 | |||
379 | 373 | label = MakeLabel (Catalog.GetString ("Open \"_Start Here\"")); | ||
380 | 374 | table.Attach (label, 0, 1, 1, 2); | ||
381 | 375 | |||
382 | 376 | entry = new Gtk.Entry (); | ||
383 | 377 | label.MnemonicWidget = entry; | ||
384 | 378 | entry.Show (); | ||
385 | 379 | table.Attach (entry, 1, 2, 1, 2); | ||
386 | 380 | |||
387 | 381 | peditor = Services.Factory.CreatePropertyEditorEntry (Preferences.KEYBINDING_OPEN_START_HERE, | ||
388 | 382 | entry); | ||
389 | 383 | SetupPropertyEditor (peditor); | ||
390 | 384 | |||
391 | 385 | keybind_peditor.AddGuard (entry); | ||
392 | 386 | |||
393 | 387 | |||
394 | 388 | // Create new note keybinding... | ||
395 | 389 | |||
396 | 390 | label = MakeLabel (Catalog.GetString ("Create _new note")); | ||
397 | 391 | table.Attach (label, 0, 1, 2, 3); | ||
398 | 392 | |||
399 | 393 | entry = new Gtk.Entry (); | ||
400 | 394 | label.MnemonicWidget = entry; | ||
401 | 395 | entry.Show (); | ||
402 | 396 | table.Attach (entry, 1, 2, 2, 3); | ||
403 | 397 | |||
404 | 398 | peditor = Services.Factory.CreatePropertyEditorEntry (Preferences.KEYBINDING_CREATE_NEW_NOTE, | ||
405 | 399 | entry); | ||
406 | 400 | SetupPropertyEditor (peditor); | ||
407 | 401 | |||
408 | 402 | keybind_peditor.AddGuard (entry); | ||
409 | 403 | |||
410 | 404 | |||
411 | 405 | // Open Search All Notes window keybinding... | ||
412 | 406 | |||
413 | 407 | label = MakeLabel (Catalog.GetString ("Open \"Search _All Notes\"")); | ||
414 | 408 | table.Attach (label, 0, 1, 3, 4); | ||
415 | 409 | |||
416 | 410 | entry = new Gtk.Entry (); | ||
417 | 411 | label.MnemonicWidget = entry; | ||
418 | 412 | entry.Show (); | ||
419 | 413 | table.Attach (entry, 1, 2, 3, 4); | ||
420 | 414 | |||
421 | 415 | peditor = Services.Factory.CreatePropertyEditorEntry ( | ||
422 | 416 | Preferences.KEYBINDING_OPEN_RECENT_CHANGES, | ||
423 | 417 | entry); | ||
424 | 418 | SetupPropertyEditor (peditor); | ||
425 | 419 | |||
426 | 420 | keybind_peditor.AddGuard (entry); | ||
427 | 421 | |||
428 | 422 | |||
429 | 423 | return hotkeys_list; | ||
430 | 424 | } | ||
431 | 425 | |||
432 | 426 | public Gtk.Widget MakeSyncPane () | ||
433 | 427 | { | ||
434 | 428 | Gtk.VBox vbox = new Gtk.VBox (false, 0); | ||
435 | 429 | vbox.Spacing = 4; | ||
436 | 430 | vbox.BorderWidth = 8; | ||
437 | 431 | |||
438 | 432 | Gtk.HBox hbox = new Gtk.HBox (false, 4); | ||
439 | 433 | |||
440 | 434 | Gtk.Label label = new Gtk.Label (Catalog.GetString ("Ser_vice:")); | ||
441 | 435 | label.Xalign = 0; | ||
442 | 436 | label.Show (); | ||
443 | 437 | hbox.PackStart (label, false, false, 0); | ||
444 | 438 | |||
445 | 439 | // Populate the store with all the available SyncServiceAddins | ||
446 | 440 | syncAddinStore = new Gtk.ListStore (typeof (SyncServiceAddin)); | ||
447 | 441 | syncAddinIters = new Dictionary<string,Gtk.TreeIter> (); | ||
448 | 442 | SyncServiceAddin [] addins = Tomboy.DefaultNoteManager.AddinManager.GetSyncServiceAddins (); | ||
449 | 443 | Array.Sort (addins, CompareSyncAddinsByName); | ||
450 | 444 | foreach (SyncServiceAddin addin in addins) { | ||
451 | 445 | Gtk.TreeIter iter = syncAddinStore.Append (); | ||
452 | 446 | syncAddinStore.SetValue (iter, 0, addin); | ||
453 | 447 | syncAddinIters [addin.Id] = iter; | ||
454 | 448 | } | ||
455 | 449 | |||
456 | 450 | syncAddinCombo = new Gtk.ComboBox (syncAddinStore); | ||
457 | 451 | label.MnemonicWidget = syncAddinCombo; | ||
458 | 452 | Gtk.CellRendererText crt = new Gtk.CellRendererText (); | ||
459 | 453 | syncAddinCombo.PackStart (crt, true); | ||
460 | 454 | syncAddinCombo.SetCellDataFunc (crt, | ||
461 | 455 | new Gtk.CellLayoutDataFunc (ComboBoxTextDataFunc)); | ||
462 | 456 | |||
463 | 457 | // Read from Preferences which service is configured and select it | ||
464 | 458 | // by default. Otherwise, just select the first one in the list. | ||
465 | 459 | string addin_id = Preferences.Get ( | ||
466 | 460 | Preferences.SYNC_SELECTED_SERVICE_ADDIN) as String; | ||
467 | 461 | |||
468 | 462 | Gtk.TreeIter active_iter; | ||
469 | 463 | if (addin_id != null && syncAddinIters.ContainsKey (addin_id)) { | ||
470 | 464 | active_iter = syncAddinIters [addin_id]; | ||
471 | 465 | syncAddinCombo.SetActiveIter (active_iter); | ||
472 | 466 | } else { | ||
473 | 467 | if (syncAddinStore.GetIterFirst (out active_iter) == true) { | ||
474 | 468 | syncAddinCombo.SetActiveIter (active_iter); | ||
475 | 469 | } | ||
476 | 470 | } | ||
477 | 471 | |||
478 | 472 | syncAddinCombo.Changed += OnSyncAddinComboChanged; | ||
479 | 473 | |||
480 | 474 | syncAddinCombo.Show (); | ||
481 | 475 | hbox.PackStart (syncAddinCombo, true, true, 0); | ||
482 | 476 | |||
483 | 477 | hbox.Show (); | ||
484 | 478 | vbox.PackStart (hbox, false, false, 0); | ||
485 | 479 | |||
486 | 480 | // Get the preferences GUI for the Sync Addin | ||
487 | 481 | if (active_iter.Stamp != Gtk.TreeIter.Zero.Stamp) | ||
488 | 482 | selectedSyncAddin = syncAddinStore.GetValue (active_iter, 0) as SyncServiceAddin; | ||
489 | 483 | |||
490 | 484 | if (selectedSyncAddin != null) | ||
491 | 485 | syncAddinPrefsWidget = selectedSyncAddin.CreatePreferencesControl (OnSyncAddinPrefsChanged); | ||
492 | 486 | if (syncAddinPrefsWidget == null) { | ||
493 | 487 | Gtk.Label l = new Gtk.Label (Catalog.GetString ("Not configurable")); | ||
494 | 488 | l.Yalign = 0.5f; | ||
495 | 489 | l.Yalign = 0.5f; | ||
496 | 490 | syncAddinPrefsWidget = l; | ||
497 | 491 | } | ||
498 | 492 | if (syncAddinPrefsWidget != null && addin_id != null && | ||
499 | 493 | syncAddinIters.ContainsKey (addin_id) && selectedSyncAddin.IsConfigured) | ||
500 | 494 | syncAddinPrefsWidget.Sensitive = false; | ||
501 | 495 | |||
502 | 496 | syncAddinPrefsWidget.Show (); | ||
503 | 497 | syncAddinPrefsContainer = new Gtk.VBox (false, 0); | ||
504 | 498 | syncAddinPrefsContainer.PackStart (syncAddinPrefsWidget, false, false, 0); | ||
505 | 499 | syncAddinPrefsContainer.Show (); | ||
506 | 500 | vbox.PackStart (syncAddinPrefsContainer, true, true, 10); | ||
507 | 501 | |||
508 | 502 | // Autosync preference | ||
509 | 503 | int timeout = (int) Preferences.Get (Preferences.SYNC_AUTOSYNC_TIMEOUT); | ||
510 | 504 | if (timeout > 0 && timeout < 5) { | ||
511 | 505 | timeout = 5; | ||
512 | 506 | Preferences.Set (Preferences.SYNC_AUTOSYNC_TIMEOUT, 5); | ||
513 | 507 | } | ||
514 | 508 | Gtk.HBox autosyncBox = new Gtk.HBox (false, 5); | ||
515 | 509 | // Translators: This is and the next string go together. | ||
516 | 510 | // Together they look like "Automatically Sync in Background Every [_] Minutes", | ||
517 | 511 | // where "[_]" is a GtkSpinButton. | ||
518 | 512 | autosyncCheck = | ||
519 | 513 | new Gtk.CheckButton (Catalog.GetString ("Automaticall_y Sync in Background Every")); | ||
520 | 514 | autosyncSpinner = new Gtk.SpinButton (5, 1000, 1); | ||
521 | 515 | autosyncSpinner.Value = timeout >= 5 ? timeout : 10; | ||
522 | 516 | Gtk.Label autosyncExtraText = | ||
523 | 517 | // Translators: See above comment for details on | ||
524 | 518 | // this string. | ||
525 | 519 | new Gtk.Label (Catalog.GetString ("Minutes")); | ||
526 | 520 | autosyncCheck.Active = autosyncSpinner.Sensitive = timeout >= 5; | ||
527 | 521 | EventHandler updateTimeoutPref = (o, e) => { | ||
528 | 522 | Preferences.Set (Preferences.SYNC_AUTOSYNC_TIMEOUT, | ||
529 | 523 | autosyncCheck.Active ? (int) autosyncSpinner.Value : -1); | ||
530 | 524 | }; | ||
531 | 525 | autosyncCheck.Toggled += (o, e) => { | ||
532 | 526 | autosyncSpinner.Sensitive = autosyncCheck.Active; | ||
533 | 527 | updateTimeoutPref (o, e); | ||
534 | 528 | }; | ||
535 | 529 | autosyncSpinner.ValueChanged += updateTimeoutPref; | ||
536 | 530 | |||
537 | 531 | autosyncBox.PackStart (autosyncCheck); | ||
538 | 532 | autosyncBox.PackStart (autosyncSpinner); | ||
539 | 533 | autosyncBox.PackStart (autosyncExtraText); | ||
540 | 534 | vbox.PackStart (autosyncBox, false, true, 0); | ||
541 | 535 | |||
542 | 536 | Gtk.HButtonBox bbox = new Gtk.HButtonBox (); | ||
543 | 537 | bbox.Spacing = 4; | ||
544 | 538 | bbox.LayoutStyle = Gtk.ButtonBoxStyle.End; | ||
545 | 539 | |||
546 | 540 | // "Advanced..." button to bring up extra sync config dialog | ||
547 | 541 | Gtk.Button advancedConfigButton = new Gtk.Button (Catalog.GetString ("_Advanced...")); | ||
548 | 542 | advancedConfigButton.Clicked += OnAdvancedSyncConfigButton; | ||
549 | 543 | advancedConfigButton.Show (); | ||
550 | 544 | bbox.PackStart (advancedConfigButton, false, false, 0); | ||
551 | 545 | bbox.SetChildSecondary (advancedConfigButton, true); | ||
552 | 546 | |||
553 | 547 | resetSyncAddinButton = new Gtk.Button (Gtk.Stock.Clear); | ||
554 | 548 | resetSyncAddinButton.Clicked += OnResetSyncAddinButton; | ||
555 | 549 | resetSyncAddinButton.Sensitive = | ||
556 | 550 | (selectedSyncAddin != null && | ||
557 | 551 | addin_id == selectedSyncAddin.Id && | ||
558 | 552 | selectedSyncAddin.IsConfigured); | ||
559 | 553 | resetSyncAddinButton.Show (); | ||
560 | 554 | bbox.PackStart (resetSyncAddinButton, false, false, 0); | ||
561 | 555 | |||
562 | 556 | // TODO: Tabbing should go directly from sync prefs widget to here | ||
563 | 557 | // TODO: Consider connecting to "Enter" pressed in sync prefs widget | ||
564 | 558 | saveSyncAddinButton = new Gtk.Button (Gtk.Stock.Save); | ||
565 | 559 | saveSyncAddinButton.Clicked += OnSaveSyncAddinButton; | ||
566 | 560 | saveSyncAddinButton.Sensitive = | ||
567 | 561 | (selectedSyncAddin != null && | ||
568 | 562 | (addin_id != selectedSyncAddin.Id || !selectedSyncAddin.IsConfigured)); | ||
569 | 563 | saveSyncAddinButton.Show (); | ||
570 | 564 | bbox.PackStart (saveSyncAddinButton, false, false, 0); | ||
571 | 565 | |||
572 | 566 | syncAddinCombo.Sensitive = | ||
573 | 567 | (selectedSyncAddin == null || | ||
574 | 568 | addin_id != selectedSyncAddin.Id || | ||
575 | 569 | !selectedSyncAddin.IsConfigured); | ||
576 | 570 | |||
577 | 571 | bbox.Show (); | ||
578 | 572 | vbox.PackStart (bbox, false, false, 0); | ||
579 | 573 | |||
580 | 574 | vbox.ShowAll (); | ||
581 | 575 | return vbox; | ||
582 | 576 | } | ||
583 | 577 | |||
584 | 578 | private int CompareSyncAddinsByName (SyncServiceAddin addin1, SyncServiceAddin addin2) | ||
585 | 579 | { | ||
586 | 580 | return addin1.Name.CompareTo (addin2.Name); | ||
587 | 581 | } | ||
588 | 582 | |||
589 | 583 | private void ComboBoxTextDataFunc (Gtk.CellLayout cell_layout, Gtk.CellRenderer cell, | ||
590 | 584 | Gtk.TreeModel tree_model, Gtk.TreeIter iter) | ||
591 | 585 | { | ||
592 | 586 | Gtk.CellRendererText crt = cell as Gtk.CellRendererText; | ||
593 | 587 | SyncServiceAddin addin = tree_model.GetValue (iter, 0) as SyncServiceAddin; | ||
594 | 588 | if (addin == null) { | ||
595 | 589 | crt.Text = string.Empty; | ||
596 | 590 | } else { | ||
597 | 591 | crt.Text = addin.Name; | ||
598 | 592 | } | ||
599 | 593 | } | ||
600 | 594 | |||
601 | 595 | // Page 3 | ||
602 | 596 | // Extension Preferences | ||
603 | 597 | public Gtk.Widget MakeAddinsPane () | ||
604 | 598 | { | ||
605 | 599 | Gtk.VBox vbox = new Gtk.VBox (false, 6); | ||
606 | 600 | vbox.BorderWidth = 6; | ||
607 | 601 | Gtk.Label l = new Gtk.Label (Catalog.GetString ( | ||
608 | 602 | "The following add-ins are installed")); | ||
609 | 603 | l.Xalign = 0; | ||
610 | 604 | l.Show (); | ||
611 | 605 | vbox.PackStart (l, false, false, 0); | ||
612 | 606 | |||
613 | 607 | Gtk.HBox hbox = new Gtk.HBox (false, 6); | ||
614 | 608 | |||
615 | 609 | // TreeView of Add-ins | ||
616 | 610 | Gtk.TreeView tree = new Gtk.TreeView (); | ||
617 | 611 | addin_tree = new Mono.Addins.Gui.AddinTreeWidget (tree); | ||
618 | 612 | |||
619 | 613 | tree.Show (); | ||
620 | 614 | |||
621 | 615 | Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow (); | ||
622 | 616 | sw.HscrollbarPolicy = Gtk.PolicyType.Automatic; | ||
623 | 617 | sw.VscrollbarPolicy = Gtk.PolicyType.Automatic; | ||
624 | 618 | sw.ShadowType = Gtk.ShadowType.In; | ||
625 | 619 | sw.Add (tree); | ||
626 | 620 | sw.Show (); | ||
627 | 621 | Gtk.LinkButton get_more_link = | ||
628 | 622 | new Gtk.LinkButton ("http://live.gnome.org/Tomboy/PluginList", | ||
629 | 623 | Catalog.GetString ("Get More Add-Ins...")); | ||
630 | 624 | get_more_link.Show (); | ||
631 | 625 | Gtk.VBox tree_box = new Gtk.VBox (false, 0); | ||
632 | 626 | tree_box.Add (sw); | ||
633 | 627 | tree_box.PackEnd (get_more_link, false, false, 5); | ||
634 | 628 | tree_box.Show (); | ||
635 | 629 | hbox.PackStart (tree_box, true, true, 0); | ||
636 | 630 | |||
637 | 631 | // Action Buttons (right of TreeView) | ||
638 | 632 | Gtk.VButtonBox button_box = new Gtk.VButtonBox (); | ||
639 | 633 | button_box.Spacing = 4; | ||
640 | 634 | button_box.Layout = Gtk.ButtonBoxStyle.Start; | ||
641 | 635 | |||
642 | 636 | // TODO: In a future version, add in an "Install Add-ins..." button | ||
643 | 637 | |||
644 | 638 | // TODO: In a future version, add in a "Repositories..." button | ||
645 | 639 | |||
646 | 640 | enable_addin_button = | ||
647 | 641 | new Gtk.Button (Catalog.GetString ("_Enable")); | ||
648 | 642 | enable_addin_button.Sensitive = false; | ||
649 | 643 | enable_addin_button.Clicked += OnEnableAddinButton; | ||
650 | 644 | enable_addin_button.Show (); | ||
651 | 645 | |||
652 | 646 | disable_addin_button = | ||
653 | 647 | new Gtk.Button (Catalog.GetString ("_Disable")); | ||
654 | 648 | disable_addin_button.Sensitive = false; | ||
655 | 649 | disable_addin_button.Clicked += OnDisableAddinButton; | ||
656 | 650 | disable_addin_button.Show (); | ||
657 | 651 | |||
658 | 652 | addin_prefs_button = | ||
659 | 653 | new Gtk.Button (Gtk.Stock.Preferences); | ||
660 | 654 | addin_prefs_button.Sensitive = false; | ||
661 | 655 | addin_prefs_button.Clicked += OnAddinPrefsButton; | ||
662 | 656 | addin_prefs_button.Show (); | ||
663 | 657 | |||
664 | 658 | addin_info_button = | ||
665 | 659 | new Gtk.Button (Gtk.Stock.Info); | ||
666 | 660 | addin_info_button.Sensitive = false; | ||
667 | 661 | addin_info_button.Clicked += OnAddinInfoButton; | ||
668 | 662 | addin_info_button.Show (); | ||
669 | 663 | |||
670 | 664 | button_box.PackStart (enable_addin_button); | ||
671 | 665 | button_box.PackStart (disable_addin_button); | ||
672 | 666 | button_box.PackStart (addin_prefs_button); | ||
673 | 667 | button_box.PackStart (addin_info_button); | ||
674 | 668 | |||
675 | 669 | button_box.Show (); | ||
676 | 670 | hbox.PackStart (button_box, false, false, 0); | ||
677 | 671 | |||
678 | 672 | hbox.Show (); | ||
679 | 673 | vbox.PackStart (hbox, true, true, 0); | ||
680 | 674 | vbox.Show (); | ||
681 | 675 | |||
682 | 676 | tree.Selection.Changed += OnAddinTreeSelectionChanged; | ||
683 | 677 | LoadAddins (); | ||
684 | 678 | |||
685 | 679 | return vbox; | ||
686 | 680 | } | ||
687 | 681 | |||
688 | 682 | void OnAddinTreeSelectionChanged (object sender, EventArgs args) | ||
689 | 683 | { | ||
690 | 684 | UpdateAddinButtons (); | ||
691 | 685 | } | ||
692 | 686 | |||
693 | 687 | /// <summary> | ||
694 | 688 | /// Set the sensitivity of the buttons based on what is selected | ||
695 | 689 | /// </summary> | ||
696 | 690 | void UpdateAddinButtons () | ||
697 | 691 | { | ||
698 | 692 | Mono.Addins.Addin sinfo = | ||
699 | 693 | addin_tree.ActiveAddinData as Mono.Addins.Addin; | ||
700 | 694 | |||
701 | 695 | if (sinfo == null) { | ||
702 | 696 | enable_addin_button.Sensitive = false; | ||
703 | 697 | disable_addin_button.Sensitive = false; | ||
704 | 698 | addin_prefs_button.Sensitive = false; | ||
705 | 699 | addin_info_button.Sensitive = false; | ||
706 | 700 | } else { | ||
707 | 701 | enable_addin_button.Sensitive = !sinfo.Enabled; | ||
708 | 702 | disable_addin_button.Sensitive = sinfo.Enabled; | ||
709 | 703 | addin_prefs_button.Sensitive = addin_manager.IsAddinConfigurable (sinfo); | ||
710 | 704 | addin_info_button.Sensitive = true; | ||
711 | 705 | } | ||
712 | 706 | } | ||
713 | 707 | |||
714 | 708 | void LoadAddins () | ||
715 | 709 | { | ||
716 | 710 | object s = addin_tree.SaveStatus (); | ||
717 | 711 | |||
718 | 712 | addin_tree.Clear (); | ||
719 | 713 | foreach (Mono.Addins.Addin ainfo in addin_manager.GetAllAddins ()) { | ||
720 | 714 | addin_tree.AddAddin ( | ||
721 | 715 | Mono.Addins.Setup.SetupService.GetAddinHeader (ainfo), | ||
722 | 716 | ainfo, | ||
723 | 717 | ainfo.Enabled, | ||
724 | 718 | ainfo.IsUserAddin); | ||
725 | 719 | } | ||
726 | 720 | |||
727 | 721 | addin_tree.RestoreStatus (s); | ||
728 | 722 | UpdateAddinButtons (); | ||
729 | 723 | } | ||
730 | 724 | |||
731 | 725 | void OnEnableAddinButton (object sender, EventArgs args) | ||
732 | 726 | { | ||
733 | 727 | Mono.Addins.Addin sinfo = | ||
734 | 728 | addin_tree.ActiveAddinData as Mono.Addins.Addin; | ||
735 | 729 | |||
736 | 730 | if (sinfo == null) | ||
737 | 731 | return; | ||
738 | 732 | |||
739 | 733 | EnableAddin (sinfo, true); | ||
740 | 734 | } | ||
741 | 735 | |||
742 | 736 | void OnDisableAddinButton (object sender, EventArgs args) | ||
743 | 737 | { | ||
744 | 738 | Mono.Addins.Addin sinfo = | ||
745 | 739 | addin_tree.ActiveAddinData as Mono.Addins.Addin; | ||
746 | 740 | |||
747 | 741 | if (sinfo == null) | ||
748 | 742 | return; | ||
749 | 743 | |||
750 | 744 | EnableAddin (sinfo, false); | ||
751 | 745 | } | ||
752 | 746 | |||
753 | 747 | void EnableAddin (Mono.Addins.Addin addin, bool enable) | ||
754 | 748 | { | ||
755 | 749 | addin.Enabled = enable; | ||
756 | 750 | LoadAddins (); | ||
757 | 751 | } | ||
758 | 752 | |||
759 | 753 | void OnAddinPrefsButton (object sender, EventArgs args) | ||
760 | 754 | { | ||
761 | 755 | Gtk.Dialog dialog = null; | ||
762 | 756 | Mono.Addins.Addin addin = | ||
763 | 757 | addin_tree.ActiveAddinData as Mono.Addins.Addin; | ||
764 | 758 | |||
765 | 759 | if (addin == null) | ||
766 | 760 | return; | ||
767 | 761 | |||
768 | 762 | if (addin_prefs_dialogs.ContainsKey (addin.Id) == false) { | ||
769 | 763 | // A preference dialog isn't open already so create a new one | ||
770 | 764 | Gtk.Image icon = | ||
771 | 765 | new Gtk.Image (Gtk.Stock.Preferences, Gtk.IconSize.Dialog); | ||
772 | 766 | Gtk.Label caption = new Gtk.Label (); | ||
773 | 767 | caption.Markup = string.Format ( | ||
774 | 768 | "<span size='large' weight='bold'>{0} {1}</span>", | ||
775 | 769 | addin.Name, addin.Version); | ||
776 | 770 | caption.Xalign = 0; | ||
777 | 771 | caption.UseMarkup = true; | ||
778 | 772 | caption.UseUnderline = false; | ||
779 | 773 | |||
780 | 774 | Gtk.Widget pref_widget = | ||
781 | 775 | addin_manager.CreateAddinPreferenceWidget (addin); | ||
782 | 776 | |||
783 | 777 | if (pref_widget == null) | ||
784 | 778 | pref_widget = new Gtk.Label (Catalog.GetString ("Not Implemented")); | ||
785 | 779 | |||
786 | 780 | Gtk.HBox hbox = new Gtk.HBox (false, 6); | ||
787 | 781 | Gtk.VBox vbox = new Gtk.VBox (false, 6); | ||
788 | 782 | vbox.BorderWidth = 6; | ||
789 | 783 | |||
790 | 784 | hbox.PackStart (icon, false, false, 0); | ||
791 | 785 | hbox.PackStart (caption, true, true, 0); | ||
792 | 786 | vbox.PackStart (hbox, false, false, 0); | ||
793 | 787 | |||
794 | 788 | vbox.PackStart (pref_widget, true, true, 0); | ||
795 | 789 | vbox.ShowAll (); | ||
796 | 790 | |||
797 | 791 | dialog = new Gtk.Dialog ( | ||
798 | 792 | string.Format (Catalog.GetString ("{0} Preferences"), | ||
799 | 793 | addin.Name), | ||
800 | 794 | this, | ||
801 | 795 | Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.NoSeparator, | ||
802 | 796 | Gtk.Stock.Close, Gtk.ResponseType.Close); | ||
803 | 797 | |||
804 | 798 | dialog.VBox.PackStart (vbox, true, true, 0); | ||
805 | 799 | dialog.DeleteEvent += AddinPrefDialogDeleted; | ||
806 | 800 | dialog.Response += AddinPrefDialogResponse; | ||
807 | 801 | |||
808 | 802 | // Store this dialog off in the dictionary so it can be | ||
809 | 803 | // presented again if the user clicks on the preferences button | ||
810 | 804 | // again before closing the preferences dialog. | ||
811 | 805 | dialog.Data ["AddinId"] = addin.Id; | ||
812 | 806 | addin_prefs_dialogs [addin.Id] = dialog; | ||
813 | 807 | } else { | ||
814 | 808 | // It's already opened so just present it again | ||
815 | 809 | dialog = addin_prefs_dialogs [addin.Id]; | ||
816 | 810 | } | ||
817 | 811 | |||
818 | 812 | dialog.Present (); | ||
819 | 813 | } | ||
820 | 814 | |||
821 | 815 | [GLib.ConnectBeforeAttribute] | ||
822 | 816 | void AddinPrefDialogDeleted (object sender, Gtk.DeleteEventArgs args) | ||
823 | 817 | { | ||
824 | 818 | // Remove the addin from the addin_prefs_dialogs Dictionary | ||
825 | 819 | Gtk.Dialog dialog = sender as Gtk.Dialog; | ||
826 | 820 | dialog.Hide (); | ||
827 | 821 | |||
828 | 822 | if (dialog.Data.ContainsKey ("AddinId")) { | ||
829 | 823 | addin_prefs_dialogs.Remove (dialog.Data ["AddinId"] as String); | ||
830 | 824 | } | ||
831 | 825 | |||
832 | 826 | dialog.Destroy (); | ||
833 | 827 | } | ||
834 | 828 | |||
835 | 829 | void AddinPrefDialogResponse (object sender, Gtk.ResponseArgs args) | ||
836 | 830 | { | ||
837 | 831 | AddinPrefDialogDeleted (sender, null); | ||
838 | 832 | } | ||
839 | 833 | |||
840 | 834 | void OnAddinInfoButton (object sender, EventArgs args) | ||
841 | 835 | { | ||
842 | 836 | Mono.Addins.Addin addin = | ||
843 | 837 | addin_tree.ActiveAddinData as Mono.Addins.Addin; | ||
844 | 838 | |||
845 | 839 | if (addin == null) | ||
846 | 840 | return; | ||
847 | 841 | |||
848 | 842 | Gtk.Dialog dialog = null; | ||
849 | 843 | if (addin_info_dialogs.ContainsKey (addin.Id) == false) { | ||
850 | 844 | dialog = new AddinInfoDialog ( | ||
851 | 845 | Mono.Addins.Setup.SetupService.GetAddinHeader (addin), | ||
852 | 846 | this); | ||
853 | 847 | dialog.DeleteEvent += AddinInfoDialogDeleted; | ||
854 | 848 | dialog.Response += AddinInfoDialogResponse; | ||
855 | 849 | |||
856 | 850 | // Store this dialog off in a dictionary so it can be presented | ||
857 | 851 | // again if the user clicks on the Info button before closing | ||
858 | 852 | // the original dialog. | ||
859 | 853 | dialog.Data ["AddinId"] = addin.Id; | ||
860 | 854 | addin_info_dialogs [addin.Id] = dialog; | ||
861 | 855 | } else { | ||
862 | 856 | // It's already opened so just present it again | ||
863 | 857 | dialog = addin_info_dialogs [addin.Id]; | ||
864 | 858 | } | ||
865 | 859 | |||
866 | 860 | dialog.Present (); | ||
867 | 861 | } | ||
868 | 862 | |||
869 | 863 | [GLib.ConnectBeforeAttribute] | ||
870 | 864 | void AddinInfoDialogDeleted (object sender, Gtk.DeleteEventArgs args) | ||
871 | 865 | { | ||
872 | 866 | // Remove the addin from the addin_prefs_dialogs Dictionary | ||
873 | 867 | Gtk.Dialog dialog = sender as Gtk.Dialog; | ||
874 | 868 | dialog.Hide (); | ||
875 | 869 | |||
876 | 870 | if (dialog.Data.ContainsKey ("AddinId")) { | ||
877 | 871 | addin_info_dialogs.Remove (dialog.Data ["AddinId"] as String); | ||
878 | 872 | } | ||
879 | 873 | |||
880 | 874 | dialog.Destroy (); | ||
881 | 875 | } | ||
882 | 876 | |||
883 | 877 | void AddinInfoDialogResponse (object sender, Gtk.ResponseArgs args) | ||
884 | 878 | { | ||
885 | 879 | AddinInfoDialogDeleted (sender, null); | ||
886 | 880 | } | ||
887 | 881 | |||
888 | 882 | void SetupPropertyEditor (IPropertyEditor peditor) | ||
889 | 883 | { | ||
890 | 884 | // Ensure the key exists | ||
891 | 885 | Preferences.Get (peditor.Key); | ||
892 | 886 | peditor.Setup (); | ||
893 | 887 | } | ||
894 | 888 | |||
895 | 889 | // Utilities... | ||
896 | 890 | |||
897 | 891 | static Gtk.Label MakeLabel (string label_text, params object[] args) | ||
898 | 892 | { | ||
899 | 893 | if (args.Length > 0) | ||
900 | 894 | label_text = String.Format (label_text, args); | ||
901 | 895 | |||
902 | 896 | Gtk.Label label = new Gtk.Label (label_text); | ||
903 | 897 | |||
904 | 898 | label.UseMarkup = true; | ||
905 | 899 | label.Justify = Gtk.Justification.Left; | ||
906 | 900 | label.SetAlignment (0.0f, 0.5f); | ||
907 | 901 | label.Show (); | ||
908 | 902 | |||
909 | 903 | return label; | ||
910 | 904 | } | ||
911 | 905 | |||
912 | 906 | static Gtk.CheckButton MakeCheckButton (string label_text) | ||
913 | 907 | { | ||
914 | 908 | Gtk.Label label = MakeLabel (label_text); | ||
915 | 909 | |||
916 | 910 | Gtk.CheckButton check = new Gtk.CheckButton (); | ||
917 | 911 | check.Add (label); | ||
918 | 912 | check.Show (); | ||
919 | 913 | |||
920 | 914 | return check; | ||
921 | 915 | } | ||
922 | 916 | |||
923 | 917 | static Gtk.Label MakeTipLabel (string label_text) | ||
924 | 918 | { | ||
925 | 919 | Gtk.Label label = MakeLabel ("<small>{0}</small>", label_text); | ||
926 | 920 | label.LineWrap = true; | ||
927 | 921 | label.Xpad = 20; | ||
928 | 922 | return label; | ||
929 | 923 | } | ||
930 | 924 | |||
931 | 925 | // Font Change handler | ||
932 | 926 | |||
933 | 927 | void OnFontButtonClicked (object sender, EventArgs args) | ||
934 | 928 | { | ||
935 | 929 | Gtk.FontSelectionDialog font_dialog = | ||
936 | 930 | new Gtk.FontSelectionDialog ( | ||
937 | 931 | Catalog.GetString ("Choose Note Font")); | ||
938 | 932 | |||
939 | 933 | string font_name = (string) | ||
940 | 934 | Preferences.Get (Preferences.CUSTOM_FONT_FACE); | ||
941 | 935 | font_dialog.SetFontName (font_name); | ||
942 | 936 | |||
943 | 937 | if ((int) Gtk.ResponseType.Ok == font_dialog.Run ()) { | ||
944 | 938 | if (font_dialog.FontName != font_name) { | ||
945 | 939 | Preferences.Set (Preferences.CUSTOM_FONT_FACE, | ||
946 | 940 | font_dialog.FontName); | ||
947 | 941 | |||
948 | 942 | UpdateFontButton (font_dialog.FontName); | ||
949 | 943 | } | ||
950 | 944 | } | ||
951 | 945 | |||
952 | 946 | font_dialog.Destroy (); | ||
953 | 947 | } | ||
954 | 948 | |||
955 | 949 | void UpdateFontButton (string font_desc) | ||
956 | 950 | { | ||
957 | 951 | Pango.FontDescription desc = | ||
958 | 952 | Pango.FontDescription.FromString (font_desc); | ||
959 | 953 | |||
960 | 954 | // Set the size label | ||
961 | 955 | font_size.Text = (desc.Size / Pango.Scale.PangoScale).ToString (); | ||
962 | 956 | |||
963 | 957 | desc.UnsetFields (Pango.FontMask.Size); | ||
964 | 958 | |||
965 | 959 | // Set the font name label | ||
966 | 960 | font_face.Markup = String.Format ("<span font_desc='{0}'>{1}</span>", | ||
967 | 961 | font_desc, | ||
968 | 962 | desc.ToString ()); | ||
969 | 963 | } | ||
970 | 964 | |||
971 | 965 | private void OnAdvancedSyncConfigButton (object sender, EventArgs args) | ||
972 | 966 | { | ||
973 | 967 | // Get saved behavior | ||
974 | 968 | SyncTitleConflictResolution savedBehavior = SyncTitleConflictResolution.Cancel; | ||
975 | 969 | object dlgBehaviorPref = Preferences.Get (Preferences.SYNC_CONFIGURED_CONFLICT_BEHAVIOR); | ||
976 | 970 | if (dlgBehaviorPref != null && dlgBehaviorPref is int) // TODO: Check range of this int | ||
977 | 971 | savedBehavior = (SyncTitleConflictResolution)dlgBehaviorPref; | ||
978 | 972 | |||
979 | 973 | // Create dialog | ||
980 | 974 | Gtk.Dialog advancedDlg = | ||
981 | 975 | new Gtk.Dialog (Catalog.GetString ("Other Synchronization Options"), | ||
982 | 976 | this, | ||
983 | 977 | Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal | Gtk.DialogFlags.NoSeparator, | ||
984 | 978 | Gtk.Stock.Close, Gtk.ResponseType.Close); | ||
985 | 979 | // Populate dialog | ||
986 | 980 | Gtk.Label label = | ||
987 | 981 | new Gtk.Label (Catalog.GetString ("When a conflict is detected between " + | ||
988 | 982 | "a local note and a note on the configured " + | ||
989 | 983 | "synchronization server:")); | ||
990 | 984 | label.Wrap = true; | ||
991 | 985 | label.Xalign = 0; | ||
992 | 986 | |||
993 | 987 | promptOnConflictRadio = | ||
994 | 988 | new Gtk.RadioButton (Catalog.GetString ("Always ask me what to do.")); | ||
995 | 989 | promptOnConflictRadio.Toggled += OnConflictOptionToggle; | ||
996 | 990 | |||
997 | 991 | renameOnConflictRadio = | ||
998 | 992 | new Gtk.RadioButton (promptOnConflictRadio, Catalog.GetString ("Rename my local note.")); | ||
999 | 993 | renameOnConflictRadio.Toggled += OnConflictOptionToggle; | ||
1000 | 994 | |||
1001 | 995 | overwriteOnConflictRadio = | ||
1002 | 996 | new Gtk.RadioButton (promptOnConflictRadio, Catalog.GetString ("Replace my local note with the server's update.")); | ||
1003 | 997 | overwriteOnConflictRadio.Toggled += OnConflictOptionToggle; | ||
1004 | 998 | |||
1005 | 999 | switch (savedBehavior) { | ||
1006 | 1000 | case SyncTitleConflictResolution.RenameExistingNoUpdate: | ||
1007 | 1001 | renameOnConflictRadio.Active = true; | ||
1008 | 1002 | break; | ||
1009 | 1003 | case SyncTitleConflictResolution.OverwriteExisting: | ||
1010 | 1004 | overwriteOnConflictRadio.Active = true; | ||
1011 | 1005 | break; | ||
1012 | 1006 | default: | ||
1013 | 1007 | promptOnConflictRadio.Active = true; | ||
1014 | 1008 | break; | ||
1015 | 1009 | } | ||
1016 | 1010 | |||
1017 | 1011 | Gtk.VBox vbox = new Gtk.VBox (); | ||
1018 | 1012 | vbox.BorderWidth = 18; | ||
1019 | 1013 | |||
1020 | 1014 | vbox.PackStart (promptOnConflictRadio); | ||
1021 | 1015 | vbox.PackStart (renameOnConflictRadio); | ||
1022 | 1016 | vbox.PackStart (overwriteOnConflictRadio); | ||
1023 | 1017 | |||
1024 | 1018 | advancedDlg.VBox.PackStart (label, false, false, 6); | ||
1025 | 1019 | advancedDlg.VBox.PackStart (vbox, false, false, 0); | ||
1026 | 1020 | |||
1027 | 1021 | advancedDlg.ShowAll (); | ||
1028 | 1022 | |||
1029 | 1023 | // Run dialog | ||
1030 | 1024 | advancedDlg.Run (); | ||
1031 | 1025 | advancedDlg.Destroy (); | ||
1032 | 1026 | } | ||
1033 | 1027 | |||
1034 | 1028 | private void OnConflictOptionToggle (object sender, EventArgs args) | ||
1035 | 1029 | { | ||
1036 | 1030 | SyncTitleConflictResolution newBehavior = SyncTitleConflictResolution.Cancel; | ||
1037 | 1031 | |||
1038 | 1032 | if (renameOnConflictRadio.Active) | ||
1039 | 1033 | newBehavior = SyncTitleConflictResolution.RenameExistingNoUpdate; | ||
1040 | 1034 | else if (overwriteOnConflictRadio.Active) | ||
1041 | 1035 | newBehavior = SyncTitleConflictResolution.OverwriteExisting; | ||
1042 | 1036 | |||
1043 | 1037 | Preferences.Set (Preferences.SYNC_CONFIGURED_CONFLICT_BEHAVIOR, | ||
1044 | 1038 | (int) newBehavior); | ||
1045 | 1039 | } | ||
1046 | 1040 | |||
1047 | 1041 | private void OnAppAddinListChanged (object sender, EventArgs args) | ||
1048 | 1042 | { | ||
1049 | 1043 | SyncServiceAddin [] newAddinsArray = Tomboy.DefaultNoteManager.AddinManager.GetSyncServiceAddins (); | ||
1050 | 1044 | Array.Sort (newAddinsArray, CompareSyncAddinsByName); | ||
1051 | 1045 | List<SyncServiceAddin> newAddins = new List<SyncServiceAddin> (newAddinsArray); | ||
1052 | 1046 | |||
1053 | 1047 | // Build easier-to-navigate list if addins currently in the combo | ||
1054 | 1048 | List<SyncServiceAddin> currentAddins = new List<SyncServiceAddin> (); | ||
1055 | 1049 | foreach (object [] currentRow in syncAddinStore) { | ||
1056 | 1050 | SyncServiceAddin currentAddin = currentRow [0] as SyncServiceAddin; | ||
1057 | 1051 | if (currentAddin != null) | ||
1058 | 1052 | currentAddins.Add (currentAddin); | ||
1059 | 1053 | } | ||
1060 | 1054 | |||
1061 | 1055 | // Add new addins | ||
1062 | 1056 | // TODO: Would be nice to insert these alphabetically instead | ||
1063 | 1057 | foreach (SyncServiceAddin newAddin in newAddins) { | ||
1064 | 1058 | if (!currentAddins.Contains (newAddin)) { | ||
1065 | 1059 | Gtk.TreeIter iter = syncAddinStore.Append (); | ||
1066 | 1060 | syncAddinStore.SetValue (iter, 0, newAddin); | ||
1067 | 1061 | syncAddinIters [newAddin.Id] = iter; | ||
1068 | 1062 | } | ||
1069 | 1063 | } | ||
1070 | 1064 | |||
1071 | 1065 | // Remove deleted addins | ||
1072 | 1066 | foreach (SyncServiceAddin currentAddin in currentAddins) { | ||
1073 | 1067 | if (!newAddins.Contains (currentAddin)) { | ||
1074 | 1068 | Gtk.TreeIter iter = syncAddinIters [currentAddin.Id]; | ||
1075 | 1069 | syncAddinStore.Remove (ref iter); | ||
1076 | 1070 | syncAddinIters.Remove (currentAddin.Id); | ||
1077 | 1071 | |||
1078 | 1072 | // FIXME: Lots of hacky stuff in here...rushing before freeze | ||
1079 | 1073 | if (currentAddin == selectedSyncAddin) { | ||
1080 | 1074 | if (syncAddinPrefsWidget != null && | ||
1081 | 1075 | !syncAddinPrefsWidget.Sensitive) | ||
1082 | 1076 | OnResetSyncAddinButton (null, null); | ||
1083 | 1077 | |||
1084 | 1078 | Gtk.TreeIter active_iter; | ||
1085 | 1079 | if (syncAddinStore.GetIterFirst (out active_iter) == true) { | ||
1086 | 1080 | syncAddinCombo.SetActiveIter (active_iter); | ||
1087 | 1081 | } else { | ||
1088 | 1082 | OnSyncAddinComboChanged (null, null); | ||
1089 | 1083 | } | ||
1090 | 1084 | } | ||
1091 | 1085 | } | ||
1092 | 1086 | } | ||
1093 | 1087 | } | ||
1094 | 1088 | |||
1095 | 1089 | void OnSyncAddinComboChanged (object sender, EventArgs args) | ||
1096 | 1090 | { | ||
1097 | 1091 | if (syncAddinPrefsWidget != null) { | ||
1098 | 1092 | syncAddinPrefsContainer.Remove (syncAddinPrefsWidget); | ||
1099 | 1093 | syncAddinPrefsWidget.Hide (); | ||
1100 | 1094 | syncAddinPrefsWidget.Destroy (); | ||
1101 | 1095 | syncAddinPrefsWidget = null; | ||
1102 | 1096 | } | ||
1103 | 1097 | |||
1104 | 1098 | Gtk.TreeIter iter; | ||
1105 | 1099 | if (syncAddinCombo.GetActiveIter (out iter)) { | ||
1106 | 1100 | SyncServiceAddin newAddin = | ||
1107 | 1101 | syncAddinStore.GetValue (iter, 0) as SyncServiceAddin; | ||
1108 | 1102 | if (newAddin != null) { | ||
1109 | 1103 | selectedSyncAddin = newAddin; | ||
1110 | 1104 | syncAddinPrefsWidget = selectedSyncAddin.CreatePreferencesControl (OnSyncAddinPrefsChanged); | ||
1111 | 1105 | if (syncAddinPrefsWidget == null) { | ||
1112 | 1106 | Gtk.Label l = new Gtk.Label (Catalog.GetString ("Not configurable")); | ||
1113 | 1107 | l.Yalign = 0.5f; | ||
1114 | 1108 | l.Yalign = 0.5f; | ||
1115 | 1109 | syncAddinPrefsWidget = l; | ||
1116 | 1110 | } | ||
1117 | 1111 | |||
1118 | 1112 | syncAddinPrefsWidget.Show (); | ||
1119 | 1113 | syncAddinPrefsContainer.PackStart (syncAddinPrefsWidget, false, false, 0); | ||
1120 | 1114 | |||
1121 | 1115 | resetSyncAddinButton.Sensitive = false; | ||
1122 | 1116 | saveSyncAddinButton.Sensitive = false; | ||
1123 | 1117 | } | ||
1124 | 1118 | } else { | ||
1125 | 1119 | selectedSyncAddin = null; | ||
1126 | 1120 | resetSyncAddinButton.Sensitive = false; | ||
1127 | 1121 | saveSyncAddinButton.Sensitive = false; | ||
1128 | 1122 | } | ||
1129 | 1123 | |||
1130 | 1124 | } | ||
1131 | 1125 | |||
1132 | 1126 | void OnResetSyncAddinButton (object sender, EventArgs args) | ||
1133 | 1127 | { | ||
1134 | 1128 | if (selectedSyncAddin == null) | ||
1135 | 1129 | return; | ||
1136 | 1130 | |||
1137 | 1131 | // User doesn't get a choice if this is invoked by disabling the addin | ||
1138 | 1132 | // FIXME: null sender check is lame! | ||
1139 | 1133 | if (sender != null) { | ||
1140 | 1134 | // Prompt the user about what they're about to do since | ||
1141 | 1135 | // it's not really recommended to switch back and forth | ||
1142 | 1136 | // between sync services. | ||
1143 | 1137 | HIGMessageDialog dialog = | ||
1144 | 1138 | new HIGMessageDialog (null, | ||
1145 | 1139 | Gtk.DialogFlags.Modal, | ||
1146 | 1140 | Gtk.MessageType.Question, | ||
1147 | 1141 | Gtk.ButtonsType.YesNo, | ||
1148 | 1142 | Catalog.GetString ("Are you sure?"), | ||
1149 | 1143 | Catalog.GetString ( | ||
1150 | 1144 | "Clearing your synchronization settings is not recommended. " + | ||
1151 | 1145 | "You may be forced to synchronize all of your notes again " + | ||
1152 | 1146 | "when you save new settings.")); | ||
1153 | 1147 | int response = dialog.Run (); | ||
1154 | 1148 | dialog.Destroy (); | ||
1155 | 1149 | if (response != (int) Gtk.ResponseType.Yes) | ||
1156 | 1150 | return; | ||
1157 | 1151 | } else { // FIXME: Weird place for this to go. User should be able to cancel disabling of addin, anyway | ||
1158 | 1152 | HIGMessageDialog dialog = | ||
1159 | 1153 | new HIGMessageDialog (null, | ||
1160 | 1154 | Gtk.DialogFlags.Modal, | ||
1161 | 1155 | Gtk.MessageType.Info, | ||
1162 | 1156 | Gtk.ButtonsType.Ok, | ||
1163 | 1157 | Catalog.GetString ("Resetting Synchronization Settings"), | ||
1164 | 1158 | Catalog.GetString ( | ||
1165 | 1159 | "You have disabled the configured synchronization service. " + | ||
1166 | 1160 | "Your synchronization settings will now be cleared. " + | ||
1167 | 1161 | "You may be forced to synchronize all of your notes again " + | ||
1168 | 1162 | "when you save new settings.")); | ||
1169 | 1163 | dialog.Run (); | ||
1170 | 1164 | dialog.Destroy (); | ||
1171 | 1165 | } | ||
1172 | 1166 | |||
1173 | 1167 | try { | ||
1174 | 1168 | selectedSyncAddin.ResetConfiguration (); | ||
1175 | 1169 | } catch (Exception e) { | ||
1176 | 1170 | Logger.Debug ("Error calling {0}.ResetConfiguration: {1}\n{2}", | ||
1177 | 1171 | selectedSyncAddin.Id, e.Message, e.StackTrace); | ||
1178 | 1172 | } | ||
1179 | 1173 | |||
1180 | 1174 | Preferences.Set ( | ||
1181 | 1175 | Preferences.SYNC_SELECTED_SERVICE_ADDIN, | ||
1182 | 1176 | String.Empty); | ||
1183 | 1177 | |||
1184 | 1178 | // Reset conflict handling behavior | ||
1185 | 1179 | Preferences.Set ( | ||
1186 | 1180 | Preferences.SYNC_CONFIGURED_CONFLICT_BEHAVIOR, | ||
1187 | 1181 | Preferences.GetDefault (Preferences.SYNC_CONFIGURED_CONFLICT_BEHAVIOR)); | ||
1188 | 1182 | |||
1189 | 1183 | SyncManager.ResetClient (); | ||
1190 | 1184 | |||
1191 | 1185 | syncAddinCombo.Sensitive = true; | ||
1192 | 1186 | resetSyncAddinButton.Sensitive = false; | ||
1193 | 1187 | saveSyncAddinButton.Sensitive = true; | ||
1194 | 1188 | if (syncAddinPrefsWidget != null) | ||
1195 | 1189 | syncAddinPrefsWidget.Sensitive = true; | ||
1196 | 1190 | } | ||
1197 | 1191 | |||
1198 | 1192 | /// <summary> | ||
1199 | 1193 | /// Attempt to save/test the connection to the sync addin. | ||
1200 | 1194 | /// </summary> | ||
1201 | 1195 | void OnSaveSyncAddinButton (object sender, EventArgs args) | ||
1202 | 1196 | { | ||
1203 | 1197 | if (selectedSyncAddin == null) | ||
1204 | 1198 | return; | ||
1205 | 1199 | |||
1206 | 1200 | bool saved = false; | ||
1207 | 1201 | string errorMsg = null; | ||
1208 | 1202 | try { | ||
1209 | 1203 | GdkWindow.Cursor = new Gdk.Cursor (Gdk.CursorType.Watch); | ||
1210 | 1204 | GdkWindow.Display.Flush (); | ||
1211 | 1205 | saved = selectedSyncAddin.SaveConfiguration (); | ||
1212 | 1206 | } catch (TomboySyncException syncEx) { | ||
1213 | 1207 | errorMsg = syncEx.Message; | ||
1214 | 1208 | } catch (Exception e) { | ||
1215 | 1209 | Logger.Debug ("Unexpected error calling {0}.SaveConfiguration: {1}\n{2}", | ||
1216 | 1210 | selectedSyncAddin.Id, e.Message, e.StackTrace); | ||
1217 | 1211 | } finally { | ||
1218 | 1212 | GdkWindow.Cursor = null; | ||
1219 | 1213 | GdkWindow.Display.Flush (); | ||
1220 | 1214 | } | ||
1221 | 1215 | |||
1222 | 1216 | HIGMessageDialog dialog; | ||
1223 | 1217 | if (saved) { | ||
1224 | 1218 | Preferences.Set ( | ||
1225 | 1219 | Preferences.SYNC_SELECTED_SERVICE_ADDIN, | ||
1226 | 1220 | selectedSyncAddin.Id); | ||
1227 | 1221 | |||
1228 | 1222 | syncAddinCombo.Sensitive = false; | ||
1229 | 1223 | syncAddinPrefsWidget.Sensitive = false; | ||
1230 | 1224 | resetSyncAddinButton.Sensitive = true; | ||
1231 | 1225 | saveSyncAddinButton.Sensitive = false; | ||
1232 | 1226 | |||
1233 | 1227 | SyncManager.ResetClient (); | ||
1234 | 1228 | |||
1235 | 1229 | // Give the user a visual letting them know that connecting | ||
1236 | 1230 | // was successful. | ||
1237 | 1231 | // TODO: Replace Yes/No with Sync/Close | ||
1238 | 1232 | dialog = | ||
1239 | 1233 | new HIGMessageDialog (this, | ||
1240 | 1234 | Gtk.DialogFlags.Modal, | ||
1241 | 1235 | Gtk.MessageType.Info, | ||
1242 | 1236 | Gtk.ButtonsType.YesNo, | ||
1243 | 1237 | Catalog.GetString ("Connection successful"), | ||
1244 | 1238 | Catalog.GetString ( | ||
1245 | 1239 | "Tomboy is ready to synchronize your notes. Would you like to synchronize them now?")); | ||
1246 | 1240 | int response = dialog.Run (); | ||
1247 | 1241 | dialog.Destroy (); | ||
1248 | 1242 | |||
1249 | 1243 | if (response == (int) Gtk.ResponseType.Yes) | ||
1250 | 1244 | // TODO: Put this voodoo in a method somewhere | ||
1251 | 1245 | Tomboy.ActionManager ["NoteSynchronizationAction"].Activate (); | ||
1252 | 1246 | } else { | ||
1253 | 1247 | // TODO: Change the SyncServiceAddin API so the call to | ||
1254 | 1248 | // SaveConfiguration has a way of passing back an exception | ||
1255 | 1249 | // or other text so it can be displayed to the user. | ||
1256 | 1250 | Preferences.Set ( | ||
1257 | 1251 | Preferences.SYNC_SELECTED_SERVICE_ADDIN, | ||
1258 | 1252 | String.Empty); | ||
1259 | 1253 | |||
1260 | 1254 | syncAddinCombo.Sensitive = true; | ||
1261 | 1255 | syncAddinPrefsWidget.Sensitive = true; | ||
1262 | 1256 | resetSyncAddinButton.Sensitive = false; | ||
1263 | 1257 | saveSyncAddinButton.Sensitive = true; | ||
1264 | 1258 | |||
1265 | 1259 | // Give the user a visual letting them know that connecting | ||
1266 | 1260 | // was successful. | ||
1267 | 1261 | if (errorMsg == null) { | ||
1268 | 1262 | errorMsg = Catalog.GetString ("Please check your information and " + | ||
1269 | 1263 | "try again. The log file {0} may " + | ||
1270 | 1264 | "contain more information about the error."); | ||
1271 | 1265 | string logPath = System.IO.Path.Combine (Services.NativeApplication.LogDirectory, | ||
1272 | 1266 | "tomboy.log"); | ||
1273 | 1267 | errorMsg = String.Format (errorMsg, logPath); | ||
1274 | 1268 | } | ||
1275 | 1269 | dialog = | ||
1276 | 1270 | new HIGMessageDialog (this, | ||
1277 | 1271 | Gtk.DialogFlags.Modal, | ||
1278 | 1272 | Gtk.MessageType.Warning, | ||
1279 | 1273 | Gtk.ButtonsType.Close, | ||
1280 | 1274 | Catalog.GetString ("Error connecting"), | ||
1281 | 1275 | errorMsg); | ||
1282 | 1276 | dialog.Run (); | ||
1283 | 1277 | dialog.Destroy (); | ||
1284 | 1278 | } | ||
1285 | 1279 | } | ||
1286 | 1280 | |||
1287 | 1281 | void OnSyncAddinPrefsChanged (object sender, EventArgs args) | ||
1288 | 1282 | { | ||
1289 | 1283 | // Enable/disable the save button based on required fields | ||
1290 | 1284 | if (selectedSyncAddin != null) | ||
1291 | 1285 | saveSyncAddinButton.Sensitive = selectedSyncAddin.AreSettingsValid; | ||
1292 | 1286 | } | ||
1293 | 1287 | |||
1294 | 1288 | void OpenTemplateButtonClicked (object sender, EventArgs args) | ||
1295 | 1289 | { | ||
1296 | 1290 | NoteManager manager = Tomboy.DefaultNoteManager; | ||
1297 | 1291 | Note template_note = manager.GetOrCreateTemplateNote (); | ||
1298 | 1292 | |||
1299 | 1293 | // Open the template note | ||
1300 | 1294 | template_note.Window.Show (); | ||
1301 | 1295 | } | ||
1302 | 1296 | } | ||
1303 | 1297 | |||
1304 | 1298 | // TODO: Figure out how to use Mono.Addins.Gui.AddinInfoDialog here instead. | ||
1305 | 1299 | // The class here is adapted directly from Mono.Addins.Gui.AddinInfoDialog. | ||
1306 | 1300 | class AddinInfoDialog : Gtk.Dialog | ||
1307 | 1301 | { | ||
1308 | 1302 | Mono.Addins.Setup.AddinHeader info; | ||
1309 | 1303 | Gtk.Label info_label; | ||
1310 | 1304 | |||
1311 | 1305 | public AddinInfoDialog ( | ||
1312 | 1306 | Mono.Addins.Setup.AddinHeader info, | ||
1313 | 1307 | Gtk.Window parent) | ||
1314 | 1308 | : base (info.Name, | ||
1315 | 1309 | parent, | ||
1316 | 1310 | Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.NoSeparator, | ||
1317 | 1311 | Gtk.Stock.Close, Gtk.ResponseType.Close) | ||
1318 | 1312 | { | ||
1319 | 1313 | this.info = info; | ||
1320 | 1314 | |||
1321 | 1315 | // TODO: Change this icon to be an addin/package icon | ||
1322 | 1316 | Gtk.Image icon = | ||
1323 | 1317 | new Gtk.Image (Gtk.Stock.DialogInfo, Gtk.IconSize.Dialog); | ||
1324 | 1318 | icon.Yalign = 0; | ||
1325 | 1319 | |||
1326 | 1320 | info_label = new Gtk.Label (); | ||
1327 | 1321 | info_label.Xalign = 0; | ||
1328 | 1322 | info_label.Yalign = 0; | ||
1329 | 1323 | info_label.UseMarkup = true; | ||
1330 | 1324 | info_label.UseUnderline = false; | ||
1331 | 1325 | info_label.Wrap = true; | ||
1332 | 1326 | |||
1333 | 1327 | Gtk.HBox hbox = new Gtk.HBox (false, 6); | ||
1334 | 1328 | Gtk.VBox vbox = new Gtk.VBox (false, 12); | ||
1335 | 1329 | hbox.BorderWidth = 12; | ||
1336 | 1330 | vbox.BorderWidth = 6; | ||
1337 | 1331 | |||
1338 | 1332 | hbox.PackStart (icon, false, false, 0); | ||
1339 | 1333 | hbox.PackStart (vbox, true, true, 0); | ||
1340 | 1334 | |||
1341 | 1335 | vbox.PackStart (info_label, true, true, 0); | ||
1342 | 1336 | |||
1343 | 1337 | hbox.ShowAll (); | ||
1344 | 1338 | |||
1345 | 1339 | VBox.PackStart (hbox, true, true, 0); | ||
1346 | 1340 | |||
1347 | 1341 | Fill (); | ||
1348 | 1342 | } | ||
1349 | 1343 | |||
1350 | 1344 | void Fill () | ||
1351 | 1345 | { | ||
1352 | 1346 | StringBuilder sb = new StringBuilder (); | ||
1353 | 1347 | sb.Append ("<b><big>" + info.Name + "</big></b>\n\n"); | ||
1354 | 1348 | |||
1355 | 1349 | if (info.Description != string.Empty) | ||
1356 | 1350 | sb.Append (info.Description + "\n\n"); | ||
1357 | 1351 | |||
1358 | 1352 | sb.Append ("<small>"); | ||
1359 | 1353 | |||
1360 | 1354 | sb.Append (string.Format ( | ||
1361 | 1355 | "<b>{0}</b>\n" + | ||
1362 | 1356 | "{1}\n\n", | ||
1363 | 1357 | Catalog.GetString ("Version:"), | ||
1364 | 1358 | info.Version)); | ||
1365 | 1359 | |||
1366 | 1360 | if (info.Author != string.Empty) | ||
1367 | 1361 | sb.Append (string.Format ( | ||
1368 | 1362 | "<b>{0}</b>\n" + | ||
1369 | 1363 | "{1}\n\n", | ||
1370 | 1364 | Catalog.GetString ("Author:"), | ||
1371 | 1365 | info.Author)); | ||
1372 | 1366 | |||
1373 | 1367 | if (info.Copyright != string.Empty) | ||
1374 | 1368 | sb.Append (string.Format ( | ||
1375 | 1369 | "<b>{0}</b>\n" + | ||
1376 | 1370 | "{1}\n\n", | ||
1377 | 1371 | Catalog.GetString ("Copyright:"), | ||
1378 | 1372 | info.Copyright)); | ||
1379 | 1373 | |||
1380 | 1374 | if (info.Dependencies.Count > 0) { | ||
1381 | 1375 | sb.Append (string.Format ( | ||
1382 | 1376 | "<b>{0}</b>\n", | ||
1383 | 1377 | Catalog.GetString ("Add-in Dependencies:"))); | ||
1384 | 1378 | foreach (Mono.Addins.Description.Dependency dep in info.Dependencies) { | ||
1385 | 1379 | sb.Append (dep.Name + "\n"); | ||
1386 | 1380 | } | ||
1387 | 1381 | } | ||
1388 | 1382 | |||
1389 | 1383 | sb.Append ("</small>"); | ||
1390 | 1384 | |||
1391 | 1385 | info_label.Markup = sb.ToString (); | ||
1392 | 1386 | } | ||
1393 | 1387 | } | ||
1394 | 1388 | } | ||
1395 | 0 | 1389 | ||
1396 | === added directory '.pc/32_logout_delay.patch' | |||
1397 | === added directory '.pc/32_logout_delay.patch/Tomboy' | |||
1398 | === added file '.pc/32_logout_delay.patch/Tomboy/GnomeApplication.cs' | |||
1399 | --- .pc/32_logout_delay.patch/Tomboy/GnomeApplication.cs 1970-01-01 00:00:00 +0000 | |||
1400 | +++ .pc/32_logout_delay.patch/Tomboy/GnomeApplication.cs 2013-02-05 16:50:59 +0000 | |||
1401 | @@ -0,0 +1,230 @@ | |||
1402 | 1 | using System; | ||
1403 | 2 | using System.Runtime.InteropServices; | ||
1404 | 3 | using System.Text; | ||
1405 | 4 | using System.IO; | ||
1406 | 5 | using System.Xml; | ||
1407 | 6 | |||
1408 | 7 | using Mono.Unix; | ||
1409 | 8 | using Mono.Unix.Native; | ||
1410 | 9 | |||
1411 | 10 | using Hyena; | ||
1412 | 11 | |||
1413 | 12 | using DBus; | ||
1414 | 13 | using org.gnome.SessionManager; | ||
1415 | 14 | |||
1416 | 15 | namespace Tomboy | ||
1417 | 16 | { | ||
1418 | 17 | public class GnomeApplication : INativeApplication | ||
1419 | 18 | { | ||
1420 | 19 | #if PANEL_APPLET | ||
1421 | 20 | private Gnome.Program program; | ||
1422 | 21 | #endif | ||
1423 | 22 | private static string confDir; | ||
1424 | 23 | private static string dataDir; | ||
1425 | 24 | private static string cacheDir; | ||
1426 | 25 | private static ObjectPath session_client_id; | ||
1427 | 26 | private const string tomboyDirName = "tomboy"; | ||
1428 | 27 | |||
1429 | 28 | static GnomeApplication () | ||
1430 | 29 | { | ||
1431 | 30 | dataDir = Path.Combine (XdgBaseDirectorySpec.GetUserDirectory ("XDG_DATA_HOME", | ||
1432 | 31 | Path.Combine (".local", "share")), | ||
1433 | 32 | tomboyDirName); | ||
1434 | 33 | confDir = Path.Combine (XdgBaseDirectorySpec.GetUserDirectory ("XDG_CONFIG_HOME", | ||
1435 | 34 | ".config"), | ||
1436 | 35 | tomboyDirName); | ||
1437 | 36 | cacheDir = Path.Combine (XdgBaseDirectorySpec.GetUserDirectory ("XDG_CACHE_HOME", | ||
1438 | 37 | ".cache"), | ||
1439 | 38 | tomboyDirName); | ||
1440 | 39 | |||
1441 | 40 | // NOTE: Other directories created on demand | ||
1442 | 41 | // (non-existence is an indicator that migration is needed) | ||
1443 | 42 | if (!Directory.Exists (cacheDir)) | ||
1444 | 43 | Directory.CreateDirectory (cacheDir); | ||
1445 | 44 | } | ||
1446 | 45 | |||
1447 | 46 | public void Initialize (string locale_dir, | ||
1448 | 47 | string display_name, | ||
1449 | 48 | string process_name, | ||
1450 | 49 | string [] args) | ||
1451 | 50 | { | ||
1452 | 51 | try { | ||
1453 | 52 | SetProcessName (process_name); | ||
1454 | 53 | } catch {} // Ignore exception if fail (not needed to run) | ||
1455 | 54 | |||
1456 | 55 | // Register handler for saving session when logging out of Gnome | ||
1457 | 56 | BusG.Init (); | ||
1458 | 57 | string startup_id = Environment.GetEnvironmentVariable ("DESKTOP_AUTOSTART_ID"); | ||
1459 | 58 | if (String.IsNullOrEmpty (startup_id)) | ||
1460 | 59 | startup_id = display_name; | ||
1461 | 60 | |||
1462 | 61 | try { | ||
1463 | 62 | SessionManager session = Bus.Session.GetObject<SessionManager> (Constants.SessionManagerInterfaceName, | ||
1464 | 63 | new ObjectPath (Constants.SessionManagerPath)); | ||
1465 | 64 | session_client_id = session.RegisterClient (display_name, startup_id); | ||
1466 | 65 | |||
1467 | 66 | ClientPrivate client = Bus.Session.GetObject<ClientPrivate> (Constants.SessionManagerInterfaceName, | ||
1468 | 67 | session_client_id); | ||
1469 | 68 | client.QueryEndSession += OnQueryEndSession; | ||
1470 | 69 | client.EndSession += OnEndSession; | ||
1471 | 70 | } catch (Exception e) { | ||
1472 | 71 | Logger.Debug ("Failed to register with session manager: {0}", e.Message); | ||
1473 | 72 | } | ||
1474 | 73 | |||
1475 | 74 | Gtk.Application.Init (); | ||
1476 | 75 | #if PANEL_APPLET | ||
1477 | 76 | program = new Gnome.Program (display_name, | ||
1478 | 77 | Defines.VERSION, | ||
1479 | 78 | Gnome.Modules.UI, | ||
1480 | 79 | args); | ||
1481 | 80 | #endif | ||
1482 | 81 | } | ||
1483 | 82 | |||
1484 | 83 | public void RegisterSessionManagerRestart (string executable_path, | ||
1485 | 84 | string[] args, | ||
1486 | 85 | string[] environment) | ||
1487 | 86 | { | ||
1488 | 87 | // Nothing to do, we dropped the .desktop file in the autostart | ||
1489 | 88 | // folder which should be enough to handle this in Gnome | ||
1490 | 89 | } | ||
1491 | 90 | |||
1492 | 91 | public void RegisterSignalHandlers () | ||
1493 | 92 | { | ||
1494 | 93 | // Connect to SIGTERM and SIGINT, so we don't lose | ||
1495 | 94 | // unsaved notes on exit... | ||
1496 | 95 | Stdlib.signal (Signum.SIGTERM, OnExitSignal); | ||
1497 | 96 | Stdlib.signal (Signum.SIGINT, OnExitSignal); | ||
1498 | 97 | } | ||
1499 | 98 | |||
1500 | 99 | public event EventHandler ExitingEvent; | ||
1501 | 100 | |||
1502 | 101 | public void Exit (int exitcode) | ||
1503 | 102 | { | ||
1504 | 103 | OnExitSignal (-1); | ||
1505 | 104 | System.Environment.Exit (exitcode); | ||
1506 | 105 | } | ||
1507 | 106 | |||
1508 | 107 | public void StartMainLoop () | ||
1509 | 108 | { | ||
1510 | 109 | #if PANEL_APPLET | ||
1511 | 110 | program.Run (); | ||
1512 | 111 | #else | ||
1513 | 112 | Gtk.Application.Run (); | ||
1514 | 113 | #endif | ||
1515 | 114 | } | ||
1516 | 115 | |||
1517 | 116 | [DllImport("libc")] | ||
1518 | 117 | private static extern int prctl (int option, | ||
1519 | 118 | byte [] arg2, | ||
1520 | 119 | IntPtr arg3, | ||
1521 | 120 | IntPtr arg4, | ||
1522 | 121 | IntPtr arg5); | ||
1523 | 122 | |||
1524 | 123 | // From Banshee: Banshee.Base/Utilities.cs | ||
1525 | 124 | private void SetProcessName (string name) | ||
1526 | 125 | { | ||
1527 | 126 | if (prctl (15 /* PR_SET_NAME */, | ||
1528 | 127 | Encoding.ASCII.GetBytes (name + "\0"), | ||
1529 | 128 | IntPtr.Zero, | ||
1530 | 129 | IntPtr.Zero, | ||
1531 | 130 | IntPtr.Zero) != 0) | ||
1532 | 131 | throw new ApplicationException ( | ||
1533 | 132 | "Error setting process name: " + | ||
1534 | 133 | Mono.Unix.Native.Stdlib.GetLastError ()); | ||
1535 | 134 | } | ||
1536 | 135 | |||
1537 | 136 | private void OnExitSignal (int signal) | ||
1538 | 137 | { | ||
1539 | 138 | if (ExitingEvent != null) | ||
1540 | 139 | ExitingEvent (null, new EventArgs ()); | ||
1541 | 140 | |||
1542 | 141 | if (signal >= 0) | ||
1543 | 142 | System.Environment.Exit (0); | ||
1544 | 143 | } | ||
1545 | 144 | |||
1546 | 145 | private void OnQueryEndSession (uint flags) | ||
1547 | 146 | { | ||
1548 | 147 | Logger.Info ("Received end session query"); | ||
1549 | 148 | |||
1550 | 149 | // The session might not actually end but it would be nice to start | ||
1551 | 150 | // some cleanup actions like saving notes here | ||
1552 | 151 | |||
1553 | 152 | // Let the session manager know its OK to continue | ||
1554 | 153 | try { | ||
1555 | 154 | ClientPrivate client = Bus.Session.GetObject<ClientPrivate> (Constants.SessionManagerInterfaceName, | ||
1556 | 155 | session_client_id); | ||
1557 | 156 | client.EndSessionResponse(true, String.Empty); | ||
1558 | 157 | } catch (Exception e) { | ||
1559 | 158 | Logger.Debug("Failed to respond to session manager: {0}", e.Message); | ||
1560 | 159 | } | ||
1561 | 160 | } | ||
1562 | 161 | |||
1563 | 162 | private void OnEndSession (uint flags) | ||
1564 | 163 | { | ||
1565 | 164 | Logger.Info ("Received end session signal"); | ||
1566 | 165 | |||
1567 | 166 | if (ExitingEvent != null) | ||
1568 | 167 | ExitingEvent (null, new EventArgs ()); | ||
1569 | 168 | |||
1570 | 169 | // Let the session manager know its OK to continue | ||
1571 | 170 | // Ideally we would wait for all the exit events to finish | ||
1572 | 171 | try { | ||
1573 | 172 | ClientPrivate client = Bus.Session.GetObject<ClientPrivate> (Constants.SessionManagerInterfaceName, | ||
1574 | 173 | session_client_id); | ||
1575 | 174 | client.EndSessionResponse (true, String.Empty); | ||
1576 | 175 | } catch (Exception e) { | ||
1577 | 176 | Logger.Debug ("Failed to respond to session manager: {0}", e.Message); | ||
1578 | 177 | } | ||
1579 | 178 | } | ||
1580 | 179 | |||
1581 | 180 | public void OpenUrl (string url, Gdk.Screen screen) | ||
1582 | 181 | { | ||
1583 | 182 | GtkBeans.Global.ShowUri (screen, url); | ||
1584 | 183 | } | ||
1585 | 184 | |||
1586 | 185 | [DllImport ("glib-2.0.dll")] | ||
1587 | 186 | static extern IntPtr g_get_language_names (); | ||
1588 | 187 | |||
1589 | 188 | public void DisplayHelp (string project, string page, Gdk.Screen screen) | ||
1590 | 189 | { | ||
1591 | 190 | string helpUrl = string.Format("http://library.gnome.org/users/{0}/", project); | ||
1592 | 191 | |||
1593 | 192 | var langsPtr = g_get_language_names (); | ||
1594 | 193 | var langs = GLib.Marshaller.NullTermPtrToStringArray (langsPtr, false); | ||
1595 | 194 | var baseHelpDir = Path.Combine (Path.Combine (Defines.DATADIR, "gnome/help"), project); | ||
1596 | 195 | if (Directory.Exists (baseHelpDir)) { | ||
1597 | 196 | foreach (var lang in langs) { | ||
1598 | 197 | var langHelpDir = Path.Combine (baseHelpDir, lang); | ||
1599 | 198 | if (Directory.Exists (langHelpDir)) | ||
1600 | 199 | // TODO:Support page | ||
1601 | 200 | helpUrl = String.Format ("ghelp://{0}", langHelpDir); | ||
1602 | 201 | } | ||
1603 | 202 | } | ||
1604 | 203 | |||
1605 | 204 | OpenUrl (helpUrl, screen); | ||
1606 | 205 | } | ||
1607 | 206 | |||
1608 | 207 | public string DataDirectory { | ||
1609 | 208 | get { return dataDir; } | ||
1610 | 209 | } | ||
1611 | 210 | |||
1612 | 211 | public string ConfigurationDirectory { | ||
1613 | 212 | get { return confDir; } | ||
1614 | 213 | } | ||
1615 | 214 | |||
1616 | 215 | public string CacheDirectory { | ||
1617 | 216 | get { return cacheDir; } | ||
1618 | 217 | } | ||
1619 | 218 | |||
1620 | 219 | public string LogDirectory { | ||
1621 | 220 | get { return confDir; } | ||
1622 | 221 | } | ||
1623 | 222 | |||
1624 | 223 | public string PreOneDotZeroNoteDirectory { | ||
1625 | 224 | get { | ||
1626 | 225 | return Path.Combine (Environment.GetEnvironmentVariable ("HOME"), | ||
1627 | 226 | ".tomboy"); | ||
1628 | 227 | } | ||
1629 | 228 | } | ||
1630 | 229 | } | ||
1631 | 230 | } | ||
1632 | 0 | 231 | ||
1633 | === modified file '.pc/applied-patches' | |||
1634 | --- .pc/applied-patches 2011-09-26 23:39:59 +0000 | |||
1635 | +++ .pc/applied-patches 2013-02-05 16:50:59 +0000 | |||
1636 | @@ -1,4 +1,5 @@ | |||
1637 | 1 | 01_dllmaps.patch | 1 | 01_dllmaps.patch |
1638 | 2 | 02_sync_save_button_sensitive.patch | ||
1639 | 2 | 03_u1_as_default_sync.patch | 3 | 03_u1_as_default_sync.patch |
1640 | 3 | 04_app_indicator.patch | 4 | 04_app_indicator.patch |
1641 | 4 | 05_add_start_u1_note.patch | 5 | 05_add_start_u1_note.patch |
1642 | @@ -6,3 +7,4 @@ | |||
1643 | 6 | 20_remove_pcfile_requires | 7 | 20_remove_pcfile_requires |
1644 | 7 | 30_fix_manpage_syntax | 8 | 30_fix_manpage_syntax |
1645 | 8 | 31_prevent_inadvertent_deletion_of_notes.patch | 9 | 31_prevent_inadvertent_deletion_of_notes.patch |
1646 | 10 | 32_logout_delay.patch | ||
1647 | 9 | 11 | ||
1648 | === modified file 'Tomboy/GnomeApplication.cs' | |||
1649 | --- Tomboy/GnomeApplication.cs 2011-07-06 10:06:49 +0000 | |||
1650 | +++ Tomboy/GnomeApplication.cs 2013-02-05 16:50:59 +0000 | |||
1651 | @@ -67,6 +67,7 @@ | |||
1652 | 67 | session_client_id); | 67 | session_client_id); |
1653 | 68 | client.QueryEndSession += OnQueryEndSession; | 68 | client.QueryEndSession += OnQueryEndSession; |
1654 | 69 | client.EndSession += OnEndSession; | 69 | client.EndSession += OnEndSession; |
1655 | 70 | client.Stop += OnStop; | ||
1656 | 70 | } catch (Exception e) { | 71 | } catch (Exception e) { |
1657 | 71 | Logger.Debug ("Failed to register with session manager: {0}", e.Message); | 72 | Logger.Debug ("Failed to register with session manager: {0}", e.Message); |
1658 | 72 | } | 73 | } |
1659 | @@ -142,6 +143,10 @@ | |||
1660 | 142 | System.Environment.Exit (0); | 143 | System.Environment.Exit (0); |
1661 | 143 | } | 144 | } |
1662 | 144 | 145 | ||
1663 | 146 | private void OnStop () { | ||
1664 | 147 | Exit(0); | ||
1665 | 148 | } | ||
1666 | 149 | |||
1667 | 145 | private void OnQueryEndSession (uint flags) | 150 | private void OnQueryEndSession (uint flags) |
1668 | 146 | { | 151 | { |
1669 | 147 | Logger.Info ("Received end session query"); | 152 | Logger.Info ("Received end session query"); |
1670 | @@ -175,6 +180,7 @@ | |||
1671 | 175 | } catch (Exception e) { | 180 | } catch (Exception e) { |
1672 | 176 | Logger.Debug ("Failed to respond to session manager: {0}", e.Message); | 181 | Logger.Debug ("Failed to respond to session manager: {0}", e.Message); |
1673 | 177 | } | 182 | } |
1674 | 183 | Exit (0); | ||
1675 | 178 | } | 184 | } |
1676 | 179 | 185 | ||
1677 | 180 | public void OpenUrl (string url, Gdk.Screen screen) | 186 | public void OpenUrl (string url, Gdk.Screen screen) |
1678 | 181 | 187 | ||
1679 | === modified file 'Tomboy/PreferencesDialog.cs' | |||
1680 | --- Tomboy/PreferencesDialog.cs 2011-08-23 22:47:32 +0000 | |||
1681 | +++ Tomboy/PreferencesDialog.cs 2013-02-05 16:50:59 +0000 | |||
1682 | @@ -1113,7 +1113,7 @@ | |||
1683 | 1113 | syncAddinPrefsContainer.PackStart (syncAddinPrefsWidget, false, false, 0); | 1113 | syncAddinPrefsContainer.PackStart (syncAddinPrefsWidget, false, false, 0); |
1684 | 1114 | 1114 | ||
1685 | 1115 | resetSyncAddinButton.Sensitive = false; | 1115 | resetSyncAddinButton.Sensitive = false; |
1687 | 1116 | saveSyncAddinButton.Sensitive = false; | 1116 | saveSyncAddinButton.Sensitive = true; |
1688 | 1117 | } | 1117 | } |
1689 | 1118 | } else { | 1118 | } else { |
1690 | 1119 | selectedSyncAddin = null; | 1119 | selectedSyncAddin = null; |
1691 | 1120 | 1120 | ||
1692 | === modified file 'debian/changelog' | |||
1693 | --- debian/changelog 2011-09-26 23:39:59 +0000 | |||
1694 | +++ debian/changelog 2013-02-05 16:50:59 +0000 | |||
1695 | @@ -1,3 +1,37 @@ | |||
1696 | 1 | tomboy (1.8.0-1ubuntu1.1.2) oneiric-proposed; urgency=low | ||
1697 | 2 | |||
1698 | 3 | * debian/patches/02_sync_save_button_sensitive.patch: | ||
1699 | 4 | * debian/patches/03_u1_as_default_sync.patch: | ||
1700 | 5 | * debian/patches/05_add_start_u1_note.patch: | ||
1701 | 6 | * debian/patches/06_use_ubuntu_sso.patch: | ||
1702 | 7 | - Remove patches to default to Ubuntu One for notes sync. (LP: #1115460) | ||
1703 | 8 | |||
1704 | 9 | -- Rodney Dawes <rodney.dawes@ubuntu.com> Mon, 04 Feb 2013 15:04:45 -0500 | ||
1705 | 10 | |||
1706 | 11 | tomboy (1.8.0-1ubuntu1.1.1) oneiric-proposed; urgency=low | ||
1707 | 12 | |||
1708 | 13 | * debian/patches/32_logout_delay.patch: | ||
1709 | 14 | - Fix the issue where tomboy is delaying the session logout. | ||
1710 | 15 | (LP: #880299) | ||
1711 | 16 | |||
1712 | 17 | [ Stéphane Graber ] | ||
1713 | 18 | * Change version number to 1.8.0-1ubuntu1.1.1 to avoid conflicting | ||
1714 | 19 | with Precise's 1.8.0-1ubuntu1.2 (which should have been -1ubuntu2) | ||
1715 | 20 | |||
1716 | 21 | -- Omer Akram <om26er@ubuntu.com> Tue, 17 Jan 2012 22:51:08 +0500 | ||
1717 | 22 | |||
1718 | 23 | tomboy (1.8.0-1ubuntu1.1) oneiric-proposed; urgency=low | ||
1719 | 24 | |||
1720 | 25 | [ Iain Lane ] | ||
1721 | 26 | * debian/control: Remove syncdaemon BD which is no longer required due to | ||
1722 | 27 | the dropping of the SSO patch in 1.8.0-1ubuntu1 | ||
1723 | 28 | |||
1724 | 29 | [ Ken VanDine ] | ||
1725 | 30 | * debian/patches/02_sync_save_button_sensitive.patch | ||
1726 | 31 | - Set save button sensitive when needed (LP: #845321) | ||
1727 | 32 | |||
1728 | 33 | -- Ken VanDine <ken.vandine@canonical.com> Fri, 14 Oct 2011 09:38:21 -0400 | ||
1729 | 34 | |||
1730 | 1 | tomboy (1.8.0-1ubuntu1) oneiric; urgency=low | 35 | tomboy (1.8.0-1ubuntu1) oneiric; urgency=low |
1731 | 2 | 36 | ||
1732 | 3 | [ Iain Lane ] | 37 | [ Iain Lane ] |
1733 | 4 | 38 | ||
1734 | === modified file 'debian/control' | |||
1735 | --- debian/control 2011-07-06 10:06:49 +0000 | |||
1736 | +++ debian/control 2013-02-05 16:50:59 +0000 | |||
1737 | @@ -27,8 +27,7 @@ | |||
1738 | 27 | libmono-addins-gui-cil-dev (>= 0.3), | 27 | libmono-addins-gui-cil-dev (>= 0.3), |
1739 | 28 | liblaunchpad-integration-cil-dev, | 28 | liblaunchpad-integration-cil-dev, |
1740 | 29 | libappindicator0.1-cil-dev, | 29 | libappindicator0.1-cil-dev, |
1743 | 30 | libproxy-dev, | 30 | libproxy-dev |
1742 | 31 | libsyncdaemon-1.0-dev | ||
1744 | 32 | Standards-Version: 3.9.2 | 31 | Standards-Version: 3.9.2 |
1745 | 33 | Homepage: http://www.gnome.org/projects/tomboy/ | 32 | Homepage: http://www.gnome.org/projects/tomboy/ |
1746 | 34 | Vcs-Git: git://git.debian.org/pkg-cli-apps/packages/tomboy.git | 33 | Vcs-Git: git://git.debian.org/pkg-cli-apps/packages/tomboy.git |
1747 | 35 | 34 | ||
1748 | === removed file 'debian/patches/03_u1_as_default_sync.patch' | |||
1749 | --- debian/patches/03_u1_as_default_sync.patch 2011-09-26 23:39:59 +0000 | |||
1750 | +++ debian/patches/03_u1_as_default_sync.patch 1970-01-01 00:00:00 +0000 | |||
1751 | @@ -1,13 +0,0 @@ | |||
1752 | 1 | Index: tomboy/Tomboy/Addins/WebSyncService/WebSyncServiceAddin.cs | ||
1753 | 2 | =================================================================== | ||
1754 | 3 | --- tomboy.orig/Tomboy/Addins/WebSyncService/WebSyncServiceAddin.cs 2011-09-26 22:25:08.135886195 +0100 | ||
1755 | 4 | +++ tomboy/Tomboy/Addins/WebSyncService/WebSyncServiceAddin.cs 2011-09-26 23:37:26.202367732 +0100 | ||
1756 | 5 | @@ -97,6 +97,8 @@ | ||
1757 | 6 | string serverPref; | ||
1758 | 7 | Api.OAuth oauth; | ||
1759 | 8 | GetConfigSettings (out oauth, out serverPref); | ||
1760 | 9 | + if (string.IsNullOrEmpty (serverPref)) | ||
1761 | 10 | + serverPref = "https://one.ubuntu.com/notes/"; | ||
1762 | 11 | prefsWidget = new WebSyncPreferencesWidget (oauth, serverPref, requiredPrefChanged); | ||
1763 | 12 | return prefsWidget; | ||
1764 | 13 | } | ||
1765 | 14 | 0 | ||
1766 | === removed file 'debian/patches/05_add_start_u1_note.patch' | |||
1767 | --- debian/patches/05_add_start_u1_note.patch 2011-07-06 10:06:49 +0000 | |||
1768 | +++ debian/patches/05_add_start_u1_note.patch 1970-01-01 00:00:00 +0000 | |||
1769 | @@ -1,39 +0,0 @@ | |||
1770 | 1 | Index: tomboy-1.7.1/Tomboy/NoteManager.cs | ||
1771 | 2 | =================================================================== | ||
1772 | 3 | --- tomboy-1.7.1.orig/Tomboy/NoteManager.cs 2011-07-06 09:58:29.039428045 +0100 | ||
1773 | 4 | +++ tomboy-1.7.1/Tomboy/NoteManager.cs 2011-07-06 09:58:36.719133213 +0100 | ||
1774 | 5 | @@ -294,6 +294,24 @@ | ||
1775 | 6 | "Also, if you type the name of another note in your " + | ||
1776 | 7 | "current note, it will automatically be linked for you." + | ||
1777 | 8 | "</note-content>"); | ||
1778 | 9 | + string u1_note_content = | ||
1779 | 10 | + Catalog.GetString ("<note-content>" + | ||
1780 | 11 | + "Ubuntu One\n\n" + | ||
1781 | 12 | + "<bold>Tomboy is better with Ubuntu One</bold> - " + | ||
1782 | 13 | + "the personal cloud that brings your digital life together.\n\n" + | ||
1783 | 14 | + "Ubuntu One does more than sync your files - whether you need " + | ||
1784 | 15 | + "to access your contacts, notes or bookmarks from any computer or " + | ||
1785 | 16 | + "the web, enjoy your favorite music from a cloud integrated store " + | ||
1786 | 17 | + "or stream your entire collection to iPhone and Android mobile phones " + | ||
1787 | 18 | + "- we've raised the bar on personal clouds. Learn more at " + | ||
1788 | 19 | + "<link:url>http://one.ubuntu.com/</link:url>.\n\n" + | ||
1789 | 20 | + "Already have an Ubuntu One account? Setup Tomboy to sync with your " + | ||
1790 | 21 | + "personal cloud by clicking Edit > Preferences and then the Synchronization "+ | ||
1791 | 22 | + "tab. Select \"Tomboy Web\" from the list of services and then click the "+ | ||
1792 | 23 | + "\"Connect to Server\" button. A web browser will appear with a few " + | ||
1793 | 24 | + "additional instructions.\n\n" + | ||
1794 | 25 | + "You can even enable automatic sync with Ubuntu One!" + | ||
1795 | 26 | + "</note-content>"); | ||
1796 | 27 | |||
1797 | 28 | try { | ||
1798 | 29 | Note start_note = Create (Catalog.GetString ("Start Here"), | ||
1799 | 30 | @@ -305,6 +323,9 @@ | ||
1800 | 31 | links_note_content); | ||
1801 | 32 | links_note.QueueSave (ChangeType.ContentChanged); | ||
1802 | 33 | |||
1803 | 34 | + Note u1_note = Create ("Ubuntu One", u1_note_content); | ||
1804 | 35 | + u1_note.QueueSave (ChangeType.ContentChanged); | ||
1805 | 36 | + | ||
1806 | 37 | if (!Tomboy.IsPanelApplet) | ||
1807 | 38 | start_note.Window.Show (); | ||
1808 | 39 | } catch (Exception e) { | ||
1809 | 40 | 0 | ||
1810 | === removed file 'debian/patches/06_use_ubuntu_sso.patch' | |||
1811 | --- debian/patches/06_use_ubuntu_sso.patch 2011-08-23 22:47:32 +0000 | |||
1812 | +++ debian/patches/06_use_ubuntu_sso.patch 1970-01-01 00:00:00 +0000 | |||
1813 | @@ -1,555 +0,0 @@ | |||
1814 | 1 | Index: tomboy/Tomboy/Addins/WebSyncService/Makefile.am | ||
1815 | 2 | =================================================================== | ||
1816 | 3 | --- tomboy.orig/Tomboy/Addins/WebSyncService/Makefile.am 2011-08-23 22:54:40.127231333 +0100 | ||
1817 | 4 | +++ tomboy/Tomboy/Addins/WebSyncService/Makefile.am 2011-08-23 23:11:21.488427309 +0100 | ||
1818 | 5 | @@ -27,6 +27,8 @@ | ||
1819 | 6 | $(srcdir)/WebSyncPreferencesWidget.cs \ | ||
1820 | 7 | $(srcdir)/WebSyncServer.cs \ | ||
1821 | 8 | $(srcdir)/WebSyncServiceAddin.cs \ | ||
1822 | 9 | + $(srcdir)/U1SyncServiceAddin.cs \ | ||
1823 | 10 | + $(srcdir)/U1SyncPreferencesWidget.cs \ | ||
1824 | 11 | $(srcdir)/Tests/*.cs \ | ||
1825 | 12 | $(srcdir)/Api/*.cs \ | ||
1826 | 13 | $(srcdir)/Api/Tests/*.cs \ | ||
1827 | 14 | Index: tomboy/Tomboy/Addins/WebSyncService/U1SyncPreferencesWidget.cs | ||
1828 | 15 | =================================================================== | ||
1829 | 16 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
1830 | 17 | +++ tomboy/Tomboy/Addins/WebSyncService/U1SyncPreferencesWidget.cs 2011-08-23 23:18:01.453092749 +0100 | ||
1831 | 18 | @@ -0,0 +1,290 @@ | ||
1832 | 19 | +// Permission is hereby granted, free of charge, to any person obtaining | ||
1833 | 20 | +// a copy of this software and associated documentation files (the | ||
1834 | 21 | +// "Software"), to deal in the Software without restriction, including | ||
1835 | 22 | +// without limitation the rights to use, copy, modify, merge, publish, | ||
1836 | 23 | +// distribute, sublicense, and/or sell copies of the Software, and to | ||
1837 | 24 | +// permit persons to whom the Software is furnished to do so, subject to | ||
1838 | 25 | +// the following conditions: | ||
1839 | 26 | +// | ||
1840 | 27 | +// The above copyright notice and this permission notice shall be | ||
1841 | 28 | +// included in all copies or substantial portions of the Software. | ||
1842 | 29 | +// | ||
1843 | 30 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
1844 | 31 | +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
1845 | 32 | +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
1846 | 33 | +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
1847 | 34 | +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
1848 | 35 | +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
1849 | 36 | +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
1850 | 37 | +// | ||
1851 | 38 | +// Copyright (c) 2010 Canonical, Ltd. (http://www.canonical.com) | ||
1852 | 39 | +// | ||
1853 | 40 | +// Authors: | ||
1854 | 41 | +// Rodrigo Moya <rodrigo.moya@canonical.com> | ||
1855 | 42 | +// | ||
1856 | 43 | + | ||
1857 | 44 | +using System; | ||
1858 | 45 | +using System.Runtime.InteropServices; | ||
1859 | 46 | +using System.Web; | ||
1860 | 47 | +using GLib; | ||
1861 | 48 | + | ||
1862 | 49 | +using Mono.Unix; | ||
1863 | 50 | +using Tomboy.WebSync.Api; | ||
1864 | 51 | +#if !WIN32 | ||
1865 | 52 | +using HL = System.Net; | ||
1866 | 53 | +#else | ||
1867 | 54 | +using HL = MonoHttp; | ||
1868 | 55 | +#endif | ||
1869 | 56 | + | ||
1870 | 57 | +namespace Tomboy.WebSync | ||
1871 | 58 | +{ | ||
1872 | 59 | + public class U1SyncPreferencesWidget : Gtk.VBox | ||
1873 | 60 | + { | ||
1874 | 61 | + private Api.OAuth oauth; | ||
1875 | 62 | + private Gtk.Button authButton; | ||
1876 | 63 | + private SyncdaemonAuthentication sdAuth; | ||
1877 | 64 | + | ||
1878 | 65 | + public U1SyncPreferencesWidget (Api.OAuth oauth, string server) : base (false, 5) | ||
1879 | 66 | + { | ||
1880 | 67 | + sdAuth = new SyncdaemonAuthentication (); | ||
1881 | 68 | + sdAuth.CredentialsFound += OnCredentialsFound; | ||
1882 | 69 | + sdAuth.AuthenticationCancelled += OnAuthCancelled; | ||
1883 | 70 | + sdAuth.AuthenticationError += OnAuthError; | ||
1884 | 71 | + | ||
1885 | 72 | + this.oauth = oauth; | ||
1886 | 73 | + | ||
1887 | 74 | + authButton = new Gtk.Button (); | ||
1888 | 75 | + if (!Auth.IsAccessToken) { | ||
1889 | 76 | + if (this.sdAuth.HasCredentials ()) { | ||
1890 | 77 | + Auth.AuthorizeLocation = "https://one.ubuntu.com/oauth/authorize/"; | ||
1891 | 78 | + Auth.AccessTokenBaseUrl = "https://one.ubuntu.com/oauth/access/"; | ||
1892 | 79 | + Auth.RequestTokenBaseUrl = "https://one.ubuntu.com/oauth/request/"; | ||
1893 | 80 | + Auth.ConsumerKey = sdAuth.ConsumerKey; | ||
1894 | 81 | + Auth.ConsumerSecret = sdAuth.ConsumerSecret; | ||
1895 | 82 | + Auth.Token = sdAuth.Token; | ||
1896 | 83 | + Auth.TokenSecret = sdAuth.TokenSecret; | ||
1897 | 84 | + | ||
1898 | 85 | + authButton.Label = Catalog.GetString ("Already registered"); | ||
1899 | 86 | + authButton.Sensitive = false; | ||
1900 | 87 | + | ||
1901 | 88 | + } else | ||
1902 | 89 | + authButton.Label = Catalog.GetString ("Register this computer"); | ||
1903 | 90 | + } else { | ||
1904 | 91 | + authButton.Label = Catalog.GetString ("Already registered"); | ||
1905 | 92 | + authButton.Sensitive = false; | ||
1906 | 93 | + } | ||
1907 | 94 | + authButton.Clicked += OnAuthButtonClicked; | ||
1908 | 95 | + | ||
1909 | 96 | + Add (authButton); | ||
1910 | 97 | + | ||
1911 | 98 | + ShowAll (); | ||
1912 | 99 | + } | ||
1913 | 100 | + | ||
1914 | 101 | + public string Server { | ||
1915 | 102 | + get { | ||
1916 | 103 | + return "https://one.ubuntu.com/notes/"; | ||
1917 | 104 | + } | ||
1918 | 105 | + } | ||
1919 | 106 | + | ||
1920 | 107 | + public Api.OAuth Auth { | ||
1921 | 108 | + get { return oauth; } | ||
1922 | 109 | + set { | ||
1923 | 110 | + oauth = value; | ||
1924 | 111 | + if (oauth == null) { | ||
1925 | 112 | + authButton.Label = | ||
1926 | 113 | + Catalog.GetString ("Register this computer"); | ||
1927 | 114 | + authButton.Sensitive = true; | ||
1928 | 115 | + } | ||
1929 | 116 | + } | ||
1930 | 117 | + } | ||
1931 | 118 | + | ||
1932 | 119 | + public void OnAuthButtonClicked (object sender, EventArgs args) | ||
1933 | 120 | + { | ||
1934 | 121 | + Auth.AuthorizeLocation = "https://one.ubuntu.com/oauth/authorize/"; | ||
1935 | 122 | + Auth.AccessTokenBaseUrl = "https://one.ubuntu.com/oauth/access/"; | ||
1936 | 123 | + Auth.RequestTokenBaseUrl = "https://one.ubuntu.com/oauth/request/"; | ||
1937 | 124 | + Auth.ConsumerKey = ""; | ||
1938 | 125 | + Auth.ConsumerSecret = ""; | ||
1939 | 126 | + Auth.Realm = ""; | ||
1940 | 127 | + Auth.Token = ""; | ||
1941 | 128 | + Auth.TokenSecret = ""; | ||
1942 | 129 | + | ||
1943 | 130 | + authButton.Label = Catalog.GetString ("Authenticating..."); | ||
1944 | 131 | + authButton.Sensitive = false; | ||
1945 | 132 | + | ||
1946 | 133 | + // Call com.ubuntu.sso | ||
1947 | 134 | + sdAuth.LoginOrRegister (); | ||
1948 | 135 | + } | ||
1949 | 136 | + | ||
1950 | 137 | + public void OnCredentialsFound (object sender, EventArgs args) | ||
1951 | 138 | + { | ||
1952 | 139 | + Auth.AuthorizeLocation = "https://one.ubuntu.com/oauth/authorize/"; | ||
1953 | 140 | + Auth.AccessTokenBaseUrl = "https://one.ubuntu.com/oauth/access/"; | ||
1954 | 141 | + Auth.RequestTokenBaseUrl = "https://one.ubuntu.com/oauth/request/"; | ||
1955 | 142 | + Auth.ConsumerKey = sdAuth.ConsumerKey; | ||
1956 | 143 | + Auth.ConsumerSecret = sdAuth.ConsumerSecret; | ||
1957 | 144 | + Auth.Token = sdAuth.Token; | ||
1958 | 145 | + Auth.TokenSecret = sdAuth.TokenSecret; | ||
1959 | 146 | + | ||
1960 | 147 | + authButton.Label = Catalog.GetString ("Authentication complete. Press Save to start synchronizing"); | ||
1961 | 148 | + } | ||
1962 | 149 | + | ||
1963 | 150 | + public void OnAuthCancelled (object sender, EventArgs args) | ||
1964 | 151 | + { | ||
1965 | 152 | + authButton.Label = Catalog.GetString ("Register this computer"); | ||
1966 | 153 | + authButton.Sensitive = false; | ||
1967 | 154 | + } | ||
1968 | 155 | + | ||
1969 | 156 | + public void OnAuthError (object sender, EventArgs args) | ||
1970 | 157 | + { | ||
1971 | 158 | + } | ||
1972 | 159 | + | ||
1973 | 160 | + | ||
1974 | 161 | + } | ||
1975 | 162 | + | ||
1976 | 163 | + class SyncdaemonAuthentication | ||
1977 | 164 | + { | ||
1978 | 165 | + private IntPtr syncdaemon = IntPtr.Zero; | ||
1979 | 166 | + private IntPtr handle = IntPtr.Zero; | ||
1980 | 167 | + private IntPtr credentials = IntPtr.Zero; | ||
1981 | 168 | + | ||
1982 | 169 | + [DllImport("syncdaemon-1.0")] | ||
1983 | 170 | + static extern IntPtr syncdaemon_daemon_new (); | ||
1984 | 171 | + | ||
1985 | 172 | + [DllImport("syncdaemon-1.0")] | ||
1986 | 173 | + static extern IntPtr syncdaemon_daemon_get_authentication (IntPtr daemon); | ||
1987 | 174 | + | ||
1988 | 175 | + [DllImport("gobject-2.0")] | ||
1989 | 176 | + static extern uint g_signal_connect_data (IntPtr obj, IntPtr name, Delegate cb, IntPtr data, IntPtr p, int flags); | ||
1990 | 177 | + | ||
1991 | 178 | + public SyncdaemonAuthentication () | ||
1992 | 179 | + { | ||
1993 | 180 | + IntPtr native_name; | ||
1994 | 181 | + | ||
1995 | 182 | + this.syncdaemon = syncdaemon_daemon_new (); | ||
1996 | 183 | + this.handle = syncdaemon_daemon_get_authentication (this.syncdaemon); | ||
1997 | 184 | + | ||
1998 | 185 | + native_name = Marshaller.StringToPtrGStrdup ("credentials_found"); | ||
1999 | 186 | + g_signal_connect_data (this.handle, native_name, | ||
2000 | 187 | + new CredentialsFoundDelegate (credentials_found_cb), | ||
2001 | 188 | + new IntPtr (0), new IntPtr (0), 0); | ||
2002 | 189 | + GLib.Marshaller.Free (native_name); | ||
2003 | 190 | + | ||
2004 | 191 | + native_name = Marshaller.StringToPtrGStrdup ("authorization_cancelled"); | ||
2005 | 192 | + g_signal_connect_data (this.handle, native_name, | ||
2006 | 193 | + new AuthCancelledDelegate (auth_cancelled_cb), | ||
2007 | 194 | + new IntPtr (0), new IntPtr (0), 0); | ||
2008 | 195 | + GLib.Marshaller.Free (native_name); | ||
2009 | 196 | + | ||
2010 | 197 | + native_name = Marshaller.StringToPtrGStrdup ("error"); | ||
2011 | 198 | + g_signal_connect_data (this.handle, native_name, | ||
2012 | 199 | + new AuthErrorDelegate (auth_error_cb), | ||
2013 | 200 | + new IntPtr (0), new IntPtr (0), 0); | ||
2014 | 201 | + GLib.Marshaller.Free (native_name); | ||
2015 | 202 | + | ||
2016 | 203 | + } | ||
2017 | 204 | + | ||
2018 | 205 | + [GLib.CDeclCallback] | ||
2019 | 206 | + delegate void CredentialsFoundDelegate (IntPtr auth, IntPtr credentials, IntPtr user_data); | ||
2020 | 207 | + | ||
2021 | 208 | + void credentials_found_cb (IntPtr auth, IntPtr credentials, IntPtr user_data) | ||
2022 | 209 | + { | ||
2023 | 210 | + Logger.Debug ("credentials_found_cb called"); | ||
2024 | 211 | + if (this.CredentialsFound != null) | ||
2025 | 212 | + this.CredentialsFound (this, new EventArgs ()); | ||
2026 | 213 | + } | ||
2027 | 214 | + | ||
2028 | 215 | + [GLib.CDeclCallback] | ||
2029 | 216 | + delegate void AuthCancelledDelegate (IntPtr auth, IntPtr user_data); | ||
2030 | 217 | + | ||
2031 | 218 | + void auth_cancelled_cb (IntPtr auth, IntPtr user_data) | ||
2032 | 219 | + { | ||
2033 | 220 | + Logger.Debug ("auth_cancelled_cb called"); | ||
2034 | 221 | + if (this.AuthenticationCancelled != null) | ||
2035 | 222 | + this.AuthenticationCancelled (this, new EventArgs ()); | ||
2036 | 223 | + } | ||
2037 | 224 | + | ||
2038 | 225 | + [GLib.CDeclCallback] | ||
2039 | 226 | + delegate void AuthErrorDelegate (IntPtr auth, IntPtr error, IntPtr user_data); | ||
2040 | 227 | + | ||
2041 | 228 | + void auth_error_cb (IntPtr auth, IntPtr error, IntPtr user_data) | ||
2042 | 229 | + { | ||
2043 | 230 | + Logger.Debug ("auth_error_cb called"); | ||
2044 | 231 | + if (this.AuthenticationError != null) | ||
2045 | 232 | + this.AuthenticationError (this, new EventArgs ()); | ||
2046 | 233 | + } | ||
2047 | 234 | + | ||
2048 | 235 | + [DllImport("syncdaemon-1.0")] | ||
2049 | 236 | + static extern IntPtr syncdaemon_authentication_find_credentials (IntPtr auth); | ||
2050 | 237 | + | ||
2051 | 238 | + private IntPtr FindCredentials () | ||
2052 | 239 | + { | ||
2053 | 240 | + if (IntPtr.Zero == this.credentials) | ||
2054 | 241 | + this.credentials = syncdaemon_authentication_find_credentials (this.handle); | ||
2055 | 242 | + | ||
2056 | 243 | + return this.credentials; | ||
2057 | 244 | + } | ||
2058 | 245 | + | ||
2059 | 246 | + [DllImport("syncdaemon-1.0")] | ||
2060 | 247 | + static extern string syncdaemon_credentials_get_consumer_key (IntPtr credentials); | ||
2061 | 248 | + | ||
2062 | 249 | + public string ConsumerKey { | ||
2063 | 250 | + get { | ||
2064 | 251 | + IntPtr raw = syncdaemon_authentication_find_credentials (this.handle); | ||
2065 | 252 | + return syncdaemon_credentials_get_consumer_key (raw); | ||
2066 | 253 | + } | ||
2067 | 254 | + } | ||
2068 | 255 | + | ||
2069 | 256 | + [DllImport("syncdaemon-1.0")] | ||
2070 | 257 | + static extern string syncdaemon_credentials_get_consumer_secret (IntPtr credentials); | ||
2071 | 258 | + | ||
2072 | 259 | + public string ConsumerSecret { | ||
2073 | 260 | + get { | ||
2074 | 261 | + IntPtr raw = syncdaemon_authentication_find_credentials (this.handle); | ||
2075 | 262 | + return syncdaemon_credentials_get_consumer_secret (raw); | ||
2076 | 263 | + } | ||
2077 | 264 | + } | ||
2078 | 265 | + | ||
2079 | 266 | + [DllImport("syncdaemon-1.0")] | ||
2080 | 267 | + static extern string syncdaemon_credentials_get_token (IntPtr credentials); | ||
2081 | 268 | + | ||
2082 | 269 | + public string Token { | ||
2083 | 270 | + get { | ||
2084 | 271 | + IntPtr raw = syncdaemon_authentication_find_credentials (this.handle); | ||
2085 | 272 | + return syncdaemon_credentials_get_token (raw); | ||
2086 | 273 | + } | ||
2087 | 274 | + } | ||
2088 | 275 | + | ||
2089 | 276 | + [DllImport("syncdaemon-1.0")] | ||
2090 | 277 | + static extern string syncdaemon_credentials_get_token_secret (IntPtr credentials); | ||
2091 | 278 | + | ||
2092 | 279 | + public string TokenSecret { | ||
2093 | 280 | + get { | ||
2094 | 281 | + IntPtr raw = syncdaemon_authentication_find_credentials (this.handle); | ||
2095 | 282 | + return syncdaemon_credentials_get_token_secret (raw); | ||
2096 | 283 | + } | ||
2097 | 284 | + } | ||
2098 | 285 | + | ||
2099 | 286 | + [DllImport("syncdaemon-1.0")] | ||
2100 | 287 | + static extern bool syncdaemon_authentication_has_credentials (IntPtr auth); | ||
2101 | 288 | + | ||
2102 | 289 | + public bool HasCredentials () | ||
2103 | 290 | + { | ||
2104 | 291 | + return syncdaemon_authentication_has_credentials (this.handle); | ||
2105 | 292 | + } | ||
2106 | 293 | + | ||
2107 | 294 | + [DllImport("syncdaemon-1.0")] | ||
2108 | 295 | + static extern void syncdaemon_authentication_login_or_register (IntPtr auth); | ||
2109 | 296 | + | ||
2110 | 297 | + public void LoginOrRegister () | ||
2111 | 298 | + { | ||
2112 | 299 | + syncdaemon_authentication_login_or_register (this.handle); | ||
2113 | 300 | + } | ||
2114 | 301 | + | ||
2115 | 302 | + public event EventHandler CredentialsFound; | ||
2116 | 303 | + | ||
2117 | 304 | + public event EventHandler AuthenticationCancelled; | ||
2118 | 305 | + | ||
2119 | 306 | + public event EventHandler AuthenticationError; | ||
2120 | 307 | + } | ||
2121 | 308 | +} | ||
2122 | 309 | Index: tomboy/Tomboy/Addins/WebSyncService/U1SyncServiceAddin.cs | ||
2123 | 310 | =================================================================== | ||
2124 | 311 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
2125 | 312 | +++ tomboy/Tomboy/Addins/WebSyncService/U1SyncServiceAddin.cs 2011-08-23 23:14:17.277675713 +0100 | ||
2126 | 313 | @@ -0,0 +1,229 @@ | ||
2127 | 314 | +// Permission is hereby granted, free of charge, to any person obtaining | ||
2128 | 315 | +// a copy of this software and associated documentation files (the | ||
2129 | 316 | +// "Software"), to deal in the Software without restriction, including | ||
2130 | 317 | +// without limitation the rights to use, copy, modify, merge, publish, | ||
2131 | 318 | +// distribute, sublicense, and/or sell copies of the Software, and to | ||
2132 | 319 | +// permit persons to whom the Software is furnished to do so, subject to | ||
2133 | 320 | +// the following conditions: | ||
2134 | 321 | +// | ||
2135 | 322 | +// The above copyright notice and this permission notice shall be | ||
2136 | 323 | +// included in all copies or substantial portions of the Software. | ||
2137 | 324 | +// | ||
2138 | 325 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
2139 | 326 | +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
2140 | 327 | +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
2141 | 328 | +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
2142 | 329 | +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
2143 | 330 | +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
2144 | 331 | +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
2145 | 332 | +// | ||
2146 | 333 | +// Copyright (c) 2010 Canonical, Ltd. (http://www.canonical.com) | ||
2147 | 334 | +// | ||
2148 | 335 | +// Authors: | ||
2149 | 336 | +// Rodrigo Moya <rodrigo.moya@canonical.com> | ||
2150 | 337 | +// | ||
2151 | 338 | + | ||
2152 | 339 | +using System; | ||
2153 | 340 | + | ||
2154 | 341 | +using Mono.Unix; | ||
2155 | 342 | + | ||
2156 | 343 | +using Tomboy.Sync; | ||
2157 | 344 | + | ||
2158 | 345 | +namespace Tomboy.WebSync | ||
2159 | 346 | +{ | ||
2160 | 347 | + public class U1SyncServiceAddin : SyncServiceAddin | ||
2161 | 348 | + { | ||
2162 | 349 | + private bool initialized; | ||
2163 | 350 | + private U1SyncPreferencesWidget prefsWidget; | ||
2164 | 351 | + | ||
2165 | 352 | + private const string serverUrlPrefPath = | ||
2166 | 353 | + "/apps/tomboy/sync/ubuntuone/server"; | ||
2167 | 354 | + private const string accessTokenBaseUrlPrefPath = | ||
2168 | 355 | + "/apps/tomboy/sync/ubuntuone/oauth_access_token_base_url"; | ||
2169 | 356 | + private const string authorizeLocationPrefPath = | ||
2170 | 357 | + "/apps/tomboy/sync/ubuntuone/oauth_authorize_location"; | ||
2171 | 358 | + private const string consumerKeyPrefPath = | ||
2172 | 359 | + "/apps/tomboy/sync/ubuntuone/oauth_consumer_key"; | ||
2173 | 360 | + private const string consumerSecretPrefPath = | ||
2174 | 361 | + "/apps/tomboy/sync/ubuntuone/oauth_consumer_secret"; | ||
2175 | 362 | + private const string realmPrefPath = | ||
2176 | 363 | + "/apps/tomboy/sync/ubuntuone/oauth_realm"; | ||
2177 | 364 | + private const string requestTokenBaseUrlPrefPath = | ||
2178 | 365 | + "/apps/tomboy/sync/ubuntuone/oauth_request_token_base_url"; | ||
2179 | 366 | + private const string tokenPrefPath = | ||
2180 | 367 | + "/apps/tomboy/sync/ubuntuone/oauth_token"; | ||
2181 | 368 | + private const string tokenSecretPrefPath = | ||
2182 | 369 | + "/apps/tomboy/sync/ubuntuone/oauth_token_secret"; | ||
2183 | 370 | + | ||
2184 | 371 | + public U1SyncServiceAddin () | ||
2185 | 372 | + { | ||
2186 | 373 | + } | ||
2187 | 374 | + | ||
2188 | 375 | + #region SyncServiceAddin Overrides | ||
2189 | 376 | + | ||
2190 | 377 | + public override string Id { | ||
2191 | 378 | + get { return "ubuntuone"; } | ||
2192 | 379 | + } | ||
2193 | 380 | + | ||
2194 | 381 | + public override string Name { | ||
2195 | 382 | + get { | ||
2196 | 383 | + return Catalog.GetString ("Ubuntu One"); | ||
2197 | 384 | + } | ||
2198 | 385 | + } | ||
2199 | 386 | + | ||
2200 | 387 | + public override bool IsConfigured { | ||
2201 | 388 | + get { | ||
2202 | 389 | + string serverPref; | ||
2203 | 390 | + Api.OAuth oauth; | ||
2204 | 391 | + GetConfigSettings (out oauth, out serverPref); | ||
2205 | 392 | + return !string.IsNullOrEmpty (serverPref) && | ||
2206 | 393 | + oauth != null && | ||
2207 | 394 | + oauth.IsAccessToken; | ||
2208 | 395 | + } | ||
2209 | 396 | + } | ||
2210 | 397 | + | ||
2211 | 398 | + public override bool IsSupported { | ||
2212 | 399 | + get { | ||
2213 | 400 | + return true; // TODO: Ever false? | ||
2214 | 401 | + } | ||
2215 | 402 | + } | ||
2216 | 403 | + | ||
2217 | 404 | + public override Gtk.Widget CreatePreferencesControl (EventHandler requiredPrefChanged) | ||
2218 | 405 | + { | ||
2219 | 406 | + string serverPref; | ||
2220 | 407 | + Api.OAuth oauth; | ||
2221 | 408 | + GetConfigSettings (out oauth, out serverPref); | ||
2222 | 409 | + prefsWidget = new U1SyncPreferencesWidget (oauth, serverPref); | ||
2223 | 410 | + return prefsWidget; | ||
2224 | 411 | + } | ||
2225 | 412 | + | ||
2226 | 413 | + public override SyncServer CreateSyncServer () | ||
2227 | 414 | + { | ||
2228 | 415 | + string serverPref; | ||
2229 | 416 | + Api.OAuth oauth; | ||
2230 | 417 | + GetConfigSettings (out oauth, out serverPref); | ||
2231 | 418 | + return new WebSyncServer (serverPref, oauth); | ||
2232 | 419 | + } | ||
2233 | 420 | + | ||
2234 | 421 | + public override void PostSyncCleanup () | ||
2235 | 422 | + { | ||
2236 | 423 | + } | ||
2237 | 424 | + | ||
2238 | 425 | + public override void ResetConfiguration () | ||
2239 | 426 | + { | ||
2240 | 427 | + SaveConfigSettings (null, null); | ||
2241 | 428 | + prefsWidget.Auth = null; | ||
2242 | 429 | + } | ||
2243 | 430 | + | ||
2244 | 431 | + public override bool SaveConfiguration () | ||
2245 | 432 | + { | ||
2246 | 433 | + // TODO: Is this really sufficient validation? | ||
2247 | 434 | + // Should we try a REST API request? | ||
2248 | 435 | + if (prefsWidget.Auth == null || | ||
2249 | 436 | + prefsWidget.Auth.ConsumerKey == null || | ||
2250 | 437 | + prefsWidget.Auth.ConsumerSecret == null || | ||
2251 | 438 | + prefsWidget.Auth.Token == null || | ||
2252 | 439 | + prefsWidget.Auth.TokenSecret == null) | ||
2253 | 440 | + return false; | ||
2254 | 441 | + SaveConfigSettings (prefsWidget.Auth, prefsWidget.Server); | ||
2255 | 442 | + return true; | ||
2256 | 443 | + } | ||
2257 | 444 | + | ||
2258 | 445 | + #endregion | ||
2259 | 446 | + | ||
2260 | 447 | + #region ApplicationAddin Overrides | ||
2261 | 448 | + | ||
2262 | 449 | + public override void Initialize () | ||
2263 | 450 | + { | ||
2264 | 451 | + initialized = true; | ||
2265 | 452 | + } | ||
2266 | 453 | + | ||
2267 | 454 | + public override void Shutdown () | ||
2268 | 455 | + { | ||
2269 | 456 | + initialized = false; | ||
2270 | 457 | + } | ||
2271 | 458 | + | ||
2272 | 459 | + public override bool Initialized { | ||
2273 | 460 | + get { return initialized; } | ||
2274 | 461 | + } | ||
2275 | 462 | + | ||
2276 | 463 | + #endregion | ||
2277 | 464 | + | ||
2278 | 465 | + #region Private Members | ||
2279 | 466 | + | ||
2280 | 467 | + private void GetConfigSettings (out Api.OAuth oauthConfig, out string serverPref) | ||
2281 | 468 | + { | ||
2282 | 469 | + serverPref = (string) | ||
2283 | 470 | + Preferences.Get (serverUrlPrefPath); | ||
2284 | 471 | + | ||
2285 | 472 | + oauthConfig = new Api.OAuth (); | ||
2286 | 473 | + oauthConfig.AccessTokenBaseUrl = | ||
2287 | 474 | + Preferences.Get (accessTokenBaseUrlPrefPath) as string; | ||
2288 | 475 | + oauthConfig.AuthorizeLocation = | ||
2289 | 476 | + Preferences.Get (authorizeLocationPrefPath) as string; | ||
2290 | 477 | + oauthConfig.ConsumerKey = | ||
2291 | 478 | + Preferences.Get (consumerKeyPrefPath) as string; | ||
2292 | 479 | + oauthConfig.ConsumerSecret = | ||
2293 | 480 | + Preferences.Get (consumerSecretPrefPath) as string; | ||
2294 | 481 | + oauthConfig.Realm = | ||
2295 | 482 | + Preferences.Get (realmPrefPath) as string; | ||
2296 | 483 | + oauthConfig.RequestTokenBaseUrl = | ||
2297 | 484 | + Preferences.Get (requestTokenBaseUrlPrefPath) as string; | ||
2298 | 485 | + oauthConfig.Token = | ||
2299 | 486 | + Preferences.Get (tokenPrefPath) as string; | ||
2300 | 487 | + oauthConfig.TokenSecret = | ||
2301 | 488 | + Preferences.Get (tokenSecretPrefPath) as string; | ||
2302 | 489 | + | ||
2303 | 490 | + // The fact that the configuration was saved at all | ||
2304 | 491 | + // implies that the token is an access token. | ||
2305 | 492 | + // TODO: Any benefit in actually storing this bool, in | ||
2306 | 493 | + // case of weird circumstances? | ||
2307 | 494 | + oauthConfig.IsAccessToken = | ||
2308 | 495 | + !String.IsNullOrEmpty (oauthConfig.Token); | ||
2309 | 496 | + } | ||
2310 | 497 | + | ||
2311 | 498 | + private void SaveConfigSettings (Api.OAuth oauthConfig, string serverPref) | ||
2312 | 499 | + { | ||
2313 | 500 | + Preferences.Set (serverUrlPrefPath, GetConfigString (serverPref)); | ||
2314 | 501 | + Preferences.Set (accessTokenBaseUrlPrefPath, | ||
2315 | 502 | + oauthConfig != null ? | ||
2316 | 503 | + GetConfigString (oauthConfig.AccessTokenBaseUrl) : | ||
2317 | 504 | + String.Empty); | ||
2318 | 505 | + Preferences.Set (authorizeLocationPrefPath, | ||
2319 | 506 | + oauthConfig != null ? | ||
2320 | 507 | + GetConfigString (oauthConfig.AuthorizeLocation) : | ||
2321 | 508 | + String.Empty); | ||
2322 | 509 | + Preferences.Set (consumerKeyPrefPath, | ||
2323 | 510 | + oauthConfig != null ? | ||
2324 | 511 | + GetConfigString (oauthConfig.ConsumerKey) : | ||
2325 | 512 | + String.Empty); | ||
2326 | 513 | + Preferences.Set (consumerSecretPrefPath, | ||
2327 | 514 | + oauthConfig != null ? | ||
2328 | 515 | + GetConfigString (oauthConfig.ConsumerSecret) : | ||
2329 | 516 | + String.Empty); | ||
2330 | 517 | + Preferences.Set (realmPrefPath, | ||
2331 | 518 | + oauthConfig != null ? | ||
2332 | 519 | + GetConfigString (oauthConfig.Realm) : | ||
2333 | 520 | + String.Empty); | ||
2334 | 521 | + Preferences.Set (requestTokenBaseUrlPrefPath, | ||
2335 | 522 | + oauthConfig != null ? | ||
2336 | 523 | + GetConfigString (oauthConfig.RequestTokenBaseUrl) : | ||
2337 | 524 | + String.Empty); | ||
2338 | 525 | + Preferences.Set (tokenPrefPath, | ||
2339 | 526 | + oauthConfig != null ? | ||
2340 | 527 | + GetConfigString (oauthConfig.Token) : | ||
2341 | 528 | + String.Empty); | ||
2342 | 529 | + Preferences.Set (tokenSecretPrefPath, | ||
2343 | 530 | + oauthConfig != null ? | ||
2344 | 531 | + GetConfigString (oauthConfig.TokenSecret) : | ||
2345 | 532 | + String.Empty); | ||
2346 | 533 | + } | ||
2347 | 534 | + | ||
2348 | 535 | + private string GetConfigString (string val) | ||
2349 | 536 | + { | ||
2350 | 537 | + return val ?? String.Empty; | ||
2351 | 538 | + } | ||
2352 | 539 | + | ||
2353 | 540 | + #endregion | ||
2354 | 541 | + } | ||
2355 | 542 | +} | ||
2356 | 543 | Index: tomboy/Tomboy/Addins/WebSyncService/WebSyncService.addin.xml | ||
2357 | 544 | =================================================================== | ||
2358 | 545 | --- tomboy.orig/Tomboy/Addins/WebSyncService/WebSyncService.addin.xml 2011-08-23 22:54:40.139230862 +0100 | ||
2359 | 546 | +++ tomboy/Tomboy/Addins/WebSyncService/WebSyncService.addin.xml 2011-08-23 23:11:21.488427309 +0100 | ||
2360 | 547 | @@ -18,4 +18,8 @@ | ||
2361 | 548 | <Extension path="/Tomboy/SyncServiceAddins"> | ||
2362 | 549 | <SyncServiceAddin type="Tomboy.WebSync.WebSyncServiceAddin" /> | ||
2363 | 550 | </Extension> | ||
2364 | 551 | + | ||
2365 | 552 | + <Extension path="/Tomboy/SyncServiceAddins"> | ||
2366 | 553 | + <SyncServiceAddin type="Tomboy.WebSync.U1SyncServiceAddin" /> | ||
2367 | 554 | + </Extension> | ||
2368 | 555 | </Addin> | ||
2369 | 556 | 0 | ||
2370 | === added file 'debian/patches/32_logout_delay.patch' | |||
2371 | --- debian/patches/32_logout_delay.patch 1970-01-01 00:00:00 +0000 | |||
2372 | +++ debian/patches/32_logout_delay.patch 2013-02-05 16:50:59 +0000 | |||
2373 | @@ -0,0 +1,42 @@ | |||
2374 | 1 | From 84797b9a9df3c84b329fbed946478f0171f5163c Mon Sep 17 00:00:00 2001 | ||
2375 | 2 | From: Jared Jennings <jjennings@src.gnome.org> | ||
2376 | 3 | Date: Mon, 16 Jan 2012 16:51:04 +0000 | ||
2377 | 4 | Subject: Sam Lin has provided a patch to address slow Logouts | ||
2378 | 5 | |||
2379 | 6 | Sam added Stop signal callback in Tomboy and it solved the issue. | ||
2380 | 7 | bgo #650029 | ||
2381 | 8 | --- | ||
2382 | 9 | diff --git a/Tomboy/GnomeApplication.cs b/Tomboy/GnomeApplication.cs | ||
2383 | 10 | index b076003..b2ef6f0 100644 | ||
2384 | 11 | --- a/Tomboy/GnomeApplication.cs | ||
2385 | 12 | +++ b/Tomboy/GnomeApplication.cs | ||
2386 | 13 | @@ -67,6 +67,7 @@ namespace Tomboy | ||
2387 | 14 | session_client_id); | ||
2388 | 15 | client.QueryEndSession += OnQueryEndSession; | ||
2389 | 16 | client.EndSession += OnEndSession; | ||
2390 | 17 | + client.Stop += OnStop; | ||
2391 | 18 | } catch (Exception e) { | ||
2392 | 19 | Logger.Debug ("Failed to register with session manager: {0}", e.Message); | ||
2393 | 20 | } | ||
2394 | 21 | @@ -142,6 +143,10 @@ namespace Tomboy | ||
2395 | 22 | System.Environment.Exit (0); | ||
2396 | 23 | } | ||
2397 | 24 | |||
2398 | 25 | + private void OnStop () { | ||
2399 | 26 | + Exit(0); | ||
2400 | 27 | + } | ||
2401 | 28 | + | ||
2402 | 29 | private void OnQueryEndSession (uint flags) | ||
2403 | 30 | { | ||
2404 | 31 | Logger.Info ("Received end session query"); | ||
2405 | 32 | @@ -175,6 +180,7 @@ namespace Tomboy | ||
2406 | 33 | } catch (Exception e) { | ||
2407 | 34 | Logger.Debug ("Failed to respond to session manager: {0}", e.Message); | ||
2408 | 35 | } | ||
2409 | 36 | + Exit (0); | ||
2410 | 37 | } | ||
2411 | 38 | |||
2412 | 39 | public void OpenUrl (string url, Gdk.Screen screen) | ||
2413 | 40 | -- | ||
2414 | 41 | cgit v0.9.0.2 | ||
2415 | 42 | |||
2416 | 0 | 43 | ||
2417 | === modified file 'debian/patches/series' | |||
2418 | --- debian/patches/series 2011-09-26 23:39:59 +0000 | |||
2419 | +++ debian/patches/series 2013-02-05 16:50:59 +0000 | |||
2420 | @@ -1,9 +1,7 @@ | |||
2421 | 1 | 01_dllmaps.patch | 1 | 01_dllmaps.patch |
2422 | 2 | 03_u1_as_default_sync.patch | ||
2423 | 3 | 04_app_indicator.patch | 2 | 04_app_indicator.patch |
2424 | 4 | 05_add_start_u1_note.patch | ||
2425 | 5 | #06_use_ubuntu_sso.patch | ||
2426 | 6 | 11_lpi.patch | 3 | 11_lpi.patch |
2427 | 7 | 20_remove_pcfile_requires | 4 | 20_remove_pcfile_requires |
2428 | 8 | 30_fix_manpage_syntax | 5 | 30_fix_manpage_syntax |
2429 | 9 | 31_prevent_inadvertent_deletion_of_notes.patch | 6 | 31_prevent_inadvertent_deletion_of_notes.patch |
2430 | 7 | 32_logout_delay.patch |
sponsored.
Please ensure you test your branch, you didn't remove the pre-applied patch from the vcs files, so the patches were still here. I had to redo the branch with quilt pop -a, and then, taking your debian/ dir.
Marking as merged.