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