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>
|
2006-02-20 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||||
|
|
||||||
* include/GParted_Core.h,
|
* include/GParted_Core.h,
|
||||||
|
|
|
@ -49,13 +49,13 @@ public:
|
||||||
Win_GParted( const std::vector<Glib::ustring> & user_devices ) ;
|
Win_GParted( const std::vector<Glib::ustring> & user_devices ) ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init_menubar( ) ;
|
void init_menubar() ;
|
||||||
void init_toolbar( ) ;
|
void init_toolbar() ;
|
||||||
void init_partition_menu( ) ;
|
void init_partition_menu() ;
|
||||||
Gtk::Menu * create_format_menu( ) ;
|
Gtk::Menu * create_format_menu() ;
|
||||||
void init_device_info( ) ;
|
void init_device_info() ;
|
||||||
void init_operationslist( ) ;
|
void init_operationslist() ;
|
||||||
void init_hpaned_main( ) ;
|
void init_hpaned_main() ;
|
||||||
|
|
||||||
void refresh_combo_devices() ;
|
void refresh_combo_devices() ;
|
||||||
void show_pulsebar( const Glib::ustring & status_message ) ;
|
void show_pulsebar( const Glib::ustring & status_message ) ;
|
||||||
|
@ -67,50 +67,52 @@ private:
|
||||||
bool on_delete_event( GdkEventAny* ) ;
|
bool on_delete_event( GdkEventAny* ) ;
|
||||||
|
|
||||||
void Add_Operation( OperationType, const Partition & );
|
void Add_Operation( OperationType, const Partition & );
|
||||||
void Refresh_Visual( );
|
void Refresh_Visual();
|
||||||
bool Quit_Check_Operations( );
|
bool Quit_Check_Operations();
|
||||||
void set_valid_operations() ;
|
void set_valid_operations() ;
|
||||||
|
|
||||||
//convenience functions
|
//convenience functions
|
||||||
void allow_new( bool b ) {
|
void allow_new( bool b ) {
|
||||||
menu_partition .items( )[ 0 ] .set_sensitive( b );
|
menu_partition .items()[ 0 ] .set_sensitive( b );
|
||||||
toolbar_main .get_nth_item( 0 ) ->set_sensitive( b ); }
|
toolbar_main .get_nth_item( 0 ) ->set_sensitive( b ); }
|
||||||
|
|
||||||
void allow_delete( bool b ) {
|
void allow_delete( bool b ) {
|
||||||
menu_partition .items( )[ 1 ] .set_sensitive( b );
|
menu_partition .items()[ 1 ] .set_sensitive( b );
|
||||||
toolbar_main .get_nth_item( 1 ) ->set_sensitive( b ); }
|
toolbar_main .get_nth_item( 1 ) ->set_sensitive( b ); }
|
||||||
|
|
||||||
void allow_resize( bool b ) {
|
void allow_resize( bool b ) {
|
||||||
menu_partition .items( )[ 3 ] .set_sensitive( b );
|
menu_partition .items()[ 3 ] .set_sensitive( b );
|
||||||
toolbar_main .get_nth_item( 3 ) ->set_sensitive( b ); }
|
toolbar_main .get_nth_item( 3 ) ->set_sensitive( b ); }
|
||||||
|
|
||||||
void allow_copy( bool b ) {
|
void allow_copy( bool b ) {
|
||||||
menu_partition .items( )[ 5 ] .set_sensitive( b );
|
menu_partition .items()[ 5 ] .set_sensitive( b );
|
||||||
toolbar_main .get_nth_item( 5 ) ->set_sensitive( b ); }
|
toolbar_main .get_nth_item( 5 ) ->set_sensitive( b ); }
|
||||||
|
|
||||||
void allow_paste( bool b ) {
|
void allow_paste( bool b ) {
|
||||||
menu_partition .items( )[ 6 ] .set_sensitive( b );
|
menu_partition .items()[ 6 ] .set_sensitive( b );
|
||||||
toolbar_main .get_nth_item( 6 ) ->set_sensitive( b ); }
|
toolbar_main .get_nth_item( 6 ) ->set_sensitive( b ); }
|
||||||
|
|
||||||
void allow_format( bool b ) {
|
void allow_format( bool b ) {
|
||||||
menu_partition .items( )[ 8 ] .set_sensitive( b ); }
|
menu_partition .items()[ 8 ] .set_sensitive( b ); }
|
||||||
|
|
||||||
void allow_unmount( bool b ) {
|
void allow_unmount( bool b ) {
|
||||||
menu_partition .items( )[ 10 ] .set_sensitive( b ); }
|
menu_partition .items()[ 10 ] .set_sensitive( b ); }
|
||||||
|
|
||||||
void allow_toggle_swap( bool b ) {
|
void allow_toggle_swap( bool b ) {
|
||||||
menu_partition .items( )[ 11 ] .set_sensitive( b ); }
|
menu_partition .items()[ 11 ] .set_sensitive( b ); }
|
||||||
|
|
||||||
void allow_info( bool b ) {
|
void allow_info( bool b ) {
|
||||||
menu_partition .items( )[ 13 ] .set_sensitive( b ); }
|
menu_partition .items()[ 13 ] .set_sensitive( b ); }
|
||||||
|
|
||||||
void allow_undo( bool b ) {
|
void allow_undo( bool b ) {
|
||||||
toolbar_main .get_nth_item( 8 ) ->set_sensitive( 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 ) {
|
void allow_apply( bool b ) {
|
||||||
toolbar_main .get_nth_item( 9 ) ->set_sensitive( 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..
|
//threads..
|
||||||
void thread_refresh_devices() ;
|
void thread_refresh_devices() ;
|
||||||
|
@ -118,19 +120,20 @@ private:
|
||||||
void thread_toggle_swap( bool * succes, Glib::ustring * error ) ;
|
void thread_toggle_swap( bool * succes, Glib::ustring * error ) ;
|
||||||
|
|
||||||
//signal handlers
|
//signal handlers
|
||||||
void open_operationslist( ) ;
|
void open_operationslist() ;
|
||||||
void close_operationslist( ) ;
|
void close_operationslist() ;
|
||||||
void clear_operationslist( ) ;
|
void clear_operationslist() ;
|
||||||
void combo_devices_changed( );
|
void combo_devices_changed();
|
||||||
void radio_devices_changed( unsigned int item ) ;
|
void radio_devices_changed( unsigned int item ) ;
|
||||||
|
void on_signal_show() ;
|
||||||
|
|
||||||
void menu_gparted_refresh_devices( );
|
void menu_gparted_refresh_devices();
|
||||||
void menu_gparted_filesystems( );
|
void menu_gparted_filesystems();
|
||||||
void menu_gparted_quit( );
|
void menu_gparted_quit();
|
||||||
void menu_view_harddisk_info( );
|
void menu_view_harddisk_info();
|
||||||
void menu_view_operations( );
|
void menu_view_operations();
|
||||||
void menu_help_contents( );
|
void menu_help_contents();
|
||||||
void menu_help_about( );
|
void menu_help_about();
|
||||||
|
|
||||||
void on_partition_selected( const Partition & partition, bool src_is_treeview ) ;
|
void on_partition_selected( const Partition & partition, bool src_is_treeview ) ;
|
||||||
void on_partition_activated() ;
|
void on_partition_activated() ;
|
||||||
|
@ -222,6 +225,7 @@ private:
|
||||||
unsigned short primary_count ;//primary_count checks for max. of 4 pimary partitions
|
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
|
unsigned short new_count;//new_count keeps track of the new created partitions
|
||||||
FS fs ;
|
FS fs ;
|
||||||
|
bool OPERATIONSLIST_OPEN ;
|
||||||
|
|
||||||
GParted_Core gparted_core ;
|
GParted_Core gparted_core ;
|
||||||
GParted::Device *temp_device ;
|
GParted::Device *temp_device ;
|
||||||
|
@ -229,8 +233,6 @@ private:
|
||||||
|
|
||||||
//stuff for progress overview and pulsebar
|
//stuff for progress overview and pulsebar
|
||||||
Glib::Thread *thread ;
|
Glib::Thread *thread ;
|
||||||
Glib::Dispatcher dispatcher;
|
|
||||||
sigc::connection conn ;
|
|
||||||
bool pulse ;
|
bool pulse ;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -368,13 +368,13 @@ void FrameVisualDisk::on_resize( Gtk::Allocation & allocation )
|
||||||
calced = calc_length( visual_partitions, TOTAL ) ;
|
calced = calc_length( visual_partitions, TOTAL ) ;
|
||||||
}
|
}
|
||||||
while ( calced > allocation .get_width() && TOTAL > 0 ) ;
|
while ( calced > allocation .get_width() && TOTAL > 0 ) ;
|
||||||
|
|
||||||
MIN_SIZE-- ;
|
MIN_SIZE-- ;
|
||||||
}
|
}
|
||||||
while ( TOTAL <= 0 && MIN_SIZE > 0 ) ;
|
while ( TOTAL <= 0 && MIN_SIZE > 0 ) ;
|
||||||
|
|
||||||
//due to rounding a few px may be lost (max. 2), lets add these to the last partition.
|
//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 ) ;
|
visual_partitions .back() .length += ( allocation .get_width() - calced ) ;
|
||||||
|
|
||||||
calc_position_and_height( visual_partitions, 0, 0 ) ;
|
calc_position_and_height( visual_partitions, 0, 0 ) ;
|
||||||
|
|
|
@ -29,19 +29,17 @@
|
||||||
#include <gtkmm/radiobuttongroup.h>
|
#include <gtkmm/radiobuttongroup.h>
|
||||||
#include <gtkmm/main.h>
|
#include <gtkmm/main.h>
|
||||||
|
|
||||||
#include <cerrno>
|
|
||||||
#include <sys/swap.h>
|
|
||||||
|
|
||||||
namespace GParted
|
namespace GParted
|
||||||
{
|
{
|
||||||
|
|
||||||
Win_GParted::Win_GParted( const std::vector<Glib::ustring> & user_devices )
|
Win_GParted::Win_GParted( const std::vector<Glib::ustring> & user_devices )
|
||||||
{
|
{
|
||||||
copied_partition .Reset( ) ;
|
copied_partition .Reset() ;
|
||||||
selected_partition .Reset( ) ;
|
selected_partition .Reset() ;
|
||||||
new_count = 1;
|
new_count = 1;
|
||||||
current_device = 0 ;
|
current_device = 0 ;
|
||||||
pulse = false ;
|
pulse = false ;
|
||||||
|
OPERATIONSLIST_OPEN = true ;
|
||||||
gparted_core .set_user_devices( user_devices ) ;
|
gparted_core .set_user_devices( user_devices ) ;
|
||||||
|
|
||||||
//==== GUI =========================
|
//==== GUI =========================
|
||||||
|
@ -60,12 +58,14 @@ Win_GParted::Win_GParted( const std::vector<Glib::ustring> & user_devices )
|
||||||
//Pack the main box
|
//Pack the main box
|
||||||
this ->add( vbox_main );
|
this ->add( vbox_main );
|
||||||
|
|
||||||
|
this ->signal_show() .connect( sigc::mem_fun(*this, &Win_GParted::on_signal_show) );
|
||||||
|
|
||||||
//menubar....
|
//menubar....
|
||||||
init_menubar( ) ;
|
init_menubar() ;
|
||||||
vbox_main .pack_start( menubar_main, Gtk::PACK_SHRINK );
|
vbox_main .pack_start( menubar_main, Gtk::PACK_SHRINK );
|
||||||
|
|
||||||
//toolbar....
|
//toolbar....
|
||||||
init_toolbar( ) ;
|
init_toolbar() ;
|
||||||
vbox_main.pack_start( hbox_toolbar, Gtk::PACK_SHRINK );
|
vbox_main.pack_start( hbox_toolbar, Gtk::PACK_SHRINK );
|
||||||
|
|
||||||
//frame_visualdisk... ( contains the visual represenation of the disks )
|
//frame_visualdisk... ( contains the visual represenation of the disks )
|
||||||
|
@ -75,17 +75,17 @@ Win_GParted::Win_GParted( const std::vector<Glib::ustring> & user_devices )
|
||||||
vbox_main .pack_start( frame_visualdisk, Gtk::PACK_SHRINK ) ;
|
vbox_main .pack_start( frame_visualdisk, Gtk::PACK_SHRINK ) ;
|
||||||
|
|
||||||
//hpaned_main (NOTE: added to vpaned_main)
|
//hpaned_main (NOTE: added to vpaned_main)
|
||||||
init_hpaned_main( ) ;
|
init_hpaned_main() ;
|
||||||
vpaned_main .pack1( hpaned_main, true, true ) ;
|
vpaned_main .pack1( hpaned_main, true, true ) ;
|
||||||
|
|
||||||
//vpaned_main....
|
//vpaned_main....
|
||||||
vbox_main .pack_start( vpaned_main );
|
vbox_main .pack_start( vpaned_main );
|
||||||
|
|
||||||
//device info...
|
//device info...
|
||||||
init_device_info( ) ;
|
init_device_info() ;
|
||||||
|
|
||||||
//operationslist...
|
//operationslist...
|
||||||
init_operationslist( ) ;
|
init_operationslist() ;
|
||||||
vpaned_main .pack2( hbox_operations, true, true ) ;
|
vpaned_main .pack2( hbox_operations, true, true ) ;
|
||||||
|
|
||||||
//statusbar...
|
//statusbar...
|
||||||
|
@ -93,63 +93,59 @@ Win_GParted::Win_GParted( const std::vector<Glib::ustring> & user_devices )
|
||||||
statusbar .add( pulsebar );
|
statusbar .add( pulsebar );
|
||||||
vbox_main .pack_start( statusbar, Gtk::PACK_SHRINK );
|
vbox_main .pack_start( statusbar, Gtk::PACK_SHRINK );
|
||||||
|
|
||||||
this ->show_all_children( );
|
this ->show_all_children();
|
||||||
|
|
||||||
//make sure harddisk information and operationlist are closed..
|
//make sure harddisk information is closed..
|
||||||
hpaned_main .get_child1( ) ->hide( ) ;
|
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( )
|
void Win_GParted::init_menubar()
|
||||||
{
|
{
|
||||||
//fill menubar_main and connect callbacks
|
//fill menubar_main and connect callbacks
|
||||||
//gparted
|
//gparted
|
||||||
menu = manage( new Gtk::Menu( ) ) ;
|
menu = manage( new Gtk::Menu() ) ;
|
||||||
image = manage( new Gtk::Image( Gtk::Stock::REFRESH, Gtk::ICON_SIZE_MENU ) );
|
image = manage( new Gtk::Image( Gtk::Stock::REFRESH, Gtk::ICON_SIZE_MENU ) );
|
||||||
menu ->items( ) .push_back( Gtk::Menu_Helpers::ImageMenuElem( _("_Refresh devices"), Gtk::AccelKey("<control>r"), *image, sigc::mem_fun(*this, &Win_GParted::menu_gparted_refresh_devices) ) );
|
menu ->items() .push_back( Gtk::Menu_Helpers::ImageMenuElem( _("_Refresh devices"), Gtk::AccelKey("<control>r"), *image, sigc::mem_fun(*this, &Win_GParted::menu_gparted_refresh_devices) ) );
|
||||||
|
|
||||||
image = manage( new Gtk::Image( Gtk::Stock::HARDDISK, Gtk::ICON_SIZE_MENU ) );
|
image = manage( new Gtk::Image( Gtk::Stock::HARDDISK, Gtk::ICON_SIZE_MENU ) );
|
||||||
menu ->items() .push_back( Gtk::Menu_Helpers::ImageMenuElem( _("Devices"), *image ) ) ;
|
menu ->items() .push_back( Gtk::Menu_Helpers::ImageMenuElem( _("Devices"), *image ) ) ;
|
||||||
|
|
||||||
menu ->items( ) .push_back( Gtk::Menu_Helpers::SeparatorElem( ) );
|
menu ->items() .push_back( Gtk::Menu_Helpers::SeparatorElem( ) );
|
||||||
menu ->items( ) .push_back( Gtk::Menu_Helpers::MenuElem( _("Filesystems"), sigc::mem_fun( *this, &Win_GParted::menu_gparted_filesystems ) ) );
|
menu ->items() .push_back( Gtk::Menu_Helpers::MenuElem( _("Filesystems"), sigc::mem_fun( *this, &Win_GParted::menu_gparted_filesystems ) ) );
|
||||||
menu ->items( ) .push_back( Gtk::Menu_Helpers::SeparatorElem( ) );
|
menu ->items() .push_back( Gtk::Menu_Helpers::SeparatorElem( ) );
|
||||||
menu ->items( ) .push_back( Gtk::Menu_Helpers::StockMenuElem( Gtk::Stock::QUIT, sigc::mem_fun(*this, &Win_GParted::menu_gparted_quit) ) );
|
menu ->items() .push_back( Gtk::Menu_Helpers::StockMenuElem( Gtk::Stock::QUIT, sigc::mem_fun(*this, &Win_GParted::menu_gparted_quit) ) );
|
||||||
menubar_main .items( ) .push_back( Gtk::Menu_Helpers::MenuElem( _("_GParted"), *menu ) );
|
menubar_main .items() .push_back( Gtk::Menu_Helpers::MenuElem( _("_GParted"), *menu ) );
|
||||||
|
|
||||||
//edit
|
//edit
|
||||||
menu = manage( new Gtk::Menu( ) ) ;
|
menu = manage( new Gtk::Menu() ) ;
|
||||||
menu ->items( ) .push_back( Gtk::Menu_Helpers::StockMenuElem( Gtk::Stock::UNDO, Gtk::AccelKey("<control>z"), sigc::mem_fun(*this, &Win_GParted::activate_undo) ) );
|
menu ->items() .push_back( Gtk::Menu_Helpers::StockMenuElem( Gtk::Stock::UNDO, Gtk::AccelKey("<control>z"), sigc::mem_fun(*this, &Win_GParted::activate_undo) ) );
|
||||||
menu ->items( ) .push_back( Gtk::Menu_Helpers::StockMenuElem( Gtk::Stock::APPLY, sigc::mem_fun(*this, &Win_GParted::activate_apply) ) );
|
menu ->items() .push_back( Gtk::Menu_Helpers::StockMenuElem( Gtk::Stock::APPLY, sigc::mem_fun(*this, &Win_GParted::activate_apply) ) );
|
||||||
menubar_main .items( ) .push_back( Gtk::Menu_Helpers::MenuElem( _("_Edit"), *menu ) );
|
menubar_main .items() .push_back( Gtk::Menu_Helpers::MenuElem( _("_Edit"), *menu ) );
|
||||||
|
|
||||||
//view
|
//view
|
||||||
menu = manage( new Gtk::Menu( ) ) ;
|
menu = manage( new Gtk::Menu( ) ) ;
|
||||||
menu ->items( ) .push_back( Gtk::Menu_Helpers::CheckMenuElem( _("Harddisk Information"), sigc::mem_fun(*this, &Win_GParted::menu_view_harddisk_info) ) );
|
menu ->items() .push_back( Gtk::Menu_Helpers::CheckMenuElem( _("Harddisk Information"), sigc::mem_fun(*this, &Win_GParted::menu_view_harddisk_info) ) );
|
||||||
menu ->items( ) .push_back( Gtk::Menu_Helpers::CheckMenuElem( _("Operations"), sigc::mem_fun(*this, &Win_GParted::menu_view_operations) ) );
|
menu ->items() .push_back( Gtk::Menu_Helpers::CheckMenuElem( _("Operations"), sigc::mem_fun(*this, &Win_GParted::menu_view_operations) ) );
|
||||||
menubar_main .items( ) .push_back( Gtk::Menu_Helpers::MenuElem( _("_View"), *menu ) );
|
menubar_main .items() .push_back( Gtk::Menu_Helpers::MenuElem( _("_View"), *menu ) );
|
||||||
|
|
||||||
//device
|
//device
|
||||||
menu = manage( new Gtk::Menu( ) ) ;
|
menu = manage( new Gtk::Menu() ) ;
|
||||||
menu ->items( ) .push_back( Gtk::Menu_Helpers::MenuElem( _("Set Disklabel"), sigc::mem_fun(*this, &Win_GParted::activate_disklabel) ) );
|
menu ->items() .push_back( Gtk::Menu_Helpers::MenuElem( _("Set Disklabel"), sigc::mem_fun(*this, &Win_GParted::activate_disklabel) ) );
|
||||||
menubar_main .items( ) .push_back( Gtk::Menu_Helpers::MenuElem( _("_Device"), *menu ) );
|
menubar_main .items() .push_back( Gtk::Menu_Helpers::MenuElem( _("_Device"), *menu ) );
|
||||||
|
|
||||||
//partition
|
//partition
|
||||||
init_partition_menu( ) ;
|
init_partition_menu() ;
|
||||||
menubar_main .items( ) .push_back( Gtk::Menu_Helpers::MenuElem( _("_Partition"), menu_partition ) );
|
menubar_main .items() .push_back( Gtk::Menu_Helpers::MenuElem( _("_Partition"), menu_partition ) );
|
||||||
|
|
||||||
//help
|
//help
|
||||||
menu = manage( new Gtk::Menu() ) ;
|
menu = manage( new Gtk::Menu() ) ;
|
||||||
menu ->items( ) .push_back(Gtk::Menu_Helpers::StockMenuElem( Gtk::Stock::HELP, sigc::mem_fun(*this, &Win_GParted::menu_help_contents) ) );
|
menu ->items() .push_back(Gtk::Menu_Helpers::StockMenuElem( Gtk::Stock::HELP, sigc::mem_fun(*this, &Win_GParted::menu_help_contents) ) );
|
||||||
menu ->items( ) .push_back( Gtk::Menu_Helpers::StockMenuElem( Gtk::Stock::ABOUT, sigc::mem_fun(*this, &Win_GParted::menu_help_about) ) );
|
menu ->items( ) .push_back( Gtk::Menu_Helpers::StockMenuElem( Gtk::Stock::ABOUT, sigc::mem_fun(*this, &Win_GParted::menu_help_about) ) );
|
||||||
|
|
||||||
menubar_main.items( ) .push_back( Gtk::Menu_Helpers::MenuElem(_("_Help"), *menu ) );
|
menubar_main.items() .push_back( Gtk::Menu_Helpers::MenuElem(_("_Help"), *menu ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Win_GParted::init_toolbar( )
|
void Win_GParted::init_toolbar()
|
||||||
{
|
{
|
||||||
//initialize and pack toolbar_main
|
//initialize and pack toolbar_main
|
||||||
hbox_toolbar.pack_start( toolbar_main );
|
hbox_toolbar.pack_start( toolbar_main );
|
||||||
|
@ -489,7 +485,6 @@ void Win_GParted::show_pulsebar( const Glib::ustring & status_message )
|
||||||
}
|
}
|
||||||
|
|
||||||
thread ->join() ;
|
thread ->join() ;
|
||||||
conn .disconnect() ;
|
|
||||||
|
|
||||||
pulsebar .hide();
|
pulsebar .hide();
|
||||||
statusbar .pop() ;
|
statusbar .pop() ;
|
||||||
|
@ -753,41 +748,44 @@ void Win_GParted::set_valid_operations()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Win_GParted::open_operationslist( )
|
void Win_GParted::open_operationslist()
|
||||||
{
|
{
|
||||||
hbox_operations .show( ) ;
|
if ( ! OPERATIONSLIST_OPEN )
|
||||||
int x,y; this ->get_size( x, y );
|
|
||||||
y -= 300;
|
|
||||||
|
|
||||||
for ( int t = vpaned_main .get_position( ) ; t > y ; t-=5 )
|
|
||||||
{
|
{
|
||||||
vpaned_main .set_position( t );
|
OPERATIONSLIST_OPEN = true ;
|
||||||
while ( Gtk::Main::events_pending( ) )
|
hbox_operations .show() ;
|
||||||
Gtk::Main::iteration( );
|
|
||||||
}
|
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( )
|
void Win_GParted::close_operationslist()
|
||||||
{
|
{
|
||||||
//FIXME: when started like 'gparted bla' it wil crash in this function
|
if ( OPERATIONSLIST_OPEN )
|
||||||
//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 )
|
|
||||||
{
|
{
|
||||||
vpaned_main .set_position( t );
|
OPERATIONSLIST_OPEN = false ;
|
||||||
while ( Gtk::Main::events_pending() )
|
|
||||||
Gtk::Main::iteration();
|
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 ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
hbox_operations .hide() ;
|
|
||||||
static_cast<Gtk::CheckMenuItem *>(
|
|
||||||
& menubar_main .items()[ 2 ] .get_submenu() ->
|
|
||||||
items()[ 1 ] ) ->set_active( false ) ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Win_GParted::clear_operationslist()
|
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()
|
void Win_GParted::thread_refresh_devices()
|
||||||
{
|
{
|
||||||
gparted_core .get_devices( devices ) ;
|
gparted_core .get_devices( devices ) ;
|
||||||
|
|
Loading…
Reference in New Issue