Beispiel #1
0
 def __init__(self, bookmark_child):
     super(LocalFile, self).__init__()
     attrs = xml_get_attrs(bookmark_child, ['href', 'modified', 'visited'])
     self._url = attrs['href'].encode('utf-8')     
     # google.parse_timestamp() just parses an RFC 3339 format timestamp,
     # which 'modified' and 'visited' timestamps here use as well.
     # We'll need to move that function to some more generic file. 
     modified = google.parse_timestamp(attrs['modified'])
     visited = google.parse_timestamp(attrs['visited'])
     self._access_time = max(modified, visited)
     self._name = urllib.unquote(os.path.basename(self._url))
     self._full_name = self._url
     self._source_key = 'files'
     self._is_valid = True
     uri = gnomevfs.URI(self._url)
     if uri.is_local:        
         self.__update_async(self.__on_async_update)
     else:
         self._is_valid = True
         self._image_name = gtk.STOCK_FILE
Beispiel #2
0
    def __load_app_from_xml(self, node):
        id = node.getAttribute("id")
        #_logger.debug("parsing application id=%s", id)
        attrs = xml_get_attrs(node, ['id', 'rank', 'usageCount', 
                                     'iconUrl', 
                                     'category',
                                     'name', 'desktopNames', 'packageNames',
                                     ('tooltip', True),
                                     ('genericName', True)
                                    ])
        description = xml_query(node, 'description#')
        if description:
            attrs['description'] = description

        ## the old http format uses 'category' for what the data model
        ## calls 'categoryDisplayName'
        if attrs.has_key('category') and not attrs.has_key('categoryDisplayName'):
            attrs['categoryDisplayName'] = attrs['category']
            del attrs['category']

        return attrs