Merge lp:~dobey/ubuntuone-client/bookmark-fixins into lp:ubuntuone-client

Proposed by dobey
Status: Merged
Approved by: Mark G. Saye
Approved revision: 233
Merged at revision: not available
Proposed branch: lp:~dobey/ubuntuone-client/bookmark-fixins
Merge into: lp:ubuntuone-client
Diff against target: 59 lines
1 file modified
bin/ubuntuone-client-applet (+10/-18)
To merge this branch: bzr merge lp:~dobey/ubuntuone-client/bookmark-fixins
Reviewer Review Type Date Requested Status
Mark G. Saye (community) Approve
John O'Brien (community) Approve
Review via email: mp+12799@code.launchpad.net

Commit message

Remove the remove_from_places code
Add a config option to only create the bookmark on first authorization
Only set the bookmark on first authorization

To post a comment you must log in.
Revision history for this message
John O'Brien (jdobrien) wrote :

Looks good.

When reviewing this I noticed I had the following bookmark:
file:///home/john/Ubuntu%20One/My%20Files Ubuntu One

I am guessing it's an old one and that it was overridden by the correct one that came after it.

review: Approve
Revision history for this message
Mark G. Saye (markgsaye) wrote :

Bookmark appears when first expected, but not after deleting it. Code looks good, tests pass (apart from one unrelated failure)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/ubuntuone-client-applet'
--- bin/ubuntuone-client-applet 2009-09-30 14:31:41 +0000
+++ bin/ubuntuone-client-applet 2009-10-02 18:00:27 +0000
@@ -121,6 +121,9 @@
121 if not self.config.has_option("ubuntuone", "connected"):121 if not self.config.has_option("ubuntuone", "connected"):
122 self.config.set("ubuntuone", "connected", "False")122 self.config.set("ubuntuone", "connected", "False")
123123
124 if not self.config.has_option("ubuntuone", "bookmarked"):
125 self.config.set("ubuntuone", "bookmarked", "False")
126
124 self.show_applet = self.config.getint("ubuntuone", "show_applet")127 self.show_applet = self.config.getint("ubuntuone", "show_applet")
125 self.connect = self.config.getint("ubuntuone", "connect")128 self.connect = self.config.getint("ubuntuone", "connect")
126 self.connected = self.config.getboolean("ubuntuone", "connected")129 self.connected = self.config.getboolean("ubuntuone", "connected")
@@ -756,8 +759,6 @@
756 iface = dbus.Interface(client, DBUS_IFACE_SYNC_NAME)759 iface = dbus.Interface(client, DBUS_IFACE_SYNC_NAME)
757 def got_root(root):760 def got_root(root):
758 """We got the root dir."""761 """We got the root dir."""
759 if self.__managed_dir:
760 self.__remove_from_places(self.__managed_dir)
761 self.__managed_dir = root762 self.__managed_dir = root
762 if os.path.isdir(self.__managed_dir) and \763 if os.path.isdir(self.__managed_dir) and \
763 os.access(self.__managed_dir,764 os.access(self.__managed_dir,
@@ -961,9 +962,10 @@
961962
962 def __add_to_places(self):963 def __add_to_places(self):
963 """Add the managed directory to the .gtk-bookmarks file."""964 """Add the managed directory to the .gtk-bookmarks file."""
964 # migrate from the old places bookmark965 # Only add once
965 if os.path.basename(self.__managed_dir) != BOOKMARK_NAME:966 if self.__config.getboolean("ubuntuone", "bookmarked"):
966 self.__remove_from_places(os.path.dirname(self.__managed_dir))967 return
968
967 path = os.path.join(os.path.expanduser("~"), ".gtk-bookmarks")969 path = os.path.join(os.path.expanduser("~"), ".gtk-bookmarks")
968 with open(path, "a+") as f:970 with open(path, "a+") as f:
969 bookmarks_entry = "file://%s %s\n" % (971 bookmarks_entry = "file://%s %s\n" % (
@@ -975,19 +977,9 @@
975 if not in_file:977 if not in_file:
976 f.write(bookmarks_entry)978 f.write(bookmarks_entry)
977979
978 def __remove_from_places(self, dir):980 self.__config.set("ubuntuone", "bookmarked", "True")
979 """Remove the old path from the .gtk-bookmarks file."""981 with open(CONF_FILE, "w+b") as f:
980 path = os.path.join(os.path.expanduser("~"), ".gtk-bookmarks")982 self.__config.write(f)
981 with open(path, "a+") as f:
982 entry = "file://%s %s\n" % (quote(dir), os.path.basename(dir))
983 lines = []
984 for line in f:
985 if line != entry:
986 lines.append(line)
987 f.truncate(0)
988 f.seek(0)
989 output = "".join(lines)
990 f.write(output)
991983
992 def sd_dbus_error(self, error):984 def sd_dbus_error(self, error):
993 """985 """

Subscribers

People subscribed via source and target branches