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
=== modified file 'tests/platform/sync_menu/test_linux.py'
--- tests/platform/sync_menu/test_linux.py 2013-04-16 15:33:43 +0000
+++ tests/platform/sync_menu/test_linux.py 2013-11-08 18:02:11 +0000
@@ -435,6 +435,18 @@
435 linux.SyncMenu.PROGRESS_MENUITEM_PROP_PERCENT_DONE),435 linux.SyncMenu.PROGRESS_MENUITEM_PROP_PERCENT_DONE),
436 percentage)436 percentage)
437437
438 def test_mnemonics_labels(self):
439 """Check that the transfers menu sanitizes the underscores."""
440 data_recent = ['file_1', 'file__2']
441 self.status_frontend.recent_transfers_data = \
442 data_recent
443 self.sync_menu.transfers.update_progress()
444 children = self.sync_menu.transfers.get_children()
445 data_recent.reverse()
446 for itemM, itemD in zip(children, data_recent):
447 self.assertEqual(itemM.property_get(
448 linux.Dbusmenu.MENUITEM_PROP_LABEL), itemD.replace('_', '__'))
449
438 def test_update_transfers(self):450 def test_update_transfers(self):
439 """Check that everything is ok when updating the transfers value."""451 """Check that everything is ok when updating the transfers value."""
440 data_current = [452 data_current = [
441453
=== modified file 'ubuntuone/platform/sync_menu/linux.py'
--- ubuntuone/platform/sync_menu/linux.py 2013-04-16 15:21:09 +0000
+++ ubuntuone/platform/sync_menu/linux.py 2013-11-08 18:02:11 +0000
@@ -269,7 +269,7 @@
269 for item in recent_transfers:269 for item in recent_transfers:
270 recent_file = Dbusmenu.Menuitem()270 recent_file = Dbusmenu.Menuitem()
271 recent_file.property_set(Dbusmenu.MENUITEM_PROP_LABEL,271 recent_file.property_set(Dbusmenu.MENUITEM_PROP_LABEL,
272 item)272 item.replace('_', '__'))
273 self.child_add_position(recent_file, 0)273 self.child_add_position(recent_file, 0)
274 temp_transfers[item] = recent_file274 temp_transfers[item] = recent_file
275 self._transfers_items = temp_transfers275 self._transfers_items = temp_transfers
@@ -305,7 +305,7 @@
305 percentage = written * 100 / size305 percentage = written * 100 / size
306 uploading_file = Dbusmenu.Menuitem()306 uploading_file = Dbusmenu.Menuitem()
307 uploading_file.property_set(Dbusmenu.MENUITEM_PROP_LABEL,307 uploading_file.property_set(Dbusmenu.MENUITEM_PROP_LABEL,
308 item)308 item.replace('_', '__'))
309 uploading_file.property_set(Dbusmenu.MENUITEM_PROP_TYPE,309 uploading_file.property_set(Dbusmenu.MENUITEM_PROP_TYPE,
310 SyncMenu.PROGRESS_MENUITEM_TYPE)310 SyncMenu.PROGRESS_MENUITEM_TYPE)
311 uploading_file.property_set_int(311 uploading_file.property_set_int(

Subscribers

People subscribed via source and target branches