make use of reference arguments instead of return values in some
* include/Operation.h, src/Operation.cc: make use of reference arguments instead of return values in some functions. Also fixed a small bug with deletion of a virtual (new) logical partition. * include/VBox_VisualDisk.h, src/VBox_VisualDisk.cc: logical filesystems weren't shown in the legend, fixed. * src/Frame_Resizer_Base.cc: fixed small bug with custom cursors. * src/TreeView_Detail.cc: removed obsolete, already commented code. * src/Win_GParted.cc: make use of reference arguments instead of return values in some functions. (see Operation)
This commit is contained in:
parent
e4d32cc1e6
commit
067c1154aa
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2004-11-07 Bart Hakvoort <gparted@users.sf.net>
|
||||
|
||||
* include/Operation.h,
|
||||
src/Operation.cc: make use of reference arguments instead of return values in some functions.
|
||||
Also fixed a small bug with deletion of a virtual (new) logical partition.
|
||||
* include/VBox_VisualDisk.h,
|
||||
src/VBox_VisualDisk.cc: logical filesystems weren't shown in the legend, fixed.
|
||||
* src/Frame_Resizer_Base.cc: fixed small bug with custom cursors.
|
||||
* src/TreeView_Detail.cc: removed obsolete, already commented code.
|
||||
* src/Win_GParted.cc: make use of reference arguments instead of return values in some functions. (see Operation)
|
||||
|
||||
2004-11-06 Bart Hakvoort <gparted@users.sf.net>
|
||||
|
||||
* include/Win_GParted.h,
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
|
||||
//this one can be a little confusing, it *DOES NOT* change any visual representation. It only applies the operation to the list with partitions.
|
||||
//this new list can be used to change the visual representation. For real writing to disk, see Apply_To_Disk()
|
||||
std::vector<Partition> Apply_Operation_To_Visual( std::vector<Partition> & partitions );
|
||||
void Apply_Operation_To_Visual( std::vector<Partition> & partitions );
|
||||
|
||||
void Apply_To_Disk( PedTimer * timer );
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@ public:
|
|||
private:
|
||||
void Build_Visual_Disk( ) ; //i still dream of some fully resizeable visualdisk....
|
||||
void Create_Visual_Partition( Partition & partition ) ;
|
||||
void Prepare_Legend( std::vector<Glib::ustring> & legend, const std::vector<Partition> & partitions ) ;
|
||||
void Build_Legend( ) ;
|
||||
|
||||
//signal handlers
|
||||
|
|
|
@ -210,7 +210,7 @@ bool Frame_Resizer_Base::drawingarea_on_button_release_event( GdkEventButton *ev
|
|||
|
||||
bool Frame_Resizer_Base::drawingarea_on_leave_notify( GdkEventCrossing *ev )
|
||||
{
|
||||
if ( ! GRIP_LEFT && ! GRIP_RIGHT && ! GRIP_MOVE && (ev ->y > 50 - BORDER || ev ->y < BORDER) )
|
||||
if ( ev ->mode != GDK_CROSSING_GRAB && ! GRIP_LEFT && ! GRIP_RIGHT && ! GRIP_MOVE )
|
||||
drawingarea .get_parent_window() ->set_cursor( *cursor_normal ) ;
|
||||
|
||||
return true;
|
||||
|
|
|
@ -99,7 +99,7 @@ Glib::ustring Operation::Get_String( )
|
|||
}
|
||||
|
||||
|
||||
std::vector<Partition> Operation::Apply_Operation_To_Visual( std::vector<Partition> & partitions )
|
||||
void Operation::Apply_Operation_To_Visual( std::vector<Partition> & partitions )
|
||||
{
|
||||
switch ( operationtype )
|
||||
{
|
||||
|
@ -109,8 +109,6 @@ std::vector<Partition> Operation::Apply_Operation_To_Visual( std::vector<Partiti
|
|||
case CONVERT :
|
||||
case COPY : Apply_Create_To_Visual( partitions ); break ;
|
||||
}
|
||||
|
||||
return partitions;
|
||||
}
|
||||
|
||||
void Operation::Apply_To_Disk( PedTimer * timer )
|
||||
|
@ -269,11 +267,14 @@ void Operation::Apply_Resize_Move_To_Visual( std::vector<Partition> & partitions
|
|||
void Operation::Apply_Resize_Move_Extended_To_Visual( std::vector<Partition> & partitions )
|
||||
{
|
||||
//stuff OUTSIDE extended partition
|
||||
partitions[ Get_Index_Original( partitions ) ] = partition_new ;
|
||||
unsigned int ext = Get_Index_Original( partitions ) ;
|
||||
partitions[ ext ] .sector_start = partition_new .sector_start ;
|
||||
partitions[ ext ] .sector_end = partition_new .sector_end ;
|
||||
|
||||
Insert_Unallocated( partitions, 0, device ->Get_Length( ) -1 ) ;
|
||||
|
||||
//stuff INSIDE extended partition
|
||||
unsigned int ext = 0 ;
|
||||
ext = 0 ;
|
||||
while ( ext < partitions .size( ) && partitions[ ext ] .type != GParted::EXTENDED ) ext++ ;
|
||||
|
||||
if ( partitions[ ext ] .logicals .size( ) && partitions[ ext ] .logicals .front( ) .type == GParted::UNALLOCATED )
|
||||
|
|
|
@ -74,21 +74,6 @@ void TreeView_Detail::Load_Partitions( std::vector<Partition> & partitions )
|
|||
{
|
||||
treestore_detail ->clear() ;
|
||||
|
||||
/* for ( unsigned int i=0;i<partitions.size();i++ )
|
||||
{
|
||||
if ( ! partitions[ i ] .inside_extended )
|
||||
{
|
||||
row = *(treestore_detail->append());
|
||||
Create_Row( row, partitions[i] );
|
||||
}
|
||||
else
|
||||
{
|
||||
childrow = *(treestore_detail->append( row.children() ));
|
||||
Create_Row( childrow, partitions[i] );
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
for ( unsigned int i=0;i<partitions.size();i++ )
|
||||
{
|
||||
row = *(treestore_detail->append());
|
||||
|
|
|
@ -170,48 +170,54 @@ void VBox_VisualDisk::Create_Visual_Partition( Partition & partition )
|
|||
tooltips.set_tip( *(visual_partitions.back() ->drawingarea), str_temp ) ;
|
||||
}
|
||||
|
||||
void VBox_VisualDisk::Prepare_Legend( std::vector<Glib::ustring> & legend, const std::vector<Partition> & partitions )
|
||||
{
|
||||
for ( unsigned int t = 0 ; t < partitions .size( ) ; t++ )
|
||||
{
|
||||
if ( std::find( legend .begin( ), legend .end( ), partitions[ t ] .filesystem ) == legend .end( ) )
|
||||
legend .push_back( partitions[ t ] .filesystem );
|
||||
|
||||
if ( partitions[ t ] .type == GParted::EXTENDED )
|
||||
Prepare_Legend( legend, partitions[ t ] .logicals ) ;
|
||||
}
|
||||
}
|
||||
|
||||
void VBox_VisualDisk::Build_Legend( )
|
||||
{
|
||||
//add the hboxes and frame_legenda
|
||||
frame_disk_legend = manage( new Gtk::Frame() ) ;
|
||||
frame_disk_legend = manage( new Gtk::Frame( ) ) ;
|
||||
hbox_legend_main.pack_start( *frame_disk_legend, Gtk::PACK_EXPAND_PADDING );
|
||||
|
||||
hbox_legend = manage( new Gtk::HBox() );
|
||||
hbox_legend = manage( new Gtk::HBox ( ) );
|
||||
frame_disk_legend ->add( *hbox_legend ) ;
|
||||
this ->pack_start( hbox_legend_main );
|
||||
|
||||
std::vector<Glib::ustring> legende;
|
||||
std::vector<Glib::ustring> legend ;
|
||||
Prepare_Legend( legend, partitions ) ;
|
||||
|
||||
bool hide_used_unused = true;
|
||||
|
||||
for ( unsigned int i=0;i<partitions.size();i++ )
|
||||
for ( unsigned int t = 0 ; t < legend .size( ) ; t++ )
|
||||
{
|
||||
if ( partitions[i] .type != GParted::UNALLOCATED && partitions[i] .type != GParted::EXTENDED && partitions[i] .filesystem != "linux-swap" )
|
||||
hide_used_unused = false;
|
||||
if ( legend[ t ] != "unallocated" && legend[ t ] != "extended" && legend[ t ] != "linux-swap" )
|
||||
hide_used_unused = false ;
|
||||
|
||||
if ( std::find( legende .begin(), legende .end(), partitions[i] .filesystem ) == legende .end() )
|
||||
{
|
||||
if ( legende .size() )
|
||||
hbox_legend ->pack_start( * mk_label( " " ), Gtk::PACK_SHRINK );
|
||||
else
|
||||
hbox_legend ->pack_start( * mk_label( " " ), Gtk::PACK_SHRINK );
|
||||
|
||||
hbox_legend ->pack_start( * mk_label( "██ ", false, false, false, Get_Color( partitions[i] .filesystem ) ), Gtk::PACK_SHRINK );
|
||||
hbox_legend ->pack_start( * mk_label( partitions[i] .filesystem + " " ), Gtk::PACK_SHRINK );
|
||||
|
||||
//make sure this color isn't added to the legend again.
|
||||
legende .push_back( partitions[i] .filesystem );
|
||||
}
|
||||
if ( t )
|
||||
hbox_legend ->pack_start( * mk_label( " " ), Gtk::PACK_SHRINK );
|
||||
else
|
||||
hbox_legend ->pack_start( * mk_label( " " ), Gtk::PACK_SHRINK );
|
||||
|
||||
hbox_legend ->pack_start( * mk_label( "██ ", false, false, false, Get_Color( legend[ t ] ) ), Gtk::PACK_SHRINK );
|
||||
hbox_legend ->pack_start( * mk_label( legend[ t ] + " " ), Gtk::PACK_SHRINK );
|
||||
}
|
||||
|
||||
//if there are any partitions add used/unused
|
||||
if ( ! hide_used_unused )
|
||||
{
|
||||
frame_disk_legend = manage( new Gtk::Frame() ) ;
|
||||
hbox_legend_main.pack_start( *frame_disk_legend, Gtk::PACK_EXPAND_PADDING );
|
||||
frame_disk_legend = manage( new Gtk::Frame( ) ) ;
|
||||
hbox_legend_main .pack_start( *frame_disk_legend, Gtk::PACK_EXPAND_PADDING );
|
||||
|
||||
hbox_legend = manage( new Gtk::HBox() );
|
||||
hbox_legend = manage( new Gtk::HBox( ) );
|
||||
frame_disk_legend ->add( *hbox_legend );
|
||||
|
||||
hbox_legend ->pack_start( * mk_label( " ██ ", false, false, false, "#F8F8BA" ), Gtk::PACK_SHRINK );
|
||||
|
|
|
@ -509,7 +509,7 @@ void Win_GParted::Refresh_Visual( )
|
|||
for ( unsigned int t = 0 ; t < operations .size( ); t++ )
|
||||
{
|
||||
if ( operations[ t ] .device ->Get_Path( ) == devices[ current_device ] ->Get_Path( ) )
|
||||
partitions = operations[ t ] .Apply_Operation_To_Visual( partitions ) ;
|
||||
operations[ t ] .Apply_Operation_To_Visual( partitions ) ;
|
||||
|
||||
treerow = *(liststore_operations ->append( ));
|
||||
treerow[ treeview_operations_columns .operation_number ] = t +1;
|
||||
|
@ -883,7 +883,7 @@ void Win_GParted::activate_resize()
|
|||
if ( operations.size() )
|
||||
for (unsigned int t=0;t<operations.size();t++ )
|
||||
if ( operations[t]. device ->Get_Path( ) == devices[ current_device ] ->Get_Path( ) )
|
||||
partitions = operations[t].Apply_Operation_To_Visual( partitions ) ;
|
||||
operations[ t ] .Apply_Operation_To_Visual( partitions ) ;
|
||||
|
||||
|
||||
Dialog_Partition_Resize_Move dialog;
|
||||
|
|
Loading…
Reference in New Issue