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
1=== modified file 'tests/platform/sync_menu/test_linux.py'
2--- tests/platform/sync_menu/test_linux.py 2012-10-11 12:01:27 +0000
3+++ tests/platform/sync_menu/test_linux.py 2012-10-30 14:00:39 +0000
4@@ -76,6 +76,7 @@
5 def __init__(self):
6 self.connect_called = False
7 self.disconnect_called = False
8+ self.fake_root_path = "/home/user/Ubuntu One"
9
10 def connect(self):
11 """Set connect to True."""
12@@ -85,6 +86,10 @@
13 """Set connect to True."""
14 self.disconnect_called = True
15
16+ def get_rootdir(self):
17+ """Return a fake ubuntu one folder path."""
18+ return self.fake_root_path
19+
20
21 class FakeSyncMenuApp(object):
22 """Fake SyncMenu."""
23@@ -157,9 +162,17 @@
24 self.sync_menu.root_menu)
25 self.assertEqual(self.sync_menu.transfers.get_parent(),
26 self.sync_menu.root_menu)
27+ self.assertEqual(self.sync_menu.open_u1_folder.get_parent(),
28+ self.sync_menu.root_menu)
29+ self.assertEqual(self.sync_menu.share_file.get_parent(),
30+ self.sync_menu.root_menu)
31
32 self.assertEqual(self.sync_menu.open_u1.property_get(
33 linux.Dbusmenu.MENUITEM_PROP_LABEL), linux.OPEN_U1)
34+ self.assertEqual(self.sync_menu.open_u1_folder.property_get(
35+ linux.Dbusmenu.MENUITEM_PROP_LABEL), linux.OPEN_U1_FOLDER)
36+ self.assertEqual(self.sync_menu.share_file.property_get(
37+ linux.Dbusmenu.MENUITEM_PROP_LABEL), linux.SHARE_A_FILE)
38 self.assertEqual(self.sync_menu.go_to_web.property_get(
39 linux.Dbusmenu.MENUITEM_PROP_LABEL), linux.GO_TO_WEB)
40 self.assertEqual(self.sync_menu.transfers.property_get(
41@@ -181,6 +194,15 @@
42 self.sync_menu.open_control_panel()
43 self.assertEqual(data, ['ubuntuone-control-panel-qt'])
44
45+ def test_open_share_tab(self):
46+ """Check that the proper action is executed."""
47+ data = []
48+
49+ self.patch(linux.glib, "spawn_command_line_async", data.append)
50+ self.sync_menu.open_share_file_tab()
51+ self.assertEqual(data, [
52+ 'ubuntuone-control-panel-qt --switch-to share_links'])
53+
54 def test_go_to_web(self):
55 """Check that the proper action is executed."""
56 data = []
57@@ -189,6 +211,14 @@
58 self.sync_menu.open_go_to_web()
59 self.assertEqual(data, [linux.DASHBOARD])
60
61+ def test_open_ubuntu_one_folder(self):
62+ """Check that the proper action is executed."""
63+ data = []
64+
65+ self.patch(linux.webbrowser, "open", data.append)
66+ self.sync_menu.open_ubuntu_one_folder()
67+ self.assertEqual(data, [self.syncdaemon_service.fake_root_path])
68+
69 def test_get_help(self):
70 """Check that the proper action is executed."""
71 data = []
72
73=== modified file 'ubuntuone/platform/sync_menu/linux.py'
74--- ubuntuone/platform/sync_menu/linux.py 2012-10-11 13:00:10 +0000
75+++ ubuntuone/platform/sync_menu/linux.py 2012-10-30 14:00:39 +0000
76@@ -63,11 +63,13 @@
77
78 Q_ = lambda string: gettext.dgettext(GETTEXT_PACKAGE, string)
79
80+GET_HELP = Q_("Get Help on the Web")
81+GO_TO_WEB = Q_("Go to the Ubuntu One Website")
82+MORE_STORAGE = Q_("Get More Space")
83 OPEN_U1 = Q_("Open Ubuntu One")
84-GO_TO_WEB = Q_("Go to the Ubuntu One Website")
85+OPEN_U1_FOLDER = Q_("Open the Ubuntu One Folder")
86+SHARE_A_FILE = Q_("Share a File")
87 TRANSFERS = Q_("Current and Recent Transfers")
88-MORE_STORAGE = Q_("Get More Space")
89-GET_HELP = Q_("Get Help on the Web")
90
91 DELAY_BETWEEN_UPDATES = 3
92 UBUNTUONE_LINK = u'https://one.ubuntu.com/'
93@@ -90,6 +92,12 @@
94
95 self.open_u1 = Dbusmenu.Menuitem()
96 self.open_u1.property_set(Dbusmenu.MENUITEM_PROP_LABEL, OPEN_U1)
97+ self.open_u1_folder = Dbusmenu.Menuitem()
98+ self.open_u1_folder.property_set(Dbusmenu.MENUITEM_PROP_LABEL,
99+ OPEN_U1_FOLDER)
100+ self.share_file = Dbusmenu.Menuitem()
101+ self.share_file.property_set(Dbusmenu.MENUITEM_PROP_LABEL,
102+ SHARE_A_FILE)
103
104 self.go_to_web = Dbusmenu.Menuitem()
105 self.go_to_web.property_set(Dbusmenu.MENUITEM_PROP_LABEL,
106@@ -110,6 +118,10 @@
107 # Connect signals
108 self.open_u1.connect(Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED,
109 self.open_control_panel)
110+ self.open_u1_folder.connect(Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED,
111+ self.open_ubuntu_one_folder)
112+ self.share_file.connect(Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED,
113+ self.open_share_file_tab)
114 self.go_to_web.connect(Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED,
115 self.open_go_to_web)
116 self.get_help.connect(Dbusmenu.MENUITEM_SIGNAL_ITEM_ACTIVATED,
117@@ -119,6 +131,8 @@
118
119 # Add items
120 self.root_menu.child_append(self.open_u1)
121+ self.root_menu.child_append(self.open_u1_folder)
122+ self.root_menu.child_append(self.share_file)
123 self.root_menu.child_append(self.go_to_web)
124 self.root_menu.child_append(self.transfers)
125 self.root_menu.child_append(self.more_storage)
126@@ -155,6 +169,18 @@
127 except glib.GError as e:
128 logger.warning('Failed to open the control panel: %s.' % e)
129
130+ def open_ubuntu_one_folder(self, *args):
131+ """Open the Ubuntu One folder."""
132+ webbrowser.open(self._syncdaemon_service.get_rootdir())
133+
134+ def open_share_file_tab(self, *args):
135+ """Open the Control Panel in the Share Tab."""
136+ try:
137+ glib.spawn_command_line_async('ubuntuone-control-panel-qt '
138+ '--switch-to share_links')
139+ except glib.GError as e:
140+ logger.warning('Failed to open the control panel: %s.' % e)
141+
142 def open_go_to_web(self, *args):
143 """Open the Ubunto One Help Page"""
144 webbrowser.open(DASHBOARD)

Subscribers

People subscribed via source and target branches