From 321f0a3dd182b0badcc29d1d641a316f18f262db Mon Sep 17 00:00:00 2001 From: Bart Hakvoort Date: Sun, 2 Apr 2006 14:04:44 +0000 Subject: [PATCH] override Gtk::Window::on_show instead of connecting to signal_show() added * include/Win_GParted.h, src/Win_GParted.cc: override Gtk::Window::on_show instead of connecting to signal_show() * include/Dialog_Filesystems.h, src/Dialog_Filesystems.cc: added columns 'detect' and 'read' --- ChangeLog | 8 +++++++ include/Dialog_Filesystems.h | 30 ++++++++++++++++--------- include/Win_GParted.h | 3 +-- src/Dialog_Filesystems.cc | 43 ++++++++++++++++++------------------ src/Win_GParted.cc | 8 +++---- 5 files changed, 53 insertions(+), 39 deletions(-) diff --git a/ChangeLog b/ChangeLog index 43f1b33b..2d183ead 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-04-02 Bart Hakvoort + + * include/Win_GParted.h, + src/Win_GParted.cc: override Gtk::Window::on_show instead of + connecting to signal_show() + * include/Dialog_Filesystems.h, + src/Dialog_Filesystems.cc: added columns 'detect' and 'read' + 2006-04-02 Bart Hakvoort * include/Utils.h, diff --git a/include/Dialog_Filesystems.h b/include/Dialog_Filesystems.h index ccdc4e87..6fec35a9 100644 --- a/include/Dialog_Filesystems.h +++ b/include/Dialog_Filesystems.h @@ -17,8 +17,7 @@ #ifndef DIALOG_FILESYSTEMS #define DIALOG_FILESYSTEMS -//FIXME add more info ( at least 'detect' which will be any filesystem we _can_ detect (and should therefore have -//it's own class) ) +//FIXME: add classes for all fs'es we can detect so they show up here. #include "../include/Utils.h" #include @@ -31,9 +30,8 @@ namespace GParted class Dialog_Filesystems : public Gtk::Dialog { public: - Dialog_Filesystems() ; - void Load_Filesystems( const std::vector< FS > & FILESYSTEMS ) ; + void Load_Filesystems( const std::vector & FILESYSTEMS ) ; ~Dialog_Filesystems() ; private: @@ -46,20 +44,30 @@ private: struct treeview_filesystems_Columns : public Gtk::TreeModelColumnRecord { Gtk::TreeModelColumn filesystem; - Gtk::TreeModelColumn< Glib::RefPtr > create; - Gtk::TreeModelColumn< Glib::RefPtr > grow; - Gtk::TreeModelColumn< Glib::RefPtr > shrink; - Gtk::TreeModelColumn< Glib::RefPtr > move; - Gtk::TreeModelColumn< Glib::RefPtr > copy; + Gtk::TreeModelColumn< Glib::RefPtr > detect ; + Gtk::TreeModelColumn< Glib::RefPtr > read ; + Gtk::TreeModelColumn< Glib::RefPtr > create ; + Gtk::TreeModelColumn< Glib::RefPtr > grow ; + Gtk::TreeModelColumn< Glib::RefPtr > shrink ; + Gtk::TreeModelColumn< Glib::RefPtr > move ; + Gtk::TreeModelColumn< Glib::RefPtr > copy ; treeview_filesystems_Columns() { - add( filesystem ); add( create ); add( grow ); - add( shrink ); add( move ); add( copy ); + add( filesystem ); + add( detect ) ; + add( read ) ; + add( create ) ; + add( grow ) ; + add( shrink ) ; + add( move ) ; + add( copy ) ; } }; treeview_filesystems_Columns treeview_filesystems_columns ; + + Glib::RefPtr icon_yes, icon_no ; }; } //GParted diff --git a/include/Win_GParted.h b/include/Win_GParted.h index c0863e8c..d5c254c6 100644 --- a/include/Win_GParted.h +++ b/include/Win_GParted.h @@ -63,7 +63,6 @@ private: //Fill txtview_device_info_buffer with some information about the selected device void Fill_Label_Device_Info( bool clear = false ); - void Add_Operation( OperationType operationtype, const Partition & new_partition, int index = -1 ) ; void Refresh_Visual(); bool Quit_Check_Operations(); @@ -124,8 +123,8 @@ private: void clear_operationslist() ; void combo_devices_changed(); void radio_devices_changed( unsigned int item ) ; - void on_signal_show() ; bool on_delete_event( GdkEventAny* ) ; + void on_show() ; void menu_gparted_refresh_devices(); void menu_gparted_filesystems(); diff --git a/src/Dialog_Filesystems.cc b/src/Dialog_Filesystems.cc index ce5a3c18..703ce864 100644 --- a/src/Dialog_Filesystems.cc +++ b/src/Dialog_Filesystems.cc @@ -24,13 +24,15 @@ namespace GParted Dialog_Filesystems::Dialog_Filesystems() { - this ->set_title( _("Filesystems") ) ; - this ->set_has_separator( false ) ; - this ->set_resizable( false ) ; + set_title( _("Filesystems") ) ; + set_has_separator( false ) ; + set_resizable( false ) ; liststore_filesystems = Gtk::ListStore::create( treeview_filesystems_columns ); treeview_filesystems .set_model( liststore_filesystems ); treeview_filesystems .append_column( _("Filesystem"), treeview_filesystems_columns .filesystem ); + treeview_filesystems .append_column( _("Detect"), treeview_filesystems_columns .detect ); + treeview_filesystems .append_column( _("Read"), treeview_filesystems_columns .read ); treeview_filesystems .append_column( _("Create"), treeview_filesystems_columns .create ); treeview_filesystems .append_column( _("Grow"), treeview_filesystems_columns .grow ); treeview_filesystems .append_column( _("Shrink"), treeview_filesystems_columns .shrink ); @@ -38,14 +40,18 @@ Dialog_Filesystems::Dialog_Filesystems() treeview_filesystems .append_column( _("Copy"), treeview_filesystems_columns .copy ); treeview_filesystems .get_selection() ->set_mode( Gtk::SELECTION_NONE ); - this ->get_vbox() ->pack_start( treeview_filesystems ) ; + get_vbox() ->pack_start( treeview_filesystems ) ; + + //initialize icons + icon_yes = render_icon( Gtk::Stock::APPLY, Gtk::ICON_SIZE_LARGE_TOOLBAR ) ; + icon_no = render_icon( Gtk::Stock::CANCEL, Gtk::ICON_SIZE_LARGE_TOOLBAR ) ; - this ->add_button( Gtk::Stock::REFRESH, Gtk::RESPONSE_OK ); - this ->add_button( Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE ) ->grab_focus() ; - this ->show_all_children() ; + add_button( Gtk::Stock::REFRESH, Gtk::RESPONSE_OK ); + add_button( Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE ) ->grab_focus() ; + show_all_children() ; } -void Dialog_Filesystems::Load_Filesystems( const std::vector< FS > & FILESYSTEMS ) +void Dialog_Filesystems::Load_Filesystems( const std::vector & FILESYSTEMS ) { liststore_filesystems ->clear() ; @@ -58,20 +64,13 @@ void Dialog_Filesystems::Show_Filesystem( const FS & fs ) treerow = *( liststore_filesystems ->append() ); treerow[ treeview_filesystems_columns .filesystem ] = Utils::get_filesystem_string( fs .filesystem ) ; - treerow[ treeview_filesystems_columns .create ] = - render_icon( fs .create ? Gtk::Stock::APPLY : Gtk::Stock::CANCEL, Gtk::ICON_SIZE_LARGE_TOOLBAR); - - treerow[ treeview_filesystems_columns .grow ] = - render_icon( fs .grow ? Gtk::Stock::APPLY : Gtk::Stock::CANCEL, Gtk::ICON_SIZE_LARGE_TOOLBAR ); - - treerow[ treeview_filesystems_columns .shrink ] = - render_icon( fs .shrink ? Gtk::Stock::APPLY : Gtk::Stock::CANCEL, Gtk::ICON_SIZE_LARGE_TOOLBAR ); - - treerow[ treeview_filesystems_columns .move ] = - render_icon( fs .move ? Gtk::Stock::APPLY : Gtk::Stock::CANCEL, Gtk::ICON_SIZE_LARGE_TOOLBAR ); - - treerow[ treeview_filesystems_columns .copy ] = - render_icon( fs .copy ? Gtk::Stock::APPLY : Gtk::Stock::CANCEL, Gtk::ICON_SIZE_LARGE_TOOLBAR ); + treerow[ treeview_filesystems_columns .detect ] = icon_yes ; + treerow[ treeview_filesystems_columns .read ] = fs .read ? icon_yes : icon_no ; + treerow[ treeview_filesystems_columns .create ] = fs .create ? icon_yes : icon_no ; + treerow[ treeview_filesystems_columns .grow ] = fs .grow ? icon_yes : icon_no ; + treerow[ treeview_filesystems_columns .shrink ] = fs .shrink ? icon_yes : icon_no ; + treerow[ treeview_filesystems_columns .move ] = fs .move ? icon_yes : icon_no ; + treerow[ treeview_filesystems_columns .copy ] = fs .copy ? icon_yes : icon_no ; } Dialog_Filesystems::~Dialog_Filesystems() diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc index 66e70db5..7cc4c79d 100644 --- a/src/Win_GParted.cc +++ b/src/Win_GParted.cc @@ -64,8 +64,6 @@ Win_GParted::Win_GParted( const std::vector & 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 ); @@ -931,8 +929,10 @@ void Win_GParted::radio_devices_changed( unsigned int item ) } } -void Win_GParted::on_signal_show() -{//FIXME: why not simply override Widget::on_show() ? +void Win_GParted::on_show() +{ + Gtk::Window::on_show() ; + vpaned_main .set_position( vpaned_main .get_height() ) ; close_operationslist() ;