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:
Bart Hakvoort 2004-12-17 19:45:04 +00:00
parent 3dd69a8345
commit 5cdc28b68f
5 changed files with 39 additions and 68 deletions

View File

@ -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> 2004-12-17 Bart Hakvoort <gparted@users.sf.net>
* src/Win_GParted.cc: fixed bug with enabling/disabling 'copy' in menus. * src/Win_GParted.cc: fixed bug with enabling/disabling 'copy' in menus.

View File

@ -43,7 +43,7 @@ class GParted_Core
public: public:
GParted_Core( ) ; GParted_Core( ) ;
void find_supported_filesystems( ) ; 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 ) ; int get_estimated_time( const Operation & operation ) ;
@ -61,7 +61,7 @@ public:
Glib::RefPtr<Gtk::TextBuffer> get_textbuffer( ) ; Glib::RefPtr<Gtk::TextBuffer> get_textbuffer( ) ;
private: 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 ) ; void Insert_Unallocated( std::vector<Partition> & partitions, Sector start, Sector end, bool inside_extended ) ;
Glib::ustring get_sym_path( const Glib::ustring & real_path ) ; Glib::ustring get_sym_path( const Glib::ustring & real_path ) ;
void Set_Used_Sectors( Partition & partition ); void Set_Used_Sectors( Partition & partition );

View File

@ -63,7 +63,6 @@ private:
void init_operationslist() ; void init_operationslist() ;
void init_hpaned_main() ; void init_hpaned_main() ;
void Find_Devices( bool deep_scan = true ) ;
void Refresh_OptionMenu( ) ; void Refresh_OptionMenu( ) ;
void Show_Pulsebar( ) ; void Show_Pulsebar( ) ;
@ -91,7 +90,7 @@ private:
void allow_undo( bool b ) { toolbar_main.get_nth_item(8) ->set_sensitive( b ); } 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 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 //signal handlers
void open_operationslist() ; void open_operationslist() ;

View File

@ -56,7 +56,7 @@ void GParted_Core::find_supported_filesystems( )
FILESYSTEMS .push_back( fs ) ; 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( ) ; 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( ) ) while ( device && strlen( device ->path ) > 6 && ( (Glib::ustring) device ->path ) .is_ascii( ) )
{ {
if ( open_device( device ->path, device ) ) if ( open_device( device ->path, device ) )
{
device_paths .push_back( get_sym_path( device ->path ) ) ; device_paths .push_back( get_sym_path( device ->path ) ) ;
if ( ! deep_scan )
break ;
}
device = ped_device_get_next( device ) ; device = ped_device_get_next( device ) ;
} }
close_device_and_disk( device, disk ) ; 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 .disktype = disk ->type ->name ;
temp_device .max_prims = ped_disk_get_max_primary_partition_count( disk ) ; 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 ) ; 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..) 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 ; int EXT_INDEX = -1 ;
@ -172,7 +167,7 @@ void GParted_Core::set_device_partitions( Device & device, bool deep_scan )
c_partition ->type, c_partition ->type,
ped_partition_is_busy( c_partition ) ); 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 ) ; Set_Used_Sectors( partition_temp ) ;

View File

@ -31,13 +31,9 @@ Win_GParted::Win_GParted( )
//store filesystems in vector and find out if their respective libs are installed //store filesystems in vector and find out if their respective libs are installed
gparted_core .find_supported_filesystems( ) ; gparted_core .find_supported_filesystems( ) ;
//locate all available devices and store them in devices vector
Find_Devices( false ) ;
Refresh_OptionMenu( ) ;
//==== GUI ========================= //==== GUI =========================
this ->set_title( _("GParted") ); this ->set_title( _("GParted") );
this->set_default_size( -1,500 ); this ->set_default_size( 775, 500 );
//Pack the main box //Pack the main box
this ->add( vbox_main ); this ->add( vbox_main );
@ -76,9 +72,6 @@ Win_GParted::Win_GParted( )
//popupmenu... //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.. //make sure harddisk information and operationlist are closed..
@ -236,13 +229,10 @@ void Win_GParted::init_device_info()
device_info .push_back( mk_label( "" ) ) ; device_info .push_back( mk_label( "" ) ) ;
table ->attach( * device_info .back(), 1,2, top++, bottom++, Gtk::FILL); table ->attach( * device_info .back(), 1,2, top++, bottom++, Gtk::FILL);
//only show realpath if it's different from the short path //real 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); table ->attach( * mk_label( " <b>" + (Glib::ustring) _( "Real Path:" ) + "</b>" ) , 0,1,top, bottom ,Gtk::FILL);
device_info .push_back( mk_label( "" ) ) ; device_info .push_back( mk_label( "" ) ) ;
table ->attach( * device_info .back(), 1,2, top++, bottom++, Gtk::FILL); table ->attach( * device_info .back(), 1,2, top++, bottom++, Gtk::FILL);
}
vbox_info .pack_start( *table, Gtk::PACK_SHRINK ); vbox_info .pack_start( *table, Gtk::PACK_SHRINK );
@ -345,25 +335,6 @@ void Win_GParted::init_hpaned_main()
hpaned_main.pack2( *scrollwindow, true,true ); 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( ) void Win_GParted::Refresh_OptionMenu( )
{ {
//fill optionmenu_devices //fill optionmenu_devices
@ -404,7 +375,9 @@ void Win_GParted::Show_Pulsebar( )
while ( pulse ) while ( pulse )
{ {
pulsebar ->pulse( ); pulsebar ->pulse( );
while (Gtk::Main::events_pending()) Gtk::Main::iteration(); while ( Gtk::Main::events_pending( ) )
Gtk::Main::iteration( );
usleep( 10000 ); usleep( 10000 );
} }
@ -429,9 +402,6 @@ void Win_GParted::Fill_Label_Device_Info( )
device_info[ t++ ] ->set_text( devices[ current_device ] .model ) ; 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( String::ucompose( _("%1 MB"), Sector_To_MB( devices[ current_device ] .length ) ) ) ;
device_info[ t++ ] ->set_text( devices[ current_device ] .path ) ; 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 //detailed info