improved behaviour of flagmanagementdialog.

* include/DialogManageFlags.h,
  src/DialogManageFlags.cc,
  src/Win_GParted.cc: improved behaviour of flagmanagementdialog.
This commit is contained in:
Bart Hakvoort 2006-04-02 11:18:34 +00:00
parent e5d12906db
commit 540152345e
4 changed files with 35 additions and 25 deletions

View File

@ -1,3 +1,9 @@
2006-04-02 Bart Hakvoort <hakvoort@cvs.gnome.org>
* include/DialogManageFlags.h,
src/DialogManageFlags.cc,
src/Win_GParted.cc: improved behaviour of flagmanagementdialog.
2006-04-01 Bart Hakvoort <hakvoort@cvs.gnome.org> 2006-04-01 Bart Hakvoort <hakvoort@cvs.gnome.org>
* src/OperationResizeMove.cc: fixed another issue in * src/OperationResizeMove.cc: fixed another issue in

View File

@ -31,7 +31,7 @@ namespace GParted
class DialogManageFlags : public Gtk::Dialog class DialogManageFlags : public Gtk::Dialog
{ {
public: public:
DialogManageFlags( const Partition & partition ) ; DialogManageFlags( const Partition & partition, std::map<Glib::ustring, bool> flag_info ) ;
sigc::signal< std::map<Glib::ustring, bool>, const Partition & > signal_get_flags ; sigc::signal< std::map<Glib::ustring, bool>, const Partition & > signal_get_flags ;
sigc::signal< bool, const Partition &, const Glib::ustring &, bool > signal_toggle_flag ; sigc::signal< bool, const Partition &, const Glib::ustring &, bool > signal_toggle_flag ;
@ -39,9 +39,7 @@ public:
bool any_change ; bool any_change ;
private: private:
void on_show() ; void load_treeview() ;
void load_flags() ;
void on_flag_toggled( const Glib::ustring & path ) ; void on_flag_toggled( const Glib::ustring & path ) ;
@ -64,6 +62,7 @@ private:
treeview_flags_Columns treeview_flags_columns ; treeview_flags_Columns treeview_flags_columns ;
Partition partition ; Partition partition ;
std::map<Glib::ustring, bool> flag_info ;
}; };
} //GParted } //GParted

View File

@ -19,18 +19,18 @@
#include <gtkmm/main.h> #include <gtkmm/main.h>
#include <gtkmm/stock.h> #include <gtkmm/stock.h>
#include <gdkmm/cursor.h>
namespace GParted namespace GParted
{ {
DialogManageFlags::DialogManageFlags( const Partition & partition ) DialogManageFlags::DialogManageFlags( const Partition & partition, std::map<Glib::ustring, bool> flag_info )
{ {
any_change = false ; any_change = false ;
set_title( String::ucompose( _("Manage flags on %1"), partition .get_path() ) ); set_title( String::ucompose( _("Manage flags on %1"), partition .get_path() ) );
set_has_separator( false ) ; set_has_separator( false ) ;
set_size_request( 300, -1 ) ; set_default_size( -1, 250 ) ;
set_resizable( false );
Glib::ustring str_temp = "<span weight=\"bold\" size=\"larger\">" ; Glib::ustring str_temp = "<span weight=\"bold\" size=\"larger\">" ;
str_temp += String::ucompose( _("Manage flags on %1"), partition .get_path() ) ; str_temp += String::ucompose( _("Manage flags on %1"), partition .get_path() ) ;
@ -49,31 +49,22 @@ DialogManageFlags::DialogManageFlags( const Partition & partition )
static_cast<Gtk::CellRendererToggle *>( treeview_flags .get_column_cell_renderer( 0 ) ) static_cast<Gtk::CellRendererToggle *>( treeview_flags .get_column_cell_renderer( 0 ) )
->signal_toggled() .connect( sigc::mem_fun( *this, &DialogManageFlags::on_flag_toggled ) ) ; ->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 ) ; get_vbox() ->pack_start( treeview_flags, Gtk::PACK_SHRINK ) ;
this ->partition = partition ; this ->partition = partition ;
this ->flag_info = flag_info ;
load_treeview() ;
add_button( Gtk::Stock::CLOSE, Gtk::RESPONSE_OK ) ->grab_focus() ; add_button( Gtk::Stock::CLOSE, Gtk::RESPONSE_OK ) ->grab_focus() ;
show_all_children() ; show_all_children() ;
} }
void DialogManageFlags::on_show() void DialogManageFlags::load_treeview()
{
Dialog::on_show() ;
while ( Gtk::Main::events_pending() )
Gtk::Main::iteration() ;
load_flags() ;
}
void DialogManageFlags::load_flags()
{ {
liststore_flags ->clear() ; liststore_flags ->clear() ;
std::map<Glib::ustring, bool> flag_info = signal_get_flags .emit( partition ) ;
for ( std::map<Glib::ustring, bool>::iterator iter = flag_info .begin() ; iter != flag_info .end() ; ++iter ) for ( std::map<Glib::ustring, bool>::iterator iter = flag_info .begin() ; iter != flag_info .end() ; ++iter )
{ {
row = *( liststore_flags ->append() ) ; row = *( liststore_flags ->append() ) ;
@ -84,6 +75,11 @@ void DialogManageFlags::load_flags()
void DialogManageFlags::on_flag_toggled( const Glib::ustring & path ) void DialogManageFlags::on_flag_toggled( const Glib::ustring & path )
{ {
get_window() ->set_cursor( Gdk::Cursor( Gdk::WATCH ) ) ;
set_sensitive( false ) ;
while ( Gtk::Main::events_pending() )
Gtk::Main::iteration() ;
any_change = true ; any_change = true ;
row = *( liststore_flags ->get_iter( path ) ) ; row = *( liststore_flags ->get_iter( path ) ) ;
@ -91,7 +87,11 @@ void DialogManageFlags::on_flag_toggled( const Glib::ustring & path )
signal_toggle_flag .emit( partition, row[ treeview_flags_columns .flag ], row[ treeview_flags_columns .status ] ) ; signal_toggle_flag .emit( partition, row[ treeview_flags_columns .flag ], row[ treeview_flags_columns .status ] ) ;
load_flags() ; flag_info = signal_get_flags .emit( partition ) ;
load_treeview() ;
set_sensitive( true ) ;
get_window() ->set_cursor() ;
} }
}//GParted }//GParted

View File

@ -932,7 +932,7 @@ void Win_GParted::radio_devices_changed( unsigned int item )
} }
void Win_GParted::on_signal_show() void Win_GParted::on_signal_show()
{ {//FIXME: why not simply override Widget::on_show() ?
vpaned_main .set_position( vpaned_main .get_height() ) ; vpaned_main .set_position( vpaned_main .get_height() ) ;
close_operationslist() ; close_operationslist() ;
@ -1672,14 +1672,19 @@ void Win_GParted::activate_disklabel()
void Win_GParted::activate_manage_flags() void Win_GParted::activate_manage_flags()
{ {
DialogManageFlags dialog( selected_partition ) ; get_window() ->set_cursor( Gdk::Cursor( Gdk::WATCH ) ) ;
dialog .set_transient_for( *this ) ; while ( Gtk::Main::events_pending() )
Gtk::Main::iteration() ;
DialogManageFlags dialog( selected_partition, gparted_core .get_available_flags( selected_partition ) ) ;
dialog .set_transient_for( *this ) ;
dialog .signal_get_flags .connect( dialog .signal_get_flags .connect(
sigc::mem_fun( &gparted_core, &GParted_Core::get_available_flags ) ) ; sigc::mem_fun( &gparted_core, &GParted_Core::get_available_flags ) ) ;
dialog .signal_toggle_flag .connect( dialog .signal_toggle_flag .connect(
sigc::mem_fun( &gparted_core, &GParted_Core::toggle_flag ) ) ; sigc::mem_fun( &gparted_core, &GParted_Core::toggle_flag ) ) ;
get_window() ->set_cursor() ;
dialog .run() ; dialog .run() ;
dialog .hide() ; dialog .hide() ;