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