Properly report specific move and resize errors as bugs (#775932)

The initial check in each of GParted_Core::resize() and move() check for
impossible conditions.  (See resize_move() where both functions are
called for confirmation).  The old messages could have suggested the
user somehow composed the operation incorrectly if they had ever been
seen.

Make it clear these failures are programming bugs, thus expecting the
user to raise a bug report should they ever be seen.  While for now the
checks are obviously impossible they document preconditions for the
functions.  More precondition checks are expected to be added later.

Bug 775932 - Refactor mostly applying of operations
This commit is contained in:
Mike Fleetwood 2016-11-19 11:17:28 +00:00 committed by Curtis Gedak
parent d2fad35407
commit 9a1841caaa
1 changed files with 17 additions and 9 deletions

View File

@ -70,6 +70,8 @@ static bool udevadm_found = false;
static bool udevsettle_found = false;
static bool hdparm_found = false;
static const Glib::ustring GPARTED_BUG( _("GParted Bug") );
GParted_Core::GParted_Core()
{
thread_status_message = "" ;
@ -2274,13 +2276,13 @@ bool GParted_Core::move( const Partition & partition_old,
if ( partition_old .get_sector_length() != partition_new .get_sector_length() )
{
operationdetail .add_child( OperationDetail(
/* TO TRANSLATORS: moving requires old and new length to be the same
* means that the length in bytes of the old partition and new partition
* must be the same. If the sector sizes of the old partition and the
* new partition are the same, then the length in sectors must be the same.
/* TO TRANSLATORS:
* means that GParted has encountered a programming bug and tried
* to change the size of a partition when performing a move only
* step which is not permitted to change the partition size.
*/
_("moving requires old and new length to be the same"), STATUS_ERROR, FONT_ITALIC ) ) ;
GPARTED_BUG + ": " + _("size of the partition is changing for a move only step"),
STATUS_ERROR, FONT_ITALIC ) );
return false ;
}
@ -2501,8 +2503,14 @@ bool GParted_Core::resize( const Partition & partition_old,
if ( partition_old .sector_start != partition_new .sector_start )
{
operationdetail .add_child( OperationDetail(
_("resizing requires old and new start to be the same"), STATUS_ERROR, FONT_ITALIC ) ) ;
/* TO TRANSLATORS:
* means that GParted has encountered a programming bug and tried
* to move the start of the partition when performing a resize
* only step which is not permitted to change the start of the
* partition.
*/
GPARTED_BUG + ": " + _("start of the partition is changing for a resize only step"),
STATUS_ERROR, FONT_ITALIC ) );
return false ;
}