self._progress("Finalising...", current_tick, total_ticks)
current_tick += len(contacts)
service.finalise(self.updated, overwrite_existing_fields)
- self.friends[service.get_id] = service.get_unmatched_friends()
+ for friend in service.get_unmatched_friends():
+ friend.set_source(service.get_id())
+ key = unicode(friend['name']).encode('trans') + "_" + service.get_id()
+ self.friends[key] = friend
# commit changes
tick_increment = total_contacts / (len(self.updated) or 1)
if result == gtk.RESPONSE_OK:
friend = view.get_selected_friend()
if friend:
- if 'contact' in friend and friend['contact'] == contact:
+ if friend.get_contact() == contact:
hildon.hildon_banner_show_information(self.main_window, '', _("Removing existing mappings is not yet supported"))
elif view.contact_mapped:
if fb2c.update_contact(contact, friend, True):
self.treestore = gtk.ListStore(gtk.gdk.Pixbuf, str, gtk.gdk.Pixbuf, gobject.TYPE_PYOBJECT)
accounts = {}
- _facebook = gtk.gdk.pixbuf_new_from_file('/opt/hermes/share/account-facebook.png')
- _twitter = gtk.gdk.pixbuf_new_from_file('/opt/hermes/share/account-twitter.png')
- _tick = gtk.icon_theme_get_default().load_icon('widgets_tickmark_list', 48, 0)
+ _tick = gtk.icon_theme_get_default().load_icon('widgets_tickmark_list', 48, 0)
self.contact_mapped = False
mapped_iter = None
for key in sorted(self.friends.keys(), cmp = lambda a, b: cmp(a.lower(), b.lower())):
friend = self.friends[key]
- if friend['account'] not in accounts:
- accounts[friend['account']] = gtk.gdk.pixbuf_new_from_file("/opt/hermes/share/account-%s.png" % (friend['account']))
+ if friend.get_source() not in accounts:
+ try:
+ accounts[friend.get_source()] = gtk.gdk.pixbuf_new_from_file("/opt/hermes/share/account-%s.png" % (friend.get_source()))
+ except glib.GError, e:
+ accounts[friend.get_source()] = None
+ print "Couldn't find icon:", e.message
- photo = friend['pic']
pixbuf = None
- if 'contact' in friend:
- if friend['contact'] == contact:
+ if friend.get_contact() is not None:
+ if friend.get_contact() == contact:
pixbuf = _tick
self.contact_mapped = True
- mapped_iter = self.treestore.append([accounts[friend['account']], friend['name'], pixbuf, friend])
+ mapped_iter = self.treestore.append([accounts[friend.get_source()], friend.get_name(), pixbuf, friend])
else:
continue
else:
- self.treestore.append([accounts[friend['account']], friend['name'], pixbuf, friend])
+ self.treestore.append([accounts[friend.get_source()], friend.get_name(), pixbuf, friend])
self.treeview = gtk.TreeView(self.treestore)
hildon.hildon_gtk_tree_view_set_ui_mode(self.treeview, gtk.HILDON_UI_MODE_EDIT)
path = self.treestore.get_path(mapped_iter)
self.treeview.get_selection().select_path(path)
self.treeview.scroll_to_cell(path)
+ else:
+ self.treeview.get_selection().unselect_all()
self.add(self.treeview)
self.set_size_request_policy(hildon.SIZE_REQUEST_CHILDREN)