Make get_custom_text() and get_generic_text() return by reference
Replace return by value of const strings from FileSystem::get_custom_text() and get_generic_text() because that implies duplication of those strings. Return a reference to constant strings instead.
This commit is contained in:
parent
aff99307d9
commit
d948cbcb91
|
@ -106,8 +106,8 @@ public:
|
||||||
FileSystem() ;
|
FileSystem() ;
|
||||||
virtual ~FileSystem() {}
|
virtual ~FileSystem() {}
|
||||||
|
|
||||||
virtual const Glib::ustring get_custom_text( CUSTOM_TEXT ttype, int index = 0 ) const;
|
virtual const Glib::ustring & get_custom_text( CUSTOM_TEXT ttype, int index = 0 ) const;
|
||||||
static const Glib::ustring get_generic_text( CUSTOM_TEXT ttype, int index = 0 ) ;
|
static const Glib::ustring & get_generic_text( CUSTOM_TEXT ttype, int index = 0 );
|
||||||
|
|
||||||
virtual FS get_filesystem_support() = 0 ;
|
virtual FS get_filesystem_support() = 0 ;
|
||||||
virtual FS_Limits get_filesystem_limits( const Partition & partition ) const { return fs_limits; };
|
virtual FS_Limits get_filesystem_limits( const Partition & partition ) const { return fs_limits; };
|
||||||
|
|
|
@ -32,7 +32,7 @@ class fat16 : public FileSystem
|
||||||
Glib::ustring check_cmd ;
|
Glib::ustring check_cmd ;
|
||||||
public:
|
public:
|
||||||
fat16( enum FSType type ) : specific_type( type ), create_cmd( "" ), check_cmd( "" ) {};
|
fat16( enum FSType type ) : specific_type( type ), create_cmd( "" ), check_cmd( "" ) {};
|
||||||
const Glib::ustring get_custom_text( CUSTOM_TEXT ttype, int index = 0 ) const;
|
const Glib::ustring & get_custom_text( CUSTOM_TEXT ttype, int index = 0 ) const;
|
||||||
FS get_filesystem_support() ;
|
FS get_filesystem_support() ;
|
||||||
void set_used_sectors( Partition & partition ) ;
|
void set_used_sectors( Partition & partition ) ;
|
||||||
void read_label( Partition & partition ) ;
|
void read_label( Partition & partition ) ;
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace GParted
|
||||||
class linux_swap : public FileSystem
|
class linux_swap : public FileSystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual const Glib::ustring get_custom_text( CUSTOM_TEXT ttype, int index = 0 ) const;
|
virtual const Glib::ustring & get_custom_text( CUSTOM_TEXT ttype, int index = 0 ) const;
|
||||||
|
|
||||||
FS get_filesystem_support() ;
|
FS get_filesystem_support() ;
|
||||||
void set_used_sectors( Partition & partition ) ;
|
void set_used_sectors( Partition & partition ) ;
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace GParted
|
||||||
class luks : public FileSystem
|
class luks : public FileSystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
const Glib::ustring get_custom_text( CUSTOM_TEXT ttype, int index = 0 ) const;
|
const Glib::ustring & get_custom_text( CUSTOM_TEXT ttype, int index = 0 ) const;
|
||||||
FS get_filesystem_support();
|
FS get_filesystem_support();
|
||||||
bool is_busy( const Glib::ustring & path );
|
bool is_busy( const Glib::ustring & path );
|
||||||
void set_used_sectors( Partition & partition );
|
void set_used_sectors( Partition & partition );
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace GParted
|
||||||
class lvm2_pv : public FileSystem
|
class lvm2_pv : public FileSystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
const Glib::ustring get_custom_text( CUSTOM_TEXT ttype, int index = 0 ) const;
|
const Glib::ustring & get_custom_text( CUSTOM_TEXT ttype, int index = 0 ) const;
|
||||||
FS get_filesystem_support() ;
|
FS get_filesystem_support() ;
|
||||||
bool is_busy( const Glib::ustring & path ) ;
|
bool is_busy( const Glib::ustring & path ) ;
|
||||||
void set_used_sectors( Partition & partition ) ;
|
void set_used_sectors( Partition & partition ) ;
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace GParted
|
||||||
class ntfs : public FileSystem
|
class ntfs : public FileSystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
const Glib::ustring get_custom_text( CUSTOM_TEXT ttype, int index = 0 ) const;
|
const Glib::ustring & get_custom_text( CUSTOM_TEXT ttype, int index = 0 ) const;
|
||||||
FS get_filesystem_support() ;
|
FS get_filesystem_support() ;
|
||||||
void set_used_sectors( Partition & partition ) ;
|
void set_used_sectors( Partition & partition ) ;
|
||||||
void read_label( Partition & partition ) ;
|
void read_label( Partition & partition ) ;
|
||||||
|
|
|
@ -31,24 +31,25 @@ FileSystem::FileSystem()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const Glib::ustring FileSystem::get_custom_text( CUSTOM_TEXT ttype, int index ) const
|
const Glib::ustring & FileSystem::get_custom_text( CUSTOM_TEXT ttype, int index ) const
|
||||||
{
|
{
|
||||||
return get_generic_text( ttype, index ) ;
|
return get_generic_text( ttype, index ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Glib::ustring FileSystem::get_generic_text( CUSTOM_TEXT ttype, int index )
|
const Glib::ustring & FileSystem::get_generic_text( CUSTOM_TEXT ttype, int index )
|
||||||
{
|
{
|
||||||
/*TO TRANSLATORS: these labels will be used in the partition menu */
|
/*TO TRANSLATORS: these labels will be used in the partition menu */
|
||||||
static const Glib::ustring activate_text = _( "_Mount" ) ;
|
static const Glib::ustring activate_text = _( "_Mount" ) ;
|
||||||
static const Glib::ustring deactivate_text = _( "_Unmount" ) ;
|
static const Glib::ustring deactivate_text = _( "_Unmount" ) ;
|
||||||
|
static const Glib::ustring empty_text;
|
||||||
|
|
||||||
switch ( ttype ) {
|
switch ( ttype ) {
|
||||||
case CTEXT_ACTIVATE_FILESYSTEM :
|
case CTEXT_ACTIVATE_FILESYSTEM :
|
||||||
return index == 0 ? activate_text : "" ;
|
return index == 0 ? activate_text : empty_text;
|
||||||
case CTEXT_DEACTIVATE_FILESYSTEM :
|
case CTEXT_DEACTIVATE_FILESYSTEM :
|
||||||
return index == 0 ? deactivate_text : "" ;
|
return index == 0 ? deactivate_text : empty_text;
|
||||||
default :
|
default :
|
||||||
return "" ;
|
return empty_text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ const Glib::ustring fat16::Change_UUID_Warning [] =
|
||||||
, ""
|
, ""
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
const Glib::ustring fat16::get_custom_text( CUSTOM_TEXT ttype, int index ) const
|
const Glib::ustring & fat16::get_custom_text( CUSTOM_TEXT ttype, int index ) const
|
||||||
{
|
{
|
||||||
int i ;
|
int i ;
|
||||||
switch ( ttype ) {
|
switch ( ttype ) {
|
||||||
|
|
|
@ -25,19 +25,20 @@
|
||||||
namespace GParted
|
namespace GParted
|
||||||
{
|
{
|
||||||
|
|
||||||
const Glib::ustring linux_swap::get_custom_text( CUSTOM_TEXT ttype, int index ) const
|
const Glib::ustring & linux_swap::get_custom_text( CUSTOM_TEXT ttype, int index ) const
|
||||||
{
|
{
|
||||||
/*TO TRANSLATORS: these labels will be used in the partition menu */
|
/*TO TRANSLATORS: these labels will be used in the partition menu */
|
||||||
static const Glib::ustring activate_text = _( "_Swapon" ) ;
|
static const Glib::ustring activate_text = _( "_Swapon" ) ;
|
||||||
static const Glib::ustring deactivate_text = _( "_Swapoff" ) ;
|
static const Glib::ustring deactivate_text = _( "_Swapoff" ) ;
|
||||||
|
static const Glib::ustring empty_text;
|
||||||
|
|
||||||
switch ( ttype ) {
|
switch ( ttype ) {
|
||||||
case CTEXT_ACTIVATE_FILESYSTEM :
|
case CTEXT_ACTIVATE_FILESYSTEM :
|
||||||
return index == 0 ? activate_text : "" ;
|
return index == 0 ? activate_text : empty_text;
|
||||||
case CTEXT_DEACTIVATE_FILESYSTEM :
|
case CTEXT_DEACTIVATE_FILESYSTEM :
|
||||||
return index == 0 ? deactivate_text : "" ;
|
return index == 0 ? deactivate_text : empty_text;
|
||||||
default :
|
default :
|
||||||
return "" ;
|
return empty_text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,20 +22,21 @@
|
||||||
namespace GParted
|
namespace GParted
|
||||||
{
|
{
|
||||||
|
|
||||||
const Glib::ustring luks::get_custom_text( CUSTOM_TEXT ttype, int index ) const
|
const Glib::ustring & luks::get_custom_text( CUSTOM_TEXT ttype, int index ) const
|
||||||
{
|
{
|
||||||
/* TO TRANSLATORS: these labels will be used in the partition menu */
|
/* TO TRANSLATORS: these labels will be used in the partition menu */
|
||||||
static const Glib::ustring activate_text = _("Open Encryption");
|
static const Glib::ustring activate_text = _("Open Encryption");
|
||||||
static const Glib::ustring deactivate_text = _("Close Encryption");
|
static const Glib::ustring deactivate_text = _("Close Encryption");
|
||||||
|
static const Glib::ustring empty_text;
|
||||||
|
|
||||||
switch ( ttype )
|
switch ( ttype )
|
||||||
{
|
{
|
||||||
case CTEXT_ACTIVATE_FILESYSTEM:
|
case CTEXT_ACTIVATE_FILESYSTEM:
|
||||||
return index == 0 ? activate_text : "";
|
return index == 0 ? activate_text : empty_text;
|
||||||
case CTEXT_DEACTIVATE_FILESYSTEM:
|
case CTEXT_DEACTIVATE_FILESYSTEM:
|
||||||
return index == 0 ? deactivate_text : "";
|
return index == 0 ? deactivate_text : empty_text;
|
||||||
default:
|
default:
|
||||||
return "";
|
return empty_text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
namespace GParted
|
namespace GParted
|
||||||
{
|
{
|
||||||
|
|
||||||
const Glib::ustring lvm2_pv::get_custom_text( CUSTOM_TEXT ttype, int index ) const
|
const Glib::ustring & lvm2_pv::get_custom_text( CUSTOM_TEXT ttype, int index ) const
|
||||||
{
|
{
|
||||||
/*TO TRANSLATORS: these labels will be used in the partition menu */
|
/*TO TRANSLATORS: these labels will be used in the partition menu */
|
||||||
static const Glib::ustring activate_text = _( "Ac_tivate" ) ;
|
static const Glib::ustring activate_text = _( "Ac_tivate" ) ;
|
||||||
|
@ -31,17 +31,18 @@ const Glib::ustring lvm2_pv::get_custom_text( CUSTOM_TEXT ttype, int index ) con
|
||||||
static const Glib::ustring resize_warning =
|
static const Glib::ustring resize_warning =
|
||||||
_( "The LVM2 Physical Volume can not currently be resized because it is a member of an exported "
|
_( "The LVM2 Physical Volume can not currently be resized because it is a member of an exported "
|
||||||
"Volume Group." ) ;
|
"Volume Group." ) ;
|
||||||
|
static const Glib::ustring empty_text;
|
||||||
|
|
||||||
switch ( ttype )
|
switch ( ttype )
|
||||||
{
|
{
|
||||||
case CTEXT_ACTIVATE_FILESYSTEM:
|
case CTEXT_ACTIVATE_FILESYSTEM:
|
||||||
return index == 0 ? activate_text : "" ;
|
return index == 0 ? activate_text : empty_text;
|
||||||
case CTEXT_DEACTIVATE_FILESYSTEM:
|
case CTEXT_DEACTIVATE_FILESYSTEM:
|
||||||
return index == 0 ? deactivate_text : "" ;
|
return index == 0 ? deactivate_text : empty_text;
|
||||||
case CTEXT_RESIZE_DISALLOWED_WARNING:
|
case CTEXT_RESIZE_DISALLOWED_WARNING:
|
||||||
return index == 0 ? resize_warning : "" ;
|
return index == 0 ? resize_warning : empty_text;
|
||||||
default:
|
default:
|
||||||
return "" ;
|
return empty_text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ const Glib::ustring ntfs::Change_UUID_Warning [] =
|
||||||
, ""
|
, ""
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
const Glib::ustring ntfs::get_custom_text( CUSTOM_TEXT ttype, int index ) const
|
const Glib::ustring & ntfs::get_custom_text( CUSTOM_TEXT ttype, int index ) const
|
||||||
{
|
{
|
||||||
int i ;
|
int i ;
|
||||||
switch ( ttype ) {
|
switch ( ttype ) {
|
||||||
|
|
Loading…
Reference in New Issue