Merge lp:~tcallawa/gwibber/gowalla into lp:gwibber
- gowalla
- Merge into trunk
Status: | Rejected |
---|---|
Rejected by: | Robert Bruce Park |
Proposed branch: | lp:~tcallawa/gwibber/gowalla |
Merge into: | lp:gwibber |
Diff against target: |
437 lines (+389/-2) 5 files modified
gwibber/lib/gtk/__init__.py (+1/-1) gwibber/lib/gtk/gowalla.py (+44/-0) gwibber/microblog/dispatcher.py (+2/-1) gwibber/microblog/gowalla.py (+123/-0) ui/gwibber-accounts-gowalla.ui (+219/-0) |
To merge this branch: | bzr merge lp:~tcallawa/gwibber/gowalla |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Robert Bruce Park | Disapprove | ||
gwibber-committers | Pending | ||
Review via email: mp+36477@code.launchpad.net |
Commit message
Description of the change
This adds support for Gowalla checkin notifications, same concept as the recently merged Foursquare support. Tested locally and it works great! (Hooray for simple JSON apis!)
Tom "spot" Callaway (tcallawa) wrote : | # |
On 03/28/2013 04:07 PM, Robert Bruce Park wrote:
> Review: Disapprove
>
> Thanks for taking the time to submit this patch, unfortunately Gwibber has gone through extensive changes recently and your patch no longer applies to the latest codebase.
>
> Unfortunately, the social network you were attempting to add will require Ubuntu Online Accounts support before we would be able to integrate the work that you've done.
>
> Here is an example of the work that was necessary to add support for the LinkedIn social network to Ubuntu Online Accounts:
>
> http://
>
> If you want your plugin to be supported in the future of Gwibber, you'll need to do something similar to this, but with the gowalla details substituted in place of the linkedin ones.
Gowalla doesn't exist anymore. Took that long to do patch triage. ;)
~tom
==
Fedora Project
Robert Bruce Park (robru) wrote : | # |
Wow, I do apologize for the delay. I've only recently been assigned to the project, so I'm just doing my best to do what I can with the backlog of merges.
I do invite you to have a look at the latest Gwibber trunk. I'm really pleased with a lot of major changes that we've landed recently and I hope that I can keep on top of the merges better than we have in the past.
Unmerged revisions
- 870. By Tom "spot" Callaway
-
New files for Gowalla
- 869. By Tom "spot" Callaway
-
Gowalla support
Preview Diff
1 | === modified file 'gwibber/lib/gtk/__init__.py' |
2 | --- gwibber/lib/gtk/__init__.py 2010-08-27 00:55:15 +0000 |
3 | +++ gwibber/lib/gtk/__init__.py 2010-09-23 17:57:44 +0000 |
4 | @@ -1,1 +1,1 @@ |
5 | -__all__ = ["twitter", "identica", "flickr", "facebook", "friendfeed", "statusnet", "digg", "qaiku", "buzz", "pingfm", "foursquare"] |
6 | +__all__ = ["twitter", "identica", "flickr", "facebook", "friendfeed", "statusnet", "digg", "qaiku", "buzz", "pingfm", "foursquare", "gowalla"] |
7 | |
8 | === added file 'gwibber/lib/gtk/gowalla.py' |
9 | --- gwibber/lib/gtk/gowalla.py 1970-01-01 00:00:00 +0000 |
10 | +++ gwibber/lib/gtk/gowalla.py 2010-09-23 17:57:44 +0000 |
11 | @@ -0,0 +1,44 @@ |
12 | +# |
13 | +# Gowalla support for Gwibber |
14 | +# |
15 | +# Derived from Foursquare support (foursquare.py) |
16 | +# |
17 | +# Copyright 2010, Tom "spot" Callaway <tcallawa@redhat.com> |
18 | +# |
19 | +# Permission to use, copy, modify, and distribute this software and its |
20 | +# documentation for any purpose and without fee is hereby granted, |
21 | +# provided that the above copyright notice appear in all copies and that |
22 | +# both that copyright notice and this permission notice appear in |
23 | +# supporting documentation. |
24 | +# |
25 | +# THE AUTHOR PROVIDES THIS SOFTWARE ''AS IS'' AND ANY EXPRESSED OR |
26 | +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
27 | +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
28 | +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
29 | +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
30 | +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
31 | +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
32 | +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
33 | +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
34 | +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
35 | + |
36 | +import gtk |
37 | +from gtk import Builder |
38 | +import gwibber.microblog |
39 | + |
40 | +class AccountWidget(gtk.VBox): |
41 | + """AccountWidget: A widget that provides a user interface for configuring Gowalla accounts in Gwibber |
42 | + """ |
43 | + |
44 | + def __init__(self, account=None, dialog=None): |
45 | + """Creates the account pane for configuring Gowalla accounts""" |
46 | + gtk.VBox.__init__( self, False, 20 ) |
47 | + self.ui = gtk.Builder() |
48 | + self.ui.set_translation_domain ("gwibber") |
49 | + self.ui.add_from_file (gwibber.resources.get_ui_asset("gwibber-accounts-gowalla.ui")) |
50 | + self.ui.connect_signals(self) |
51 | + self.vbox_settings = self.ui.get_object("vbox_settings") |
52 | + self.pack_start(self.vbox_settings, False, False) |
53 | + self.show_all() |
54 | + if dialog: |
55 | + dialog.get_object("vbox_create").show() |
56 | |
57 | === modified file 'gwibber/microblog/dispatcher.py' |
58 | --- gwibber/microblog/dispatcher.py 2010-09-22 16:55:24 +0000 |
59 | +++ gwibber/microblog/dispatcher.py 2010-09-23 17:57:44 +0000 |
60 | @@ -5,7 +5,7 @@ |
61 | import gobject, dbus, dbus.service |
62 | import twitter, identica, statusnet, flickr, facebook |
63 | import qaiku, friendfeed, digg, buzz, pingfm |
64 | -import foursquare |
65 | +import foursquare, gowalla |
66 | import sqlite3, mx.DateTime, re, uuid |
67 | import urlshorter, storage, network, util, config |
68 | |
69 | @@ -43,6 +43,7 @@ |
70 | "buzz": buzz, |
71 | "pingfm": pingfm, |
72 | "foursquare": foursquare, |
73 | + "gowalla": gowalla, |
74 | } |
75 | |
76 | FEATURES = json.loads(GWIBBER_OPERATIONS) |
77 | |
78 | === added file 'gwibber/microblog/gowalla.py' |
79 | --- gwibber/microblog/gowalla.py 1970-01-01 00:00:00 +0000 |
80 | +++ gwibber/microblog/gowalla.py 2010-09-23 17:57:44 +0000 |
81 | @@ -0,0 +1,123 @@ |
82 | +# |
83 | +# Gowalla support for Gwibber |
84 | +# |
85 | +# Derived from Foursquare support (foursquare.py) |
86 | +# |
87 | +# Copyright 2010, Tom "spot" Callaway <tcallawa@redhat.com> |
88 | +# |
89 | +# Permission to use, copy, modify, and distribute this software and its |
90 | +# documentation for any purpose and without fee is hereby granted, |
91 | +# provided that the above copyright notice appear in all copies and that |
92 | +# both that copyright notice and this permission notice appear in |
93 | +# supporting documentation. |
94 | +# |
95 | +# THE AUTHOR PROVIDES THIS SOFTWARE ''AS IS'' AND ANY EXPRESSED OR |
96 | +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
97 | +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
98 | +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
99 | +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
100 | +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
101 | +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
102 | +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
103 | +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
104 | +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
105 | + |
106 | +import network, json, util, htmllib, re |
107 | +from util import log |
108 | +from util import exceptions |
109 | +from gettext import lgettext as _ |
110 | +log.logger.name = "Gowalla" |
111 | + |
112 | +PROTOCOL_INFO = { |
113 | + "name": "Gowalla", |
114 | + "version": "1.0", |
115 | + |
116 | + "config": [ |
117 | + "private:password", |
118 | + "receive_enabled", |
119 | + "username", |
120 | + "color", |
121 | + ], |
122 | + |
123 | + "authtype": "none", |
124 | + "color": "#f7911f", |
125 | + |
126 | + "features": [ |
127 | + "receive", |
128 | + ], |
129 | + |
130 | + "default_streams": [ |
131 | + "receive", |
132 | + ], |
133 | +} |
134 | + |
135 | +URL_PREFIX = "https://api.gowalla.com" |
136 | + |
137 | +class Client: |
138 | + def __init__(self, acct): |
139 | + self.account = acct |
140 | + |
141 | + def _message(self, data): |
142 | + |
143 | + m = {}; |
144 | + m["mid"] = str(data["user"]["first_name"]) + str(data["user"]["last_name"]) |
145 | + m["service"] = "gowalla" |
146 | + m["account"] = self.account["id"] |
147 | + m["time"] = util.parsetime(data["created_at"]) |
148 | + |
149 | + messagetext = "" |
150 | + text = "" |
151 | + if data.has_key("spot"): |
152 | + if data.has_key("message"): |
153 | + messagetext += data["message"] + "<br/><br/>" |
154 | + text += data["message"] + "\n" |
155 | + m["url"] = "<a href='http://gowalla.com%s'>" % data["spot"]["url"] |
156 | + m["url"] = "http://gowalla.com%s" % data["spot"]["url"] |
157 | + img = "<table><tr><td><img src='%s'/></td><td>" % data["spot"]["image_url"] |
158 | + messagetext += img + "Checked in at <a href='" + m["url"] + "'>" + data["spot"]["name"] + "</a>" |
159 | + text += "Checked in at " + data["spot"]["name"] |
160 | + else: |
161 | + if data.has_key("message"): |
162 | + messagetext += data["message"] + "<br/><br/>" |
163 | + text += data["message"] + "\n" |
164 | + else: |
165 | + text= "Checked in off the grid" |
166 | + shouttext= "<table><tr><td><img src='http://gowalla.com/favicon.ico'/></td><td>Checked in off the grid" |
167 | + |
168 | + m["text"] = text |
169 | + m["content"] = messagetext + "</td></tr></table>" |
170 | + m["html"] = messagetext + "</td></tr></table>" |
171 | + |
172 | + m["sender"] = {} |
173 | + m["sender"]["image"] = data["user"]["image_url"] |
174 | + m["sender"]["url"] = "http://gowalla.com%s" % data["user"]["url"] |
175 | + fullname = "" |
176 | + if data["user"].has_key("first_name"): |
177 | + fullname += data["user"]["first_name"] + " " |
178 | + if data["user"].has_key("last_name"): |
179 | + fullname += data["user"]["last_name"] |
180 | + |
181 | + m["sender"]["name"] = fullname |
182 | + m["sender"]["nick"] = fullname |
183 | + |
184 | + m["source"] = "<a href='http://gowalla.com/'>Gowalla</a>" |
185 | + |
186 | + return m |
187 | + |
188 | + def _get(self, path, parse="message", post=False, single=False, **args): |
189 | + url = "/".join((URL_PREFIX, path)) |
190 | + |
191 | + data = network.Download(url, util.compact(args) or None, post, |
192 | + self.account["username"], self.account["password"]).get_json() |
193 | + |
194 | + checkins = data["activity"] |
195 | + if single: return [getattr(self, "_%s" % parse)(checkins)] |
196 | + if parse: return [getattr(self, "_%s" % parse)(m) for m in checkins] |
197 | + else: return [] |
198 | + |
199 | + def __call__(self, opname, **args): |
200 | + return getattr(self, opname)(**args) |
201 | + |
202 | + def receive(self): |
203 | + return self._get("users/%s/activity/friends" % self.account["username"]) |
204 | + |
205 | |
206 | === added file 'ui/gwibber-accounts-gowalla.ui' |
207 | --- ui/gwibber-accounts-gowalla.ui 1970-01-01 00:00:00 +0000 |
208 | +++ ui/gwibber-accounts-gowalla.ui 2010-09-23 17:57:44 +0000 |
209 | @@ -0,0 +1,219 @@ |
210 | +<?xml version="1.0"?> |
211 | +<interface> |
212 | + <requires lib="gtk+" version="2.16"/> |
213 | + <!-- interface-naming-policy toplevel-contextual --> |
214 | + <object class="GtkVBox" id="vbox_settings"> |
215 | + <property name="visible">True</property> |
216 | + <property name="orientation">vertical</property> |
217 | + <property name="spacing">6</property> |
218 | + <child> |
219 | + <object class="GtkTable" id="table_common_settings"> |
220 | + <property name="visible">True</property> |
221 | + <property name="n_rows">3</property> |
222 | + <property name="n_columns">3</property> |
223 | + <property name="column_spacing">12</property> |
224 | + <property name="row_spacing">6</property> |
225 | + <child> |
226 | + <object class="GtkEntry" id="password"> |
227 | + <property name="visible">True</property> |
228 | + <property name="can_focus">True</property> |
229 | + <property name="visibility">False</property> |
230 | + <property name="invisible_char">●</property> |
231 | + </object> |
232 | + <packing> |
233 | + <property name="left_attach">1</property> |
234 | + <property name="right_attach">3</property> |
235 | + <property name="top_attach">2</property> |
236 | + <property name="bottom_attach">3</property> |
237 | + <property name="y_options"></property> |
238 | + </packing> |
239 | + </child> |
240 | + <child> |
241 | + <object class="GtkEntry" id="username"> |
242 | + <property name="visible">True</property> |
243 | + <property name="can_focus">True</property> |
244 | + <property name="invisible_char">●</property> |
245 | + </object> |
246 | + <packing> |
247 | + <property name="left_attach">1</property> |
248 | + <property name="right_attach">3</property> |
249 | + <property name="y_options"></property> |
250 | + </packing> |
251 | + </child> |
252 | + <child> |
253 | + <object class="GtkLabel" id="label_username"> |
254 | + <property name="visible">True</property> |
255 | + <property name="xalign">0</property> |
256 | + <property name="label" translatable="yes">Login I_D:</property> |
257 | + <property name="use_underline">True</property> |
258 | + <property name="mnemonic_widget">username</property> |
259 | + </object> |
260 | + <packing> |
261 | + <property name="x_options">GTK_FILL</property> |
262 | + <property name="y_options"></property> |
263 | + </packing> |
264 | + </child> |
265 | + <child> |
266 | + <object class="GtkLabel" id="label_password"> |
267 | + <property name="visible">True</property> |
268 | + <property name="xalign">0</property> |
269 | + <property name="label" translatable="yes">Pass_word:</property> |
270 | + <property name="use_underline">True</property> |
271 | + <property name="justify">right</property> |
272 | + <property name="mnemonic_widget">password</property> |
273 | + </object> |
274 | + <packing> |
275 | + <property name="top_attach">2</property> |
276 | + <property name="bottom_attach">3</property> |
277 | + <property name="x_options">GTK_FILL</property> |
278 | + <property name="y_options"></property> |
279 | + </packing> |
280 | + </child> |
281 | + <child> |
282 | + <object class="GtkVBox" id="vbox1"> |
283 | + <property name="visible">True</property> |
284 | + <property name="orientation">vertical</property> |
285 | + <child> |
286 | + <object class="GtkLabel" id="label_username_example"> |
287 | + <property name="visible">True</property> |
288 | + <property name="xalign">0</property> |
289 | + <property name="xpad">3</property> |
290 | + <property name="label" translatable="yes"><span size="small"><b>Example:</b> username@email.com</span></property> |
291 | + <property name="use_markup">True</property> |
292 | + </object> |
293 | + <packing> |
294 | + <property name="position">0</property> |
295 | + </packing> |
296 | + </child> |
297 | + </object> |
298 | + <packing> |
299 | + <property name="left_attach">1</property> |
300 | + <property name="right_attach">2</property> |
301 | + <property name="top_attach">1</property> |
302 | + <property name="bottom_attach">2</property> |
303 | + </packing> |
304 | + </child> |
305 | + <child> |
306 | + <placeholder/> |
307 | + </child> |
308 | + <child> |
309 | + <placeholder/> |
310 | + </child> |
311 | + </object> |
312 | + <packing> |
313 | + <property name="expand">False</property> |
314 | + <property name="fill">False</property> |
315 | + <property name="position">0</property> |
316 | + </packing> |
317 | + </child> |
318 | + <child> |
319 | + <object class="GtkExpander" id="expander1"> |
320 | + <property name="visible">True</property> |
321 | + <property name="can_focus">True</property> |
322 | + <child> |
323 | + <object class="GtkVBox" id="vbox_advanced"> |
324 | + <property name="visible">True</property> |
325 | + <property name="orientation">vertical</property> |
326 | + <property name="spacing">6</property> |
327 | + <child> |
328 | + <object class="GtkLabel" id="label3"> |
329 | + <property name="visible">True</property> |
330 | + <property name="label" translatable="yes">Account Status</property> |
331 | + <attributes> |
332 | + <attribute name="weight" value="bold"/> |
333 | + </attributes> |
334 | + </object> |
335 | + <packing> |
336 | + <property name="position">0</property> |
337 | + </packing> |
338 | + </child> |
339 | + <child> |
340 | + <object class="GtkTable" id="table_advanced_settings"> |
341 | + <property name="visible">True</property> |
342 | + <property name="n_rows">2</property> |
343 | + <property name="n_columns">3</property> |
344 | + <property name="column_spacing">12</property> |
345 | + <property name="row_spacing">6</property> |
346 | + <child> |
347 | + <object class="GtkCheckButton" id="receive_enabled"> |
348 | + <property name="label" translatable="yes">_Receive Messages</property> |
349 | + <property name="visible">True</property> |
350 | + <property name="can_focus">True</property> |
351 | + <property name="receives_default">False</property> |
352 | + <property name="use_underline">True</property> |
353 | + <property name="active">True</property> |
354 | + <property name="draw_indicator">True</property> |
355 | + </object> |
356 | + <packing> |
357 | + <property name="right_attach">3</property> |
358 | + <property name="x_options">GTK_FILL</property> |
359 | + <property name="y_options"></property> |
360 | + </packing> |
361 | + </child> |
362 | + </object> |
363 | + <packing> |
364 | + <property name="position">1</property> |
365 | + </packing> |
366 | + </child> |
367 | + <child> |
368 | + <object class="GtkLabel" id="label2"> |
369 | + <property name="visible">True</property> |
370 | + <property name="label" translatable="yes">Appearance</property> |
371 | + <attributes> |
372 | + <attribute name="weight" value="bold"/> |
373 | + </attributes> |
374 | + </object> |
375 | + <packing> |
376 | + <property name="position">2</property> |
377 | + </packing> |
378 | + </child> |
379 | + <child> |
380 | + <object class="GtkHBox" id="hbox1"> |
381 | + <property name="visible">True</property> |
382 | + <property name="homogeneous">True</property> |
383 | + <child> |
384 | + <object class="GtkLabel" id="label4"> |
385 | + <property name="visible">True</property> |
386 | + <property name="label" translatable="yes">Message Color:</property> |
387 | + </object> |
388 | + <packing> |
389 | + <property name="position">0</property> |
390 | + </packing> |
391 | + </child> |
392 | + <child> |
393 | + <object class="GtkColorButton" id="color"> |
394 | + <property name="visible">True</property> |
395 | + <property name="can_focus">True</property> |
396 | + <property name="receives_default">True</property> |
397 | + <property name="color">#000000000000</property> |
398 | + </object> |
399 | + <packing> |
400 | + <property name="expand">False</property> |
401 | + <property name="position">1</property> |
402 | + </packing> |
403 | + </child> |
404 | + </object> |
405 | + <packing> |
406 | + <property name="position">3</property> |
407 | + </packing> |
408 | + </child> |
409 | + </object> |
410 | + </child> |
411 | + <child type="label"> |
412 | + <object class="GtkLabel" id="label1"> |
413 | + <property name="visible">True</property> |
414 | + <property name="label" translatable="yes">Advanced</property> |
415 | + <attributes> |
416 | + <attribute name="weight" value="bold"/> |
417 | + </attributes> |
418 | + </object> |
419 | + </child> |
420 | + </object> |
421 | + <packing> |
422 | + <property name="expand">False</property> |
423 | + <property name="fill">False</property> |
424 | + <property name="position">1</property> |
425 | + </packing> |
426 | + </child> |
427 | + </object> |
428 | +</interface> |
429 | |
430 | === added file 'ui/icons/breakdance/16x16/gowalla.png' |
431 | Binary files ui/icons/breakdance/16x16/gowalla.png 1970-01-01 00:00:00 +0000 and ui/icons/breakdance/16x16/gowalla.png 2010-09-23 17:57:44 +0000 differ |
432 | === added file 'ui/icons/breakdance/22x22/gowalla.png' |
433 | Binary files ui/icons/breakdance/22x22/gowalla.png 1970-01-01 00:00:00 +0000 and ui/icons/breakdance/22x22/gowalla.png 2010-09-23 17:57:44 +0000 differ |
434 | === added file 'ui/icons/breakdance/32x32/gowalla.png' |
435 | Binary files ui/icons/breakdance/32x32/gowalla.png 1970-01-01 00:00:00 +0000 and ui/icons/breakdance/32x32/gowalla.png 2010-09-23 17:57:44 +0000 differ |
436 | === added file 'ui/icons/breakdance/scalable/gowalla.png' |
437 | Binary files ui/icons/breakdance/scalable/gowalla.png 1970-01-01 00:00:00 +0000 and ui/icons/breakdance/scalable/gowalla.png 2010-09-23 17:57:44 +0000 differ |
Thanks for taking the time to submit this patch, unfortunately Gwibber has gone through extensive changes recently and your patch no longer applies to the latest codebase.
Unfortunately, the social network you were attempting to add will require Ubuntu Online Accounts support before we would be able to integrate the work that you've done.
Here is an example of the work that was necessary to add support for the LinkedIn social network to Ubuntu Online Accounts:
http:// bazaar. launchpad. net/~online- accounts/ account- plugins/ trunk/revision/ 96
If you want your plugin to be supported in the future of Gwibber, you'll need to do something similar to this, but with the gowalla details substituted in place of the linkedin ones.