bigboard r7388 - in branches/bigboard-0-5/bigboard: . stocks/people
- From: otaylor svn gnome org
- To: svn-commits-list gnome org
- Subject: bigboard r7388 - in branches/bigboard-0-5/bigboard: . stocks/people
- Date: Thu, 19 Jun 2008 03:55:17 +0000 (UTC)
Author: otaylor
Date: Thu Jun 19 03:55:17 2008
New Revision: 7388
URL: http://svn.gnome.org/viewvc/bigboard?rev=7388&view=rev
Log:
Clean up handling of homeUrl, and be robust against no homeUrl
Modified:
branches/bigboard-0-5/bigboard/people_tracker.py
branches/bigboard-0-5/bigboard/stocks/people/peoplewidgets.py
Modified: branches/bigboard-0-5/bigboard/people_tracker.py
==============================================================================
--- branches/bigboard-0-5/bigboard/people_tracker.py (original)
+++ branches/bigboard-0-5/bigboard/people_tracker.py Thu Jun 19 03:55:17 2008
@@ -29,6 +29,7 @@
__gsignals__ = {
"display-name-changed": (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
"icon-url-changed": (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
+ "home-url-changed": (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
"aims-changed": (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
"aim-buddies-changed": (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
"emails-changed": (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
@@ -54,6 +55,7 @@
self.local_buddies = []
self.icon_url = None
+ self.home_url = None
self.online = False
self.status = STATUS_NOT_A_CONTACT
@@ -102,6 +104,7 @@
if self.user:
self.user.disconnect(self.__user_name_changed)
self.user.disconnect(self.__user_photo_url_changed)
+ self.user.disconnect(self.__user_home_url_changed)
self.user.disconnect(self.__user_aims_changed)
self.user.disconnect(self.__user_emails_changed)
self.user.disconnect(self.__user_xmpps_changed)
@@ -114,6 +117,7 @@
if self.user:
self.user.connect(self.__user_name_changed, "name")
self.user.connect(self.__user_photo_url_changed, "photoUrl")
+ self.user.connect(self.__user_home_url_changed, "homeUrl")
self.user.connect(self.__user_aims_changed, "aims")
self.user.connect(self.__user_emails_changed, "emails")
self.user.connect(self.__user_xmpps_changed, "xmpps")
@@ -128,6 +132,7 @@
self.__user_aim_buddies_changed(user)
self.__user_xmpp_buddies_changed(user)
self.__user_photo_url_changed(user)
+ self.__user_home_url_changed(user)
self.__user_local_buddies_changed(user)
def __set_buddy(self, buddy):
@@ -173,6 +178,9 @@
def __user_photo_url_changed(self, user):
self.__update_icon_url()
+ def __user_home_url_changed(self, user):
+ self.__update_home_url()
+
def __user_aims_changed(self, user):
self.__update_aims()
@@ -280,6 +288,15 @@
self.icon_url = icon_url
self.emit('icon-url-changed')
+ def __update_home_url(self):
+ home_url = None
+ if self.user:
+ home_url = getattr(self.user, 'homeUrl', None)
+
+ if self.home_url != home_url:
+ self.home_url = home_url
+ self.emit('home-url-changed')
+
def __update_aims(self):
aims = set()
if self.contact:
@@ -404,31 +421,6 @@
self.__update_icon_url()
self.__update_online()
- def __update_icon_url(self):
- icon_url = None
- if self.user:
- icon_url = getattr(self.user, 'photoUrl', None)
-
- if not icon_url:
- for buddy in self.aim_buddies:
- icon_url = getattr(buddy, 'icon', None)
- if icon_url:
- break
- if not icon_url:
- for buddy in self.xmpp_buddies:
- icon_url = getattr(buddy, 'icon', None)
- if icon_url:
- break
- if not icon_url:
- for buddy in self.local_buddies:
- icon_url = getattr(buddy, 'contact', None)
- if icon_url:
- break
-
- if self.icon_url != icon_url:
- self.icon_url = icon_url
- self.emit('icon-url-changed')
-
def __update_online(self):
online = False
if not online:
Modified: branches/bigboard-0-5/bigboard/stocks/people/peoplewidgets.py
==============================================================================
--- branches/bigboard-0-5/bigboard/stocks/people/peoplewidgets.py (original)
+++ branches/bigboard-0-5/bigboard/stocks/people/peoplewidgets.py Thu Jun 19 03:55:17 2008
@@ -540,11 +540,13 @@
self.__header.append(name_vbox)
- user = self.person.user
- if user:
- mugshot_link = ActionLink(text="Mugshot", padding=6)
- self.__header.append(mugshot_link, flags=hippo.PACK_END)
- mugshot_link.connect("activated", self.__on_activate_web)
+ if self.person.home_url:
+ if self.person.home_url.find("mugshot.org") >= 0:
+ web_link = ActionLink(text="Mugshot", padding=6)
+ else:
+ web_link = ActionLink(text="Web", padding=6)
+ self.__header.append(web_link, flags=hippo.PACK_END)
+ web_link.connect("activated", self.__on_activate_web)
self.__top_box = hippo.CanvasBox(orientation=hippo.ORIENTATION_HORIZONTAL)
self.append(self.__top_box)
@@ -552,8 +554,8 @@
self.__photo = CanvasMugshotURLImage(scale_width=60,
scale_height=60,
border=5)
-
- if user:
+
+ if self.person.home_url:
self.__photo.set_clickable(True)
self.__photo.connect("activated", self.__on_activate_web)
@@ -826,7 +828,8 @@
def __on_activate_web(self, canvas_item):
self.emit("close", True)
- libbig.show_url(self.person.user.homeUrl)
+ if self.person.home_url:
+ libbig.show_url(self.person.home_url)
def __on_activate_email(self, canvas_item, addr):
self.emit("close", True)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]