emit proper signals for several events. cleanups..
* include/TreeView_Detail.h, src/TreeView_Detail.cc, include/VBox_VisualDisk.h, src/VBox_VisualDisk.cc, include/Win_GParted.h, src/Win_GParted.cc: emit proper signals for several events. * include/Partition.h, src/Partition.cc: cleanups..
This commit is contained in:
parent
adc76a7686
commit
7ef6e3e5c8
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2005-12-24 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||
|
||||
* include/TreeView_Detail.h,
|
||||
src/TreeView_Detail.cc,
|
||||
include/VBox_VisualDisk.h,
|
||||
src/VBox_VisualDisk.cc,
|
||||
include/Win_GParted.h,
|
||||
src/Win_GParted.cc: emit proper signals for several events.
|
||||
* include/Partition.h,
|
||||
src/Partition.cc: cleanups..
|
||||
|
||||
2005-12-22 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||
|
||||
* include/Partition.h,
|
||||
|
|
|
@ -51,21 +51,21 @@ enum PartitionStatus {
|
|||
class Partition
|
||||
{
|
||||
public:
|
||||
Partition( ) ;
|
||||
~Partition( ) ;
|
||||
Partition() ;
|
||||
~Partition() ;
|
||||
|
||||
void Reset( ) ;
|
||||
void Reset() ;
|
||||
|
||||
//simple Set-functions. only for convenience, since most members are public
|
||||
void Set( const Glib::ustring & device_path,
|
||||
const Glib::ustring & partition,
|
||||
const int partition_number,
|
||||
const PartitionType type,
|
||||
const FILESYSTEM filesystem,
|
||||
const Sector & sector_start,
|
||||
const Sector & sector_end,
|
||||
const bool inside_extended,
|
||||
const bool busy ) ;
|
||||
int partition_number,
|
||||
PartitionType type,
|
||||
FILESYSTEM filesystem,
|
||||
Sector sector_start,
|
||||
Sector sector_end,
|
||||
bool inside_extended,
|
||||
bool busy ) ;
|
||||
|
||||
void Set_Unused( Sector sectors_unused ) ;
|
||||
|
||||
|
@ -74,11 +74,11 @@ public:
|
|||
//update partition number (used when a logical partition is deleted)
|
||||
void Update_Number( int new_number );
|
||||
|
||||
const long Get_Length_MB( ) const ;
|
||||
const long Get_Used_MB( ) const ;
|
||||
const long Get_Unused_MB( ) const ;
|
||||
long Get_Length_MB() const ;
|
||||
long Get_Used_MB() const ;
|
||||
long Get_Unused_MB() const ;
|
||||
|
||||
bool operator==( const Partition & partition ) ;
|
||||
bool operator==( const Partition & partition ) const ;
|
||||
|
||||
//some public members
|
||||
Glib::ustring partition;//the symbolic path (e.g. /dev/hda1 )
|
||||
|
@ -92,7 +92,7 @@ public:
|
|||
Sector sectors_used;
|
||||
Sector sectors_unused;
|
||||
Gdk::Color color;
|
||||
bool inside_extended;//used to check wether partition resides inside extended partition or not.
|
||||
bool inside_extended;
|
||||
bool busy;
|
||||
Glib::ustring error;
|
||||
Glib::ustring flags;
|
||||
|
|
|
@ -35,26 +35,32 @@ namespace GParted
|
|||
class TreeView_Detail : public Gtk::TreeView
|
||||
{
|
||||
public:
|
||||
TreeView_Detail( );
|
||||
void Load_Partitions( const std::vector<Partition> & partitions ) ;
|
||||
void Set_Selected( const Partition & partition );
|
||||
void Clear( ) ;
|
||||
TreeView_Detail();
|
||||
void load_partitions( const std::vector<Partition> & partitions ) ;
|
||||
void set_selected( const Partition & partition );
|
||||
void clear() ;
|
||||
|
||||
//signals for interclass communication
|
||||
sigc::signal<void, GdkEventButton *, const Partition & > signal_mouse_click;
|
||||
sigc::signal< void, const Partition &, bool > signal_partition_selected ;
|
||||
sigc::signal< void > signal_partition_activated ;
|
||||
sigc::signal< void, unsigned int, unsigned int > signal_popup_menu ;
|
||||
|
||||
private:
|
||||
void Create_Row( const Gtk::TreeRow & treerow, const Partition & partition );
|
||||
bool set_selected( Gtk::TreeModel::Children rows, const Partition & partition, bool inside_extended = false ) ;
|
||||
void create_row( const Gtk::TreeRow & treerow, const Partition & partition );
|
||||
|
||||
//overridden signal
|
||||
virtual bool on_button_press_event(GdkEventButton *);
|
||||
//(overridden) signals
|
||||
bool on_button_press_event( GdkEventButton * event );
|
||||
void on_row_activated( const Gtk::TreeModel::Path & path, Gtk::TreeViewColumn * column ) ;
|
||||
void on_selection_changed() ;
|
||||
|
||||
Gtk::TreeRow row, childrow;
|
||||
Gtk::TreeIter iter, iter_child;
|
||||
|
||||
Glib::RefPtr<Gtk::TreeStore> treestore_detail;
|
||||
Glib::RefPtr<Gtk::TreeSelection> treeselection;
|
||||
|
||||
bool block ;
|
||||
|
||||
//columns for this treeview
|
||||
struct treeview_detail_Columns : public Gtk::TreeModelColumnRecord
|
||||
{
|
||||
|
@ -79,8 +85,6 @@ private:
|
|||
};
|
||||
|
||||
treeview_detail_Columns treeview_detail_columns;
|
||||
Partition partition_temp ; //used in Set_Selected to make the check a bit more readable
|
||||
|
||||
};
|
||||
|
||||
} //GParted
|
||||
|
|
|
@ -39,7 +39,9 @@ public:
|
|||
void clear() ;
|
||||
|
||||
//public signal for interclass communication
|
||||
sigc::signal<void, GdkEventButton *, const Partition &> signal_mouse_click;
|
||||
sigc::signal< void, const Partition &, bool > signal_partition_selected ;
|
||||
sigc::signal< void > signal_partition_activated ;
|
||||
sigc::signal< void, unsigned int, unsigned int > signal_popup_menu ;
|
||||
|
||||
private:
|
||||
struct visual_partition ;
|
||||
|
|
|
@ -131,7 +131,10 @@ private:
|
|||
void menu_help_contents( );
|
||||
void menu_help_about( );
|
||||
|
||||
void mouse_click( GdkEventButton*, const Partition & );
|
||||
void on_partition_selected( const Partition & partition, bool src_is_treeview ) ;
|
||||
void on_partition_activated() ;
|
||||
void on_partition_popup_menu( unsigned int button, unsigned int time ) ;
|
||||
|
||||
bool max_amount_prim_reached( ) ;
|
||||
|
||||
void activate_resize( );
|
||||
|
|
|
@ -20,12 +20,12 @@
|
|||
namespace GParted
|
||||
{
|
||||
|
||||
Partition::Partition( )
|
||||
Partition::Partition()
|
||||
{
|
||||
Reset( ) ;
|
||||
Reset() ;
|
||||
}
|
||||
|
||||
void Partition::Reset( )
|
||||
void Partition::Reset()
|
||||
{
|
||||
partition = error = flags = mountpoint = "" ;
|
||||
status = GParted::STAT_REAL ;
|
||||
|
@ -34,18 +34,18 @@ void Partition::Reset( )
|
|||
partition_number = sector_start = sector_end = sectors_used = sectors_unused = -1;
|
||||
color .set( "black" ) ;
|
||||
inside_extended = busy = false ;
|
||||
logicals .clear( ) ;
|
||||
logicals .clear() ;
|
||||
}
|
||||
|
||||
void Partition::Set( const Glib::ustring & device_path,
|
||||
const Glib::ustring & partition,
|
||||
const int partition_number,
|
||||
const PartitionType type,
|
||||
const FILESYSTEM filesystem,
|
||||
const Sector & sector_start,
|
||||
const Sector & sector_end,
|
||||
const bool inside_extended,
|
||||
const bool busy )
|
||||
int partition_number,
|
||||
PartitionType type,
|
||||
FILESYSTEM filesystem,
|
||||
Sector sector_start,
|
||||
Sector sector_end,
|
||||
bool inside_extended,
|
||||
bool busy )
|
||||
{
|
||||
this ->device_path = device_path ;
|
||||
this ->partition = partition;
|
||||
|
@ -90,29 +90,29 @@ void Partition::Update_Number( int new_number )
|
|||
this ->partition = device_path + Utils::num_to_str( partition_number ) ;
|
||||
}
|
||||
|
||||
const long Partition::Get_Length_MB( ) const
|
||||
long Partition::Get_Length_MB() const
|
||||
{
|
||||
return Utils::Sector_To_MB( sector_end - sector_start ) ;
|
||||
}
|
||||
|
||||
const long Partition::Get_Used_MB( ) const
|
||||
long Partition::Get_Used_MB() const
|
||||
{
|
||||
return Utils::Sector_To_MB( this ->sectors_used ) ;
|
||||
}
|
||||
|
||||
const long Partition::Get_Unused_MB( ) const
|
||||
long Partition::Get_Unused_MB() const
|
||||
{
|
||||
return Get_Length_MB( ) - Get_Used_MB( ) ;
|
||||
return Get_Length_MB() - Get_Used_MB( ) ;
|
||||
}
|
||||
|
||||
bool Partition::operator==( const Partition & partition )
|
||||
bool Partition::operator==( const Partition & partition ) const
|
||||
{
|
||||
return this ->partition_number == partition .partition_number &&
|
||||
this ->sector_start == partition .sector_start &&
|
||||
this ->type == partition .type ;
|
||||
}
|
||||
|
||||
Partition::~Partition( )
|
||||
Partition::~Partition()
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -22,106 +22,100 @@ namespace GParted
|
|||
|
||||
TreeView_Detail::TreeView_Detail( )
|
||||
{
|
||||
block = false ;
|
||||
|
||||
treestore_detail = Gtk::TreeStore::create( treeview_detail_columns );
|
||||
this ->set_model( treestore_detail );
|
||||
this ->set_rules_hint( true );
|
||||
this ->treeselection = this ->get_selection();
|
||||
set_model( treestore_detail );
|
||||
set_rules_hint( true );
|
||||
treeselection = get_selection();
|
||||
treeselection ->signal_changed() .connect( sigc::mem_fun( *this, &TreeView_Detail::on_selection_changed ) );
|
||||
|
||||
//append columns
|
||||
this->append_column( _("Partition"), treeview_detail_columns .partition );
|
||||
this->append_column( _("Filesystem"), treeview_detail_columns .color );
|
||||
this->append_column( _("Size(MB)"), treeview_detail_columns .size );
|
||||
this->append_column( _("Used(MB)"), treeview_detail_columns .used );
|
||||
this->append_column( _("Unused(MB)"), treeview_detail_columns .unused );
|
||||
this->append_column( _("Flags"), treeview_detail_columns .flags );
|
||||
|
||||
append_column( _("Partition"), treeview_detail_columns .partition );
|
||||
append_column( _("Filesystem"), treeview_detail_columns .color );
|
||||
append_column( _("Size(MB)"), treeview_detail_columns .size );
|
||||
append_column( _("Used(MB)"), treeview_detail_columns .used );
|
||||
append_column( _("Unused(MB)"), treeview_detail_columns .unused );
|
||||
append_column( _("Flags"), treeview_detail_columns .flags );
|
||||
|
||||
//status_icon
|
||||
this ->get_column( 0 ) ->pack_start( treeview_detail_columns.status_icon, false );
|
||||
get_column( 0 ) ->pack_start( treeview_detail_columns.status_icon, false );
|
||||
|
||||
//filesystem text
|
||||
this ->get_column( 1 ) ->pack_start( treeview_detail_columns .filesystem, true );
|
||||
get_column( 1 ) ->pack_start( treeview_detail_columns .filesystem, true );
|
||||
|
||||
//colored text in Partition column
|
||||
Gtk::CellRendererText *cell_renderer_text = dynamic_cast<Gtk::CellRendererText*>( this->get_column( 0 ) ->get_first_cell_renderer( ) );
|
||||
this->get_column( 0 ) ->add_attribute( cell_renderer_text ->property_foreground(), treeview_detail_columns .text_color );
|
||||
Gtk::CellRendererText *cell_renderer_text = dynamic_cast<Gtk::CellRendererText*>( get_column( 0 ) ->get_first_cell_renderer( ) );
|
||||
get_column( 0 ) ->add_attribute( cell_renderer_text ->property_foreground(), treeview_detail_columns .text_color );
|
||||
|
||||
//colored text in Filesystem column
|
||||
std::vector<Gtk::CellRenderer *> renderers = this ->get_column( 1 ) ->get_cell_renderers() ;
|
||||
std::vector<Gtk::CellRenderer *> renderers = get_column( 1 ) ->get_cell_renderers() ;
|
||||
cell_renderer_text = dynamic_cast<Gtk::CellRendererText*>( renderers .back() ) ;
|
||||
this ->get_column( 1 ) ->add_attribute( cell_renderer_text ->property_foreground(), treeview_detail_columns .text_color );
|
||||
get_column( 1 ) ->add_attribute( cell_renderer_text ->property_foreground(), treeview_detail_columns .text_color );
|
||||
|
||||
//set alignment of numeric columns to right
|
||||
for( short t = 2 ; t < 5 ; t++ )
|
||||
dynamic_cast<Gtk::CellRendererText*>( this ->get_column( t ) ->get_first_cell_renderer() ) ->property_xalign() = 1 ;
|
||||
dynamic_cast<Gtk::CellRendererText*>( get_column( t ) ->get_first_cell_renderer() ) ->property_xalign() = 1 ;
|
||||
}
|
||||
|
||||
void TreeView_Detail::Load_Partitions( const std::vector<Partition> & partitions )
|
||||
void TreeView_Detail::load_partitions( const std::vector<Partition> & partitions )
|
||||
{
|
||||
treestore_detail ->clear( ) ;
|
||||
treestore_detail ->clear() ;
|
||||
|
||||
for ( unsigned int i = 0 ; i < partitions .size( ) ; i++ )
|
||||
for ( unsigned int i = 0 ; i < partitions .size() ; i++ )
|
||||
{
|
||||
row = *( treestore_detail ->append( ) );
|
||||
Create_Row( row, partitions[ i ] );
|
||||
row = *( treestore_detail ->append() );
|
||||
create_row( row, partitions[ i ] );
|
||||
|
||||
if ( partitions[ i ] .type == GParted::TYPE_EXTENDED )
|
||||
{
|
||||
for ( unsigned int t = 0 ; t < partitions[ i ] .logicals .size( ) ; t++ )
|
||||
for ( unsigned int t = 0 ; t < partitions[ i ] .logicals .size() ; t++ )
|
||||
{
|
||||
childrow = *( treestore_detail ->append( row.children( ) ) );
|
||||
Create_Row( childrow, partitions[ i ] .logicals[ t ] );
|
||||
childrow = *( treestore_detail ->append( row.children() ) );
|
||||
create_row( childrow, partitions[ i ] .logicals[ t ] );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//show logical partitions ( if any )
|
||||
this ->expand_all( );
|
||||
expand_all();
|
||||
|
||||
this ->columns_autosize( );
|
||||
columns_autosize();
|
||||
}
|
||||
|
||||
void TreeView_Detail::Set_Selected( const Partition & partition )
|
||||
void TreeView_Detail::set_selected( const Partition & partition )
|
||||
{
|
||||
//look for appropiate row
|
||||
for( iter = treestore_detail ->children() .begin() ; iter != treestore_detail ->children() .end() ; iter++ )
|
||||
{
|
||||
row = *iter;
|
||||
partition_temp = row[ treeview_detail_columns.partition_struct ] ;
|
||||
//primary's
|
||||
if ( partition .sector_start >= partition_temp .sector_start &&
|
||||
partition .sector_end <=partition_temp .sector_end &&
|
||||
partition.inside_extended == partition_temp.inside_extended )
|
||||
{
|
||||
this ->set_cursor( static_cast <Gtk::TreePath> ( row ) );
|
||||
return;
|
||||
}
|
||||
|
||||
//logicals
|
||||
if ( row .children() .size( ) > 0 ) //this is the row with the extended partition, search it's childrows...
|
||||
for( iter_child = row .children() .begin() ; iter_child != row.children() .end() ; iter_child++ )
|
||||
{
|
||||
childrow = *iter_child;
|
||||
partition_temp = childrow[ treeview_detail_columns.partition_struct ] ;
|
||||
|
||||
if ( partition .sector_start >= partition_temp .sector_start && partition .sector_end <= partition_temp .sector_end )
|
||||
{
|
||||
this ->expand_all();
|
||||
this ->set_cursor( static_cast <Gtk::TreePath> ( childrow ) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
block = true ;
|
||||
set_selected( treestore_detail ->children(), partition ) ;
|
||||
block = false ;
|
||||
}
|
||||
|
||||
void TreeView_Detail::Clear( )
|
||||
void TreeView_Detail::clear()
|
||||
{
|
||||
treestore_detail ->clear( ) ;
|
||||
treestore_detail ->clear() ;
|
||||
}
|
||||
|
||||
void TreeView_Detail::Create_Row( const Gtk::TreeRow & treerow, const Partition & partition )
|
||||
bool TreeView_Detail::set_selected( Gtk::TreeModel::Children rows, const Partition & partition, bool inside_extended )
|
||||
{
|
||||
for ( unsigned int t = 0 ; t < rows .size() ; t++ )
|
||||
{
|
||||
if ( static_cast<Partition>( rows[ t ] [ treeview_detail_columns .partition_struct ] ) == partition )
|
||||
{
|
||||
if ( inside_extended )
|
||||
expand_all() ;
|
||||
|
||||
set_cursor( static_cast<Gtk::TreePath>( rows[ t ] ) ) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
if ( rows[ t ] .children() .size() > 0 && set_selected( rows[ t ] .children(), partition, true ) )
|
||||
return true ;
|
||||
}
|
||||
|
||||
return false ;
|
||||
}
|
||||
|
||||
void TreeView_Detail::create_row( const Gtk::TreeRow & treerow, const Partition & partition )
|
||||
{
|
||||
//hereby i assume these 2 are mutual exclusive. is this wise?? Time (and bugreports) will tell :)
|
||||
if ( partition .busy )
|
||||
|
@ -132,23 +126,19 @@ void TreeView_Detail::Create_Row( const Gtk::TreeRow & treerow, const Partition
|
|||
treerow[ treeview_detail_columns .partition ] = partition .partition;
|
||||
treerow[ treeview_detail_columns .color ] = Utils::get_color_as_pixbuf( partition .filesystem, 16, 16 ) ;
|
||||
|
||||
treerow[ treeview_detail_columns .text_color ] = ( partition .type == GParted::TYPE_UNALLOCATED ) ? "darkgrey" : "black" ;
|
||||
treerow[ treeview_detail_columns .text_color ] = partition .type == GParted::TYPE_UNALLOCATED ? "darkgrey" : "black" ;
|
||||
treerow[ treeview_detail_columns .filesystem ] = Utils::Get_Filesystem_String( partition .filesystem ) ;
|
||||
|
||||
//size
|
||||
treerow[ treeview_detail_columns .size ] = Utils::num_to_str( partition .Get_Length_MB( ) ) ;
|
||||
treerow[ treeview_detail_columns .size ] = Utils::num_to_str( partition .Get_Length_MB() ) ;
|
||||
|
||||
//used
|
||||
if ( partition .sectors_used != -1 )
|
||||
treerow[ treeview_detail_columns .used ] = Utils::num_to_str( partition .Get_Used_MB( ) ) ;
|
||||
else
|
||||
treerow[ treeview_detail_columns .used ] = "---" ;
|
||||
treerow[ treeview_detail_columns .used ] =
|
||||
partition .sectors_used == -1 ? "---" : Utils::num_to_str( partition .Get_Used_MB() ) ;
|
||||
|
||||
//unused
|
||||
if ( partition .sectors_unused != -1 )
|
||||
treerow[ treeview_detail_columns .unused ] = Utils::num_to_str( partition .Get_Unused_MB( ) ) ;
|
||||
else
|
||||
treerow[ treeview_detail_columns .unused ] = "---" ;
|
||||
treerow[ treeview_detail_columns .unused ] =
|
||||
partition .sectors_unused == -1 ? "---" : Utils::num_to_str( partition .Get_Unused_MB() ) ;
|
||||
|
||||
//flags
|
||||
treerow[ treeview_detail_columns .flags ] = " " + partition .flags ;
|
||||
|
@ -157,20 +147,33 @@ void TreeView_Detail::Create_Row( const Gtk::TreeRow & treerow, const Partition
|
|||
treerow[ treeview_detail_columns .partition_struct ] = partition;
|
||||
}
|
||||
|
||||
bool TreeView_Detail::on_button_press_event( GdkEventButton* event )
|
||||
bool TreeView_Detail::on_button_press_event( GdkEventButton * event )
|
||||
{
|
||||
//Call base class, to allow normal handling,
|
||||
bool return_value = TreeView::on_button_press_event( event );
|
||||
bool handled = Gtk::TreeView::on_button_press_event( event ) ;
|
||||
|
||||
iter = treeselection ->get_selected( );
|
||||
//right-click
|
||||
if ( event ->button == 3 )
|
||||
signal_popup_menu .emit( event ->button, event ->time ) ;
|
||||
|
||||
if ( *iter != 0 )
|
||||
return handled ;
|
||||
}
|
||||
|
||||
void TreeView_Detail::on_row_activated( const Gtk::TreeModel::Path & path, Gtk::TreeViewColumn * column )
|
||||
{
|
||||
//Call base class, to allow normal handling,
|
||||
Gtk::TreeView::on_row_activated( path, column ) ;
|
||||
|
||||
signal_partition_activated .emit() ;
|
||||
}
|
||||
|
||||
void TreeView_Detail::on_selection_changed()
|
||||
{
|
||||
if ( ! block && treeselection ->get_selected() != 0 )
|
||||
{
|
||||
row = *iter;
|
||||
signal_mouse_click .emit( event, row[ treeview_detail_columns .partition_struct ] );
|
||||
row = (Gtk::TreeRow) * treeselection ->get_selected() ;
|
||||
signal_partition_selected .emit( row[ treeview_detail_columns .partition_struct ], true ) ;
|
||||
}
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
} //GParted
|
||||
|
|
|
@ -414,8 +414,15 @@ bool VBox_VisualDisk::drawingarea_on_expose( GdkEventExpose * event )
|
|||
|
||||
bool VBox_VisualDisk::on_drawingarea_button_press( GdkEventButton * event )
|
||||
{
|
||||
if ( set_selected( visual_partitions, static_cast<int>( event ->x ), static_cast<int>( event ->y ) ) )
|
||||
signal_mouse_click .emit( event, selected_vp .partition );
|
||||
set_selected( visual_partitions, static_cast<int>( event ->x ), static_cast<int>( event ->y ) ) ;
|
||||
draw_partitions( visual_partitions ) ;
|
||||
|
||||
signal_partition_selected .emit( selected_vp .partition, false ) ;
|
||||
|
||||
if ( event ->type == GDK_2BUTTON_PRESS )
|
||||
signal_partition_activated .emit() ;
|
||||
else if ( event ->button == 3 )
|
||||
signal_popup_menu .emit( event ->button, event ->time ) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
|
|
@ -50,7 +50,9 @@ Win_GParted::Win_GParted( )
|
|||
vbox_main.pack_start( hbox_toolbar, Gtk::PACK_SHRINK );
|
||||
|
||||
//vbox_visual_disk... ( contains the visual represenation of the disks )
|
||||
vbox_visual_disk .signal_mouse_click.connect( sigc::mem_fun( this, &Win_GParted::mouse_click ) ) ;
|
||||
vbox_visual_disk .signal_partition_selected .connect( sigc::mem_fun( this, &Win_GParted::on_partition_selected ) ) ;
|
||||
vbox_visual_disk .signal_partition_activated .connect( sigc::mem_fun( this, &Win_GParted::on_partition_activated ) ) ;
|
||||
vbox_visual_disk .signal_popup_menu .connect( sigc::mem_fun( this, &Win_GParted::on_partition_popup_menu ) );
|
||||
vbox_main .pack_start( vbox_visual_disk, Gtk::PACK_SHRINK ) ;
|
||||
|
||||
//hpaned_main (NOTE: added to vpaned_main)
|
||||
|
@ -341,8 +343,10 @@ void Win_GParted::init_hpaned_main( )
|
|||
scrollwindow ->set_shadow_type( Gtk::SHADOW_ETCHED_IN );
|
||||
scrollwindow ->set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC );
|
||||
|
||||
//connect signal and add treeview_detail
|
||||
treeview_detail .signal_mouse_click .connect( sigc::mem_fun( this, &Win_GParted::mouse_click ) );
|
||||
//connect signals and add treeview_detail
|
||||
treeview_detail .signal_partition_selected .connect( sigc::mem_fun( this, &Win_GParted::on_partition_selected ) );
|
||||
treeview_detail .signal_partition_activated .connect( sigc::mem_fun( this, &Win_GParted::on_partition_activated ) );
|
||||
treeview_detail .signal_popup_menu .connect( sigc::mem_fun( this, &Win_GParted::on_partition_popup_menu ) );
|
||||
scrollwindow ->add( treeview_detail );
|
||||
hpaned_main.pack2( *scrollwindow, true, true );
|
||||
}
|
||||
|
@ -532,7 +536,7 @@ void Win_GParted::Refresh_Visual( )
|
|||
vbox_visual_disk .load_partitions( partitions, devices[ current_device ] .length ) ;
|
||||
|
||||
//treeview details
|
||||
treeview_detail .Load_Partitions( partitions ) ;
|
||||
treeview_detail .load_partitions( partitions ) ;
|
||||
|
||||
//no partition can be selected after a refresh..
|
||||
selected_partition .Reset() ;
|
||||
|
@ -752,7 +756,7 @@ void Win_GParted::menu_gparted_refresh_devices( )
|
|||
Fill_Label_Device_Info( true ) ;
|
||||
|
||||
vbox_visual_disk .clear() ;
|
||||
treeview_detail .Clear() ;
|
||||
treeview_detail .clear() ;
|
||||
|
||||
//hmzz, this is really paranoid, but i think it's the right thing to do ;)
|
||||
liststore_operations ->clear( ) ;
|
||||
|
@ -869,26 +873,27 @@ void Win_GParted::menu_help_about( )
|
|||
dialog .run( ) ;
|
||||
}
|
||||
|
||||
void Win_GParted::mouse_click( GdkEventButton *event, const Partition & partition )
|
||||
void Win_GParted::on_partition_selected( const Partition & partition, bool src_is_treeview )
|
||||
{
|
||||
selected_partition = partition;
|
||||
|
||||
Set_Valid_Operations( ) ;
|
||||
|
||||
treeview_detail .Set_Selected( partition );
|
||||
Set_Valid_Operations() ;
|
||||
|
||||
if ( src_is_treeview )
|
||||
vbox_visual_disk .set_selected( partition ) ;
|
||||
else
|
||||
treeview_detail .set_selected( partition ) ;
|
||||
}
|
||||
|
||||
if ( event ->type == GDK_2BUTTON_PRESS && ! pulse )
|
||||
activate_info( ) ;
|
||||
else if ( event ->button == 3 ) //right-click
|
||||
{
|
||||
//prepare convert menu
|
||||
if ( selected_partition .type != GParted::TYPE_UNALLOCATED )
|
||||
Set_Valid_Convert_Filesystems( ) ;
|
||||
void Win_GParted::on_partition_activated()
|
||||
{
|
||||
if ( ! pulse )
|
||||
activate_info() ;
|
||||
}
|
||||
|
||||
menu_partition .popup( event ->button, event ->time );
|
||||
}
|
||||
void Win_GParted::on_partition_popup_menu( unsigned int button, unsigned int time )
|
||||
{
|
||||
menu_partition .popup( button, time );
|
||||
}
|
||||
|
||||
bool Win_GParted::max_amount_prim_reached( )
|
||||
|
|
Loading…
Reference in New Issue