added convenience function cleanups

* include/Utils.h,
  src/Utils.cc: added convenience function
* src/DialogManageFlags.cc,
  src/Win_GParted.cc: cleanups
This commit is contained in:
Bart Hakvoort 2006-04-02 13:04:24 +00:00
parent 540152345e
commit dcf31ca083
5 changed files with 22 additions and 5 deletions

View File

@ -1,3 +1,10 @@
2006-04-02 Bart Hakvoort <hakvoort@cvs.gnome.org>
* include/Utils.h,
src/Utils.cc: added convenience function
* src/DialogManageFlags.cc,
src/Win_GParted.cc: cleanups
2006-04-02 Bart Hakvoort <hakvoort@cvs.gnome.org>
* include/DialogManageFlags.h,

View File

@ -124,6 +124,7 @@ public:
static Glib::ustring get_filesystem_string( FILESYSTEM filesystem ) ;
static Glib::ustring format_size( Sector size ) ;
static double sector_to_unit( Sector sectors, SIZE_UNIT size_unit ) ;
static int execute_command( const Glib::ustring & command ) ;
static int execute_command( const Glib::ustring & command,
Glib::ustring & output,
Glib::ustring & error,

View File

@ -30,8 +30,8 @@ DialogManageFlags::DialogManageFlags( const Partition & partition, std::map<Glib
set_title( String::ucompose( _("Manage flags on %1"), partition .get_path() ) );
set_has_separator( false ) ;
set_default_size( -1, 250 ) ;
set_default_size( 300, -1 ) ;
Glib::ustring str_temp = "<span weight=\"bold\" size=\"larger\">" ;
str_temp += String::ucompose( _("Manage flags on %1"), partition .get_path() ) ;
str_temp += "</span>\n" ;
@ -49,7 +49,6 @@ DialogManageFlags::DialogManageFlags( const Partition & partition, std::map<Glib
static_cast<Gtk::CellRendererToggle *>( treeview_flags .get_column_cell_renderer( 0 ) )
->signal_toggled() .connect( sigc::mem_fun( *this, &DialogManageFlags::on_flag_toggled ) ) ;
treeview_flags .set_size_request( 300, -1 ) ;
get_vbox() ->pack_start( treeview_flags, Gtk::PACK_SHRINK ) ;
this ->partition = partition ;

View File

@ -184,6 +184,12 @@ double Utils::sector_to_unit( Sector sectors, SIZE_UNIT size_unit )
return sectors ;
}
}
int Utils::execute_command( const Glib::ustring & command )
{
Glib::ustring dummy ;
return execute_command( command, dummy, dummy ) ;
}
int Utils::execute_command( const Glib::ustring & command,
Glib::ustring & output,

View File

@ -1532,9 +1532,13 @@ void Win_GParted::thread_toggle_swap( bool * succes, Glib::ustring * error )
Glib::ustring dummy ;
if ( selected_partition .busy )
*succes = ! Utils::execute_command( "swapoff -v " + selected_partition .get_path() + " && sync", dummy, *error ) ;
*succes = ! Utils::execute_command( "swapoff -v " + selected_partition .get_path() + " && sync",
dummy,
*error ) ;
else
*succes = ! Utils::execute_command( "swapon -v " + selected_partition .get_path() + " && sync", dummy, *error ) ;
*succes = ! Utils::execute_command( "swapon -v " + selected_partition .get_path() + " && sync",
dummy,
*error ) ;
pulse = false ;
}