made icon behaviour more intelligent small improvement in

* include/TreeView_Detail.h,
  src/TreeView_Detail.cc: made icon behaviour more intelligent
* src/GParted_Core.cc: small improvement in open_device_and_disk()
This commit is contained in:
Bart Hakvoort 2006-03-27 19:21:37 +00:00
parent 511a628939
commit 9ccc70cb59
5 changed files with 35 additions and 23 deletions

View File

@ -1,3 +1,9 @@
2006-03-27 Bart Hakvoort <hakvoort@cvs.gnome.org>
* include/TreeView_Detail.h,
src/TreeView_Detail.cc: made icon behaviour more intelligent
* src/GParted_Core.cc: small improvement in open_device_and_disk()
2006-03-26 Bart Hakvoort <hakvoort@cvs.gnome.org>
* src/GParted_Core.cc: made some small adjustments to devicechecks.

View File

@ -73,8 +73,8 @@ private:
Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > color ;
Gtk::TreeModelColumn<Glib::ustring> text_color;
Gtk::TreeModelColumn<Glib::ustring> mount_text_color;
Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > status_icon;
Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > error_icon;
Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > icon1 ;
Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > icon2 ;
Gtk::TreeModelColumn<Glib::ustring> flags;
Gtk::TreeModelColumn<Partition> partition; //hidden column
@ -82,8 +82,8 @@ private:
{
add( path ); add( filesystem ); add( mountpoint ) ;
add( size ); add( used ); add( unused ); add( color );
add( text_color ); add( mount_text_color ); add( status_icon );
add( error_icon ) ; add( flags ); add( partition );
add( text_color ); add( mount_text_color ); add( icon1 );
add( icon2 ) ; add( flags ); add( partition );
}
};

View File

@ -1202,20 +1202,22 @@ bool GParted_Core::open_device( const Glib::ustring & device_path )
bool GParted_Core::open_device_and_disk( const Glib::ustring & device_path, bool strict )
{
lp_device = NULL ;
lp_disk = NULL ;
if ( open_device( device_path ) )
{
lp_disk = ped_disk_new( lp_device );
//if ! disk and writeable it's probably a HD without disklabel.
//We return true here and deal with them in GParted_Core::get_devices
if ( ! lp_disk && ( strict || lp_device ->read_only ) )
{
ped_device_destroy( lp_device ) ;
lp_device = NULL ;
if ( lp_disk || ( ! strict && ! lp_device ->read_only ) )
return true ;
return false;
close_device_and_disk() ;
}
return true ;
return false ;
}
void GParted_Core::close_device_and_disk()

View File

@ -40,8 +40,8 @@ TreeView_Detail::TreeView_Detail()
append_column( _("Flags"), treeview_detail_columns .flags );
//icons
get_column( 0 ) ->pack_start( treeview_detail_columns .error_icon, false );
get_column( 0 ) ->pack_start( treeview_detail_columns .status_icon, false );
get_column( 0 ) ->pack_start( treeview_detail_columns .icon2, false );
get_column( 0 ) ->pack_start( treeview_detail_columns .icon1, false );
//PARTITION
//colored text in Partition column
@ -149,13 +149,19 @@ bool TreeView_Detail::set_selected( Gtk::TreeModel::Children rows, const Partiti
void TreeView_Detail::create_row( const Gtk::TreeRow & treerow, const Partition & partition )
{
if ( partition .busy )
treerow[ treeview_detail_columns .status_icon ] =
treerow[ treeview_detail_columns .icon1 ] =
render_icon( Gtk::Stock::DIALOG_AUTHENTICATION, Gtk::ICON_SIZE_BUTTON );
//FIXME: we should display warningicon in the same column as mounticon if partition is unmounted..
if ( ! partition .error .empty() )
treerow[ treeview_detail_columns .error_icon ] =
{
if ( ! static_cast< Glib::RefPtr<Gdk::Pixbuf> >( treerow[ treeview_detail_columns .icon1 ] ) )
treerow[ treeview_detail_columns .icon1 ] =
render_icon( Gtk::Stock::DIALOG_WARNING, Gtk::ICON_SIZE_BUTTON );
else
treerow[ treeview_detail_columns .icon2 ] =
render_icon( Gtk::Stock::DIALOG_WARNING, Gtk::ICON_SIZE_BUTTON );
}
treerow[ treeview_detail_columns .path ] = partition .get_path() ;

View File

@ -1315,8 +1315,6 @@ void Win_GParted::activate_delete()
/* if deleted one is NEW, it doesn't make sense to add it to the operationslist,
* we erase its creation and possible modifications like resize etc.. from the operationslist.
* Calling Refresh_Visual will wipe every memory of its existence ;-)*/
//FIXME: afaik all allowed operation on STAT_NEW will replace the new partition
//therefore it's impossible to have >1 operations on a STAT_NEW and contains this check unnecessary overkill
if ( selected_partition .status == GParted::STAT_NEW )
{
//remove all operations done on this new partition (this includes creation)