Merge lp:~3v1n0/ubuntuone-client/mnemonics-files-fix into lp:ubuntuone-client

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: dobey
Approved revision: 1404
Merged at revision: 1403
Proposed branch: lp:~3v1n0/ubuntuone-client/mnemonics-files-fix
Merge into: lp:ubuntuone-client
Diff against target: 44 lines (+14/-2)
2 files modified
tests/platform/sync_menu/test_linux.py (+12/-0)
ubuntuone/platform/sync_menu/linux.py (+2/-2)
To merge this branch: bzr merge lp:~3v1n0/ubuntuone-client/mnemonics-files-fix
Reviewer Review Type Date Requested Status
Mike McCracken (community) Approve
dobey (community) Approve
Review via email: mp+194560@code.launchpad.net

Commit message

LinuxSyncMenu: Sanitize the menu entries by replacing one underscore character into two.

This makes libdbusmenu happy and show it as a single underscore instead that as a mnemonic
character.

Description of the change

LibDBusMenu internally treats strings with one underscore char as mnemonics, this won't happens when adding two underscores.

To post a comment you must log in.
Revision history for this message
dobey (dobey) wrote :

Looks ok to me.

review: Approve
Revision history for this message
Mike McCracken (mikemc) :
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 2013-04-16 15:33:43 +0000
3+++ tests/platform/sync_menu/test_linux.py 2013-11-08 18:02:11 +0000
4@@ -435,6 +435,18 @@
5 linux.SyncMenu.PROGRESS_MENUITEM_PROP_PERCENT_DONE),
6 percentage)
7
8+ def test_mnemonics_labels(self):
9+ """Check that the transfers menu sanitizes the underscores."""
10+ data_recent = ['file_1', 'file__2']
11+ self.status_frontend.recent_transfers_data = \
12+ data_recent
13+ self.sync_menu.transfers.update_progress()
14+ children = self.sync_menu.transfers.get_children()
15+ data_recent.reverse()
16+ for itemM, itemD in zip(children, data_recent):
17+ self.assertEqual(itemM.property_get(
18+ linux.Dbusmenu.MENUITEM_PROP_LABEL), itemD.replace('_', '__'))
19+
20 def test_update_transfers(self):
21 """Check that everything is ok when updating the transfers value."""
22 data_current = [
23
24=== modified file 'ubuntuone/platform/sync_menu/linux.py'
25--- ubuntuone/platform/sync_menu/linux.py 2013-04-16 15:21:09 +0000
26+++ ubuntuone/platform/sync_menu/linux.py 2013-11-08 18:02:11 +0000
27@@ -269,7 +269,7 @@
28 for item in recent_transfers:
29 recent_file = Dbusmenu.Menuitem()
30 recent_file.property_set(Dbusmenu.MENUITEM_PROP_LABEL,
31- item)
32+ item.replace('_', '__'))
33 self.child_add_position(recent_file, 0)
34 temp_transfers[item] = recent_file
35 self._transfers_items = temp_transfers
36@@ -305,7 +305,7 @@
37 percentage = written * 100 / size
38 uploading_file = Dbusmenu.Menuitem()
39 uploading_file.property_set(Dbusmenu.MENUITEM_PROP_LABEL,
40- item)
41+ item.replace('_', '__'))
42 uploading_file.property_set(Dbusmenu.MENUITEM_PROP_TYPE,
43 SyncMenu.PROGRESS_MENUITEM_TYPE)
44 uploading_file.property_set_int(

Subscribers

People subscribed via source and target branches