improved behaviour of flagmanagementdialog.
* include/DialogManageFlags.h, src/DialogManageFlags.cc, src/Win_GParted.cc: improved behaviour of flagmanagementdialog.
This commit is contained in:
parent
e5d12906db
commit
540152345e
|
@ -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>
|
||||
|
||||
* src/OperationResizeMove.cc: fixed another issue in
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace GParted
|
|||
class DialogManageFlags : public Gtk::Dialog
|
||||
{
|
||||
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< bool, const Partition &, const Glib::ustring &, bool > signal_toggle_flag ;
|
||||
|
@ -39,9 +39,7 @@ public:
|
|||
bool any_change ;
|
||||
|
||||
private:
|
||||
void on_show() ;
|
||||
|
||||
void load_flags() ;
|
||||
void load_treeview() ;
|
||||
void on_flag_toggled( const Glib::ustring & path ) ;
|
||||
|
||||
|
||||
|
@ -64,6 +62,7 @@ private:
|
|||
treeview_flags_Columns treeview_flags_columns ;
|
||||
|
||||
Partition partition ;
|
||||
std::map<Glib::ustring, bool> flag_info ;
|
||||
};
|
||||
|
||||
} //GParted
|
||||
|
|
|
@ -19,18 +19,18 @@
|
|||
|
||||
#include <gtkmm/main.h>
|
||||
#include <gtkmm/stock.h>
|
||||
#include <gdkmm/cursor.h>
|
||||
|
||||
namespace GParted
|
||||
{
|
||||
|
||||
DialogManageFlags::DialogManageFlags( const Partition & partition )
|
||||
DialogManageFlags::DialogManageFlags( const Partition & partition, std::map<Glib::ustring, bool> flag_info )
|
||||
{
|
||||
any_change = false ;
|
||||
|
||||
set_title( String::ucompose( _("Manage flags on %1"), partition .get_path() ) );
|
||||
set_has_separator( false ) ;
|
||||
set_size_request( 300, -1 ) ;
|
||||
set_resizable( false );
|
||||
set_default_size( -1, 250 ) ;
|
||||
|
||||
Glib::ustring str_temp = "<span weight=\"bold\" size=\"larger\">" ;
|
||||
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 ) )
|
||||
->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 ;
|
||||
this ->flag_info = flag_info ;
|
||||
|
||||
load_treeview() ;
|
||||
add_button( Gtk::Stock::CLOSE, Gtk::RESPONSE_OK ) ->grab_focus() ;
|
||||
|
||||
show_all_children() ;
|
||||
}
|
||||
|
||||
void DialogManageFlags::on_show()
|
||||
{
|
||||
Dialog::on_show() ;
|
||||
|
||||
while ( Gtk::Main::events_pending() )
|
||||
Gtk::Main::iteration() ;
|
||||
|
||||
load_flags() ;
|
||||
}
|
||||
|
||||
void DialogManageFlags::load_flags()
|
||||
void DialogManageFlags::load_treeview()
|
||||
{
|
||||
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 )
|
||||
{
|
||||
row = *( liststore_flags ->append() ) ;
|
||||
|
@ -84,6 +75,11 @@ void DialogManageFlags::load_flags()
|
|||
|
||||
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 ;
|
||||
|
||||
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 ] ) ;
|
||||
|
||||
load_flags() ;
|
||||
flag_info = signal_get_flags .emit( partition ) ;
|
||||
load_treeview() ;
|
||||
|
||||
set_sensitive( true ) ;
|
||||
get_window() ->set_cursor() ;
|
||||
}
|
||||
|
||||
}//GParted
|
||||
|
|
|
@ -932,7 +932,7 @@ void Win_GParted::radio_devices_changed( unsigned int item )
|
|||
}
|
||||
|
||||
void Win_GParted::on_signal_show()
|
||||
{
|
||||
{//FIXME: why not simply override Widget::on_show() ?
|
||||
vpaned_main .set_position( vpaned_main .get_height() ) ;
|
||||
close_operationslist() ;
|
||||
|
||||
|
@ -1672,17 +1672,22 @@ void Win_GParted::activate_disklabel()
|
|||
|
||||
void Win_GParted::activate_manage_flags()
|
||||
{
|
||||
DialogManageFlags dialog( selected_partition ) ;
|
||||
dialog .set_transient_for( *this ) ;
|
||||
get_window() ->set_cursor( Gdk::Cursor( Gdk::WATCH ) ) ;
|
||||
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(
|
||||
sigc::mem_fun( &gparted_core, &GParted_Core::get_available_flags ) ) ;
|
||||
dialog .signal_toggle_flag .connect(
|
||||
sigc::mem_fun( &gparted_core, &GParted_Core::toggle_flag ) ) ;
|
||||
|
||||
get_window() ->set_cursor() ;
|
||||
|
||||
dialog .run() ;
|
||||
dialog .hide() ;
|
||||
|
||||
|
||||
if ( dialog .any_change )
|
||||
menu_gparted_refresh_devices() ;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue