Merge lp:~rodrigo-moya/ubuntu/maverick/tomboy/fix-sso-signals into lp:~ubuntu-desktop/tomboy/ubuntu

Proposed by Rodrigo Moya on 2010-08-18
Status: Merged
Merged at revision: 50
Proposed branch: lp:~rodrigo-moya/ubuntu/maverick/tomboy/fix-sso-signals
Merge into: lp:~ubuntu-desktop/tomboy/ubuntu
Diff against target: 183 lines (+104/-6)
2 files modified
debian/changelog (+7/-0)
debian/patches/06_use_ubuntu_sso.patch (+97/-6)
To merge this branch: bzr merge lp:~rodrigo-moya/ubuntu/maverick/tomboy/fix-sso-signals
Reviewer Review Type Date Requested Status
Ubuntu branches 2010-08-18 Pending
Review via email: mp+32982@code.launchpad.net
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=== modified file 'debian/changelog'
2--- debian/changelog 2010-08-13 07:48:22 +0000
3+++ debian/changelog 2010-08-18 11:33:46 +0000
4@@ -1,3 +1,10 @@
5+tomboy (1.3.1-1ubuntu5) maverick; urgency=low
6+
7+ * debian/patches/06_use_ubuntu_sso.patch:
8+ - Add missing code to listen to DBus signals for Ubuntu SSO
9+
10+ -- Rodrigo Moya <rodrigo.moya@canonical.com> Wed, 18 Aug 2010 10:49:38 +0200
11+
12 tomboy (1.3.1-1ubuntu4) maverick; urgency=low
13
14 * debian/patches/06_use_ubuntu_sso.patch:
15
16=== modified file 'debian/patches/06_use_ubuntu_sso.patch'
17--- debian/patches/06_use_ubuntu_sso.patch 2010-08-13 07:48:22 +0000
18+++ debian/patches/06_use_ubuntu_sso.patch 2010-08-18 11:33:46 +0000
19@@ -13,10 +13,10 @@
20 $(srcdir)/Api/Tests/*.cs \
21 diff --git a/Tomboy/Addins/WebSyncService/U1SyncPreferencesWidget.cs b/Tomboy/Addins/WebSyncService/U1SyncPreferencesWidget.cs
22 new file mode 100644
23-index 0000000..c0859f8
24+index 0000000..0c88ec1
25 --- /dev/null
26 +++ b/Tomboy/Addins/WebSyncService/U1SyncPreferencesWidget.cs
27-@@ -0,0 +1,202 @@
28+@@ -0,0 +1,290 @@
29 +// Permission is hereby granted, free of charge, to any person obtaining
30 +// a copy of this software and associated documentation files (the
31 +// "Software"), to deal in the Software without restriction, including
32@@ -66,6 +66,10 @@
33 + public U1SyncPreferencesWidget (Api.OAuth oauth, string server) : base (false, 5)
34 + {
35 + sdAuth = new SyncdaemonAuthentication ();
36++ sdAuth.CredentialsFound += OnCredentialsFound;
37++ sdAuth.AuthenticationCancelled += OnAuthCancelled;
38++ sdAuth.AuthenticationError += OnAuthError;
39++
40 + this.oauth = oauth;
41 +
42 + authButton = new Gtk.Button ();
43@@ -97,7 +101,7 @@
44 +
45 + public string Server {
46 + get {
47-+ return "https://one.ubuntu.com/notes/";
48++ return "https://edge.one.ubuntu.com/notes/";
49 + }
50 + }
51 +
52@@ -131,6 +135,30 @@
53 + sdAuth.LoginOrRegister ();
54 + }
55 +
56++ public void OnCredentialsFound (object sender, EventArgs args)
57++ {
58++ Auth.AuthorizeLocation = "https://one.ubuntu.com/oauth/authorize/";
59++ Auth.AccessTokenBaseUrl = "https://one.ubuntu.com/oauth/access/";
60++ Auth.RequestTokenBaseUrl = "https://one.ubuntu.com/oauth/request/";
61++ Auth.ConsumerKey = sdAuth.ConsumerKey;
62++ Auth.ConsumerSecret = sdAuth.ConsumerSecret;
63++ Auth.Token = sdAuth.Token;
64++ Auth.TokenSecret = sdAuth.TokenSecret;
65++
66++ authButton.Label = Catalog.GetString ("Authentication complete. Press Save to start synchronizing");
67++ }
68++
69++ public void OnAuthCancelled (object sender, EventArgs args)
70++ {
71++ authButton.Label = Catalog.GetString ("Register this computer");
72++ authButton.Sensitive = false;
73++ }
74++
75++ public void OnAuthError (object sender, EventArgs args)
76++ {
77++ }
78++
79++
80 + }
81 +
82 + class SyncdaemonAuthentication
83@@ -145,10 +173,64 @@
84 + [DllImport("syncdaemon-1.0")]
85 + static extern IntPtr syncdaemon_daemon_get_authentication (IntPtr daemon);
86 +
87++ [DllImport("gobject-2.0")]
88++ static extern uint g_signal_connect_data (IntPtr obj, IntPtr name, Delegate cb, IntPtr data, IntPtr p, int flags);
89++
90 + public SyncdaemonAuthentication ()
91 + {
92++ IntPtr native_name;
93++
94 + this.syncdaemon = syncdaemon_daemon_new ();
95 + this.handle = syncdaemon_daemon_get_authentication (this.syncdaemon);
96++
97++ native_name = Marshaller.StringToPtrGStrdup ("credentials_found");
98++ g_signal_connect_data (this.handle, native_name,
99++ new CredentialsFoundDelegate (credentials_found_cb),
100++ new IntPtr (0), new IntPtr (0), 0);
101++ GLib.Marshaller.Free (native_name);
102++
103++ native_name = Marshaller.StringToPtrGStrdup ("authorization_cancelled");
104++ g_signal_connect_data (this.handle, native_name,
105++ new AuthCancelledDelegate (auth_cancelled_cb),
106++ new IntPtr (0), new IntPtr (0), 0);
107++ GLib.Marshaller.Free (native_name);
108++
109++ native_name = Marshaller.StringToPtrGStrdup ("error");
110++ g_signal_connect_data (this.handle, native_name,
111++ new AuthErrorDelegate (auth_error_cb),
112++ new IntPtr (0), new IntPtr (0), 0);
113++ GLib.Marshaller.Free (native_name);
114++
115++ }
116++
117++ [GLib.CDeclCallback]
118++ delegate void CredentialsFoundDelegate (IntPtr auth, IntPtr credentials, IntPtr user_data);
119++
120++ void credentials_found_cb (IntPtr auth, IntPtr credentials, IntPtr user_data)
121++ {
122++ Logger.Debug ("credentials_found_cb called");
123++ if (this.CredentialsFound != null)
124++ this.CredentialsFound (this, new EventArgs ());
125++ }
126++
127++ [GLib.CDeclCallback]
128++ delegate void AuthCancelledDelegate (IntPtr auth, IntPtr user_data);
129++
130++ void auth_cancelled_cb (IntPtr auth, IntPtr user_data)
131++ {
132++ Logger.Debug ("auth_cancelled_cb called");
133++ if (this.AuthenticationCancelled != null)
134++ this.AuthenticationCancelled (this, new EventArgs ());
135++ }
136++
137++ [GLib.CDeclCallback]
138++ delegate void AuthErrorDelegate (IntPtr auth, IntPtr error, IntPtr user_data);
139++
140++ void auth_error_cb (IntPtr auth, IntPtr error, IntPtr user_data)
141++ {
142++ Logger.Debug ("auth_error_cb called");
143++ if (this.AuthenticationError != null)
144++ this.AuthenticationError (this, new EventArgs ());
145 + }
146 +
147 + [DllImport("syncdaemon-1.0")]
148@@ -217,15 +299,21 @@
149 + {
150 + syncdaemon_authentication_login_or_register (this.handle);
151 + }
152++
153++ public event EventHandler CredentialsFound;
154++
155++ public event EventHandler AuthenticationCancelled;
156++
157++ public event EventHandler AuthenticationError;
158 + }
159 +}
160 \ No newline at end of file
161 diff --git a/Tomboy/Addins/WebSyncService/U1SyncServiceAddin.cs b/Tomboy/Addins/WebSyncService/U1SyncServiceAddin.cs
162 new file mode 100644
163-index 0000000..5a94631
164+index 0000000..e6143c5
165 --- /dev/null
166 +++ b/Tomboy/Addins/WebSyncService/U1SyncServiceAddin.cs
167-@@ -0,0 +1,226 @@
168+@@ -0,0 +1,229 @@
169 +// Permission is hereby granted, free of charge, to any person obtaining
170 +// a copy of this software and associated documentation files (the
171 +// "Software"), to deal in the Software without restriction, including
172@@ -348,7 +436,10 @@
173 + // TODO: Is this really sufficient validation?
174 + // Should we try a REST API request?
175 + if (prefsWidget.Auth == null ||
176-+ !prefsWidget.Auth.IsAccessToken)
177++ prefsWidget.Auth.ConsumerKey == null ||
178++ prefsWidget.Auth.ConsumerSecret == null ||
179++ prefsWidget.Auth.Token == null ||
180++ prefsWidget.Auth.TokenSecret == null)
181 + return false;
182 + SaveConfigSettings (prefsWidget.Auth, prefsWidget.Server);
183 + return true;

Subscribers

People subscribed via source and target branches

to all changes: