Merge lp:~flimm/usb-creator/warn-before-format into lp:usb-creator

Proposed by David D Lowe
Status: Work in progress
Proposed branch: lp:~flimm/usb-creator/warn-before-format
Merge into: lp:usb-creator
Diff against target: 149 lines (+83/-4)
5 files modified
bin/usb-creator-helper (+1/-1)
debian/changelog (+5/-1)
debian/copyright (+5/-0)
usbcreator/backends/devicekit/backend.py (+1/-1)
usbcreator/frontends/gtk/frontend.py (+71/-1)
To merge this branch: bzr merge lp:~flimm/usb-creator/warn-before-format
Reviewer Review Type Date Requested Status
Dimitri John Ledkov Needs Information
Review via email: mp+17177@code.launchpad.net
To post a comment you must log in.
259. By David D Lowe

Merged with trunk.

260. By David D Lowe

Display partition name instead of drive name if only one partition is going to be deleted.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Now we do have a warning dialog box "Are you sure you want to erase this drive?" (at least in gtk).
Also we erase individual partitions now.
Is this still necessary? I see that you make more informative dialog boxes.

review: Needs Information
Revision history for this message
David D Lowe (flimm) wrote :

Seeing as USB Creator only erases individual partitions now, this fix is no longer necessary.

Any ideas what I could have done different to get this patch reviewed sooner? If it's just a matter of usb-creator developers being busy, I understand.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

I am so sorry, the review delay was a failure on our side. In the recent times, the core developer of usb-creator started working on other projects and this one got less attention. I am hoping to do timely reviews of usb-creator merge proposals.

Unmerged revisions

260. By David D Lowe

Display partition name instead of drive name if only one partition is going to be deleted.

259. By David D Lowe

Merged with trunk.

258. By David D Lowe

Warn user before formatting, listing all partitions that are going to be lost if more than one. (Fixes bug #446891

257. By David D Lowe

Warn user before formatting drive. (Fixes bug #443330)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/usb-creator-helper'
--- bin/usb-creator-helper 2009-12-08 08:58:46 +0000
+++ bin/usb-creator-helper 2010-01-13 18:33:15 +0000
@@ -100,7 +100,7 @@
100 def Format(self, device, sender=None, conn=None):100 def Format(self, device, sender=None, conn=None):
101 self.check_polkit(sender, conn, 'com.ubuntu.usbcreator.format')101 self.check_polkit(sender, conn, 'com.ubuntu.usbcreator.format')
102 check_system_internal(device)102 check_system_internal(device)
103 # TODO evand 2009-08-25: Needs a confirmation dialog.103 # TODO evand 2009-08-25: Needs a confirmation dialog. (Note: completed for gtk)
104 # XXX test with a device that doesn't have a partition table.104 # XXX test with a device that doesn't have a partition table.
105 bus = dbus.SystemBus()105 bus = dbus.SystemBus()
106 devkit = bus.get_object('org.freedesktop.DeviceKit.Disks',106 devkit = bus.get_object('org.freedesktop.DeviceKit.Disks',
107107
=== modified file 'debian/changelog'
--- debian/changelog 2010-01-11 19:28:39 +0000
+++ debian/changelog 2010-01-13 18:33:15 +0000
@@ -1,9 +1,13 @@
1usb-creator (0.2.15) UNRELEASED; urgency=low1usb-creator (0.2.15) UNRELEASED; urgency=low
22
3 [Mario Limonciello]
3 * Ensure that the download_dir is really a directory before scanning it for 4 * Ensure that the download_dir is really a directory before scanning it for
4 ISOs to include in the list. Fixes launching usb-creator-gtk as root.5 ISOs to include in the list. Fixes launching usb-creator-gtk as root.
56
6 -- Mario Limonciello <mario_limonciello@dell.com> Mon, 11 Jan 2010 13:27:36 -06007 [ David D Lowe ]
8 * Warn users before formatting entire drive. (LP: #443330)
9
10 -- David D Lowe <daviddlowe.flimm@gmail.com> Wed, 13 Jan 2010 18:11:08 +0000
711
8usb-creator (0.2.14) lucid; urgency=low12usb-creator (0.2.14) lucid; urgency=low
913
1014
=== modified file 'debian/copyright'
--- debian/copyright 2009-08-26 19:26:08 +0000
+++ debian/copyright 2010-01-13 18:33:15 +0000
@@ -8,6 +8,11 @@
88
9 Copyright (C) 2008 Canonical Ltd.9 Copyright (C) 2008 Canonical Ltd.
1010
11To the extent possible under law, David D Lowe has waived all copyright and
12related or neighboring rights to his modifications to this work, according to
13http://creativecommons.org/publicdomain/zero/1.0/
14You may delete this line and the three before it.
15
11KDE/Qt port Details16KDE/Qt port Details
12-------------------17-------------------
1318
1419
=== modified file 'usbcreator/backends/devicekit/backend.py'
--- usbcreator/backends/devicekit/backend.py 2009-10-19 09:53:52 +0000
+++ usbcreator/backends/devicekit/backend.py 2010-01-13 18:33:15 +0000
@@ -243,7 +243,7 @@
243 return mp243 return mp
244 244
245 def format(self, device):245 def format(self, device):
246 # TODO evand 2009-08-25: Needs a confirmation dialog.246 # TODO evand 2009-08-25: Needs a confirmation dialog. (Note: completed for gtk)
247 try:247 try:
248 dk = self.bus.get_object('org.freedesktop.DeviceKit.Disks', device)248 dk = self.bus.get_object('org.freedesktop.DeviceKit.Disks', device)
249 device = dk.Get(device, 'device-file', dbus_interface=PROPS_IFACE)249 device = dk.Get(device, 'device-file', dbus_interface=PROPS_IFACE)
250250
=== modified file 'usbcreator/frontends/gtk/frontend.py'
--- usbcreator/frontends/gtk/frontend.py 2010-01-11 19:28:39 +0000
+++ usbcreator/frontends/gtk/frontend.py 2010-01-13 18:33:15 +0000
@@ -659,13 +659,83 @@
659 message)659 message)
660 dialog.run()660 dialog.run()
661 dialog.destroy()661 dialog.destroy()
662
663 def _confirm(self, message, buttons, default=0, secondary_markup=None):
664 dialog = gtk.MessageDialog(self.window, gtk.DIALOG_MODAL |
665 gtk.DIALOG_DESTROY_WITH_PARENT,
666 gtk.MESSAGE_WARNING, gtk.BUTTONS_NONE, message)
667 for ii in xrange(len(buttons)):
668 dialog.add_button(buttons[ii], ii)
669 dialog.set_default_response(default)
670 if not secondary_markup is None:
671 dialog.format_secondary_markup(secondary_markup)
672 response = dialog.run()
673 if response == gtk.RESPONSE_DELETE_EVENT:
674 response = -1
675 dialog.destroy()
676 return response
677
678 @staticmethod
679 def get_drive(dev):
680 drive = None
681 monitor = gio.volume_monitor_get()
682 for item in monitor.get_connected_drives():
683 if 'unix-device' in item.enumerate_identifiers():
684 if item.get_identifier('unix-device') == dev:
685 drive = item
686 if drive is None:
687 for item in monitor.get_volumes():
688 if 'unix-device' in item.enumerate_identifiers():
689 if item.get_identifier('unix-device') == dev:
690 drive = item.get_drive()
691 return drive
692
693 if 'unix-device' in item.enumerate_identifiers():
694 driveStr = drive.get_identifier('unix-device')
695 vols = drive.get_volumes()
696 volsStr = ""
697 for vol in vols:
698 if 'unix-device' in item.enumerate_identifiers():
699 volsStr += vol.get_identifier('unix-device') + "\t"
700 volsStr += vol.get_name() + "\n"
662701
663 def format_dest_clicked(self, *args):702 def format_dest_clicked(self, *args):
664 # FIXME evand 2009-04-30: This needs a big warning dialog.
665 model, iterator = self.dest_treeview.get_selection().get_selected()703 model, iterator = self.dest_treeview.get_selection().get_selected()
666 if not iterator:704 if not iterator:
667 return705 return
668 udi = model[iterator][0]706 udi = model[iterator][0]
707
708 # warn user before continuing
709 drive = self.get_drive(self.backend.targets[udi]['device'])
710 details = ''
711 drive_title = udi
712 if not drive is None:
713 if 'unix-device' in drive.enumerate_identifiers():
714 drive_title = ' (' + drive.get_identifier('unix-device') + ')'
715 drive_title = '<i>' + drive.get_name() + drive_title + '</i>'
716 if len(drive.get_volumes()) > 1:
717 details = '\n\n' + \
718 _('The following partitions will be deleted:') + '\n<tt>'
719 for vol in drive.get_volumes():
720 details += '\t'
721 if 'unix-device' in vol.enumerate_identifiers():
722 details += vol.get_identifier('unix-device')
723 details += '\t' + vol.get_name() + '\n'
724 details += '</tt>'
725 elif len(drive.get_volumes()) == 1:
726 vol = drive.get_volumes()[0]
727 if 'unix-device' in vol.enumerate_identifiers():
728 drive_title = '<i>%s (%s)</i>' % (vol.get_name(),
729 vol.get_identifier('unix-device'))
730 rv = self._confirm(_('Formatting the drive will erase it in its '
731 'entirety.'), (gtk.STOCK_CANCEL,
732 _('_Format entire drive')), 1,( _('Make a backup '
733 'copy of any valuable data on %s before '
734 'continuing.') % drive_title)
735 + details)
736 if rv != 1:
737 return
738
669 self.backend.format(udi)739 self.backend.format(udi)
670740
671 def open_dest_folder(self, *args):741 def open_dest_folder(self, *args):

Subscribers

People subscribed via source and target branches