Merge lp:~dobey/ubuntu/quantal/tomboy/no-more-u1 into lp:ubuntu/quantal/tomboy

Proposed by dobey
Status: Merged
Merge reported by: Martin Pitt
Merged at revision: not available
Proposed branch: lp:~dobey/ubuntu/quantal/tomboy/no-more-u1
Merge into: lp:ubuntu/quantal/tomboy
Diff against target: 681 lines (+10/-636)
6 files modified
debian/changelog (+10/-0)
debian/patches/02_sync_save_button_sensitive.patch (+0/-25)
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/series (+0/-4)
To merge this branch: bzr merge lp:~dobey/ubuntu/quantal/tomboy/no-more-u1
Reviewer Review Type Date Requested Status
Didier Roche-Tolomelli Approve
Ubuntu branches Pending
Review via email: mp+146674@code.launchpad.net

Description of the change

* debian/patches/02_sync_save_button_sensitive.patch:
* debian/patches/03_u1_as_default_sync.patch:
* debian/patches/05_add_start_u1_note.patch:
* debian/patches/06_use_ubuntu_sso.patch:
  - Remove patches to default to Ubuntu One for notes sync. (LP: #1115460)

To post a comment you must log in.
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

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.

review: Approve
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

(Note that I needed to change the version to 1.12.0-1ubuntu1.1 as (1.12.0-1ubuntu2 was already in the archive)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2012-09-25 11:01:34 +0000
+++ debian/changelog 2013-02-05 16:50:52 +0000
@@ -1,3 +1,13 @@
1tomboy (1.12.0-1ubuntu2) quantal-proposed; urgency=low
2
3 * debian/patches/02_sync_save_button_sensitive.patch:
4 * debian/patches/03_u1_as_default_sync.patch:
5 * debian/patches/05_add_start_u1_note.patch:
6 * debian/patches/06_use_ubuntu_sso.patch:
7 - Remove patches to default to Ubuntu One for notes sync. (LP: #1115460)
8
9 -- Rodney Dawes <rodney.dawes@ubuntu.com> Tue, 05 Feb 2013 11:26:05 -0500
10
1tomboy (1.12.0-1ubuntu1) quantal; urgency=low11tomboy (1.12.0-1ubuntu1) quantal; urgency=low
212
3 * Rebase on Debian experimental, remaining changes13 * Rebase on Debian experimental, remaining changes
414
=== removed file 'debian/patches/02_sync_save_button_sensitive.patch'
--- debian/patches/02_sync_save_button_sensitive.patch 2012-05-03 21:17:32 +0000
+++ debian/patches/02_sync_save_button_sensitive.patch 1970-01-01 00:00:00 +0000
@@ -1,25 +0,0 @@
1Description: Ensure the save button is sensitive when setting up WebSync.
2This is a work around, but gets us back to where we were in Natty. Upstream
3relies on the entries changing to set the button sensitive, however we
4pre-populate the fields with ubuntuone settings. If these don't get changed
5the user can not save the settings even after successful auth. Ideally it
6should become sensitive when Auth.IsAccessToken becomes true.
7Author: Ken VanDine <ken.vandine@ubuntu.com>
8Bug-Ubuntu: https://launchpad.net/bugs/845321
9Bug: https://bugzilla.gnome.org/show_bug.cgi?id=473332
10Forwarded: not-needed
11
12=== modified file 'Tomboy/PreferencesDialog.cs'
13Index: tomboy/Tomboy/PreferencesDialog.cs
14===================================================================
15--- tomboy.orig/Tomboy/PreferencesDialog.cs 2012-05-03 21:16:57.692547228 +0100
16+++ tomboy/Tomboy/PreferencesDialog.cs 2012-05-03 21:17:00.604547100 +0100
17@@ -1113,7 +1113,7 @@
18 syncAddinPrefsContainer.PackStart (syncAddinPrefsWidget, false, false, 0);
19
20 resetSyncAddinButton.Sensitive = false;
21- saveSyncAddinButton.Sensitive = false;
22+ saveSyncAddinButton.Sensitive = true;
23 }
24 } else {
25 selectedSyncAddin = null;
260
=== removed file 'debian/patches/03_u1_as_default_sync.patch'
--- debian/patches/03_u1_as_default_sync.patch 2012-05-03 21:17:32 +0000
+++ debian/patches/03_u1_as_default_sync.patch 1970-01-01 00:00:00 +0000
@@ -1,13 +0,0 @@
1Index: tomboy/Tomboy/Addins/WebSyncService/WebSyncServiceAddin.cs
2===================================================================
3--- tomboy.orig/Tomboy/Addins/WebSyncService/WebSyncServiceAddin.cs 2012-05-03 21:16:57.656547230 +0100
4+++ tomboy/Tomboy/Addins/WebSyncService/WebSyncServiceAddin.cs 2012-05-03 21:17:00.788547091 +0100
5@@ -97,6 +97,8 @@
6 string serverPref;
7 Api.OAuth oauth;
8 GetConfigSettings (out oauth, out serverPref);
9+ if (string.IsNullOrEmpty (serverPref))
10+ serverPref = "https://one.ubuntu.com/notes/";
11 prefsWidget = new WebSyncPreferencesWidget (oauth, serverPref, requiredPrefChanged);
12 return prefsWidget;
13 }
140
=== removed file 'debian/patches/05_add_start_u1_note.patch'
--- debian/patches/05_add_start_u1_note.patch 2012-05-03 21:17:32 +0000
+++ debian/patches/05_add_start_u1_note.patch 1970-01-01 00:00:00 +0000
@@ -1,39 +0,0 @@
1Index: tomboy/Tomboy/NoteManager.cs
2===================================================================
3--- tomboy.orig/Tomboy/NoteManager.cs 2012-05-03 21:17:00.972547084 +0100
4+++ tomboy/Tomboy/NoteManager.cs 2012-05-03 21:17:01.280547071 +0100
5@@ -298,6 +298,24 @@
6 "Also, if you type the name of another note in your " +
7 "current note, it will automatically be linked for you." +
8 "</note-content>");
9+ string u1_note_content =
10+ Catalog.GetString ("<note-content>" +
11+ "Ubuntu One\n\n" +
12+ "<bold>Tomboy is better with Ubuntu One</bold> - " +
13+ "the personal cloud that brings your digital life together.\n\n" +
14+ "Ubuntu One does more than sync your files - whether you need " +
15+ "to access your contacts, notes or bookmarks from any computer or " +
16+ "the web, enjoy your favorite music from a cloud integrated store " +
17+ "or stream your entire collection to iPhone and Android mobile phones " +
18+ "- we've raised the bar on personal clouds. Learn more at " +
19+ "<link:url>http://one.ubuntu.com/</link:url>.\n\n" +
20+ "Already have an Ubuntu One account? Setup Tomboy to sync with your " +
21+ "personal cloud by clicking Edit > Preferences and then the Synchronization "+
22+ "tab. Select \"Tomboy Web\" from the list of services and then click the "+
23+ "\"Connect to Server\" button. A web browser will appear with a few " +
24+ "additional instructions.\n\n" +
25+ "You can even enable automatic sync with Ubuntu One!" +
26+ "</note-content>");
27
28 try {
29 Note start_note = Create (Catalog.GetString ("Start Here"),
30@@ -309,6 +327,9 @@
31 links_note_content);
32 links_note.QueueSave (ChangeType.ContentChanged);
33
34+ Note u1_note = Create ("Ubuntu One", u1_note_content);
35+ u1_note.QueueSave (ChangeType.ContentChanged);
36+
37 if (!Tomboy.IsPanelApplet)
38 start_note.Window.Show ();
39 } catch (Exception e) {
400
=== removed file 'debian/patches/06_use_ubuntu_sso.patch'
--- debian/patches/06_use_ubuntu_sso.patch 2011-08-23 22:47:32 +0000
+++ debian/patches/06_use_ubuntu_sso.patch 1970-01-01 00:00:00 +0000
@@ -1,555 +0,0 @@
1Index: tomboy/Tomboy/Addins/WebSyncService/Makefile.am
2===================================================================
3--- tomboy.orig/Tomboy/Addins/WebSyncService/Makefile.am 2011-08-23 22:54:40.127231333 +0100
4+++ tomboy/Tomboy/Addins/WebSyncService/Makefile.am 2011-08-23 23:11:21.488427309 +0100
5@@ -27,6 +27,8 @@
6 $(srcdir)/WebSyncPreferencesWidget.cs \
7 $(srcdir)/WebSyncServer.cs \
8 $(srcdir)/WebSyncServiceAddin.cs \
9+ $(srcdir)/U1SyncServiceAddin.cs \
10+ $(srcdir)/U1SyncPreferencesWidget.cs \
11 $(srcdir)/Tests/*.cs \
12 $(srcdir)/Api/*.cs \
13 $(srcdir)/Api/Tests/*.cs \
14Index: tomboy/Tomboy/Addins/WebSyncService/U1SyncPreferencesWidget.cs
15===================================================================
16--- /dev/null 1970-01-01 00:00:00.000000000 +0000
17+++ tomboy/Tomboy/Addins/WebSyncService/U1SyncPreferencesWidget.cs 2011-08-23 23:18:01.453092749 +0100
18@@ -0,0 +1,290 @@
19+// Permission is hereby granted, free of charge, to any person obtaining
20+// a copy of this software and associated documentation files (the
21+// "Software"), to deal in the Software without restriction, including
22+// without limitation the rights to use, copy, modify, merge, publish,
23+// distribute, sublicense, and/or sell copies of the Software, and to
24+// permit persons to whom the Software is furnished to do so, subject to
25+// the following conditions:
26+//
27+// The above copyright notice and this permission notice shall be
28+// included in all copies or substantial portions of the Software.
29+//
30+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
31+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
33+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
34+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
35+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
36+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37+//
38+// Copyright (c) 2010 Canonical, Ltd. (http://www.canonical.com)
39+//
40+// Authors:
41+// Rodrigo Moya <rodrigo.moya@canonical.com>
42+//
43+
44+using System;
45+using System.Runtime.InteropServices;
46+using System.Web;
47+using GLib;
48+
49+using Mono.Unix;
50+using Tomboy.WebSync.Api;
51+#if !WIN32
52+using HL = System.Net;
53+#else
54+using HL = MonoHttp;
55+#endif
56+
57+namespace Tomboy.WebSync
58+{
59+ public class U1SyncPreferencesWidget : Gtk.VBox
60+ {
61+ private Api.OAuth oauth;
62+ private Gtk.Button authButton;
63+ private SyncdaemonAuthentication sdAuth;
64+
65+ public U1SyncPreferencesWidget (Api.OAuth oauth, string server) : base (false, 5)
66+ {
67+ sdAuth = new SyncdaemonAuthentication ();
68+ sdAuth.CredentialsFound += OnCredentialsFound;
69+ sdAuth.AuthenticationCancelled += OnAuthCancelled;
70+ sdAuth.AuthenticationError += OnAuthError;
71+
72+ this.oauth = oauth;
73+
74+ authButton = new Gtk.Button ();
75+ if (!Auth.IsAccessToken) {
76+ if (this.sdAuth.HasCredentials ()) {
77+ Auth.AuthorizeLocation = "https://one.ubuntu.com/oauth/authorize/";
78+ Auth.AccessTokenBaseUrl = "https://one.ubuntu.com/oauth/access/";
79+ Auth.RequestTokenBaseUrl = "https://one.ubuntu.com/oauth/request/";
80+ Auth.ConsumerKey = sdAuth.ConsumerKey;
81+ Auth.ConsumerSecret = sdAuth.ConsumerSecret;
82+ Auth.Token = sdAuth.Token;
83+ Auth.TokenSecret = sdAuth.TokenSecret;
84+
85+ authButton.Label = Catalog.GetString ("Already registered");
86+ authButton.Sensitive = false;
87+
88+ } else
89+ authButton.Label = Catalog.GetString ("Register this computer");
90+ } else {
91+ authButton.Label = Catalog.GetString ("Already registered");
92+ authButton.Sensitive = false;
93+ }
94+ authButton.Clicked += OnAuthButtonClicked;
95+
96+ Add (authButton);
97+
98+ ShowAll ();
99+ }
100+
101+ public string Server {
102+ get {
103+ return "https://one.ubuntu.com/notes/";
104+ }
105+ }
106+
107+ public Api.OAuth Auth {
108+ get { return oauth; }
109+ set {
110+ oauth = value;
111+ if (oauth == null) {
112+ authButton.Label =
113+ Catalog.GetString ("Register this computer");
114+ authButton.Sensitive = true;
115+ }
116+ }
117+ }
118+
119+ public void OnAuthButtonClicked (object sender, EventArgs args)
120+ {
121+ Auth.AuthorizeLocation = "https://one.ubuntu.com/oauth/authorize/";
122+ Auth.AccessTokenBaseUrl = "https://one.ubuntu.com/oauth/access/";
123+ Auth.RequestTokenBaseUrl = "https://one.ubuntu.com/oauth/request/";
124+ Auth.ConsumerKey = "";
125+ Auth.ConsumerSecret = "";
126+ Auth.Realm = "";
127+ Auth.Token = "";
128+ Auth.TokenSecret = "";
129+
130+ authButton.Label = Catalog.GetString ("Authenticating...");
131+ authButton.Sensitive = false;
132+
133+ // Call com.ubuntu.sso
134+ sdAuth.LoginOrRegister ();
135+ }
136+
137+ public void OnCredentialsFound (object sender, EventArgs args)
138+ {
139+ Auth.AuthorizeLocation = "https://one.ubuntu.com/oauth/authorize/";
140+ Auth.AccessTokenBaseUrl = "https://one.ubuntu.com/oauth/access/";
141+ Auth.RequestTokenBaseUrl = "https://one.ubuntu.com/oauth/request/";
142+ Auth.ConsumerKey = sdAuth.ConsumerKey;
143+ Auth.ConsumerSecret = sdAuth.ConsumerSecret;
144+ Auth.Token = sdAuth.Token;
145+ Auth.TokenSecret = sdAuth.TokenSecret;
146+
147+ authButton.Label = Catalog.GetString ("Authentication complete. Press Save to start synchronizing");
148+ }
149+
150+ public void OnAuthCancelled (object sender, EventArgs args)
151+ {
152+ authButton.Label = Catalog.GetString ("Register this computer");
153+ authButton.Sensitive = false;
154+ }
155+
156+ public void OnAuthError (object sender, EventArgs args)
157+ {
158+ }
159+
160+
161+ }
162+
163+ class SyncdaemonAuthentication
164+ {
165+ private IntPtr syncdaemon = IntPtr.Zero;
166+ private IntPtr handle = IntPtr.Zero;
167+ private IntPtr credentials = IntPtr.Zero;
168+
169+ [DllImport("syncdaemon-1.0")]
170+ static extern IntPtr syncdaemon_daemon_new ();
171+
172+ [DllImport("syncdaemon-1.0")]
173+ static extern IntPtr syncdaemon_daemon_get_authentication (IntPtr daemon);
174+
175+ [DllImport("gobject-2.0")]
176+ static extern uint g_signal_connect_data (IntPtr obj, IntPtr name, Delegate cb, IntPtr data, IntPtr p, int flags);
177+
178+ public SyncdaemonAuthentication ()
179+ {
180+ IntPtr native_name;
181+
182+ this.syncdaemon = syncdaemon_daemon_new ();
183+ this.handle = syncdaemon_daemon_get_authentication (this.syncdaemon);
184+
185+ native_name = Marshaller.StringToPtrGStrdup ("credentials_found");
186+ g_signal_connect_data (this.handle, native_name,
187+ new CredentialsFoundDelegate (credentials_found_cb),
188+ new IntPtr (0), new IntPtr (0), 0);
189+ GLib.Marshaller.Free (native_name);
190+
191+ native_name = Marshaller.StringToPtrGStrdup ("authorization_cancelled");
192+ g_signal_connect_data (this.handle, native_name,
193+ new AuthCancelledDelegate (auth_cancelled_cb),
194+ new IntPtr (0), new IntPtr (0), 0);
195+ GLib.Marshaller.Free (native_name);
196+
197+ native_name = Marshaller.StringToPtrGStrdup ("error");
198+ g_signal_connect_data (this.handle, native_name,
199+ new AuthErrorDelegate (auth_error_cb),
200+ new IntPtr (0), new IntPtr (0), 0);
201+ GLib.Marshaller.Free (native_name);
202+
203+ }
204+
205+ [GLib.CDeclCallback]
206+ delegate void CredentialsFoundDelegate (IntPtr auth, IntPtr credentials, IntPtr user_data);
207+
208+ void credentials_found_cb (IntPtr auth, IntPtr credentials, IntPtr user_data)
209+ {
210+ Logger.Debug ("credentials_found_cb called");
211+ if (this.CredentialsFound != null)
212+ this.CredentialsFound (this, new EventArgs ());
213+ }
214+
215+ [GLib.CDeclCallback]
216+ delegate void AuthCancelledDelegate (IntPtr auth, IntPtr user_data);
217+
218+ void auth_cancelled_cb (IntPtr auth, IntPtr user_data)
219+ {
220+ Logger.Debug ("auth_cancelled_cb called");
221+ if (this.AuthenticationCancelled != null)
222+ this.AuthenticationCancelled (this, new EventArgs ());
223+ }
224+
225+ [GLib.CDeclCallback]
226+ delegate void AuthErrorDelegate (IntPtr auth, IntPtr error, IntPtr user_data);
227+
228+ void auth_error_cb (IntPtr auth, IntPtr error, IntPtr user_data)
229+ {
230+ Logger.Debug ("auth_error_cb called");
231+ if (this.AuthenticationError != null)
232+ this.AuthenticationError (this, new EventArgs ());
233+ }
234+
235+ [DllImport("syncdaemon-1.0")]
236+ static extern IntPtr syncdaemon_authentication_find_credentials (IntPtr auth);
237+
238+ private IntPtr FindCredentials ()
239+ {
240+ if (IntPtr.Zero == this.credentials)
241+ this.credentials = syncdaemon_authentication_find_credentials (this.handle);
242+
243+ return this.credentials;
244+ }
245+
246+ [DllImport("syncdaemon-1.0")]
247+ static extern string syncdaemon_credentials_get_consumer_key (IntPtr credentials);
248+
249+ public string ConsumerKey {
250+ get {
251+ IntPtr raw = syncdaemon_authentication_find_credentials (this.handle);
252+ return syncdaemon_credentials_get_consumer_key (raw);
253+ }
254+ }
255+
256+ [DllImport("syncdaemon-1.0")]
257+ static extern string syncdaemon_credentials_get_consumer_secret (IntPtr credentials);
258+
259+ public string ConsumerSecret {
260+ get {
261+ IntPtr raw = syncdaemon_authentication_find_credentials (this.handle);
262+ return syncdaemon_credentials_get_consumer_secret (raw);
263+ }
264+ }
265+
266+ [DllImport("syncdaemon-1.0")]
267+ static extern string syncdaemon_credentials_get_token (IntPtr credentials);
268+
269+ public string Token {
270+ get {
271+ IntPtr raw = syncdaemon_authentication_find_credentials (this.handle);
272+ return syncdaemon_credentials_get_token (raw);
273+ }
274+ }
275+
276+ [DllImport("syncdaemon-1.0")]
277+ static extern string syncdaemon_credentials_get_token_secret (IntPtr credentials);
278+
279+ public string TokenSecret {
280+ get {
281+ IntPtr raw = syncdaemon_authentication_find_credentials (this.handle);
282+ return syncdaemon_credentials_get_token_secret (raw);
283+ }
284+ }
285+
286+ [DllImport("syncdaemon-1.0")]
287+ static extern bool syncdaemon_authentication_has_credentials (IntPtr auth);
288+
289+ public bool HasCredentials ()
290+ {
291+ return syncdaemon_authentication_has_credentials (this.handle);
292+ }
293+
294+ [DllImport("syncdaemon-1.0")]
295+ static extern void syncdaemon_authentication_login_or_register (IntPtr auth);
296+
297+ public void LoginOrRegister ()
298+ {
299+ syncdaemon_authentication_login_or_register (this.handle);
300+ }
301+
302+ public event EventHandler CredentialsFound;
303+
304+ public event EventHandler AuthenticationCancelled;
305+
306+ public event EventHandler AuthenticationError;
307+ }
308+}
309Index: tomboy/Tomboy/Addins/WebSyncService/U1SyncServiceAddin.cs
310===================================================================
311--- /dev/null 1970-01-01 00:00:00.000000000 +0000
312+++ tomboy/Tomboy/Addins/WebSyncService/U1SyncServiceAddin.cs 2011-08-23 23:14:17.277675713 +0100
313@@ -0,0 +1,229 @@
314+// Permission is hereby granted, free of charge, to any person obtaining
315+// a copy of this software and associated documentation files (the
316+// "Software"), to deal in the Software without restriction, including
317+// without limitation the rights to use, copy, modify, merge, publish,
318+// distribute, sublicense, and/or sell copies of the Software, and to
319+// permit persons to whom the Software is furnished to do so, subject to
320+// the following conditions:
321+//
322+// The above copyright notice and this permission notice shall be
323+// included in all copies or substantial portions of the Software.
324+//
325+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
326+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
327+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
328+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
329+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
330+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
331+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
332+//
333+// Copyright (c) 2010 Canonical, Ltd. (http://www.canonical.com)
334+//
335+// Authors:
336+// Rodrigo Moya <rodrigo.moya@canonical.com>
337+//
338+
339+using System;
340+
341+using Mono.Unix;
342+
343+using Tomboy.Sync;
344+
345+namespace Tomboy.WebSync
346+{
347+ public class U1SyncServiceAddin : SyncServiceAddin
348+ {
349+ private bool initialized;
350+ private U1SyncPreferencesWidget prefsWidget;
351+
352+ private const string serverUrlPrefPath =
353+ "/apps/tomboy/sync/ubuntuone/server";
354+ private const string accessTokenBaseUrlPrefPath =
355+ "/apps/tomboy/sync/ubuntuone/oauth_access_token_base_url";
356+ private const string authorizeLocationPrefPath =
357+ "/apps/tomboy/sync/ubuntuone/oauth_authorize_location";
358+ private const string consumerKeyPrefPath =
359+ "/apps/tomboy/sync/ubuntuone/oauth_consumer_key";
360+ private const string consumerSecretPrefPath =
361+ "/apps/tomboy/sync/ubuntuone/oauth_consumer_secret";
362+ private const string realmPrefPath =
363+ "/apps/tomboy/sync/ubuntuone/oauth_realm";
364+ private const string requestTokenBaseUrlPrefPath =
365+ "/apps/tomboy/sync/ubuntuone/oauth_request_token_base_url";
366+ private const string tokenPrefPath =
367+ "/apps/tomboy/sync/ubuntuone/oauth_token";
368+ private const string tokenSecretPrefPath =
369+ "/apps/tomboy/sync/ubuntuone/oauth_token_secret";
370+
371+ public U1SyncServiceAddin ()
372+ {
373+ }
374+
375+ #region SyncServiceAddin Overrides
376+
377+ public override string Id {
378+ get { return "ubuntuone"; }
379+ }
380+
381+ public override string Name {
382+ get {
383+ return Catalog.GetString ("Ubuntu One");
384+ }
385+ }
386+
387+ public override bool IsConfigured {
388+ get {
389+ string serverPref;
390+ Api.OAuth oauth;
391+ GetConfigSettings (out oauth, out serverPref);
392+ return !string.IsNullOrEmpty (serverPref) &&
393+ oauth != null &&
394+ oauth.IsAccessToken;
395+ }
396+ }
397+
398+ public override bool IsSupported {
399+ get {
400+ return true; // TODO: Ever false?
401+ }
402+ }
403+
404+ public override Gtk.Widget CreatePreferencesControl (EventHandler requiredPrefChanged)
405+ {
406+ string serverPref;
407+ Api.OAuth oauth;
408+ GetConfigSettings (out oauth, out serverPref);
409+ prefsWidget = new U1SyncPreferencesWidget (oauth, serverPref);
410+ return prefsWidget;
411+ }
412+
413+ public override SyncServer CreateSyncServer ()
414+ {
415+ string serverPref;
416+ Api.OAuth oauth;
417+ GetConfigSettings (out oauth, out serverPref);
418+ return new WebSyncServer (serverPref, oauth);
419+ }
420+
421+ public override void PostSyncCleanup ()
422+ {
423+ }
424+
425+ public override void ResetConfiguration ()
426+ {
427+ SaveConfigSettings (null, null);
428+ prefsWidget.Auth = null;
429+ }
430+
431+ public override bool SaveConfiguration ()
432+ {
433+ // TODO: Is this really sufficient validation?
434+ // Should we try a REST API request?
435+ if (prefsWidget.Auth == null ||
436+ prefsWidget.Auth.ConsumerKey == null ||
437+ prefsWidget.Auth.ConsumerSecret == null ||
438+ prefsWidget.Auth.Token == null ||
439+ prefsWidget.Auth.TokenSecret == null)
440+ return false;
441+ SaveConfigSettings (prefsWidget.Auth, prefsWidget.Server);
442+ return true;
443+ }
444+
445+ #endregion
446+
447+ #region ApplicationAddin Overrides
448+
449+ public override void Initialize ()
450+ {
451+ initialized = true;
452+ }
453+
454+ public override void Shutdown ()
455+ {
456+ initialized = false;
457+ }
458+
459+ public override bool Initialized {
460+ get { return initialized; }
461+ }
462+
463+ #endregion
464+
465+ #region Private Members
466+
467+ private void GetConfigSettings (out Api.OAuth oauthConfig, out string serverPref)
468+ {
469+ serverPref = (string)
470+ Preferences.Get (serverUrlPrefPath);
471+
472+ oauthConfig = new Api.OAuth ();
473+ oauthConfig.AccessTokenBaseUrl =
474+ Preferences.Get (accessTokenBaseUrlPrefPath) as string;
475+ oauthConfig.AuthorizeLocation =
476+ Preferences.Get (authorizeLocationPrefPath) as string;
477+ oauthConfig.ConsumerKey =
478+ Preferences.Get (consumerKeyPrefPath) as string;
479+ oauthConfig.ConsumerSecret =
480+ Preferences.Get (consumerSecretPrefPath) as string;
481+ oauthConfig.Realm =
482+ Preferences.Get (realmPrefPath) as string;
483+ oauthConfig.RequestTokenBaseUrl =
484+ Preferences.Get (requestTokenBaseUrlPrefPath) as string;
485+ oauthConfig.Token =
486+ Preferences.Get (tokenPrefPath) as string;
487+ oauthConfig.TokenSecret =
488+ Preferences.Get (tokenSecretPrefPath) as string;
489+
490+ // The fact that the configuration was saved at all
491+ // implies that the token is an access token.
492+ // TODO: Any benefit in actually storing this bool, in
493+ // case of weird circumstances?
494+ oauthConfig.IsAccessToken =
495+ !String.IsNullOrEmpty (oauthConfig.Token);
496+ }
497+
498+ private void SaveConfigSettings (Api.OAuth oauthConfig, string serverPref)
499+ {
500+ Preferences.Set (serverUrlPrefPath, GetConfigString (serverPref));
501+ Preferences.Set (accessTokenBaseUrlPrefPath,
502+ oauthConfig != null ?
503+ GetConfigString (oauthConfig.AccessTokenBaseUrl) :
504+ String.Empty);
505+ Preferences.Set (authorizeLocationPrefPath,
506+ oauthConfig != null ?
507+ GetConfigString (oauthConfig.AuthorizeLocation) :
508+ String.Empty);
509+ Preferences.Set (consumerKeyPrefPath,
510+ oauthConfig != null ?
511+ GetConfigString (oauthConfig.ConsumerKey) :
512+ String.Empty);
513+ Preferences.Set (consumerSecretPrefPath,
514+ oauthConfig != null ?
515+ GetConfigString (oauthConfig.ConsumerSecret) :
516+ String.Empty);
517+ Preferences.Set (realmPrefPath,
518+ oauthConfig != null ?
519+ GetConfigString (oauthConfig.Realm) :
520+ String.Empty);
521+ Preferences.Set (requestTokenBaseUrlPrefPath,
522+ oauthConfig != null ?
523+ GetConfigString (oauthConfig.RequestTokenBaseUrl) :
524+ String.Empty);
525+ Preferences.Set (tokenPrefPath,
526+ oauthConfig != null ?
527+ GetConfigString (oauthConfig.Token) :
528+ String.Empty);
529+ Preferences.Set (tokenSecretPrefPath,
530+ oauthConfig != null ?
531+ GetConfigString (oauthConfig.TokenSecret) :
532+ String.Empty);
533+ }
534+
535+ private string GetConfigString (string val)
536+ {
537+ return val ?? String.Empty;
538+ }
539+
540+ #endregion
541+ }
542+}
543Index: tomboy/Tomboy/Addins/WebSyncService/WebSyncService.addin.xml
544===================================================================
545--- tomboy.orig/Tomboy/Addins/WebSyncService/WebSyncService.addin.xml 2011-08-23 22:54:40.139230862 +0100
546+++ tomboy/Tomboy/Addins/WebSyncService/WebSyncService.addin.xml 2011-08-23 23:11:21.488427309 +0100
547@@ -18,4 +18,8 @@
548 <Extension path="/Tomboy/SyncServiceAddins">
549 <SyncServiceAddin type="Tomboy.WebSync.WebSyncServiceAddin" />
550 </Extension>
551+
552+ <Extension path="/Tomboy/SyncServiceAddins">
553+ <SyncServiceAddin type="Tomboy.WebSync.U1SyncServiceAddin" />
554+ </Extension>
555 </Addin>
5560
=== modified file 'debian/patches/series'
--- debian/patches/series 2012-08-06 18:13:55 +0000
+++ debian/patches/series 2013-02-05 16:50:52 +0000
@@ -1,7 +1,3 @@
101_dllmaps.patch101_dllmaps.patch
202_sync_save_button_sensitive.patch
303_u1_as_default_sync.patch
404_app_indicator.patch204_app_indicator.patch
505_add_start_u1_note.patch
6#06_use_ubuntu_sso.patch
720_remove_pcfile_requires320_remove_pcfile_requires

Subscribers

People subscribed via source and target branches

to all changes: