prevent crasher when visual_disks is empty. load devices at startup on
* src/FrameVisualDisk.cc: prevent crasher when visual_disks is empty. * include/Win_GParted.h, src/Win_GParted.cc: load devices at startup on signal_show instead of dispatching it from the c'tor. Also did some cleanups in the behaviour of opening and closing of the operationslist.
This commit is contained in:
parent
a538361d3d
commit
283b40b892
|
@ -1,3 +1,12 @@
|
|||
2006-02-22 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||
|
||||
* src/FrameVisualDisk.cc: prevent crasher when visual_disks is empty.
|
||||
* include/Win_GParted.h,
|
||||
src/Win_GParted.cc: load devices at startup on signal_show instead
|
||||
of dispatching it from the c'tor.
|
||||
Also did some cleanups in the behaviour of opening and closing of
|
||||
the operationslist.
|
||||
|
||||
2006-02-20 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||
|
||||
* include/GParted_Core.h,
|
||||
|
|
|
@ -106,11 +106,13 @@ private:
|
|||
|
||||
void allow_undo( bool b ) {
|
||||
toolbar_main .get_nth_item( 8 ) ->set_sensitive( b );
|
||||
( (Gtk::CheckMenuItem *) & menubar_main .items( ) [ 1 ] .get_submenu( ) ->items( ) [ 0 ] ) ->set_sensitive( b ) ; }
|
||||
static_cast<Gtk::CheckMenuItem *>( & menubar_main .items()[ 1 ] .get_submenu() ->items()[ 0 ] )
|
||||
->set_sensitive( b ) ; }
|
||||
|
||||
void allow_apply( bool b ) {
|
||||
toolbar_main .get_nth_item( 9 ) ->set_sensitive( b );
|
||||
( (Gtk::CheckMenuItem *) & menubar_main .items( ) [ 1 ] .get_submenu( ) ->items( ) [ 1 ] ) ->set_sensitive( b ) ; }
|
||||
static_cast<Gtk::CheckMenuItem *>( & menubar_main .items()[ 1 ] .get_submenu() ->items()[ 1 ] )
|
||||
->set_sensitive( b ) ; }
|
||||
|
||||
//threads..
|
||||
void thread_refresh_devices() ;
|
||||
|
@ -123,6 +125,7 @@ private:
|
|||
void clear_operationslist() ;
|
||||
void combo_devices_changed();
|
||||
void radio_devices_changed( unsigned int item ) ;
|
||||
void on_signal_show() ;
|
||||
|
||||
void menu_gparted_refresh_devices();
|
||||
void menu_gparted_filesystems();
|
||||
|
@ -222,6 +225,7 @@ private:
|
|||
unsigned short primary_count ;//primary_count checks for max. of 4 pimary partitions
|
||||
unsigned short new_count;//new_count keeps track of the new created partitions
|
||||
FS fs ;
|
||||
bool OPERATIONSLIST_OPEN ;
|
||||
|
||||
GParted_Core gparted_core ;
|
||||
GParted::Device *temp_device ;
|
||||
|
@ -229,8 +233,6 @@ private:
|
|||
|
||||
//stuff for progress overview and pulsebar
|
||||
Glib::Thread *thread ;
|
||||
Glib::Dispatcher dispatcher;
|
||||
sigc::connection conn ;
|
||||
bool pulse ;
|
||||
};
|
||||
|
||||
|
|
|
@ -374,7 +374,7 @@ void FrameVisualDisk::on_resize( Gtk::Allocation & allocation )
|
|||
while ( TOTAL <= 0 && MIN_SIZE > 0 ) ;
|
||||
|
||||
//due to rounding a few px may be lost (max. 2), lets add these to the last partition.
|
||||
if ( allocation .get_width() > calced )
|
||||
if ( allocation .get_width() > calced && visual_partitions .size() )
|
||||
visual_partitions .back() .length += ( allocation .get_width() - calced ) ;
|
||||
|
||||
calc_position_and_height( visual_partitions, 0, 0 ) ;
|
||||
|
|
|
@ -29,9 +29,6 @@
|
|||
#include <gtkmm/radiobuttongroup.h>
|
||||
#include <gtkmm/main.h>
|
||||
|
||||
#include <cerrno>
|
||||
#include <sys/swap.h>
|
||||
|
||||
namespace GParted
|
||||
{
|
||||
|
||||
|
@ -42,6 +39,7 @@ Win_GParted::Win_GParted( const std::vector<Glib::ustring> & user_devices )
|
|||
new_count = 1;
|
||||
current_device = 0 ;
|
||||
pulse = false ;
|
||||
OPERATIONSLIST_OPEN = true ;
|
||||
gparted_core .set_user_devices( user_devices ) ;
|
||||
|
||||
//==== GUI =========================
|
||||
|
@ -60,6 +58,8 @@ Win_GParted::Win_GParted( const std::vector<Glib::ustring> & user_devices )
|
|||
//Pack the main box
|
||||
this ->add( vbox_main );
|
||||
|
||||
this ->signal_show() .connect( sigc::mem_fun(*this, &Win_GParted::on_signal_show) );
|
||||
|
||||
//menubar....
|
||||
init_menubar() ;
|
||||
vbox_main .pack_start( menubar_main, Gtk::PACK_SHRINK );
|
||||
|
@ -95,12 +95,8 @@ Win_GParted::Win_GParted( const std::vector<Glib::ustring> & user_devices )
|
|||
|
||||
this ->show_all_children();
|
||||
|
||||
//make sure harddisk information and operationlist are closed..
|
||||
//make sure harddisk information is closed..
|
||||
hpaned_main .get_child1() ->hide() ;
|
||||
close_operationslist( ) ;
|
||||
|
||||
conn = dispatcher .connect( sigc::mem_fun( *this, &Win_GParted::menu_gparted_refresh_devices ) );
|
||||
dispatcher() ;
|
||||
}
|
||||
|
||||
void Win_GParted::init_menubar()
|
||||
|
@ -489,7 +485,6 @@ void Win_GParted::show_pulsebar( const Glib::ustring & status_message )
|
|||
}
|
||||
|
||||
thread ->join() ;
|
||||
conn .disconnect() ;
|
||||
|
||||
pulsebar .hide();
|
||||
statusbar .pop() ;
|
||||
|
@ -755,39 +750,42 @@ void Win_GParted::set_valid_operations()
|
|||
|
||||
void Win_GParted::open_operationslist()
|
||||
{
|
||||
if ( ! OPERATIONSLIST_OPEN )
|
||||
{
|
||||
OPERATIONSLIST_OPEN = true ;
|
||||
hbox_operations .show() ;
|
||||
int x,y; this ->get_size( x, y );
|
||||
y -= 300;
|
||||
|
||||
for ( int t = vpaned_main .get_position( ) ; t > y ; t-=5 )
|
||||
for ( int t = vpaned_main .get_height() ; t > ( vpaned_main .get_height() - 100 ) ; t -= 5 )
|
||||
{
|
||||
vpaned_main .set_position( t );
|
||||
while ( Gtk::Main::events_pending() )
|
||||
Gtk::Main::iteration() ;
|
||||
}
|
||||
|
||||
( (Gtk::CheckMenuItem *) & menubar_main .items( ) [ 2 ] .get_submenu( ) ->items( ) [ 1 ] ) ->set_active( true ) ;
|
||||
static_cast<Gtk::CheckMenuItem *>( & menubar_main .items()[ 2 ] .get_submenu() ->items()[ 1 ] )
|
||||
->set_active( true ) ;
|
||||
}
|
||||
}
|
||||
|
||||
void Win_GParted::close_operationslist()
|
||||
{
|
||||
//FIXME: when started like 'gparted bla' it wil crash in this function
|
||||
//most likely this has something to do with the removal of the legend which rendered
|
||||
//the '210' incorrect. This static numbering sucks anyway, so i should find a way to open and
|
||||
//close the operationslist without these static numbers. See also open_operationslist()
|
||||
int x,y; this ->get_size( x, y );
|
||||
y -= 210 ; //height of whole app - menubar - visualdisk - statusbar ....
|
||||
for ( int t = vpaned_main .get_position() ; t < y ; t+=5 )
|
||||
if ( OPERATIONSLIST_OPEN )
|
||||
{
|
||||
OPERATIONSLIST_OPEN = false ;
|
||||
|
||||
for ( int t = vpaned_main .get_position() ; t < vpaned_main .get_height() ; t += 5 )
|
||||
{
|
||||
vpaned_main .set_position( t ) ;
|
||||
|
||||
while ( Gtk::Main::events_pending() )
|
||||
Gtk::Main::iteration();
|
||||
}
|
||||
|
||||
hbox_operations .hide() ;
|
||||
static_cast<Gtk::CheckMenuItem *>(
|
||||
& menubar_main .items()[ 2 ] .get_submenu() ->
|
||||
items()[ 1 ] ) ->set_active( false ) ;
|
||||
|
||||
static_cast<Gtk::CheckMenuItem *>( & menubar_main .items()[ 2 ] .get_submenu() ->items()[ 1 ] )
|
||||
->set_active( false ) ;
|
||||
}
|
||||
}
|
||||
|
||||
void Win_GParted::clear_operationslist()
|
||||
|
@ -825,6 +823,14 @@ void Win_GParted::radio_devices_changed( unsigned int item )
|
|||
}
|
||||
}
|
||||
|
||||
void Win_GParted::on_signal_show()
|
||||
{
|
||||
vpaned_main .set_position( vpaned_main .get_height() ) ;
|
||||
close_operationslist() ;
|
||||
|
||||
menu_gparted_refresh_devices() ;
|
||||
}
|
||||
|
||||
void Win_GParted::thread_refresh_devices()
|
||||
{
|
||||
gparted_core .get_devices( devices ) ;
|
||||
|
|
Loading…
Reference in New Issue