Removed 'deep_scan' flag. From now on all scans are 'deep scans'. Gui is
* include/GParted_Core.h, src/GParted_Core.cc: Removed 'deep_scan' flag. From now on all scans are 'deep scans'. * include/Win_GParted.h, src/Win_GParted.cc: Gui is now loaded before anything else. (#161054)
This commit is contained in:
parent
3dd69a8345
commit
5cdc28b68f
|
@ -1,3 +1,10 @@
|
|||
2004-12-17 Bart Hakvoort <gparted@users.sf.net>
|
||||
|
||||
* include/GParted_Core.h,
|
||||
src/GParted_Core.cc: Removed 'deep_scan' flag. From now on all scans are 'deep scans'.
|
||||
* include/Win_GParted.h,
|
||||
src/Win_GParted.cc: Gui is now loaded before anything else. (#161054)
|
||||
|
||||
2004-12-17 Bart Hakvoort <gparted@users.sf.net>
|
||||
|
||||
* src/Win_GParted.cc: fixed bug with enabling/disabling 'copy' in menus.
|
||||
|
|
|
@ -43,7 +43,7 @@ class GParted_Core
|
|||
public:
|
||||
GParted_Core( ) ;
|
||||
void find_supported_filesystems( ) ;
|
||||
void get_devices( std::vector<Device> & devices, bool deep_scan ) ;
|
||||
void get_devices( std::vector<Device> & devices ) ;
|
||||
|
||||
int get_estimated_time( const Operation & operation ) ;
|
||||
|
||||
|
@ -61,7 +61,7 @@ public:
|
|||
Glib::RefPtr<Gtk::TextBuffer> get_textbuffer( ) ;
|
||||
|
||||
private:
|
||||
void set_device_partitions( Device & device, bool deep_scan = true ) ;
|
||||
void set_device_partitions( Device & device ) ;
|
||||
void Insert_Unallocated( std::vector<Partition> & partitions, Sector start, Sector end, bool inside_extended ) ;
|
||||
Glib::ustring get_sym_path( const Glib::ustring & real_path ) ;
|
||||
void Set_Used_Sectors( Partition & partition );
|
||||
|
|
|
@ -63,7 +63,6 @@ private:
|
|||
void init_operationslist() ;
|
||||
void init_hpaned_main() ;
|
||||
|
||||
void Find_Devices( bool deep_scan = true ) ;
|
||||
void Refresh_OptionMenu( ) ;
|
||||
void Show_Pulsebar( ) ;
|
||||
|
||||
|
@ -91,7 +90,7 @@ private:
|
|||
void allow_undo( bool b ) { toolbar_main.get_nth_item(8) ->set_sensitive( b ); }
|
||||
void allow_apply( bool b ) { toolbar_main.get_nth_item(9) ->set_sensitive( b ); }
|
||||
|
||||
void find_devices_thread( ) { Find_Devices( ) ; pulse = false ; }
|
||||
void find_devices_thread( ) { gparted_core .get_devices( devices ) ; pulse = false ; }
|
||||
|
||||
//signal handlers
|
||||
void open_operationslist() ;
|
||||
|
|
|
@ -56,7 +56,7 @@ void GParted_Core::find_supported_filesystems( )
|
|||
FILESYSTEMS .push_back( fs ) ;
|
||||
}
|
||||
|
||||
void GParted_Core::get_devices( std::vector<Device> & devices, bool deep_scan )
|
||||
void GParted_Core::get_devices( std::vector<Device> & devices )
|
||||
{
|
||||
devices .clear( ) ;
|
||||
|
||||
|
@ -73,13 +73,8 @@ void GParted_Core::get_devices( std::vector<Device> & devices, bool deep_scan )
|
|||
while ( device && strlen( device ->path ) > 6 && ( (Glib::ustring) device ->path ) .is_ascii( ) )
|
||||
{
|
||||
if ( open_device( device ->path, device ) )
|
||||
{
|
||||
device_paths .push_back( get_sym_path( device ->path ) ) ;
|
||||
|
||||
if ( ! deep_scan )
|
||||
break ;
|
||||
}
|
||||
|
||||
|
||||
device = ped_device_get_next( device ) ;
|
||||
}
|
||||
close_device_and_disk( device, disk ) ;
|
||||
|
@ -108,9 +103,9 @@ void GParted_Core::get_devices( std::vector<Device> & devices, bool deep_scan )
|
|||
temp_device .disktype = disk ->type ->name ;
|
||||
temp_device .max_prims = ped_disk_get_max_primary_partition_count( disk ) ;
|
||||
|
||||
set_device_partitions( temp_device, deep_scan ) ;
|
||||
set_device_partitions( temp_device ) ;
|
||||
|
||||
if ( deep_scan && temp_device .busy )
|
||||
if ( temp_device .busy )
|
||||
{
|
||||
temp_device .readonly = ! ped_disk_commit_to_os( disk ) ;
|
||||
sleep( 1 ) ;//this sucks, but it seems that after the commit test, the paths are removed and added again (which takes time..)
|
||||
|
@ -134,7 +129,7 @@ void GParted_Core::get_devices( std::vector<Device> & devices, bool deep_scan )
|
|||
}
|
||||
}
|
||||
|
||||
void GParted_Core::set_device_partitions( Device & device, bool deep_scan )
|
||||
void GParted_Core::set_device_partitions( Device & device )
|
||||
{
|
||||
int EXT_INDEX = -1 ;
|
||||
|
||||
|
@ -172,7 +167,7 @@ void GParted_Core::set_device_partitions( Device & device, bool deep_scan )
|
|||
c_partition ->type,
|
||||
ped_partition_is_busy( c_partition ) );
|
||||
|
||||
if ( deep_scan && partition_temp .filesystem != "linux-swap" )
|
||||
if ( partition_temp .filesystem != "linux-swap" )
|
||||
{
|
||||
Set_Used_Sectors( partition_temp ) ;
|
||||
|
||||
|
|
|
@ -31,55 +31,48 @@ Win_GParted::Win_GParted( )
|
|||
//store filesystems in vector and find out if their respective libs are installed
|
||||
gparted_core .find_supported_filesystems( ) ;
|
||||
|
||||
//locate all available devices and store them in devices vector
|
||||
Find_Devices( false ) ;
|
||||
Refresh_OptionMenu( ) ;
|
||||
|
||||
//==== GUI =========================
|
||||
this->set_title( _("GParted") );
|
||||
this->set_default_size( -1,500 );
|
||||
this ->set_title( _("GParted") );
|
||||
this ->set_default_size( 775, 500 );
|
||||
|
||||
//Pack the main box
|
||||
this->add( vbox_main );
|
||||
this ->add( vbox_main );
|
||||
|
||||
//menubar....
|
||||
init_menubar() ;
|
||||
init_menubar( ) ;
|
||||
vbox_main .pack_start( menubar_main, Gtk::PACK_SHRINK );
|
||||
|
||||
//toolbar....
|
||||
init_toolbar() ;
|
||||
init_toolbar( ) ;
|
||||
vbox_main.pack_start( hbox_toolbar, Gtk::PACK_SHRINK );
|
||||
|
||||
//hbox_visual... ( contains the visual represenation of the disks )
|
||||
vbox_main.pack_start( hbox_visual, Gtk::PACK_SHRINK );
|
||||
|
||||
//hpaned_main (NOTE: added to vpaned_main)
|
||||
init_hpaned_main() ;
|
||||
init_hpaned_main( ) ;
|
||||
vpaned_main .pack1( hpaned_main, true, true ) ;
|
||||
|
||||
//vpaned_main....
|
||||
vbox_main.pack_start( vpaned_main );
|
||||
vbox_main .pack_start( vpaned_main );
|
||||
|
||||
//device info...
|
||||
init_device_info() ;
|
||||
init_device_info( ) ;
|
||||
|
||||
//operationslist...
|
||||
init_operationslist( ) ;
|
||||
vpaned_main .pack2( hbox_operations, true, true ) ;
|
||||
|
||||
//statusbar...
|
||||
pulsebar = manage( new Gtk::ProgressBar() );
|
||||
pulsebar = manage( new Gtk::ProgressBar( ) );
|
||||
pulsebar ->set_pulse_step( 0.01 );
|
||||
statusbar .add( *pulsebar );
|
||||
vbox_main .pack_start( statusbar, Gtk::PACK_SHRINK );
|
||||
|
||||
//popupmenu...
|
||||
init_popupmenu() ;
|
||||
init_popupmenu( ) ;
|
||||
|
||||
//initizialize for the first time...
|
||||
optionmenu_devices_changed();
|
||||
|
||||
this ->show_all_children();
|
||||
this ->show_all_children( );
|
||||
|
||||
//make sure harddisk information and operationlist are closed..
|
||||
hpaned_main .get_child1( ) ->hide( ) ;
|
||||
|
@ -236,14 +229,11 @@ void Win_GParted::init_device_info()
|
|||
device_info .push_back( mk_label( "" ) ) ;
|
||||
table ->attach( * device_info .back(), 1,2, top++, bottom++, Gtk::FILL);
|
||||
|
||||
//only show realpath if it's different from the short path
|
||||
if ( devices[ current_device ] .path != devices[ current_device ] .realpath )
|
||||
{
|
||||
table ->attach( * mk_label( " <b>" + (Glib::ustring) _( "Real Path:" ) + "</b>" ) , 0,1,top, bottom ,Gtk::FILL);
|
||||
device_info .push_back( mk_label( "" ) ) ;
|
||||
table ->attach( * device_info .back(), 1,2, top++, bottom++, Gtk::FILL);
|
||||
}
|
||||
|
||||
//real path
|
||||
table ->attach( * mk_label( " <b>" + (Glib::ustring) _( "Real Path:" ) + "</b>" ) , 0,1,top, bottom ,Gtk::FILL);
|
||||
device_info .push_back( mk_label( "" ) ) ;
|
||||
table ->attach( * device_info .back(), 1,2, top++, bottom++, Gtk::FILL);
|
||||
|
||||
vbox_info .pack_start( *table, Gtk::PACK_SHRINK );
|
||||
|
||||
//DETAILED DEVICE INFO
|
||||
|
@ -345,25 +335,6 @@ void Win_GParted::init_hpaned_main()
|
|||
hpaned_main.pack2( *scrollwindow, true,true );
|
||||
}
|
||||
|
||||
void Win_GParted::Find_Devices( bool deep_scan )
|
||||
{
|
||||
gparted_core .get_devices( devices, deep_scan ) ;
|
||||
|
||||
//paranoia check.. :)
|
||||
if ( devices .empty( ) )
|
||||
{
|
||||
str_temp = "<span weight=\"bold\" size=\"larger\">" ;
|
||||
str_temp += _("No devices were detected") ;
|
||||
str_temp += "</span>\n\n" ;
|
||||
str_temp += _("You have probably encountered a bug. GParted will quit now.") ;
|
||||
|
||||
Gtk::MessageDialog dialog( *this, str_temp, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true ) ;
|
||||
dialog .run( ) ; //<---NOT threadsave..
|
||||
|
||||
exit( 0 ) ;
|
||||
}
|
||||
}
|
||||
|
||||
void Win_GParted::Refresh_OptionMenu( )
|
||||
{
|
||||
//fill optionmenu_devices
|
||||
|
@ -403,9 +374,11 @@ void Win_GParted::Show_Pulsebar( )
|
|||
pulse = true ;
|
||||
while ( pulse )
|
||||
{
|
||||
pulsebar ->pulse();
|
||||
while (Gtk::Main::events_pending()) Gtk::Main::iteration();
|
||||
usleep(10000);
|
||||
pulsebar ->pulse( );
|
||||
while ( Gtk::Main::events_pending( ) )
|
||||
Gtk::Main::iteration( );
|
||||
|
||||
usleep( 10000 );
|
||||
}
|
||||
|
||||
thread ->join( ) ;
|
||||
|
@ -423,16 +396,13 @@ void Win_GParted::Show_Pulsebar( )
|
|||
|
||||
void Win_GParted::Fill_Label_Device_Info( )
|
||||
{
|
||||
short t=0;
|
||||
short t = 0;
|
||||
|
||||
//global info...
|
||||
device_info[ t++ ] ->set_text( devices[ current_device ] .model ) ;
|
||||
device_info[ t++ ] ->set_text( String::ucompose( _("%1 MB"), Sector_To_MB( devices[ current_device ] .length ) ) ) ;
|
||||
device_info[ t++ ] ->set_text( devices[ current_device ] .path ) ;
|
||||
|
||||
//only show realpath if it's diffent from the short path...
|
||||
if ( devices[ current_device ] .path != devices[ current_device ] .realpath )
|
||||
device_info[ t++ ] ->set_text( devices[ current_device ] .realpath ) ;
|
||||
device_info[ t++ ] ->set_text( devices[ current_device ] .realpath ) ;
|
||||
|
||||
//detailed info
|
||||
device_info[ t++ ] ->set_text( devices[ current_device ] .disktype ) ;
|
||||
|
|
Loading…
Reference in New Issue