- Timestamp:
- 07/09/06 18:13:24 (2 years ago)
- Files:
-
- 1 modified
-
storage/bookmarks_store.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
storage/bookmarks_store.py
r33 r34 8 8 sys.exit(1) 9 9 10 bmark_file="bookmarks.xml"11 12 10 # this class represent the whole bookmarks list 13 11 class bookmarks_store : 14 12 15 13 # bts_name is a string arg. It will be used to have 16 14 # differents bookmarks for differents protocols. 17 15 def __init__(self, bts_name) : 16 self.bmark_file ="bookmarks_%s.xml" %(bts_name) 18 17 #listing is : Title of the bookmarks, description of the search 19 18 # search method : … … 23 22 # 4- advanced search 24 23 self.listing = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING) 25 def reorder_callback(treemodel, path, iter, new_order): 24 # rows-reordered signal not sent 25 # but I let this code here, don't know why. 26 def reorder_callback(treemodel, path, itera, new_order): 26 27 print "reordering" 27 28 self.sync_file() 29 # Funny ! rows-reordered is not sent but we can 30 # use the rows-deleted signal as well. 31 def deleted_callback(treemodel, path): 32 self.sync_file() 28 33 self.listing.connect("rows-reordered", reorder_callback) 29 if os.path.exists(bmark_file) : 30 f = open(bmark_file,mode='r') 34 self.listing.connect("row-deleted", deleted_callback) 35 if os.path.exists(self.bmark_file) : 36 f = open(self.bmark_file,mode='r') 31 37 # sanitize the pretty XML 32 38 stringed = f.read().replace('\n','').replace('\t','') … … 42 48 # 43 49 #then we create the file 44 f = open( bmark_file, mode='a+')50 f = open(self.bmark_file, mode='a+') 45 51 f.write(doc.toxml().encode("utf-8")) 46 52 f.close() … … 81 87 # but I'm not sure that those operations are so frequent 82 88 # might be changed in the future. 83 f = open( bmark_file, mode='w+')89 f = open(self.bmark_file, mode='w+') 84 90 f.write(doc.toprettyxml().encode("utf-8")) 85 91 f.close()
