diff --git a/ChangeLog b/ChangeLog index ab89029f..f4fd3942 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-03-06 Bart Hakvoort + + * include/TreeView_Detail.h, + src/TreeView_Detail.cc: support showing of warning icon even when a + partition is mounted. + 2006-03-06 Bart Hakvoort * src/Win_GParted.cc: made message about max. primary partitions a bit diff --git a/include/TreeView_Detail.h b/include/TreeView_Detail.h index b40a85c5..08eb056a 100644 --- a/include/TreeView_Detail.h +++ b/include/TreeView_Detail.h @@ -64,7 +64,7 @@ private: //columns for this treeview struct treeview_detail_Columns : public Gtk::TreeModelColumnRecord { - Gtk::TreeModelColumn partition; + Gtk::TreeModelColumn path; Gtk::TreeModelColumn filesystem; Gtk::TreeModelColumn mountpoint; Gtk::TreeModelColumn size; @@ -73,15 +73,16 @@ private: Gtk::TreeModelColumn< Glib::RefPtr > color; Gtk::TreeModelColumn text_color; Gtk::TreeModelColumn< Glib::RefPtr > status_icon; + Gtk::TreeModelColumn< Glib::RefPtr > error_icon; Gtk::TreeModelColumn flags; - Gtk::TreeModelColumn partition_struct; //hidden column ( see also on_button_press_event ) + Gtk::TreeModelColumn partition; //hidden column - treeview_detail_Columns( ) + treeview_detail_Columns() { - add( partition ); add( filesystem ); add( mountpoint ) ; + add( path ); add( filesystem ); add( mountpoint ) ; add( size ); add( used ); add( unused ); add( color ); add( text_color ); add( status_icon ); - add( flags ); add(partition_struct); + add( error_icon ) ; add( flags ); add( partition ); } }; diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc index b5733a16..e1cc1535 100644 --- a/src/GParted_Core.cc +++ b/src/GParted_Core.cc @@ -439,7 +439,7 @@ void GParted_Core::set_used_sectors( std::vector & partitions ) if ( partitions[ t ] .busy ) { if ( partitions[ t ] .mountpoints .size() > 0 ) - { + { if ( statvfs( partitions[ t ] .mountpoints .back() .c_str(), &sfs ) == 0 ) partitions[ t ] .Set_Unused( sfs .f_bfree * (sfs .f_bsize / 512) ) ; else diff --git a/src/TreeView_Detail.cc b/src/TreeView_Detail.cc index c5dba9c9..c4d85b56 100644 --- a/src/TreeView_Detail.cc +++ b/src/TreeView_Detail.cc @@ -16,12 +16,11 @@ */ #include "../include/TreeView_Detail.h" -#include namespace GParted { -TreeView_Detail::TreeView_Detail( ) +TreeView_Detail::TreeView_Detail() { block = false ; @@ -32,7 +31,7 @@ TreeView_Detail::TreeView_Detail( ) treeselection ->signal_changed() .connect( sigc::mem_fun( *this, &TreeView_Detail::on_selection_changed ) ); //append columns - append_column( _("Partition"), treeview_detail_columns .partition ); + append_column( _("Partition"), treeview_detail_columns .path ); append_column( _("Filesystem"), treeview_detail_columns .color ); append_column( _("Mountpoint"), treeview_detail_columns .mountpoint ); append_column( _("Size"), treeview_detail_columns .size ); @@ -40,7 +39,8 @@ TreeView_Detail::TreeView_Detail( ) append_column( _("Unused"), treeview_detail_columns .unused ); append_column( _("Flags"), treeview_detail_columns .flags ); - //status_icon + //icons + get_column( 0 ) ->pack_start( treeview_detail_columns .error_icon, false ); get_column( 0 ) ->pack_start( treeview_detail_columns .status_icon, false ); //filesystem text @@ -122,7 +122,7 @@ bool TreeView_Detail::set_selected( Gtk::TreeModel::Children rows, const Partiti { for ( unsigned int t = 0 ; t < rows .size() ; t++ ) { - if ( static_cast( rows[ t ] [ treeview_detail_columns .partition_struct ] ) == partition ) + if ( static_cast( rows[ t ] [ treeview_detail_columns .partition ] ) == partition ) { if ( inside_extended ) expand_all() ; @@ -140,18 +140,19 @@ bool TreeView_Detail::set_selected( Gtk::TreeModel::Children rows, const Partiti void TreeView_Detail::create_row( const Gtk::TreeRow & treerow, const Partition & partition ) { - //FIXME: this approach is too simplistic, we need to display the lock AND the warning icon if necessary - //e.g. if statvfs in the core fails, we need to display both icons... if ( partition .busy ) - treerow[ treeview_detail_columns .status_icon ] = render_icon( Gtk::Stock::DIALOG_AUTHENTICATION, Gtk::ICON_SIZE_BUTTON ); - else if ( partition .error != "" ) - treerow[ treeview_detail_columns .status_icon ] = render_icon( Gtk::Stock::DIALOG_WARNING, Gtk::ICON_SIZE_BUTTON ); + treerow[ treeview_detail_columns .status_icon ] = + render_icon( Gtk::Stock::DIALOG_AUTHENTICATION, Gtk::ICON_SIZE_BUTTON ); - treerow[ treeview_detail_columns .partition ] = partition .partition; + if ( ! partition .error .empty() ) + treerow[ treeview_detail_columns .error_icon ] = + render_icon( Gtk::Stock::DIALOG_WARNING, Gtk::ICON_SIZE_BUTTON ); + + treerow[ treeview_detail_columns .path ] = partition .partition ; //this fixes a weird issue (see #169683 for more info) if ( partition .type == GParted::TYPE_EXTENDED && partition .busy ) - treerow[ treeview_detail_columns .partition ] = treerow[ treeview_detail_columns .partition ] + " " ; + treerow[ treeview_detail_columns .path ] = treerow[ treeview_detail_columns .path ] + " " ; treerow[ treeview_detail_columns .color ] = Utils::get_color_as_pixbuf( partition .filesystem, 16, 16 ) ; @@ -181,7 +182,7 @@ void TreeView_Detail::create_row( const Gtk::TreeRow & treerow, const Partition Glib::build_path( ", ", partition .flags ) ; //hidden column (partition object) - treerow[ treeview_detail_columns .partition_struct ] = partition; + treerow[ treeview_detail_columns .partition ] = partition; } bool TreeView_Detail::on_button_press_event( GdkEventButton * event ) @@ -209,7 +210,7 @@ void TreeView_Detail::on_selection_changed() if ( ! block && treeselection ->get_selected() != 0 ) { row = static_cast( * treeselection ->get_selected() ) ; - signal_partition_selected .emit( row[ treeview_detail_columns .partition_struct ], true ) ; + signal_partition_selected .emit( row[ treeview_detail_columns .partition ], true ) ; } }