- def _init_contacts_view(self):
- self._contactsview.set_model(self._contactsmodel)
-
- # Add the column to the treeview
- column = gtk.TreeViewColumn("Contact")
-
- #displayContactSource = False
- displayContactSource = True
- if displayContactSource:
- textrenderer = gtk.CellRendererText()
- column.pack_start(textrenderer, expand=False)
- column.add_attribute(textrenderer, 'text', 0)
-
- textrenderer = gtk.CellRendererText()
- column.pack_start(textrenderer, expand=True)
- column.add_attribute(textrenderer, 'text', 1)
-
- textrenderer = gtk.CellRendererText()
- column.pack_start(textrenderer, expand=True)
- column.add_attribute(textrenderer, 'text', 4)
-
- column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
- column.set_sort_column_id(1)
- column.set_visible(True)
- self._contactsview.append_column(column)
-
- self._contactsviewselection = self._contactsview.get_selection()
- self._contactsviewselection.set_mode(gtk.SELECTION_SINGLE)
-
- def _init_books_combo(self):
- self._booksList.clear()
- for (factoryId, bookId), (factoryName, bookName) in self.get_addressbooks():
- if factoryName and bookName:
- entryName = "%s: %s" % (factoryName, bookName)
- elif factoryName:
- entryName = factoryName
- elif bookName:
- entryName = bookName
- else:
- entryName = "Bad name (%d)" % factoryId
- row = (str(factoryId), bookId, entryName)
- self._booksList.append(row)
-
- self._booksSelectionBox.set_model(self._booksList)
- cell = gtk.CellRendererText()
- self._booksSelectionBox.pack_start(cell, True)
- self._booksSelectionBox.add_attribute(cell, 'text', 2)
- self._booksSelectionBox.set_active(0)
-