Some minor cleanups to the new GUI for addressbooks
authorepage <eopage@byu.net>
Sat, 9 Aug 2008 22:16:11 +0000 (22:16 +0000)
committerepage <eopage@byu.net>
Sat, 9 Aug 2008 22:16:11 +0000 (22:16 +0000)
git-svn-id: file:///svnroot/gc-dialer/trunk@134 c39d3808-3fe2-4d86-a59f-b7f623ee9f21

src/evo_backend.py
src/gc_backend.py
src/gc_dialer.py

index cd6a50c..85452ae 100644 (file)
@@ -62,9 +62,13 @@ class EvolutionAddressBook(object):
                return self
 
        @staticmethod
-       def factory_name():
+       def factory_short_name():
                return "Evo"
 
+       @staticmethod
+       def factory_name():
+               return "Evolution"
+
        def get_contacts(self):
                """
                @returns Iterable of (contact id, contact name)
index 9af4df7..c600713 100644 (file)
@@ -262,15 +262,19 @@ class GCDialer(object):
                """
                @returns Iterable of (Address Book Factory, Book Id, Book Name)
                """
-               yield self, "", "Grand Central"
+               yield self, "", ""
        
        def open_addressbook(self, bookId):
                return self
 
        @staticmethod
-       def factory_name():
+       def factory_short_name():
                return "GC"
 
+       @staticmethod
+       def factory_name():
+               return "Grand Central"
+
        def get_contacts(self):
                """
                @returns Iterable of (contact id, contact name)
index 888ef83..e1677f3 100755 (executable)
@@ -164,6 +164,10 @@ class DummyAddressBook(object):
                return self
 
        @staticmethod
+       def factory_short_name():
+               return ""
+
+       @staticmethod
        def factory_name():
                return ""
 
@@ -392,7 +396,14 @@ class Dialpad(object):
 
                self._booksList = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING)
                for (factoryId, bookId), (factoryName, bookName) in self.get_addressbooks():
-                       entryName = "%s: %s" % (factoryName, bookName) if factoryName else bookName
+                       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)
 
@@ -517,7 +528,7 @@ class Dialpad(object):
                if self._gcContactIcon is not None:
                        contactType = (self._gcContactIcon,)
                else:
-                       contactType = (self._gcContactText,)
+                       contactType = (self._addressBook.factory_short_name(),)
                for contactId, contactName in self._addressBook.get_contacts():
                        self._contactsmodel.append(contactType + (contactName, "", contactId) + ("",))
                        yield