diff -up gwibber-2.91.92/gwibber/microblog/plugins/gowalla/gtk/gowalla/__init__.py.gowalla gwibber-2.91.92/gwibber/microblog/plugins/gowalla/gtk/gowalla/__init__.py --- gwibber-2.91.92/gwibber/microblog/plugins/gowalla/gtk/gowalla/__init__.py.gowalla 2011-03-25 13:37:54.077113013 -0400 +++ gwibber-2.91.92/gwibber/microblog/plugins/gowalla/gtk/gowalla/__init__.py 2011-03-25 13:18:40.175113003 -0400 @@ -0,0 +1,43 @@ +# +# Gowalla support for Gwibber +# +# Derived from Foursquare support (foursquare.py) +# That code is (C) 2010 Ken VanDine <ken.vandine@canonical.com> +# and is available under GPLv2 only. +# +# Copyright 2011, Tom "spot" Callaway <tcallawa@redhat.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 or later +# as published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +import gtk +from gtk import Builder +from gwibber.microblog.util import resources + +class AccountWidget(gtk.VBox): + """AccountWidget: A widget that provides a user interface for configuring Gowalla accounts in Gwibber + """ + + def __init__(self, account=None, dialog=None): + """Creates the account pane for configuring Gowalla accounts""" + gtk.VBox.__init__( self, False, 20 ) + self.ui = gtk.Builder() + self.ui.set_translation_domain ("gwibber") + self.ui.add_from_file (resources.get_ui_asset("gwibber-accounts-gowalla.ui")) + self.ui.connect_signals(self) + self.vbox_settings = self.ui.get_object("vbox_settings") + self.pack_start(self.vbox_settings, False, False) + self.show_all() + if dialog.ui: + dialog.ui.get_object("vbox_create").show() + + diff -up gwibber-2.91.92/gwibber/microblog/plugins/gowalla/gtk/__init__.py.gowalla gwibber-2.91.92/gwibber/microblog/plugins/gowalla/gtk/__init__.py diff -up gwibber-2.91.92/gwibber/microblog/plugins/gowalla/__init__.py.gowalla gwibber-2.91.92/gwibber/microblog/plugins/gowalla/__init__.py --- gwibber-2.91.92/gwibber/microblog/plugins/gowalla/__init__.py.gowalla 2011-03-25 13:37:40.775113004 -0400 +++ gwibber-2.91.92/gwibber/microblog/plugins/gowalla/__init__.py 2011-03-25 13:32:04.759113008 -0400 @@ -0,0 +1,134 @@ +# +# Gowalla support for Gwibber +# +# Derived from Foursquare support (foursquare/__init__.py) +# +# Copyright 2011, Tom "spot" Callaway <tcallawa@redhat.com> +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose and without fee is hereby granted, +# provided that the above copyright notice appear in all copies and that +# both that copyright notice and this permission notice appear in +# supporting documentation. +# +# THE AUTHOR PROVIDES THIS SOFTWARE ''AS IS'' AND ANY EXPRESSED OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +from gwibber.microblog import network, util +from gwibber.microblog.util import log, resources +import json, htmllib, re +from gettext import lgettext as _ +log.logger.name = "Gowalla" + +PROTOCOL_INFO = { + "name": "Gowalla", + "version": "1.0", + + "config": [ + "private:password", + "receive_enabled", + "username", + "color", + ], + + "authtype": "none", + "color": "#f7911f", + + "features": [ + "receive", + ], + + "default_streams": [ + "receive", + ], +} + +URL_PREFIX = "https://api.gowalla.com/" + +class Client: + def __init__(self, acct): + self.account = acct + + def _message(self, data): + + m = {}; + m["mid"] = str(data["user"]["first_name"]) + str(data["user"]["last_name"]) + m["service"] = "gowalla" + m["account"] = self.account["id"] + m["time"] = util.parsetime(data["created_at"]) + + messagetext = "" + text = "" + if data.has_key("spot"): + if data.has_key("message"): + messagetext += data["message"] + "<br/><br/>" + text += data["message"] + "\n" + m["url"] = "http://gowalla.com%s" % data["spot"]["url"] + img = "<table><tr><td><img src='%s'/></td><td>" % data["spot"]["image_url"] + messagetext += img + "Checked in at <a href='" + m["url"] + "'>" + data["spot"]["name"] + "</a>" + text += "Checked in at " + data["spot"]["name"] + else: + if data.has_key("message"): + messagetext += data["message"] + "<br/><br/>" + text += data["message"] + "\n" + else: + text= "Checked in off the grid" + messagetext= "<table><tr><td><img src='http://gowalla.com/favicon.ico'/></td><td>Checked in off the grid" + + m["text"] = text + m["content"] = messagetext + "</td></tr></table>" + m["html"] = messagetext + "</td></tr></table>" + + m["sender"] = {} + m["sender"]["image"] = data["user"]["image_url"] + m["sender"]["url"] = "http://gowalla.com%s" % data["user"]["url"] + fullname = "" + if data["user"].has_key("first_name"): + fullname += data["user"]["first_name"] + " " + if data["user"].has_key("last_name"): + fullname += data["user"]["last_name"] + + m["sender"]["name"] = fullname + m["sender"]["nick"] = fullname + + m["source"] = "<a href='http://gowalla.com/'>Gowalla</a>" + + return m + + def _check_error(self, data): + if isinstance(data, dict) and "activity" in data: + return True + else: + log.logger.error("Gowalla error %s", data) + return False + + def _get(self, path, parse="message", post=False, single=False, **args): + url = "/".join((URL_PREFIX, path)) + + data = network.Download(url, util.compact(args) or None, post, + self.account["username"], self.account["password"]).get_json() + + resources.dump(self.account["service"], self.account["id"], data) + + if not self._check_error(data): + return [] + + checkins = data["activity"] + if single: return [getattr(self, "_%s" % parse)(checkins)] + if parse: return [getattr(self, "_%s" % parse)(m) for m in checkins] + else: return [] + + def __call__(self, opname, **args): + return getattr(self, opname)(**args) + + def receive(self): + return self._get("users/%s/activity/friends" % self.account["username"]) + diff -up gwibber-2.91.92/gwibber/microblog/plugins/gowalla/ui/gwibber-accounts-gowalla.ui.gowalla gwibber-2.91.92/gwibber/microblog/plugins/gowalla/ui/gwibber-accounts-gowalla.ui --- gwibber-2.91.92/gwibber/microblog/plugins/gowalla/ui/gwibber-accounts-gowalla.ui.gowalla 2011-03-25 13:37:59.317113004 -0400 +++ gwibber-2.91.92/gwibber/microblog/plugins/gowalla/ui/gwibber-accounts-gowalla.ui 2011-03-25 13:21:50.015113004 -0400 @@ -0,0 +1,201 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <requires lib="gtk+" version="2.16"/> + <!-- interface-naming-policy toplevel-contextual --> + <object class="GtkVBox" id="vbox_settings"> + <property name="visible">True</property> + <property name="spacing">6</property> + <child> + <object class="GtkTable" id="table_common_settings"> + <property name="visible">True</property> + <property name="n_rows">3</property> + <property name="n_columns">3</property> + <property name="column_spacing">12</property> + <property name="row_spacing">6</property> + <child> + <object class="GtkEntry" id="password"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="visibility">False</property> + <property name="invisible_char">●</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">3</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="y_options"></property> + </packing> + </child> + <child> + <object class="GtkEntry" id="username"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">●</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">3</property> + <property name="y_options"></property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label_username"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Login I_D:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">username</property> + </object> + <packing> + <property name="x_options">GTK_FILL</property> + <property name="y_options"></property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label_password"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Pass_word:</property> + <property name="use_underline">True</property> + <property name="justify">right</property> + <property name="mnemonic_widget">password</property> + </object> + <packing> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options"></property> + </packing> + </child> + <child> + <object class="GtkVBox" id="vbox1"> + <property name="visible">True</property> + <child> + <object class="GtkLabel" id="label_username_example"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="xpad">3</property> + <property name="label" translatable="yes"><span size="small"><b>Example:</b> username@email.com</span></property> + <property name="use_markup">True</property> + </object> + <packing> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkHSeparator" id="hseparator1"> + <property name="visible">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkVBox" id="vbox_advanced"> + <property name="visible">True</property> + <property name="spacing">6</property> + <child> + <object class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Account Settings:</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + <packing> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkTable" id="table_advanced_settings"> + <property name="visible">True</property> + <property name="n_columns">3</property> + <property name="column_spacing">12</property> + <property name="row_spacing">6</property> + <child> + <object class="GtkCheckButton" id="receive_enabled"> + <property name="label" translatable="yes">_Receive Messages</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Include this account when downloading messages</property> + <property name="use_underline">True</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="right_attach">3</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options"></property> + </packing> + </child> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkHBox" id="hbox1"> + <property name="visible">True</property> + <property name="homogeneous">True</property> + <child> + <object class="GtkLabel" id="label4"> + <property name="visible">True</property> + <property name="tooltip_text" translatable="yes">Color used to help distinguish accounts</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Account Color:</property> + </object> + <packing> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkColorButton" id="color"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Color used to help distinguish accounts</property> + <property name="color">#000000000000</property> + </object> + <packing> + <property name="expand">False</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="position">2</property> + </packing> + </child> + </object> +</interface> diff -up gwibber-2.91.92/po/POTFILES.in.gowalla gwibber-2.91.92/po/POTFILES.in --- gwibber-2.91.92/po/POTFILES.in.gowalla 2011-03-25 13:34:39.204112988 -0400 +++ gwibber-2.91.92/po/POTFILES.in 2011-03-25 13:35:10.815112928 -0400 @@ -34,6 +34,7 @@ gwibber/util.py [type: gettext/glade] gwibber/microblog/plugins/twitter/ui/gwibber-accounts-twitter.ui [type: gettext/glade] gwibber/microblog/plugins/qaiku/ui/gwibber-accounts-qaiku.ui [type: gettext/glade] gwibber/microblog/plugins/foursquare/ui/gwibber-accounts-foursquare.ui +[type: gettext/glade] gwibber/microblog/plugins/gowalla/ui/gwibber-accounts-gowalla.ui ui/templates/base.mako ui/templates/targetbar.mako bin/gwibber-poster diff -up gwibber-2.91.92/setup.py.gowalla gwibber-2.91.92/setup.py --- gwibber-2.91.92/setup.py.gowalla 2011-03-25 13:35:19.692113025 -0400 +++ gwibber-2.91.92/setup.py 2011-03-25 13:36:38.870113063 -0400 @@ -61,6 +61,14 @@ setup(name="gwibber", ('share/gwibber/plugins/foursquare/ui/icons/22x22', glob("gwibber/microblog/plugins/foursquare/ui/icons/22x22/*.*")), ('share/gwibber/plugins/foursquare/ui/icons/32x32', glob("gwibber/microblog/plugins/foursquare/ui/icons/32x32/*.*")), ('share/gwibber/plugins/foursquare/ui/icons/scalable', glob("gwibber/microblog/plugins/foursquare/ui/icons/scalable/*.*")), + ('share/gwibber/plugins/gowalla', glob("gwibber/microblog/plugins/gowalla/*.*")), + ('share/gwibber/plugins/gowalla/gtk', glob("gwibber/microblog/plugins/gowalla/gtk/*.*")), + ('share/gwibber/plugins/gowalla/gtk/gowalla', glob("gwibber/microblog/plugins/gowalla/gtk/gowalla/*.*")), + ('share/gwibber/plugins/gowalla/ui', glob("gwibber/microblog/plugins/gowalla/ui/*.*")), + ('share/gwibber/plugins/gowalla/ui/icons/16x16', glob("gwibber/microblog/plugins/gowalla/ui/icons/16x16/*.*")), + ('share/gwibber/plugins/gowalla/ui/icons/22x22', glob("gwibber/microblog/plugins/gowalla/ui/icons/22x22/*.*")), + ('share/gwibber/plugins/gowalla/ui/icons/32x32', glob("gwibber/microblog/plugins/gowalla/ui/icons/32x32/*.*")), + ('share/gwibber/plugins/gowalla/ui/icons/scalable', glob("gwibber/microblog/plugins/gowalla/ui/icons/scalable/*.*")), ('share/gwibber/plugins/buzz', glob("gwibber/microblog/plugins/buzz/*.*")), ('share/gwibber/plugins/buzz/gtk', glob("gwibber/microblog/plugins/buzz/gtk/*.*")), ('share/gwibber/plugins/buzz/gtk/buzz', glob("gwibber/microblog/plugins/buzz/gtk/buzz/*.*")), --- gwibber-2.91.92/gwibber/microblog/plugins/gowalla/gtk/__init__.py.gowalla 2011-03-25 14:53:06.734113004 -0400 +++ gwibber-2.91.92/gwibber/microblog/plugins/gowalla/gtk/__init__.py 2011-03-25 14:53:19.607112967 -0400 @@ -0,0 +1 @@ +