commented 'ss .imbue( std::locale( "" ) )' (#157871) cleanups allow forced
* src/Utils.cc: commented 'ss .imbue( std::locale( "" ) )' (#157871) * src/Win_GParted.cc, src/TreeView_Detail.cc, src/Dialog_Base_Partition.cc: cleanups * include/Dialog_Partition_New.h, include/Partition.h, src/Dialog_Partition_New.cc, src/GParted_Core.cc, src/Partition.cc: allow forced partitionsizes (aka: do not round to cylinder). (#169486)
This commit is contained in:
parent
9565c28d56
commit
f9ab3cdd3c
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
2006-01-07 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||
|
||||
* src/Utils.cc: commented 'ss .imbue( std::locale( "" ) )' (#157871)
|
||||
* src/Win_GParted.cc,
|
||||
src/TreeView_Detail.cc,
|
||||
src/Dialog_Base_Partition.cc: cleanups
|
||||
* include/Dialog_Partition_New.h,
|
||||
include/Partition.h,
|
||||
src/Dialog_Partition_New.cc,
|
||||
src/GParted_Core.cc,
|
||||
src/Partition.cc: allow forced partitionsizes (aka: do not round to
|
||||
cylinder). (#169486)
|
||||
|
||||
2006-01-06 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||
|
||||
* src/VBox_VisualDisk.cc: replaced free_color() with deprecated
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
|
||||
#include "../include/Dialog_Base_Partition.h"
|
||||
|
||||
#include <gtkmm/messagedialog.h>
|
||||
#include <gtkmm/optionmenu.h>
|
||||
#include <gtkmm/checkbutton.h>
|
||||
|
||||
namespace GParted
|
||||
{
|
||||
|
@ -38,6 +38,7 @@ private:
|
|||
|
||||
Gtk::Table table_create;
|
||||
Gtk::OptionMenu optionmenu_type, optionmenu_filesystem;
|
||||
Gtk::CheckButton checkbutton_round_to_cylinders ;
|
||||
Gtk::Menu menu_type, menu_filesystem;
|
||||
|
||||
std::vector<FS> FILESYSTEMS ;
|
||||
|
|
|
@ -97,6 +97,8 @@ public:
|
|||
|
||||
std::vector<Partition> logicals ;
|
||||
|
||||
bool strict ;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
|
|
@ -76,15 +76,13 @@ Dialog_Base_Partition::Dialog_Base_Partition( )
|
|||
|
||||
//connect signalhandlers of the spinbuttons
|
||||
if ( ! fixed_start )
|
||||
spinbutton_before .signal_value_changed( ) .connect( sigc::bind<SPINBUTTON>( sigc::mem_fun( *this, &Dialog_Base_Partition::on_spinbutton_value_changed), BEFORE) ) ;
|
||||
spinbutton_before .signal_value_changed() .connect(
|
||||
sigc::bind<SPINBUTTON>( sigc::mem_fun(*this, &Dialog_Base_Partition::on_spinbutton_value_changed), BEFORE ) ) ;
|
||||
|
||||
spinbutton_size .signal_value_changed( ) .connect( sigc::bind<SPINBUTTON>( sigc::mem_fun( *this, &Dialog_Base_Partition::on_spinbutton_value_changed), SIZE) ) ;
|
||||
spinbutton_after .signal_value_changed( ) .connect( sigc::bind<SPINBUTTON>( sigc::mem_fun( *this, &Dialog_Base_Partition::on_spinbutton_value_changed), AFTER) ) ;
|
||||
|
||||
//pack warning about small differences in values..
|
||||
this ->get_vbox( ) ->pack_start( * Utils::mk_label( "\n <i>" + (Glib::ustring) _( "NOTE: values on disk may differ slightly from the values entered here.") + "</i>" ), Gtk::PACK_SHRINK );
|
||||
|
||||
this ->get_vbox( ) ->pack_start( * Utils::mk_label( "" ), Gtk::PACK_SHRINK ); //filler :-P
|
||||
spinbutton_size .signal_value_changed() .connect(
|
||||
sigc::bind<SPINBUTTON>( sigc::mem_fun(*this, &Dialog_Base_Partition::on_spinbutton_value_changed), SIZE ) ) ;
|
||||
spinbutton_after .signal_value_changed() .connect(
|
||||
sigc::bind<SPINBUTTON>( sigc::mem_fun(*this, &Dialog_Base_Partition::on_spinbutton_value_changed), AFTER ) ) ;
|
||||
|
||||
this->add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL );
|
||||
this ->show_all_children( ) ;
|
||||
|
@ -133,7 +131,8 @@ Partition Dialog_Base_Partition::Get_New_Partition( )
|
|||
|
||||
//set new value of unused..
|
||||
if ( selected_partition .sectors_used != -1 )
|
||||
selected_partition .sectors_unused = ( selected_partition .sector_end - selected_partition .sector_start) - selected_partition .sectors_used ;
|
||||
selected_partition .sectors_unused =
|
||||
(selected_partition .sector_end - selected_partition .sector_start) - selected_partition .sectors_used ;
|
||||
|
||||
return selected_partition ;
|
||||
}
|
||||
|
@ -142,18 +141,23 @@ void Dialog_Base_Partition::Set_Confirm_Button( CONFIRMBUTTON button_type )
|
|||
{
|
||||
switch( button_type )
|
||||
{
|
||||
case NEW : this ->add_button( Gtk::Stock::ADD, Gtk::RESPONSE_OK );
|
||||
case NEW :
|
||||
this ->add_button( Gtk::Stock::ADD, Gtk::RESPONSE_OK );
|
||||
|
||||
break ;
|
||||
case RESIZE_MOVE: image_temp = manage( new Gtk::Image( Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_BUTTON ) );
|
||||
case RESIZE_MOVE:
|
||||
image_temp = manage( new Gtk::Image( Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_BUTTON ) );
|
||||
hbox_resize_move .pack_start( *image_temp, Gtk::PACK_EXPAND_PADDING ) ;
|
||||
hbox_resize_move .pack_start( * Utils::mk_label( fixed_start ? _("Resize") : _("Resize/Move") ), Gtk::PACK_EXPAND_PADDING ) ;
|
||||
button_resize_move .add( hbox_resize_move ) ;
|
||||
|
||||
this ->add_action_widget ( button_resize_move, Gtk::RESPONSE_OK ) ;
|
||||
button_resize_move .set_sensitive( false ) ;
|
||||
break ;
|
||||
|
||||
case PASTE : this ->add_button( Gtk::Stock::PASTE, Gtk::RESPONSE_OK );
|
||||
break ;
|
||||
case PASTE :
|
||||
this ->add_button( Gtk::Stock::PASTE, Gtk::RESPONSE_OK );
|
||||
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
@ -190,7 +194,7 @@ void Dialog_Base_Partition::on_signal_resize( int x_start, int x_end, Frame_Resi
|
|||
|
||||
spinbutton_size .set_value( ( x_end - x_start ) * MB_PER_PIXEL ) ;
|
||||
|
||||
fixed_start ? before_value = 0 : before_value = spinbutton_before .get_value( ) ;
|
||||
before_value = fixed_start ? 0 : spinbutton_before .get_value() ;
|
||||
|
||||
if ( arrow == Frame_Resizer_Base::ARROW_RIGHT ) //don't touch freespace before, leave it as it is
|
||||
{
|
||||
|
@ -222,21 +226,24 @@ void Dialog_Base_Partition::on_spinbutton_value_changed( SPINBUTTON spinbutton )
|
|||
{
|
||||
if ( ! GRIP )
|
||||
{
|
||||
fixed_start ? before_value = 0 : before_value = spinbutton_before .get_value( ) ;
|
||||
before_value = fixed_start ? 0 : spinbutton_before .get_value() ;
|
||||
|
||||
//Balance the spinbuttons
|
||||
switch ( spinbutton )
|
||||
{
|
||||
case BEFORE : spinbutton_after .set_value( TOTAL_MB - spinbutton_size .get_value( ) - before_value) ;
|
||||
case BEFORE :
|
||||
spinbutton_after .set_value( TOTAL_MB - spinbutton_size .get_value() - before_value ) ;
|
||||
spinbutton_size .set_value( TOTAL_MB - before_value - spinbutton_after .get_value() ) ;
|
||||
|
||||
break ;
|
||||
case SIZE : spinbutton_after .set_value( TOTAL_MB - before_value - spinbutton_size .get_value( ) );
|
||||
case SIZE :
|
||||
spinbutton_after .set_value( TOTAL_MB - before_value - spinbutton_size .get_value() );
|
||||
if ( ! fixed_start )
|
||||
spinbutton_before .set_value( TOTAL_MB - spinbutton_size .get_value() - spinbutton_after .get_value() );
|
||||
|
||||
break;
|
||||
case AFTER : if ( ! fixed_start )
|
||||
case AFTER :
|
||||
if ( ! fixed_start )
|
||||
spinbutton_before .set_value( TOTAL_MB - spinbutton_size .get_value() - spinbutton_after .get_value() );
|
||||
|
||||
spinbutton_size .set_value( TOTAL_MB - before_value - spinbutton_after .get_value() ) ;
|
||||
|
@ -244,7 +251,6 @@ void Dialog_Base_Partition::on_spinbutton_value_changed( SPINBUTTON spinbutton )
|
|||
break;
|
||||
}
|
||||
|
||||
|
||||
//And apply the changes to the visual view...
|
||||
if ( ! fixed_start )
|
||||
frame_resizer_base ->set_x_start( Utils::Round( spinbutton_before .get_value() / MB_PER_PIXEL ) ) ;
|
||||
|
@ -259,13 +265,10 @@ void Dialog_Base_Partition::on_spinbutton_value_changed( SPINBUTTON spinbutton )
|
|||
|
||||
void Dialog_Base_Partition::Check_Change( )
|
||||
{
|
||||
if ( ORIG_BEFORE == spinbutton_before .get_value_as_int( ) &&
|
||||
ORIG_SIZE == spinbutton_size .get_value_as_int( ) &&
|
||||
ORIG_AFTER == spinbutton_after .get_value_as_int( )
|
||||
)
|
||||
button_resize_move .set_sensitive( false ) ;
|
||||
else
|
||||
button_resize_move .set_sensitive( true ) ;
|
||||
button_resize_move .set_sensitive(
|
||||
ORIG_BEFORE != spinbutton_before .get_value_as_int() ||
|
||||
ORIG_SIZE != spinbutton_size .get_value_as_int() ||
|
||||
ORIG_AFTER != spinbutton_after .get_value_as_int() ) ;
|
||||
}
|
||||
|
||||
Dialog_Base_Partition::~Dialog_Base_Partition()
|
||||
|
|
|
@ -29,6 +29,14 @@ Dialog_Partition_New::Dialog_Partition_New( )
|
|||
|
||||
//set used (in pixels)...
|
||||
frame_resizer_base ->set_used( 0 ) ;
|
||||
|
||||
//checkbutton..
|
||||
checkbutton_round_to_cylinders .set_label( _("Round to cylinders") ) ;
|
||||
checkbutton_round_to_cylinders .set_active( true ) ;
|
||||
checkbutton_round_to_cylinders .signal_clicked() .connect(
|
||||
sigc::bind<bool>( sigc::mem_fun(*this, &Dialog_Partition_New::optionmenu_changed), false ) ) ;
|
||||
|
||||
this ->get_vbox() ->pack_start( checkbutton_round_to_cylinders, Gtk::PACK_SHRINK ) ;
|
||||
}
|
||||
|
||||
void Dialog_Partition_New::Set_Data( const Partition & partition, bool any_extended, unsigned short new_count, const std::vector<FS> & FILESYSTEMS, bool only_unformatted, int cylinder_size )
|
||||
|
@ -125,7 +133,8 @@ Partition Dialog_Partition_New::Get_New_Partition()
|
|||
new_start = START + (Sector) (spinbutton_before .get_value( ) * MEGABYTE) ;
|
||||
new_end = new_start + (Sector) (spinbutton_size .get_value( ) * MEGABYTE) ;
|
||||
|
||||
//due to loss of precision during calcs from Sector -> MB and back, it is possible the new partition thinks it's bigger then it can be. Here we try to solve this.
|
||||
/* due to loss of precision during calcs from Sector -> MB and back, it is possible the new
|
||||
* partition thinks it's bigger then it can be. Here we try to solve this.*/
|
||||
if ( new_start < selected_partition.sector_start )
|
||||
new_start = selected_partition.sector_start ;
|
||||
if ( new_end > selected_partition.sector_end )
|
||||
|
@ -153,6 +162,8 @@ Partition Dialog_Partition_New::Get_New_Partition()
|
|||
part_temp .logicals .push_back( UNALLOCATED ) ;
|
||||
}
|
||||
|
||||
part_temp .strict = ! checkbutton_round_to_cylinders .get_active() ;
|
||||
|
||||
return part_temp;
|
||||
}
|
||||
|
||||
|
@ -179,8 +190,14 @@ void Dialog_Partition_New::optionmenu_changed( bool type )
|
|||
if ( ! type )
|
||||
{
|
||||
fs = FILESYSTEMS[ optionmenu_filesystem .get_history() ] ;
|
||||
|
||||
if ( checkbutton_round_to_cylinders .get_active() )
|
||||
{
|
||||
if ( fs .MIN < cylinder_size )
|
||||
fs .MIN = cylinder_size ;
|
||||
}
|
||||
else if ( fs .MIN < 1 )
|
||||
fs .MIN = 1 ;
|
||||
|
||||
if ( selected_partition .Get_Length_MB( ) < fs .MIN )
|
||||
fs .MIN = selected_partition .Get_Length_MB( ) ;
|
||||
|
@ -200,7 +217,7 @@ void Dialog_Partition_New::optionmenu_changed( bool type )
|
|||
|
||||
//set fitting resizer colors
|
||||
//backgroundcolor..
|
||||
optionmenu_type .get_history( ) == 2 ? color_temp .set( "darkgrey" ) : color_temp .set( "white" ) ;
|
||||
color_temp .set( optionmenu_type .get_history() == 2 ? "darkgrey" : "white" ) ;
|
||||
frame_resizer_base ->override_default_rgb_unused_color( color_temp );
|
||||
|
||||
//partitioncolor..
|
||||
|
|
|
@ -745,6 +745,14 @@ int GParted_Core::Create_Empty_Partition( Partition & new_partition, bool copy )
|
|||
c_part = ped_partition_new( lp_disk, type, NULL, new_partition .sector_start, new_partition .sector_end ) ;
|
||||
if ( c_part )
|
||||
{
|
||||
if ( new_partition .strict )
|
||||
{
|
||||
PedGeometry *geom = ped_geometry_new( lp_device, new_partition .sector_start, new_partition .get_length() ) ;
|
||||
|
||||
if ( geom )
|
||||
constraint = ped_constraint_exact( geom ) ;
|
||||
}
|
||||
else
|
||||
constraint = ped_constraint_any( lp_device );
|
||||
|
||||
if ( constraint )
|
||||
|
|
|
@ -33,7 +33,7 @@ void Partition::Reset()
|
|||
filesystem = GParted::FS_UNALLOCATED ;
|
||||
partition_number = sector_start = sector_end = sectors_used = sectors_unused = -1;
|
||||
color .set( "black" ) ;
|
||||
inside_extended = busy = false ;
|
||||
inside_extended = busy = strict = false ;
|
||||
logicals .clear() ;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,8 +57,8 @@ TreeView_Detail::TreeView_Detail( )
|
|||
treeview_detail_columns .text_color );
|
||||
|
||||
//pixbuf and text are both left aligned
|
||||
get_column( 1 ) ->get_first_cell_renderer() ->property_xalign() = 0 ;
|
||||
cell_renderer_text ->property_xalign() = 0 ;
|
||||
get_column( 1 ) ->get_first_cell_renderer() ->property_xalign() = Gtk::ALIGN_LEFT ;
|
||||
cell_renderer_text ->property_xalign() = Gtk::ALIGN_LEFT ;
|
||||
|
||||
//set alignment of numeric columns to right
|
||||
for( short t = 2 ; t < 5 ; t++ )
|
||||
|
|
|
@ -243,7 +243,7 @@ Glib::ustring Utils::format_size( Sector size )
|
|||
{
|
||||
size *= 512 ;
|
||||
std::stringstream ss ;
|
||||
ss .imbue( std::locale( "" ) ) ;
|
||||
//ss .imbue( std::locale( "" ) ) ; see #157871
|
||||
ss << std::setiosflags( std::ios::fixed ) << std::setprecision( 2 ) ;
|
||||
|
||||
if ( size < 1073741824 )
|
||||
|
|
Loading…
Reference in New Issue