Merge lp:~diegosarmentero/ubuntuone-client/menu-new-options into lp:ubuntuone-client

Proposed by Diego Sarmentero
Status: Merged
Approved by: dobey
Approved revision: 1358
Merged at revision: 1357
Proposed branch: lp:~diegosarmentero/ubuntuone-client/menu-new-options
Merge into: lp:ubuntuone-client
Diff against target: 144 lines (+59/-3)
2 files modified
tests/platform/sync_menu/test_linux.py (+30/-0)
ubuntuone/platform/sync_menu/linux.py (+29/-3)
To merge this branch: bzr merge lp:~diegosarmentero/ubuntuone-client/menu-new-options
Reviewer Review Type Date Requested Status
dobey (community) Approve
Michał Karnicki (community) Approve
Review via email: mp+132106@code.launchpad.net

Commit message

- Adding access to the Ubuntu One folder and Share tab from the sync menu indicator (LP: #1063786 #1063788).

Description of the change

You can test it IRL, stopping syncdaemon with: u1sdtool -q
And then executing this branch with (inside this branch folder): PYTHONPATH=. bin/ubuntuone-syncdaemon

To post a comment you must log in.
1358. By Diego Sarmentero

sorting the string alphabetically

Revision history for this message
Michał Karnicki (karni) :
review: Approve
Revision history for this message
dobey (dobey) wrote :

Is there a rationale somewhere for these additions? The bugs just say "we need these" with no rationale or design documentation about them at all. Adding a bunch of excessive things to the menu seems to be the wrong way to go about this.

review: Needs Information
Revision history for this message
Diego Sarmentero (diegosarmentero) wrote :

> Is there a rationale somewhere for these additions? The bugs just say "we need
> these" with no rationale or design documentation about them at all. Adding a
> bunch of excessive things to the menu seems to be the wrong way to go about
> this.

Yes, this was designed, but we didn't have the time to implement it before:
https://docs.google.com/a/canonical.com/presentation/d/1muWyqTsKPgHahHfapHGROafcJcm_Z_XiSaNyxKS3h-w/edit

Revision history for this message
dobey (dobey) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/platform/sync_menu/test_linux.py'
--- tests/platform/sync_menu/test_linux.py 2012-10-11 12:01:27 +0000
+++ tests/platform/sync_menu/test_linux.py 2012-10-30 14:00:39 +0000
@@ -76,6 +76,7 @@
76 def __init__(self):76 def __init__(self):
77 self.connect_called = False77 self.connect_called = False
78 self.disconnect_called = False78 self.disconnect_called = False
79 self.fake_root_path = "/home/user/Ubuntu One"
7980
80 def connect(self):81 def connect(self):
81 """Set connect to True."""82 """Set connect to True."""
@@ -85,6 +86,10 @@
85 """Set connect to True."""86 """Set connect to True."""
86 self.disconnect_called = True87 self.disconnect_called = True
8788
89 def get_rootdir(self):
90 """Return a fake ubuntu one folder path."""
91 return self.fake_root_path
92
8893
89class FakeSyncMenuApp(object):94class FakeSyncMenuApp(object):
90 """Fake SyncMenu."""95 """Fake SyncMenu."""
@@ -157,9 +162,17 @@
157 self.sync_menu.root_menu)162 self.sync_menu.root_menu)
158 self.assertEqual(self.sync_menu.transfers.get_parent(),163 self.assertEqual(self.sync_menu.transfers.get_parent(),
159 self.sync_menu.root_menu)164 self.sync_menu.root_menu)
165 self.assertEqual(self.sync_menu.open_u1_folder.get_parent(),
166 self.sync_menu.root_menu)
167 self.assertEqual(self.sync_menu.share_file.get_parent(),
168 self.sync_menu.root_menu)
160169
161 self.assertEqual(self.sync_menu.open_u1.property_get(170 self.assertEqual(self.sync_menu.open_u1.property_get(
162 linux.Dbusmenu.MENUITEM_PROP_LABEL), linux.OPEN_U1)171 linux.Dbusmenu.MENUITEM_PROP_LABEL), linux.OPEN_U1)
172 self.assertEqual(self.sync_menu.open_u1_folder.property_get(
173 linux.Dbusmenu.MENUITEM_PROP_LABEL), linux.OPEN_U1_FOLDER)
174 self.assertEqual(self.sync_menu.share_file.property_get(
175 linux.Dbusmenu.MENUITEM_PROP_LABEL), linux.SHARE_A_FILE)
163 self.assertEqual(self.sync_menu.go_to_web.property_get(176 self.assertEqual(self.sync_menu.go_to_web.property_get(
164 linux.Dbusmenu.MENUITEM_PROP_LABEL), linux.GO_TO_WEB)177 linux.Dbusmenu.MENUITEM_PROP_LABEL), linux.GO_TO_WEB)
165 self.assertEqual(self.sync_menu.transfers.property_get(178 self.assertEqual(self.sync_menu.transfers.property_get(
@@ -181,6 +194,15 @@
181 self.sync_menu.open_control_panel()194 self.sync_menu.open_control_panel()
182 self.assertEqual(data, ['ubuntuone-control-panel-qt'])195 self.assertEqual(data, ['ubuntuone-control-panel-qt'])
183196
197 def test_open_share_tab(self):
198 """Check that the proper action is executed."""
199 data = []
200
201 self.patch(linux.glib, "spawn_command_line_async", data.append)
202 self.sync_menu.open_share_file_tab()
203 self.assertEqual(data, [
204 'ubuntuone-control-panel-qt --switch-to share_links'])
205
184 def test_go_to_web(self):206 def test_go_to_web(self):
185 """Check that the proper action is executed."""207 """Check that the proper action is executed."""
186 data = []208 data = []
@@ -189,6 +211,14 @@
189 self.sync_menu.open_go_to_web()211 self.sync_menu.open_go_to_web()
190 self.assertEqual(data, [linux.DASHBOARD])212 self.assertEqual(data, [linux.DASHBOARD])
191213
214 def test_open_ubuntu_one_folder(self):
215 """Check that the proper action is executed."""
216 data = []
217
218 self.patch(linux.webbrowser, "open", data.append)
219 self.sync_menu.open_ubuntu_one_folder()
220 self.assertEqual(data, [self.syncdaemon_service.fake_root_path])
221
192 def test_get_help(self):222 def test_get_help(self):
193 """Check that the proper action is executed."""223 """Check that the proper action is executed."""
194 data = []224 data = []
195225
=== modified file 'ubuntuone/platform/sync_menu/linux.py'
--- ubuntuone/platform/sync_menu/linux.py 2012-10-11 13:00:10 +0000
+++ ubuntuone/platform/sync_menu/linux.py 2012-10-30 14:00:39 +0000
@@ -63,11 +63,13 @@
6363
64Q_ = lambda string: gettext.dgettext(GETTEXT_PACKAGE, string)64Q_ = lambda string: gettext.dgettext(GETTEXT_PACKAGE, string)
6565
66GET_HELP = Q_("Get Help on the Web")
67GO_TO_WEB = Q_("Go to the Ubuntu One Website")
68MORE_STORAGE = Q_("Get More Space")
66OPEN_U1 = Q_("Open Ubuntu One")69OPEN_U1 = Q_("Open Ubuntu One")
67GO_TO_WEB = Q_("Go to the Ubuntu One Website")70OPEN_U1_FOLDER = Q_("Open the Ubuntu One Folder")
71SHARE_A_FILE = Q_("Share a File")
68TRANSFERS = Q_("Current and Recent Transfers")72TRANSFERS = Q_("Current and Recent Transfers")
69MORE_STORAGE = Q_("Get More Space")
70GET_HELP = Q_("Get Help on the Web")
7173
72DELAY_BETWEEN_UPDATES = 374DELAY_BETWEEN_UPDATES = 3
73UBUNTUONE_LINK = u'https://one.ubuntu.com/'75UBUNTUONE_LINK = u'https://one.ubuntu.com/'
@@ -90,6 +92,12 @@
9092
91 self.open_u1 = Dbusmenu.Menuitem()93 self.open_u1 = Dbusmenu.Menuitem()
92 self.open_u1.property_set(Dbusmenu.MENUITEM_PROP_LABEL, OPEN_U1)94 self.open_u1.property_set(Dbusmenu.MENUITEM_PROP_LABEL, OPEN_U1)
95 self.open_u1_folder = Dbusmenu.Menuitem()
96 self.open_u1_folder.property_set(Dbusmenu.MENUITEM_PROP_LABEL,
97 OPEN_U1_FOLDER)
98 self.share_file = Dbusmenu.Menuitem()
99 self.share_file.property_set(Dbusmenu.MENUITEM_PROP_LABEL,
100 SHARE_A_FILE)
93101
94 self.go_to_web = Dbusmenu.Menuitem()102 self.go_to_web = Dbusmenu.Menuitem()
95 self.go_to_web.property_set(Dbusmenu.MENUITEM_PROP_LABEL,103 self.go_to_web.property_set(Dbusmenu.MENUITEM_PROP_LABEL,
@@ -110,6 +118,10 @@
110 # Connect signals118 # Connect signals
111 self.open_u1.connect(Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED,119 self.open_u1.connect(Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED,
112 self.open_control_panel)120 self.open_control_panel)
121 self.open_u1_folder.connect(Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED,
122 self.open_ubuntu_one_folder)
123 self.share_file.connect(Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED,
124 self.open_share_file_tab)
113 self.go_to_web.connect(Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED,125 self.go_to_web.connect(Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED,
114 self.open_go_to_web)126 self.open_go_to_web)
115 self.get_help.connect(Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED,127 self.get_help.connect(Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED,
@@ -119,6 +131,8 @@
119131
120 # Add items132 # Add items
121 self.root_menu.child_append(self.open_u1)133 self.root_menu.child_append(self.open_u1)
134 self.root_menu.child_append(self.open_u1_folder)
135 self.root_menu.child_append(self.share_file)
122 self.root_menu.child_append(self.go_to_web)136 self.root_menu.child_append(self.go_to_web)
123 self.root_menu.child_append(self.transfers)137 self.root_menu.child_append(self.transfers)
124 self.root_menu.child_append(self.more_storage)138 self.root_menu.child_append(self.more_storage)
@@ -155,6 +169,18 @@
155 except glib.GError as e:169 except glib.GError as e:
156 logger.warning('Failed to open the control panel: %s.' % e)170 logger.warning('Failed to open the control panel: %s.' % e)
157171
172 def open_ubuntu_one_folder(self, *args):
173 """Open the Ubuntu One folder."""
174 webbrowser.open(self._syncdaemon_service.get_rootdir())
175
176 def open_share_file_tab(self, *args):
177 """Open the Control Panel in the Share Tab."""
178 try:
179 glib.spawn_command_line_async('ubuntuone-control-panel-qt '
180 '--switch-to share_links')
181 except glib.GError as e:
182 logger.warning('Failed to open the control panel: %s.' % e)
183
158 def open_go_to_web(self, *args):184 def open_go_to_web(self, *args):
159 """Open the Ubunto One Help Page"""185 """Open the Ubunto One Help Page"""
160 webbrowser.open(DASHBOARD)186 webbrowser.open(DASHBOARD)

Subscribers

People subscribed via source and target branches